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 2012/02/08 15:13:20 UTC

svn commit: r1241905 - in /myfaces/tobago/trunk/tobago-example/tobago-example-test/src: main/java/org/apache/myfaces/tobago/example/test/ main/webapp/ test/java/org/apache/myfaces/tobago/example/test/

Author: lofwyr
Date: Wed Feb  8 14:13:19 2012
New Revision: 1241905

URL: http://svn.apache.org/viewvc?rev=1241905&view=rev
Log:
- 404 page has an error log now
- the context path is no longer tobago-example-test, but empty instead

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/404.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java?rev=1241905&r1=1241904&r2=1241905&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java Wed Feb  8 14:13:19 2012
@@ -55,6 +55,8 @@ public class Filter {
       "/index.html", // intern
       "/navigation.*", // intern
 
+      "/404.*", // meta test
+
       "/meta-test/meta-1.*", // meta test
       "/meta-test/meta-2.*\\.jspx", // meta test
       "/meta-test/meta-3.*\\.xhtml", // meta test

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/404.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/404.xhtml?rev=1241905&r1=1241904&r2=1241905&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/404.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/404.xhtml Wed Feb  8 14:13:19 2012
@@ -26,12 +26,14 @@
 
     <tc:panel>
       <f:facet name="layout">
-        <tc:gridLayout rows="auto;*;*" />
+        <tc:gridLayout rows="auto;*;*"/>
       </f:facet>
 
-      <tc:messages />
+      <tc:messages/>
       <tc:out value="The page was not found!"/>
     </tc:panel>
 
+    <tc:script onload="LOG.error('404 - page not found.')"/>
+
   </tc:page>
 </f:view>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java?rev=1241905&r1=1241904&r2=1241905&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java Wed Feb  8 14:13:19 2012
@@ -25,7 +25,8 @@ import org.junit.Before;
 
 public abstract class SeleniumTest {
 
-  private static final String CONTEXT_PATH = "tobago-example-test";
+  private static final String CONTEXT_PATH = "";
+  //  private static final String CONTEXT_PATH = "tobago-example-test";
   private static final String SERVLET_MAPPING = "faces";
 
   public static final String ERROR_ON_SERVER = "error on server";
@@ -56,7 +57,9 @@ public abstract class SeleniumTest {
   protected void checkPage() {
     final String location = selenium.getLocation();
     final String html = getHtmlSource();
-    Assert.assertFalse(format(ERROR_ON_SERVER, location, html, ""), errorOnServer());
+    if (errorOnServer()) {
+      Assert.fail(format(ERROR_ON_SERVER, location, html, ""));
+    }
     try {
       if (isErrorOnPage()) {
         Assert.fail(format(HAS_ERROR_SEVERITY, location, html, getErrors()));
@@ -109,6 +112,10 @@ public abstract class SeleniumTest {
 
   protected static String createUrl(String page) {
     Assert.assertTrue("Page name must start with a slash.", page.startsWith("/"));
-    return '/' + CONTEXT_PATH + '/' + SERVLET_MAPPING + page;
+    if (CONTEXT_PATH.length() == 0) {
+      return '/' + SERVLET_MAPPING + page;
+    } else {
+      return '/' + CONTEXT_PATH + '/' + SERVLET_MAPPING + page;
+    }
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java?rev=1241905&r1=1241904&r2=1241905&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java Wed Feb  8 14:13:19 2012
@@ -24,7 +24,8 @@ public class SimpleSeleniumTest extends 
 
   @Test
   public void testHelloWorld() {
-    getSelenium().open("/tobago-example-test/faces/simple.xhtml");
+    getSelenium().open("/faces/simple.xhtml");
+    checkPage();
     Assert.assertEquals("Simple Test", getSelenium().getValue("page:in"));
     getSelenium().captureScreenshot(SimpleSeleniumTest.class.getName() + ".testHelloWorld.png");
   }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java?rev=1241905&r1=1241904&r2=1241905&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java Wed Feb  8 14:13:19 2012
@@ -17,7 +17,6 @@ package org.apache.myfaces.tobago.exampl
  * limitations under the License.
  */
 
-import com.thoughtworks.selenium.SeleniumException;
 import org.junit.Assert;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -40,7 +39,7 @@ public class TestTheAutomaticSeleniumTes
     Collection<Object[]> pages = AutomaticSeleniumTest.findPages();
     for (Object[] page : pages) {
       String url = (String) page[1];
-      String prefix = "/tobago-example-test/faces/meta-test/";
+      String prefix = "/faces/meta-test/";
       if (url.startsWith(prefix)) {
         metaTestList.add(url.substring(prefix.length()));
       }
@@ -68,8 +67,8 @@ public class TestTheAutomaticSeleniumTes
       test.testPageConsistency();
       test.tearDown();
       Assert.fail("The test should fail, but wasn't.");
-    } catch (SeleniumException e) {
-      Assert.assertTrue(e.getMessage().contains("Response_Code = 404"));
+    } catch (AssertionError e) {
+      Assert.assertTrue(e.getMessage().contains("404 - page not found"));
     }
   }