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 2009/06/18 16:33:46 UTC
svn commit: r786084 - in /myfaces/tobago/branches/tobago-1.0.x/example/test:
./ src/main/java/org/apache/myfaces/tobago/example/test/
src/main/webapp/meta-test/ src/main/webapp/script/
src/test/java/org/apache/myfaces/tobago/example/test/
Author: lofwyr
Date: Thu Jun 18 14:33:45 2009
New Revision: 786084
URL: http://svn.apache.org/viewvc?rev=786084&view=rev
Log:
TOBAGO-765: merging with trunk
Added:
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/meta-test/ (props changed)
- copied from r786069, myfaces/tobago/trunk/example/test/src/main/webapp/meta-test/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/script/ (props changed)
- copied from r786069, myfaces/tobago/trunk/example/test/src/main/webapp/script/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java
Modified:
myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java
Modified: myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml?rev=786084&r1=786083&r2=786084&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml Thu Jun 18 14:33:45 2009
@@ -26,7 +26,7 @@
<artifactId>tobago-example-test</artifactId>
<packaging>war</packaging>
<name>Tobago Example Test</name>
- <description>A web application to provide test pages for running automated tests (todo).</description>
+ <description>A web application to provide test pages for running automated tests.</description>
<build>
<finalName>tobago-example-test</finalName>
<plugins>
@@ -241,7 +241,6 @@
</excludes>
<includes>
<include>**/*SeleniumTest.java</include>
- <include>**/*SeleniumSuite.java</include>
</includes>
</configuration>
</execution>
@@ -515,4 +514,18 @@
</build>
</profile>
</profiles>
+
+ <repositories>
+ <repository>
+ <id>openqa</id>
+ <name>OpenQA Repository</name>
+ <url>http://nexus.openqa.org/content/repositories/releases/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
</project>
Modified: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java?rev=786084&r1=786083&r2=786084&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java Thu Jun 18 14:33:45 2009
@@ -29,17 +29,29 @@
private static final Log LOG = LogFactory.getLog(Filter.class);
- public static final List<String> ALLOWED = Arrays.asList(".*\\.xhtml", ".*\\.jsp", ".*\\.jspx", ".*\\.html");
+ public static final List<String> ALLOWED = Arrays.asList(
+ ".*\\.xhtml",
+ ".*\\.jsp",
+ ".*\\.jspx",
+ ".*\\.html"
+ );
public static final Set<String> FORBIDDEN = new HashSet<String>(Arrays.asList(
"/META-INF.*",
"/WEB-INF.*",
"/index.html",
- "/navi.xhtml",
+ "/meta-test/meta-1.*",
+ "/meta-test/meta-2.*\\.jspx",
+ "/meta-test/meta-3.*\\.xhtml",
+ "/meta-test/meta-4.*",
+ "/navi.*",
"/org/apache/myfaces/tobago/renderkit/html/standard/blank.html",
"/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/dojo/.*",
"/tc/button/plain.html",
- "/tc/button/plain_de.html"));
+ "/tc/button/plain_de.html",
+ "/tc/gridLayout/horizontal-600px-default-300px.*",
+ "/tc/gridLayout/horizontal-default-default-600px.*"
+ ));
public static boolean isValid(String name) {
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/meta-test/
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/script/
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java?rev=786084&r1=786083&r2=786084&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java Thu Jun 18 14:33:45 2009
@@ -30,6 +30,10 @@
@RunWith(Parameterized.class)
public class AutomaticSeleniumTest extends SeleniumTest {
+ static final String CONTAINS_A_404 = "contains a 404";
+ static final String HAS_ERROR_SEVERITY = "has error severity";
+ static final String IS_BROKEN = "is broken";
+
private static final String MAVEN_TARGET = "target/tobago-example-test";
private static final String CONTEXT_PATH = "tobago-example-test";
private static final String SERVLET_MAPPING = "faces";
@@ -42,13 +46,13 @@
@Test
public void testPageConsistency() {
- selenium.open("/tobago-example-test/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js");
+
selenium.open(url);
- Assert.assertFalse("Page '" + url + "' contains a 404. Source=" + selenium.getHtmlSource(), pageNotFound());
+ Assert.assertFalse("Page '" + url + "' " + CONTAINS_A_404 + ". Source=" + selenium.getHtmlSource(), pageNotFound());
try {
- Assert.assertFalse("Page '" + url + "' has error severity. Source=" + selenium.getHtmlSource(), isErrorOnPage());
+ Assert.assertFalse("Page '" + url + "' " + HAS_ERROR_SEVERITY + ". Source=" + selenium.getHtmlSource(), isErrorOnPage());
} catch (SeleniumException e) {
- Assert.fail("Page '" + url + "' is broken. Not a Tobago page? Source=" + selenium.getHtmlSource() + " exception=" + e);
+ Assert.fail("Page '" + url + "' " + IS_BROKEN + ". Not a Tobago page? Source=" + selenium.getHtmlSource() + " exception=" + e);
}
}
@@ -105,7 +109,8 @@
}
protected static String createUrl(String page) {
- return '/' + CONTEXT_PATH + '/' + SERVLET_MAPPING + '/' + page;
+ Assert.assertTrue("Page name must start with a slash.", page.startsWith("/"));
+ return '/' + CONTEXT_PATH + '/' + SERVLET_MAPPING + page;
}
}
Modified: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java?rev=786084&r1=786083&r2=786084&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java Thu Jun 18 14:33:45 2009
@@ -36,6 +36,6 @@
Assert.assertFalse(Filter.isValid("/META-INF/"));
Assert.assertFalse(Filter.isValid("/navi.xhtml"));
- Assert.assertTrue(Filter.isValid("/navi-2.xhtml"));
+ Assert.assertTrue(Filter.isValid("/nav.xhtml"));
}
}
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java?rev=786084&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java Thu Jun 18 14:33:45 2009
@@ -0,0 +1,116 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class TestTheAutomaticSeleniumTest {
+
+ private static final Log LOG = LogFactory.getLog(TestTheAutomaticSeleniumTest.class);
+
+ @Test
+ public void areTheCorrectFilesTested() {
+
+ List<String> metaTestList = new ArrayList<String>();
+
+ Collection<Object[]> pages = AutomaticSeleniumTest.findPages();
+ for (Object[] page : pages) {
+ String url = (String) page[1];
+ String prefix = "/tobago-example-test/faces/meta-test/";
+ if (url.startsWith(prefix)) {
+ metaTestList.add(url.substring(prefix.length()));
+ }
+ }
+
+ Collections.sort(metaTestList);
+
+ String[] expected = new String[]{
+ "meta-0-ok.jspx",
+ "meta-0-ok.xhtml",
+ "meta-2-ok.xhtml",
+ "meta-3-ok.jspx"
+ };
+
+ Assert.assertArrayEquals(expected, metaTestList.toArray());
+ }
+
+ @Test
+ public void test404() throws Exception {
+ try {
+ String url = AutomaticSeleniumTest.createUrl("/meta-test/meta-404-not-existing.xhtml");
+ LOG.info("Testing page: '" + url + "'");
+ AutomaticSeleniumTest test = new AutomaticSeleniumTest(url, url);
+ test.setUp();
+ test.testPageConsistency();
+ test.tearDown();
+ Assert.fail("The test should fail, but wasn't.");
+ } catch (AssertionError e) {
+ if (e.getMessage().contains(AutomaticSeleniumTest.CONTAINS_A_404)) {
+ // okay, the error was detected.
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ @Test
+ public void testErrorSeverity() throws Exception {
+ try {
+ String url = AutomaticSeleniumTest.createUrl("/meta-test/meta-1-fail.xhtml");
+ LOG.info("Testing page: '" + url + "'");
+ AutomaticSeleniumTest test = new AutomaticSeleniumTest(url, url);
+ test.setUp();
+ test.testPageConsistency();
+ test.tearDown();
+ Assert.fail("The test should fail, but wasn't.");
+ } catch (AssertionError e) {
+ if (e.getMessage().contains(AutomaticSeleniumTest.HAS_ERROR_SEVERITY)) {
+ // okay, the error was detected.
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ @Test
+ public void testNotTobago() throws Exception {
+ try {
+ String url = AutomaticSeleniumTest.createUrl("/meta-test/meta-4-not-tobago.xhtml");
+ LOG.info("Testing page: '" + url + "'");
+ AutomaticSeleniumTest test = new AutomaticSeleniumTest(url, url);
+ test.setUp();
+ test.testPageConsistency();
+ test.tearDown();
+ Assert.fail("The test should fail, but wasn't.");
+ } catch (AssertionError e) {
+ if (e.getMessage().contains(AutomaticSeleniumTest.IS_BROKEN)) {
+ // okay, the error was detected.
+ } else {
+ throw e;
+ }
+ }
+ }
+}