You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/12/12 21:55:00 UTC

svn commit: r1773881 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/TestController.java webapp/menu.xhtml

Author: lofwyr
Date: Mon Dec 12 21:55:00 2016
New Revision: 1773881

URL: http://svn.apache.org/viewvc?rev=1773881&view=rev
Log:
simplify test

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java?rev=1773881&r1=1773880&r2=1773881&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java Mon Dec 12 21:55:00 2016
@@ -35,35 +35,17 @@ public class TestController implements S
 
   private static final Logger LOG = LoggerFactory.getLogger(TestController.class);
 
-  public String getPage() {
+  public String getTestBase() {
     final FacesContext facesContext = FacesContext.getCurrentInstance();
     final ExternalContext externalContext = facesContext.getExternalContext();
     final String viewId = facesContext.getViewRoot().getViewId();
-    final String testJs = viewId.substring(0, viewId.length() - 6) + ".test.js";
+    final String base = viewId.substring(0, viewId.length() - 6);
     try {
-      if (externalContext.getResource(testJs) != null) {
-        return "/faces" + viewId;
+      if (externalContext.getResource(base + ".test.js") != null) {
+        return base;
       }
     } catch (MalformedURLException e) {
-      LOG.error("", e);
-      return "error";
-    }
-
-    return null;
-  }
-
-  public String getTestJs() {
-    final FacesContext facesContext = FacesContext.getCurrentInstance();
-    final ExternalContext externalContext = facesContext.getExternalContext();
-    final String viewId = facesContext.getViewRoot().getViewId();
-    final String testJs = viewId.substring(0, viewId.length() - 6) + ".test.js";
-    try {
-      if (externalContext.getResource(testJs) != null) {
-        return testJs.substring(1);
-      }
-    } catch (MalformedURLException e) {
-      LOG.error("", e);
-      return "error";
+      LOG.error("viewId='" + viewId + "'", e);
     }
 
     return null;

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml?rev=1773881&r1=1773880&r2=1773881&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml Mon Dec 12 21:55:00 2016
@@ -122,9 +122,9 @@
                      link="/faces/test.xhtml"
                      label="Run Test"
                      immediate="true" tip="Run Test"
-                     rendered="#{testController.testJs != null}">
-            <f:param name="page" value="#{request.contextPath}#{testController.page}"/>
-            <f:param name="testjs" value="#{request.contextPath}/#{testController.testJs}"/>
+                     rendered="#{testController.testBase != null}">
+            <f:param name="page" value="#{request.contextPath}/faces#{testController.testBase}.xhtml"/>
+            <f:param name="testjs" value="#{request.contextPath}#{testController.testBase}.test.js"/>
           </tc:button>
           <tc:button id="closetest" label="Close Test"
                      immediate="true" tip="Close test window"/>