You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/03/03 19:00:23 UTC
svn commit: r514207 - in /tapestry/tapestry5/tapestry-test/trunk: ./ src/
src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/tapestry/ src/main/java/org/apache/tapestry/test/
src/site/ src/site/apt/ src/site/...
Author: hlship
Date: Sat Mar 3 10:00:22 2007
New Revision: 514207
URL: http://svn.apache.org/viewvc?view=rev&rev=514207
Log:
Initial check-in.
Added:
tapestry/tapestry5/tapestry-test/trunk/.classpath
tapestry/tapestry5/tapestry-test/trunk/.project
tapestry/tapestry5/tapestry-test/trunk/LICENSE-2.0.txt
tapestry/tapestry5/tapestry-test/trunk/NOTICE.txt
tapestry/tapestry5/tapestry-test/trunk/pom.xml
tapestry/tapestry5/tapestry-test/trunk/src/
tapestry/tapestry5/tapestry-test/trunk/src/main/
tapestry/tapestry5/tapestry-test/trunk/src/main/java/
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/JettyRunner.java
tapestry/tapestry5/tapestry-test/trunk/src/site/
tapestry/tapestry5/tapestry-test/trunk/src/site/apt/
tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt
tapestry/tapestry5/tapestry-test/trunk/src/site/resources/
tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/
tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/jdstyle.css
tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/site.css
tapestry/tapestry5/tapestry-test/trunk/src/site/site.xml
Added: tapestry/tapestry5/tapestry-test/trunk/.classpath
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/.classpath?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/.classpath (added)
+++ tapestry/tapestry5/tapestry-test/trunk/.classpath Sat Mar 3 10:00:22 2007
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: tapestry/tapestry5/tapestry-test/trunk/.project
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/.project?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/.project (added)
+++ tapestry/tapestry5/tapestry-test/trunk/.project Sat Mar 3 10:00:22 2007
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>tapestry-test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: tapestry/tapestry5/tapestry-test/trunk/LICENSE-2.0.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/LICENSE-2.0.txt?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/LICENSE-2.0.txt (added)
+++ tapestry/tapestry5/tapestry-test/trunk/LICENSE-2.0.txt Sat Mar 3 10:00:22 2007
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
Added: tapestry/tapestry5/tapestry-test/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/NOTICE.txt?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/NOTICE.txt (added)
+++ tapestry/tapestry5/tapestry-test/trunk/NOTICE.txt Sat Mar 3 10:00:22 2007
@@ -0,0 +1,6 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+
+
+
Added: tapestry/tapestry5/tapestry-test/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/pom.xml?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/pom.xml (added)
+++ tapestry/tapestry5/tapestry-test/trunk/pom.xml Sat Mar 3 10:00:22 2007
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-test</artifactId>
+ <version>5.0.3-SNAPSHOT</version>
+ <name>Tapestry Test Utilities</name>
+ <inceptionYear>2007</inceptionYear>
+ <description>Test utilities needed by Tapestry</description>
+ <parent>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-project</artifactId>
+ <version>5.0.3-SNAPSHOT</version>
+ <relativePath>../tapestry-project/pom.xml</relativePath>
+ </parent>
+ <!-- Due to Maven 2 bugs, this has to be copied into each module POM. -->
+ <url>http://tapestry.apache.org/tapestry5/${pom.artifactId}/</url>
+ <scm>
+ <connection>scm:svn:https://svn.apache.org/repos/asf/tapestry/tapestry5/${pom.artifactId}/trunk/</connection>
+ <url>http://svn.apache.org/viewvc/tapestry/tapestry5/${pom.artifactId}/trunk/</url>
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>org.openqa.selenium.client-drivers</groupId>
+ <artifactId>selenium-java-client-driver</artifactId>
+ <version>0.8.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openqa.selenium.server</groupId>
+ <artifactId>selenium-server</artifactId>
+ <version>0.8.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.1</version>
+ <classifier>jdk15</classifier>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <!--
+ <tags>
+ <tag>
+ <name>todo</name>
+ <!- - Should be a combinaition of the letters Xaoptcmf - ->
+ <placement>a</placement>
+ <head>To do something:</head>
+ </tag>
+ </tags> -->
+ <linksource>true</linksource>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
+ </links>
+ <stylesheetfile>${basedir}/src/site/resources/css/jdstyle.css</stylesheetfile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
\ No newline at end of file
Added: tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java (added)
+++ tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java Sat Mar 3 10:00:22 2007
@@ -0,0 +1,484 @@
+package org.apache.tapestry.test;
+
+import static java.lang.String.format;
+
+import org.openqa.selenium.server.SeleniumServer;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Parameters;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+/**
+ * A base class for creating integration tests. Ths encapsulates starting up an in-process copy of
+ * Jetty, and in-process copy of {@link SeleniumServer}, and a Selenium client.
+ * <p>
+ * Unless you are <em>very, very clever</em>, you will want to run the tests sequentially. TestNG
+ * tends to run them in an arbitrary order unless you explicitly set the order. If you have managed
+ * to get TestNG to run tests in parallel, you may see further problems caused by a single client
+ * jumping all over your web application in an unpredictable order.
+ * <p>
+ * This class implements the {@link Selenium} interface, and delegates all those methods to the
+ * {@link DefaultSelenium} instance it creates.
+ *
+ * @see JettyRunner
+ */
+public abstract class AbstractIntegrationTestSuite extends Assert implements Selenium
+{
+
+ /** 60 seconds */
+ public static final String PAGE_LOAD_TIMEOUT = "600000";
+
+ /** The port on which the internal copy of Jetty is executed. */
+ public static final int JETTY_PORT = 9999;
+
+ // This is likely to be a problem, since may want to test with a context path, rather than as
+ // root.
+ public static final String BASE_URL = format("http://localhost:%d/", JETTY_PORT);
+
+ private JettyRunner _jettyRunner;
+
+ private Selenium _selenium;
+
+ private SeleniumServer _server;
+
+ protected final void assertSourcePresent(String... expected)
+ {
+ String source = _selenium.getHtmlSource();
+
+ for (String snippet : expected)
+ {
+ if (source.contains(snippet))
+ continue;
+
+ System.err.printf("Source content '%s' not found in:\n%s\n\n", snippet, source);
+
+ throw new AssertionError("Page did not contain source '" + snippet + "'.");
+ }
+ }
+
+ protected final void assertText(String locator, String expected)
+ {
+ String actual = null;
+
+ try
+ {
+ actual = getText(locator);
+ }
+ catch (RuntimeException ex)
+ {
+ System.err.printf(
+ "Error accessing %s: %s, in:\n\n%s\n\n",
+ locator,
+ ex.getMessage(),
+ _selenium.getHtmlSource());
+
+ throw ex;
+ }
+
+ if (actual.equals(expected))
+ return;
+
+ System.err.printf(
+ "Text for %s should be '%s' but is '%s', in:\n\n%s\n\n",
+ locator,
+ expected,
+ actual,
+ getHtmlSource());
+
+ throw new AssertionError(String.format("%s was '%s' not '%s'", locator, actual, expected));
+ }
+
+ protected final void assertTextPresent(String... text)
+ {
+ for (String item : text)
+ {
+ if (isTextPresent(item))
+ return;
+
+ System.err.printf("Text pattern '%s' not found in:\n%s\n\n", item, _selenium
+ .getHtmlSource());
+
+ throw new AssertionError("Page did not contain '" + item + "'.");
+ }
+ }
+
+ protected final void assertFieldValue(String locator, String expected)
+ {
+ assertEquals(getValue(locator), expected);
+ }
+
+ protected final void clickAndWait(String link)
+ {
+ _selenium.click(link);
+ _selenium.waitForPageToLoad(PAGE_LOAD_TIMEOUT);
+ }
+
+ protected final void assertTextSeries(String idFormat, int startIndex, String... values)
+ {
+ for (int i = 0; i < values.length; i++)
+ {
+ String id = format(idFormat, startIndex + i);
+
+ assertText(id, values[i]);
+ }
+ }
+
+ @AfterClass
+ public void cleanup() throws Exception
+ {
+ _selenium.stop();
+ _selenium = null;
+
+ _server.stop();
+ _server = null;
+
+ _jettyRunner.stop();
+ _jettyRunner = null;
+ }
+
+ @Parameters(
+ { "tapestry.integration-webapp" })
+ @BeforeClass
+ public void setup(String webappRoot) throws Exception
+ {
+ _jettyRunner = new JettyRunner("/", JETTY_PORT, webappRoot);
+
+ _server = new SeleniumServer();
+
+ _server.start();
+
+ _selenium = new DefaultSelenium("localhost", SeleniumServer.DEFAULT_PORT, "*firefox",
+ BASE_URL);
+
+ _selenium.start();
+
+ // Warm things up; this prevents errors when the first test runs. Seems to be a problem
+ // with Selenium: inside the JavaScript or the server code.
+
+ _selenium.open(BASE_URL);
+ }
+
+ public void addSelection(String locator, String optionLocator)
+ {
+ _selenium.addSelection(locator, optionLocator);
+ }
+
+ public void answerOnNextPrompt(String answer)
+ {
+ _selenium.answerOnNextPrompt(answer);
+ }
+
+ public void check(String locator)
+ {
+ _selenium.check(locator);
+ }
+
+ public void chooseCancelOnNextConfirmation()
+ {
+ _selenium.chooseCancelOnNextConfirmation();
+ }
+
+ public void click(String locator)
+ {
+ _selenium.click(locator);
+ }
+
+ public void close()
+ {
+ _selenium.close();
+ }
+
+ public void fireEvent(String locator, String eventName)
+ {
+ _selenium.fireEvent(locator, eventName);
+ }
+
+ public String getAlert()
+ {
+ return _selenium.getAlert();
+ }
+
+ public String[] getAllButtons()
+ {
+ return _selenium.getAllButtons();
+ }
+
+ public String[] getAllFields()
+ {
+ return _selenium.getAllFields();
+ }
+
+ public String[] getAllLinks()
+ {
+ return _selenium.getAllLinks();
+ }
+
+ public String getAttribute(String attributeLocator)
+ {
+ return _selenium.getAttribute(attributeLocator);
+ }
+
+ public String getBodyText()
+ {
+ return _selenium.getBodyText();
+ }
+
+ public String getConfirmation()
+ {
+ return _selenium.getConfirmation();
+ }
+
+ public Number getCursorPosition(String locator)
+ {
+ return _selenium.getCursorPosition(locator);
+ }
+
+ public String getEval(String script)
+ {
+ return _selenium.getEval(script);
+ }
+
+ public String getExpression(String expression)
+ {
+ return _selenium.getExpression(expression);
+ }
+
+ public String getHtmlSource()
+ {
+ return _selenium.getHtmlSource();
+ }
+
+ public String getLocation()
+ {
+ return _selenium.getLocation();
+ }
+
+ public String getPrompt()
+ {
+ return _selenium.getPrompt();
+ }
+
+ public String getSelectedId(String selectLocator)
+ {
+ return _selenium.getSelectedId(selectLocator);
+ }
+
+ public String[] getSelectedIds(String selectLocator)
+ {
+ return _selenium.getSelectedIds(selectLocator);
+ }
+
+ public String getSelectedIndex(String selectLocator)
+ {
+ return _selenium.getSelectedIndex(selectLocator);
+ }
+
+ public String[] getSelectedIndexes(String selectLocator)
+ {
+ return _selenium.getSelectedIndexes(selectLocator);
+ }
+
+ public String getSelectedLabel(String selectLocator)
+ {
+ return _selenium.getSelectedLabel(selectLocator);
+ }
+
+ public String[] getSelectedLabels(String selectLocator)
+ {
+ return _selenium.getSelectedLabels(selectLocator);
+ }
+
+ public String getSelectedValue(String selectLocator)
+ {
+ return _selenium.getSelectedValue(selectLocator);
+ }
+
+ public String[] getSelectedValues(String selectLocator)
+ {
+ return _selenium.getSelectedValues(selectLocator);
+ }
+
+ public String[] getSelectOptions(String selectLocator)
+ {
+ return _selenium.getSelectOptions(selectLocator);
+ }
+
+ public String getTable(String tableCellAddress)
+ {
+ return _selenium.getTable(tableCellAddress);
+ }
+
+ public String getText(String locator)
+ {
+ return _selenium.getText(locator);
+ }
+
+ public String getTitle()
+ {
+ return _selenium.getTitle();
+ }
+
+ public String getValue(String locator)
+ {
+ return _selenium.getValue(locator);
+ }
+
+ public void goBack()
+ {
+ _selenium.goBack();
+ }
+
+ public boolean isAlertPresent()
+ {
+ return _selenium.isAlertPresent();
+ }
+
+ public boolean isChecked(String locator)
+ {
+ return _selenium.isChecked(locator);
+ }
+
+ public boolean isConfirmationPresent()
+ {
+ return _selenium.isConfirmationPresent();
+ }
+
+ public boolean isEditable(String locator)
+ {
+ return _selenium.isEditable(locator);
+ }
+
+ public boolean isElementPresent(String locator)
+ {
+ return _selenium.isElementPresent(locator);
+ }
+
+ public boolean isPromptPresent()
+ {
+ return _selenium.isPromptPresent();
+ }
+
+ public boolean isSomethingSelected(String selectLocator)
+ {
+ return _selenium.isSomethingSelected(selectLocator);
+ }
+
+ public boolean isTextPresent(String pattern)
+ {
+ return _selenium.isTextPresent(pattern);
+ }
+
+ public boolean isVisible(String locator)
+ {
+ return _selenium.isVisible(locator);
+ }
+
+ public void keyDown(String locator, String keycode)
+ {
+ _selenium.keyDown(locator, keycode);
+ }
+
+ public void keyPress(String locator, String keycode)
+ {
+ _selenium.keyPress(locator, keycode);
+ }
+
+ public void keyUp(String locator, String keycode)
+ {
+ _selenium.keyUp(locator, keycode);
+ }
+
+ public void mouseDown(String locator)
+ {
+ _selenium.mouseDown(locator);
+ }
+
+ public void mouseOver(String locator)
+ {
+ _selenium.mouseOver(locator);
+ }
+
+ public void open(String url)
+ {
+ _selenium.open(url);
+ }
+
+ public void refresh()
+ {
+ _selenium.refresh();
+ }
+
+ public void removeSelection(String locator, String optionLocator)
+ {
+ _selenium.removeSelection(locator, optionLocator);
+ }
+
+ public void select(String selectLocator, String optionLocator)
+ {
+ _selenium.select(selectLocator, optionLocator);
+ }
+
+ public void selectWindow(String windowID)
+ {
+ _selenium.selectWindow(windowID);
+ }
+
+ public void setContext(String context, String logLevelThreshold)
+ {
+ _selenium.setContext(context, logLevelThreshold);
+ }
+
+ public void setCursorPosition(String locator, String position)
+ {
+ _selenium.setCursorPosition(locator, position);
+ }
+
+ public void setTimeout(String timeout)
+ {
+ _selenium.setTimeout(timeout);
+ }
+
+ public void start()
+ {
+ _selenium.start();
+ }
+
+ public void stop()
+ {
+ _selenium.stop();
+ }
+
+ public void submit(String formLocator)
+ {
+ _selenium.submit(formLocator);
+ }
+
+ public void type(String locator, String value)
+ {
+ _selenium.type(locator, value);
+ }
+
+ public void uncheck(String locator)
+ {
+ _selenium.uncheck(locator);
+ }
+
+ public void waitForCondition(String script, String timeout)
+ {
+ _selenium.waitForCondition(script, timeout);
+ }
+
+ public void waitForPageToLoad(String timeout)
+ {
+ _selenium.waitForPageToLoad(timeout);
+ }
+
+ public void waitForPopUp(String windowID, String timeout)
+ {
+ _selenium.waitForPopUp(windowID, timeout);
+ }
+
+}
Added: tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/JettyRunner.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/JettyRunner.java?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/JettyRunner.java (added)
+++ tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/JettyRunner.java Sat Mar 3 10:00:22 2007
@@ -0,0 +1,115 @@
+// Copyright 2006, 2007 The Apache Software Foundation
+//
+// Licensed 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.
+
+package org.apache.tapestry.test;
+
+import static java.lang.String.format;
+
+import org.mortbay.http.NCSARequestLog;
+import org.mortbay.http.SocketListener;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.WebApplicationContext;
+
+/**
+ * Used to start up an instance of the Jetty servlet container in-process, as part of an integration
+ * test suite. The started Jetty is reliant on the file <code>src/test/conf/webdefault.xml</code>.
+ *
+ * @see AbstractIntegrationTestSuite
+ */
+public class JettyRunner
+{
+ public static final String DEFAULT_CONTEXT_PATH = "/";
+
+ public static final int DEFAULT_PORT = 80;
+
+ private final String _contextPath;
+
+ private final int _port;
+
+ private final String _warPath;
+
+ private final Server _jetty;
+
+ /** Defaults the context path to "/" and the port to 80. */
+ public JettyRunner(String warPath)
+ {
+ this(DEFAULT_CONTEXT_PATH, DEFAULT_PORT, warPath);
+ }
+
+ /**
+ * Creates and starts a new instance of Jetty. This should be done from a test case setup
+ * method.
+ *
+ * @param contextPath
+ * the context path for the deployed application
+ * @param port
+ * the port number used to access the application
+ * @param warPath
+ * the path to the exploded web application (typically, "src/main/webapp")
+ */
+ public JettyRunner(String contextPath, int port, String warPath)
+ {
+ _contextPath = contextPath;
+ _port = port;
+ _warPath = warPath;
+
+ _jetty = createAndStart();
+ }
+
+ /** Stops the Jetty instance. This should be called from a test case tear down method. */
+ public void stop()
+ {
+ try
+ {
+ _jetty.stop();
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Error stopping Jetty instance: " + ex.toString(), ex);
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return format("<JettyRunner %s:%d (%s)>", _contextPath, _port, _warPath);
+ }
+
+ private Server createAndStart()
+ {
+ try
+ {
+ Server server = new Server();
+
+ SocketListener socketListener = new SocketListener();
+ socketListener.setPort(_port);
+ server.addListener(socketListener);
+
+ NCSARequestLog log = new NCSARequestLog();
+ server.setRequestLog(log);
+
+ WebApplicationContext context = server.addWebApplication(_contextPath, _warPath);
+
+ context.setDefaultsDescriptor("src/test/conf/webdefault.xml");
+
+ server.start();
+
+ return server;
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Failure starting Jetty instance: " + ex.toString(), ex);
+ }
+ }
+}
Added: tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt (added)
+++ tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt Sat Mar 3 10:00:22 2007
@@ -0,0 +1,15 @@
+ ----
+ Tapestry Test Utilities
+ ----
+
+Tapestry Test Utilities
+
+ This is just a couple of base classes to make it easier to build integration test suites around Selenium.
+
+ The strategy is to start, in process, a Selenimum Server (which, in turn, starts and manages a web browser),
+ a Jetty instance (for the web browser to talk to), and a Selenium client (which talks to the server).
+
+ The client is able to request URLs, fill in form data, click links, and make assertions about output
+ and behavior.
+
+ <<More details forthcoming.>>
\ No newline at end of file
Added: tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/jdstyle.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/jdstyle.css?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/jdstyle.css (added)
+++ tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/jdstyle.css Sat Mar 3 10:00:22 2007
@@ -0,0 +1,117 @@
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults */
+
+/* Page background color */
+body { font-family: Arial;
+ background-color: white;
+ font-size: 10pt;
+ }
+td { font-family: Arial;
+ font-size: 10pt;
+ }
+/* Table colors */
+.TableHeadingColor { background: #F4F4F4 }
+.TableSubHeadingColor { background: #F4F4F4 }
+.TableRowColor { background: #FFFFFF }
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont { font-size: normal; font-family: Arial }
+.FrameHeadingFont { font-size: normal; font-family: Arial }
+.FrameItemFont { font-size: normal; font-family: Arial }
+
+/* Example of smaller, sans-serif font in frames */
+/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
+
+/* Navigation bar fonts and colors */
+.NavBarCell1 { background-color:#F4F4F4;}
+.NavBarCell1Rev { background-color:silver;}
+
+.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
+
+.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+
+A {
+ color: #003399;
+}
+
+A:active {
+ color: #003399;
+}
+
+A:visited {
+ color: #888888;
+}
+
+P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+}
+
+TD, TH, SPAN {
+ color: #000000;
+}
+
+BLOCKQUOTE {
+ margin-right: 0px;
+}
+
+
+/*H1, H2, H3, H4, H5, H6 {
+ color: #000000;
+ font-weight:500;
+ margin-top:10px;
+ padding-top:15px;
+}
+
+H1 { font-size: 150%; }
+H2 { font-size: 140%; }
+H3 { font-size: 110%; font-weight: bold; }
+H4 { font-size: 110%; font-weight: bold;}
+H5 { font-size: 100%; font-style: italic; }
+H6 { font-size: 100%; font-style: italic; }*/
+
+TT {
+font-size: 90%;
+ font-family: "Courier New", Courier, monospace;
+ color: #000000;
+}
+
+PRE {
+font-size: 90%;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #CCCCCC;
+ background-color: #F4F4F4;
+}
+
+UL, OL, LI {
+ list-style: disc;
+}
+
+HR {
+ width: 100%;
+ height: 1px;
+ background-color: #CCCCCC;
+ border-width: 0px;
+ padding: 0px;
+ color: #CCCCCC;
+}
+
+.variablelist {
+ padding-top: 10;
+ padding-bottom:10;
+ margin:0;
+}
+
+.itemizedlist, UL {
+ padding-top: 0;
+ padding-bottom:0;
+ margin:0;
+}
+
+.term {
+ font-weight:bold;
+}
Added: tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/site.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/site.css?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/site.css (added)
+++ tapestry/tapestry5/tapestry-test/trunk/src/site/resources/css/site.css Sat Mar 3 10:00:22 2007
@@ -0,0 +1,40 @@
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+ background: none;
+ padding-right: 0;
+}
+
+body ul {
+ list-style-type: square;
+}
+
+#downloadbox {
+ float: right;
+ margin: 0 1em 2em 2em;
+ padding: 1em;
+ border: 1px solid #999;
+ background-color: #eee;
+}
+
+#downloadbox h5 {
+ color: #000;
+ margin: 0;
+ border-bottom: 1px solid #aaaaaa;
+ font-size: smaller;
+ padding: 0;
+}
+
+#downloadbox p {
+ margin-top: 1em;
+ margin-bottom: 0;
+}
+
+#downloadbox ul {
+ margin-top: 0;
+ margin-bottom: 1em;
+ list-style-type: disc;
+}
+
+#downloadbox li {
+ font-size: smaller;
+}
+
Added: tapestry/tapestry5/tapestry-test/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/site/site.xml?view=auto&rev=514207
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/site/site.xml (added)
+++ tapestry/tapestry5/tapestry-test/trunk/src/site/site.xml Sat Mar 3 10:00:22 2007
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 2006, 2007 The Apache Software Foundation
+
+ Licensed 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 name="Tapestry Core">
+ <bannerLeft>
+ <name>Tapestry 5</name>
+ <href>http://tapestry.apache.org/tapestry5/</href>
+ <src>images/tapestry_banner.gif</src>
+ </bannerLeft>
+ <bannerRight>
+ <name>Apache</name>
+ <href>http://www.apache.org</href>
+ <src>images/asf_logo_wide.gif</src>
+ </bannerRight>
+ <skin>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>maven-skin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </skin>
+
+ <publishDate format="dd MMM yyyy" />
+
+ <body>
+ <links>
+ <item name="Tapestry" href="http://tapestry.apache.org/" />
+ <item name="Apache" href="http://www.apache.org/" />
+ </links>
+
+ <menu ref="reports"/>
+
+ </body>
+</project>