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/17 17:04:04 UTC
svn commit: r785648 - in /myfaces/tobago/branches/tobago-1.0.x/example: ./
test/ test/src/ test/src/main/ test/src/main/java/ test/src/main/java/org/
test/src/main/java/org/apache/ test/src/main/java/org/apache/myfaces/
test/src/main/java/org/apache/my...
Author: lofwyr
Date: Wed Jun 17 15:04:03 2009
New Revision: 785648
URL: http://svn.apache.org/viewvc?rev=785648&view=rev
Log:
TOBAGO-765: adding a test application for automated tests
Added:
myfaces/tobago/branches/tobago-1.0.x/example/test/
myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DebugModePhaseListener.java
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java
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/main/java/org/apache/myfaces/tobago/example/test/PageItem.java
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/ (props changed)
- copied from r785087, myfaces/tobago/trunk/example/test/src/main/resources/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml (contents, props changed)
- copied, changed from r781384, myfaces/tobago/branches/tobago-1.0.x/example/experimental/src/main/webapp/WEB-INF/tobago-config.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/web.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/index.html
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/navi.xhtml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/simple.xhtml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/link-attribute.xhtml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain.html
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain_de.html
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/xslt/
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/xslt/facelet2jsp.xsl
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/ (props changed)
- copied from r785176, myfaces/tobago/trunk/example/test/src/test/
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
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
Modified:
myfaces/tobago/branches/tobago-1.0.x/example/pom.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/log4j.xml
myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
Modified: myfaces/tobago/branches/tobago-1.0.x/example/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/pom.xml?rev=785648&r1=785647&r2=785648&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/pom.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/pom.xml Wed Jun 17 15:04:03 2009
@@ -75,6 +75,7 @@
<module>demo</module>
<module>nonfacesrequest</module>
<module>experimental</module>
+ <module>test</module>
</modules>
</profile>
<profile>
@@ -88,6 +89,7 @@
<module>sandbox</module>
<module>security</module>
<module>experimental</module>
+ <module>test</module>
<module>facelets</module>
<module>tobago-example-assembly</module>
<module>tobago-theme-example</module>
Added: 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=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/pom.xml Wed Jun 17 15:04:03 2009
@@ -0,0 +1,518 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-example</artifactId>
+ <version>1.0.22-SNAPSHOT</version>
+ </parent>
+ <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>
+ <build>
+ <finalName>tobago-example-test</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>maven-theme-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webResources>
+ <resource>
+ <targetPath>src</targetPath>
+ <directory>${basedir}/src/main/java</directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <!--
+ <configuration>
+ <server>asari</server>
+ <update>true</update>
+ <url>http://10.0.0.4:8080/manager</url>
+ </configuration>
+ -->
+ <configuration>
+ <server>tomcat</server>
+ <update>true</update>
+ <url>http://localhost:8080/manager</url>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xslt-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>transform</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <srcDir>src/main/webapp</srcDir>
+ <destDir>target/tobago-example-test</destDir>
+ <xslFile>../demo/src/main/xslt/facelet2jsp.xsl</xslFile>
+ <srcIncludes>**/*.xhtml</srcIncludes>
+ <fileNameRegex>(.*).xhtml</fileNameRegex>
+ <fileNameReplacement>$1.jspx</fileNameReplacement>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/*SeleniumTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tobago/tags/tobago-1.0.21/example/test</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/tags/tobago-1.0.21/example/test</developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/myfaces/tobago/tags/tobago-1.0.21/example/test</url>
+ </scm>
+
+ <dependencies>
+ <!--dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-example</artifactId>
+ <version>${project.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-charlotteville</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-scarborough</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-sandbox</artifactId>
+ <version>${project.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-speyside</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-richmond</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-standard</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-core</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>sun.jdk</groupId>
+ <artifactId>tools</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-facelets</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>sun.jdk</groupId>
+ <artifactId>tools</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.11</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ <version>2.0.8</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>${facelets.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium.client-drivers</groupId>
+ <artifactId>selenium-java-client-driver</artifactId>
+ <version>1.0-beta-2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>integration-test</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/*SeleniumTest.java</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/*SeleniumTest.java</include>
+ <include>**/*SeleniumSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>tomcat5x</containerId>
+ <zipUrlInstaller>
+ <url>http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip</url>
+ </zipUrlInstaller>
+ </container>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ <goal>deploy</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>8080</port>
+ </connector>
+ </connectors>
+ <!-- XXX what is a good name for stopKey? -->
+ <stopKey>foo</stopKey>
+ <stopPort>9999</stopPort>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run-exploded</goal>
+ </goals>
+ <configuration>
+ <daemon>true</daemon>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>selenium-maven-plugin</artifactId>
+ <version>1.0-rc-1</version>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start-server</goal>
+ </goals>
+ <configuration>
+ <background>true</background>
+ <logOutput>true</logOutput>
+ <!--multiWindow>true</multiWindow-->
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>stop</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop-server</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>ssl</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.security.SslSocketConnector">
+ <port>1443</port>
+ <maxIdleTime>30000</maxIdleTime>
+ <keystore>src/test/keystore/jettykeystore</keystore>
+ <password>xxxxxx</password>
+ <keyPassword>xxxxxx</keyPassword>
+ </connector>
+ </connectors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>myfaces</id>
+ <activation>
+ <property>
+ <name>!jsf</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>myfaces12</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces12</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces12.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces12.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf-provided</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>provided</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>sunjsf</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>ri</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-message-fix</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>sunjsf12</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>ri12</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${sunjsf12.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${sunjsf12.version}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <name>java.net Maven 1 Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ </profile>
+ <profile>
+ <!--
+ mvn package cargo:start -Ptomcat5x
+ -->
+ <id>tomcat5x</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>0.3</version>
+ <configuration>
+ <container>
+ <containerId>tomcat5x</containerId>
+ <zipUrlInstaller>
+ <url>http://apache.easy-webs.de/tomcat/tomcat-5/v5.5.23/bin/apache-tomcat-5.5.23.zip</url>
+ <installDir>${project.build.directory}/tomcat5</installDir>
+ </zipUrlInstaller>
+ </container>
+ <configuration>
+ <home>${project.build.directory}/tomcat5/container</home>
+ </configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DebugModePhaseListener.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/DebugModePhaseListener.java?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DebugModePhaseListener.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DebugModePhaseListener.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,42 @@
+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.myfaces.tobago.context.ClientProperties;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+/**
+ * Ensures that the application for this user is running in debug mode.
+ */
+public class DebugModePhaseListener implements PhaseListener {
+
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ ClientProperties client = ClientProperties.getInstance(event.getFacesContext());
+ client.setDebugMode(true);
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.RENDER_RESPONSE;
+ }
+}
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.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/DirectoryBrowser.java?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,72 @@
+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 javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+public class DirectoryBrowser {
+
+ private static final Log LOG = LogFactory.getLog(DirectoryBrowser.class);
+
+ public List<PageItem> getList() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ List<PageItem> list = new ArrayList<PageItem>();
+ locateResourcesInWar(((ServletContext) facesContext.getExternalContext().getContext()), list, "/");
+ Collections.sort(list);
+ return list;
+ }
+
+ private void locateResourcesInWar(ServletContext servletContext, List<PageItem> list, String path) {
+
+ // fix for jetty6
+ if (path.endsWith("/") && path.length() > 1) {
+ path = path.substring(0, path.length() - 1);
+ }
+ Set<String> resourcePaths = servletContext.getResourcePaths(path);
+ if (resourcePaths == null || resourcePaths.isEmpty()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Skipping empty resource path: path='" + path + "'");
+ }
+ return;
+ }
+ for (String childPath : resourcePaths) {
+ if (childPath.endsWith("/")) {
+ // ignore, because weblogic puts the path directory itself in the Set
+ if (!childPath.equals(path)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("childPath dir " + childPath);
+ }
+ locateResourcesInWar(servletContext, list, childPath);
+ }
+ } else {
+ if (Filter.isValid(childPath)) {
+ LOG.info("add resc " + childPath);
+ list.add(new PageItem(childPath));
+ }
+ }
+ }
+ }
+}
Added: 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=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,74 @@
+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 java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class Filter {
+
+ private static final Log LOG = LogFactory.getLog(Filter.class);
+
+ 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",
+ "/org/apache/myfaces/tobago/renderkit/html/standard/blank.html",
+ "/tc/button/plain.html",
+ "/tc/button/plain_de.html"));
+
+ public static boolean isValid(String name) {
+
+ // 1st all has to start with a '/' slash
+
+ if (!name.startsWith("/")) {
+ return false;
+ }
+
+ // 2nd the positive check
+
+ boolean matches = false;
+ for (String allowed : ALLOWED) {
+ if (name.matches(allowed)) {
+ matches = true;
+ }
+ }
+ if (!matches) {
+ return false;
+ }
+
+ // 3rd the negative check
+
+ for (String forbidden : FORBIDDEN) {
+ if (name.matches(forbidden)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+}
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.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/PageItem.java?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,59 @@
+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.
+ */
+
+public class PageItem implements Comparable {
+
+ private String resource;
+ private boolean jsfResource;
+ private String label;
+
+ public PageItem(String name) {
+ this.resource = name.substring(1);
+ label = name;
+ jsfResource = name.endsWith(".xhtml") || name.endsWith(".jspx");
+ }
+
+ public String getResource() {
+ return resource;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public boolean isJsfResource() {
+ return jsfResource;
+ }
+
+ public void setJsfResource(boolean jsfResource) {
+ this.jsfResource = jsfResource;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public int compareTo(Object object) {
+ return label.compareTo(((PageItem) object).label);
+ }
+}
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/log4j.xml?rev=785648&r1=785087&r2=785648&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/log4j.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/resources/log4j.xml Wed Jun 17 15:04:03 2009
@@ -30,6 +30,10 @@
</layout>
</appender>
+ <category name="org.apache.myfaces.tobago.example.test">
+ <priority value="debug" />
+ </category>
+
<root>
<priority value="info" />
<appender-ref ref="logfile" />
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/faces-config.xml?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/faces-config.xml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/faces-config.xml Wed Jun 17 15:04:03 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+
+<faces-config>
+
+ <application>
+ <view-handler>
+ com.sun.facelets.FaceletViewHandler
+ </view-handler>
+ </application>
+
+ <managed-bean>
+ <managed-bean-name>browser</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.DirectoryBrowser</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <lifecycle>
+ <phase-listener>
+ org.apache.myfaces.tobago.example.test.DebugModePhaseListener
+ </phase-listener>
+ </lifecycle>
+
+</faces-config>
Copied: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml (from r781384, myfaces/tobago/branches/tobago-1.0.x/example/experimental/src/main/webapp/WEB-INF/tobago-config.xml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml?p2=myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml&p1=myfaces/tobago/branches/tobago-1.0.x/example/experimental/src/main/webapp/WEB-INF/tobago-config.xml&r1=781384&r2=785648&rev=785648&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/experimental/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml Wed Jun 17 15:04:03 2009
@@ -21,11 +21,7 @@
"-//The Apache Software Foundation//DTD Tobago Config 1.0//EN" "tobago-config_1_0.dtd">
<tobago-config>
-
<theme-config>
<default-theme>speyside</default-theme>
</theme-config>
-
- <resource-dir>tobago-resource</resource-dir>
- <ajax-enabled>true</ajax-enabled>
</tobago-config>
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/tobago-config.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Jun 17 15:04:03 2009
@@ -0,0 +1 @@
+/myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/tobago-config.xml:699460,699891-700092,743495-743708,744771-744909,744926
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/web.xml?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/web.xml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/WEB-INF/web.xml Wed Jun 17 15:04:03 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <display-name>Tobago Application for Quality Assurance</display-name>
+ <description>Will be used for automated tests in the build process.</description>
+
+ <context-param>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.SKIP_COMMENTS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*.xhtml</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>FacesServlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>3</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>FacesServlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+
+ <jsp-config>
+ <jsp-property-group>
+ <url-pattern>*.jsp</url-pattern>
+ <page-encoding>UTF-8</page-encoding>
+ </jsp-property-group>
+ </jsp-config>
+
+</web-app>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/index.html?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/index.html (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/index.html Wed Jun 17 15:04:03 2009
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+ <TITLE>Tobago Test Page</TITLE>
+</HEAD>
+<FRAMESET COLS="30%,70%">
+ <FRAME SRC="faces/navi.xhtml" NAME="navi">
+ <FRAME NAME="test">
+</FRAMESET>
+</HTML>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/navi.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/navi.xhtml?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/navi.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/navi.xhtml Wed Jun 17 15:04:03 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <tc:page id="page" label="XXX" width="300px" height="700px">
+ <f:facet name="layout">
+ <tc:gridLayout/>
+ </f:facet>
+
+ <tc:sheet value="#{browser.list}" columns="*" var="item" rows="1000">
+ <tc:column label="Test Pages">
+ <tc:link resource="#{item.resource}" jsfResource="#{item.jsfResource}" label="#{item.label}" target="test"/>
+ </tc:column>
+ </tc:sheet>
+
+ </tc:page>
+</f:view>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/simple.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/simple.xhtml?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/simple.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/simple.xhtml Wed Jun 17 15:04:03 2009
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <tc:page id="page">
+
+ <tc:in readonly="true" id="in" value="Simple Test"/>
+
+ </tc:page>
+</f:view>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/link-attribute.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/link-attribute.xhtml?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/link-attribute.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/link-attribute.xhtml Wed Jun 17 15:04:03 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+
+<f:view
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <tc:page id="page" width="300px" height="50px">
+ <f:facet name="layout">
+ <tc:gridLayout/>
+ </f:facet>
+
+ <tc:button label="internal link with slash" link="/tc/button/plain.html" />
+ <tc:button label="internal link without slash" link="plain.html" />
+ <tc:button label="external link" link="http://www.apache.org/" />
+
+ </tc:page>
+</f:view>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain.html?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain.html (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain.html Wed Jun 17 15:04:03 2009
@@ -0,0 +1,5 @@
+<html>
+<body>
+A simple page for the resource test.
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain_de.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain_de.html?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain_de.html (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/button/plain_de.html Wed Jun 17 15:04:03 2009
@@ -0,0 +1,5 @@
+<html>
+<body>
+Eine einfache Seite für den Resourcen-Test.
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/xslt/facelet2jsp.xsl
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/xslt/facelet2jsp.xsl?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/xslt/facelet2jsp.xsl (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/xslt/facelet2jsp.xsl Wed Jun 17 15:04:03 2009
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ This code is experimenal and only for use in this example
+-->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:layout="urn:jsptagdir:/WEB-INF/tags/layout">
+
+ <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
+
+ <xsl:template match="/ui:composition">
+ <xsl:comment>
+ This Code is generated. Do not change.
+ </xsl:comment>
+
+ <xsl:comment>
+ * 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.
+ </xsl:comment>
+
+ <jsp:root version="2.0">
+ <jsp:directive.page contentType="text/html; charset=utf-8"/>
+ <layout:overview>
+ <jsp:params>
+ <xsl:apply-templates select="ui:param" mode="parameter"/>
+ </jsp:params>
+ <jsp:body>
+ <xsl:apply-templates/>
+ </jsp:body>
+ </layout:overview>
+ </jsp:root>
+ </xsl:template>
+
+ <xsl:template match="ui:param" mode="parameter">
+ <jsp:param name="title" value="BASICS"/>
+ </xsl:template>
+
+ <xsl:template match="ui:param">
+ <!-- ignore -->
+ </xsl:template>
+
+ <xsl:template match="*">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/
------------------------------------------------------------------------------
svn:mergeinfo =
Added: 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=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,111 @@
+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 com.thoughtworks.selenium.SeleniumException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+@RunWith(Parameterized.class)
+public class AutomaticSeleniumTest extends SeleniumTest {
+
+ 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";
+
+ private String url;
+
+ public AutomaticSeleniumTest(String title, String url) {
+ this.url = url;
+ }
+
+ @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());
+ try {
+ 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);
+ }
+ }
+
+ /**
+ * Was the page not found?
+ *
+ * @return True if the page not found.
+ */
+ // XXX might be improved, I didn't find a way to read the HTTP status code
+ protected boolean pageNotFound() {
+ return selenium.getHtmlSource().contains("404");
+ }
+
+ /**
+ * Checks the page for the Tobago JavaScript Logging Framework and tests its severity.
+ *
+ * @return True if the severity level of the page is error
+ * @throws SeleniumException If the page is not a Tobago page, or any other problem with JavaScrpt or the page.
+ */
+ protected boolean isErrorOnPage() throws SeleniumException {
+ String errorSeverity = selenium.getEval("window.LOG.getMaximumSeverity() >= window.LOG.ERROR");
+ return Boolean.parseBoolean(errorSeverity);
+ }
+
+ @Parameterized.Parameters
+ public static Collection<Object[]> findPages() {
+ List<Object[]> result = new ArrayList<Object[]>();
+
+ collect(result, MAVEN_TARGET + '/', "");
+
+ return result;
+ }
+
+ private static void collect(List<Object[]> result, String base, String directory) {
+ String[] filenames = new File(base + directory).list();
+
+ for (String filename : filenames) {
+
+ String path = directory + '/' + filename;
+
+ if (new File(base + path).isDirectory()) {
+ collect(result, base, path);
+ continue;
+ }
+
+ if (Filter.isValid(path)) {
+ Object[] objects = {
+ path,
+ createUrl(path)
+ };
+ result.add(objects);
+ }
+ }
+ }
+
+ protected static String createUrl(String page) {
+ return '/' + CONTEXT_PATH + '/' + SERVLET_MAPPING + '/' + page;
+ }
+
+}
Added: 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=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,41 @@
+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.junit.Assert;
+import org.junit.Test;
+
+public class FilterUnitTest {
+
+ @Test
+ public void testIsValid() {
+ Assert.assertFalse(Filter.isValid("test.html"));
+ Assert.assertTrue(Filter.isValid("/test.html"));
+
+ Assert.assertFalse(Filter.isValid("/WEB-INF"));
+ Assert.assertFalse(Filter.isValid("/WEB-INF/"));
+ Assert.assertFalse(Filter.isValid("/WEB-INF/web.xml"));
+ Assert.assertFalse(Filter.isValid("/WEB-INF/test.xhtml"));
+
+ Assert.assertFalse(Filter.isValid("/NETA-INF"));
+ Assert.assertFalse(Filter.isValid("/META-INF/"));
+
+ Assert.assertFalse(Filter.isValid("/navi.xhtml"));
+ Assert.assertTrue(Filter.isValid("/navi-2.xhtml"));
+ }
+}
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.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/Parameterized.java?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,105 @@
+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.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+import org.junit.runners.model.TestClass;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * XXX
+ * This class will be obsolete if this feature request for JUnit is resolved:
+ * http://sourceforge.net/tracker/index.php?func=detail&aid=1742040&group_id=15278&atid=365278
+ */
+public class Parameterized extends Suite {
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ public static @interface Parameters {
+ }
+
+ public Parameterized(Class<?> clazz) throws Throwable {
+ super(clazz, new ArrayList<Runner>());
+
+ FrameworkMethod method = findMethod(getTestClass());
+ List<Object[]> parametersList = (List<Object[]>) method.invokeExplosively(null);
+ for (int i = 0; i < parametersList.size(); i++)
+ getChildren().add(new ClassRunnerForParameters(getTestClass().getJavaClass(), parametersList.get(i)));
+ }
+
+ private FrameworkMethod findMethod(TestClass clazz) throws Throwable {
+ List<FrameworkMethod> methods = clazz.getAnnotatedMethods(Parameters.class);
+ for (FrameworkMethod method : methods) {
+ int modifiers = method.getMethod().getModifiers();
+ if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
+ return method;
+ }
+ }
+ throw new Exception(
+ "Need a public static method with @Parameters annotation in class " + getName());
+ }
+
+ public static class ClassRunnerForParameters extends BlockJUnit4ClassRunner {
+
+ private Object[] parameters;
+
+ ClassRunnerForParameters(Class<?> clazz, Object[] parameters) throws InitializationError {
+ super(clazz);
+ this.parameters = parameters;
+ }
+
+ @Override
+ protected Object createTest() throws Exception {
+ return getTestClass().getOnlyConstructor().newInstance(parameters);
+ }
+
+ @Override
+ protected String getName() {
+ return "[" + parameters[0].toString() + "]";
+ }
+
+ @Override
+ protected String testName(FrameworkMethod method) {
+ return method.getName() + getName();
+ }
+
+ @Override
+ protected Statement classBlock(RunNotifier notifier) {
+ return childrenInvoker(notifier);
+ }
+
+ @Override
+ protected void validateZeroArgConstructor(List<Throwable> errors) {
+ // In this case there should be a constructor with arguments.
+ }
+ }
+
+}
Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.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/SeleniumTest.java?rev=785648&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java Wed Jun 17 15:04:03 2009
@@ -0,0 +1,44 @@
+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 com.thoughtworks.selenium.DefaultSelenium;
+import org.junit.After;
+import org.junit.Before;
+
+public abstract class SeleniumTest {
+
+ private static final String BASE_URL = "http://localhost:8080/";
+
+ protected DefaultSelenium selenium;
+
+ @Before
+ public void setUp() throws Exception {
+ selenium = createSeleniumClient(BASE_URL);
+ selenium.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ selenium.stop();
+ }
+
+ protected DefaultSelenium createSeleniumClient(String url) throws Exception {
+ return new DefaultSelenium("localhost", 4444, "*firefox", url);
+ }
+}
Modified: myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.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/SimpleSeleniumTest.java?rev=785648&r1=785176&r2=785648&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java Wed Jun 17 15:04:03 2009
@@ -17,34 +17,16 @@
* limitations under the License.
*/
-import com.thoughtworks.selenium.DefaultSelenium;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
-public class SimpleSeleniumTest extends TestCase {
-
- private DefaultSelenium selenium;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- selenium = createSeleniumClient("http://localhost:8080/");
- selenium.start();
- }
-
- @Override
- public void tearDown() throws Exception {
- selenium.stop();
- super.tearDown();
- }
-
- protected DefaultSelenium createSeleniumClient(String url) throws Exception {
- return new DefaultSelenium("localhost", 4444, "*firefox", url);
- }
+public class SimpleSeleniumTest extends SeleniumTest {
+ @Test
public void testHelloWorld() {
- selenium.open("http://localhost:8080/tobago-example-test/faces/simple.xhtml");
- assertEquals("Simple Test", selenium.getValue("page:in"));
- selenium.captureScreenshot(SimpleSeleniumTest.class.getName() + ".testHelloWorld.png");
+ selenium.open("http://localhost:8080/tobago-example-test/faces/simple.xhtml");
+ Assert.assertEquals("Simple Test", selenium.getValue("page:in"));
+ selenium.captureScreenshot(SimpleSeleniumTest.class.getName() + ".testHelloWorld.png");
}
}