Author: andyhot
Date: Thu Nov 9 17:57:36 2006
New Revision: 473166
URL: http://svn.apache.org/viewvc?view=rev&rev=473166
Log:
Browser based tests
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Home.html
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1129.html
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1141.html
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/test1.application
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/web.xml
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/conf/
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/conf/webdefault.xml
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/JettyRunner.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/components/
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Home.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1129.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1141.java
Added: tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Home.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Home.html?view=auto&rev=473166
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Home.html
(added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Home.html
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,8 @@
+<html jwcid="@Shell" title="In-Browser Tests">
+ <body jwcid="@Body">
+ <ul>
+ <li><a jwcid="@PageLink" page="Tap1129">TAPESTRY-1129</a></li>
+ <li><a jwcid="@PageLink" page="Tap1141">TAPESTRY-1141</a></li>
+ </ul>
+ </body>
+</html>
\ No newline at end of file
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1129.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1129.html?view=auto&rev=473166
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1129.html
(added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1129.html
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,17 @@
+<html jwcid="@Shell" title="TAPESTRY-1129">
+ <body jwcid="@Body">
+ <h2>AJAX page update problem in Firefox</h2>
+ <h3>textareas issue</h3>
+
+ <a jwcid="@DirectLink" listener="listener:doRefresh"
+ updateComponents="testme" async="ognl:true">refresh</a>
+
+ <div jwcid="@Any" id="testme">
+ <div id="flag"><span jwcid="@Insert" value="ognl:flag"/></div>
+ <form jwcid="@Form" listener="listener:doNothing">
+ <textarea jwcid="@TextArea" value="ognl:text"/>
+ </form>
+ </div>
+
+ </body>
+</html>
\ No newline at end of file
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1141.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1141.html?view=auto&rev=473166
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1141.html
(added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/Tap1141.html
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,16 @@
+<html jwcid="@Shell" title="TAPESTRY-1141">
+ <body jwcid="@Body">
+ <h2>Async form fails if keyboard is used to trigger the submit...</h2>
+ <form jwcid="@Form" async="ognl:true" json="ognl:false"
listener="listener:doProcess"
+ updateComponents="testme">
+ <span jwcid="@For" source="ognl:{'1','2','3'}" value="ognl:num">
+ <input jwcid="[EMAIL PROTECTED]" value="ognl:num" id="num"/>
+ </span>
+ <br />
+ <input jwcid="@Submit" value="Go!"/>
+ </form>
+
+ <div jwcid="@Any" id="testme">[<span jwcid="@Insert"
value="ognl:text"/>]</div>
+
+ </body>
+</html>
\ No newline at end of file
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/test1.application
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/test1.application?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/test1.application
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/test1.application
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 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.
+-->
+
+<!DOCTYPE application PUBLIC
+ "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
+ "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
+
+<application name="Testing browser specific issues">
+
+ <meta key="org.apache.tapestry.page-class-packages"
+ value="org.apache.tapestry.integration.app1.pages"/>
+ <meta key="org.apache.tapestry.component-class-packages"
+ value="org.apache.tapestry.integration.app1.components"/>
+
+
+</application>
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/web.xml?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/web.xml
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/app1/WEB-INF/web.xml
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2004, 2005 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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
+"http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+ <display-name>test1</display-name>
+ <description>Browser tests</description>
+ <filter>
+ <filter-name>redirect</filter-name>
+ <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>redirect</filter-name>
+ <url-pattern>/</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>test1</servlet-name>
+
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>test1</servlet-name>
+ <url-pattern>/app</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>15</session-timeout>
+ </session-config>
+</web-app>
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/conf/webdefault.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test-data/conf/webdefault.xml?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/conf/webdefault.xml
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test-data/conf/webdefault.xml
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 2006 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.
+-->
+
+<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">
+
+ <description>
+ Default web.xml file.
+ This file is applied to a Web application before it's own WEB_INF/web.xml
file
+ </description>
+
+
+
+ <!-- ==================================================================== -->
+ <!-- Context params to control Session Cookies -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- UNCOMMENT TO ACTIVATE
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name>
+ <param-value>127.0.0.1</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
+ <param-value>/</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.MaxAge</param-name>
+ <param-value>-1</param-value>
+ </context-param>
+ -->
+
+
+
+ <!-- ==================================================================== -->
+ <!-- The default servlet. -->
+ <!-- This servlet, normally mapped to /, provides the handling for static -->
+ <!-- content, OPTIONS and TRACE methods for the context. -->
+ <!-- The following initParameters are supported: -->
+ <!-- -->
+ <!-- acceptRanges If true, range requests and responses are -->
+ <!-- supported -->
+ <!-- -->
+ <!-- dirAllowed If true, directory listings are returned if no -->
+ <!-- welcome file is found. Else 403 Forbidden. -->
+ <!-- -->
+ <!-- putAllowed If true, the PUT method is allowed -->
+ <!-- -->
+ <!-- delAllowed If true, the DELETE method is allowed -->
+ <!-- -->
+ <!-- redirectWelcome If true, redirect welcome file requests -->
+ <!-- else use request dispatcher forwards -->
+ <!-- -->
+ <!-- minGzipLength If set to a positive integer, then static content -->
+ <!-- larger than this will be served as gzip content -->
+ <!-- encoded if a matching resource is found ending -->
+ <!-- with ".gz" -->
+ <!-- -->
+ <!-- resoureBase Can be set to replace the context resource base -->
+ <!-- -->
+ <!-- relativeResourceBase -->
+ <!-- Set with a pathname relative to the base of the -->
+ <!-- servlet context root. Useful for only serving -->
+ <!-- static content from only specific subdirectories. -->
+ <!-- -->
+ <!-- The MOVE method is allowed if PUT and DELETE are allowed -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.mortbay.jetty.servlet.Default</servlet-class>
+ <init-param>
+ <param-name>acceptRanges</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>dirAllowed</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>putAllowed</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>delAllowed</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirectWelcome</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>minGzipLength</param-name>
+ <param-value>8192</param-value>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+
+ <servlet-mapping> <servlet-name>default</servlet-name>
<url-pattern>/</url-pattern> </servlet-mapping>
+
+ <!-- ==================================================================== -->
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+
+ <!-- ==================================================================== -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ </welcome-file-list>
+
+ <!-- ==================================================================== -->
+ <locale-encoding-mapping-list>
+
<locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping>
+
<locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping>
+ </locale-encoding-mapping-list>
+
+
+
+</web-app>
+
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/IntegrationTests.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/IntegrationTests.java?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/IntegrationTests.java
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/IntegrationTests.java
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,153 @@
+// Copyright 2006 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.integration;
+
+import org.openqa.selenium.server.SeleniumServer;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+/**
+ * Note: If these tests fail with BindException when starting Jetty, it could
be Skype. At least on
+ * my system, Skype is listening on localhost:80.
+ */
[EMAIL PROTECTED](timeOut = 50000, sequential = true, groups =
+{ "integration" })
+public class IntegrationTests extends Assert
+{
+ private static final int JETTY_PORT = 9999;
+ private static final String BASE_URL = "http://localhost:9999/";
+
+ /** 60 seconds */
+ public static final String PAGE_LOAD_TIMEOUT = "600000";
+
+ private Selenium _selenium;
+
+ private SeleniumServer _server;
+
+ private JettyRunner _jettyRunner;
+
+ @BeforeClass
+ public void startupBackground() throws Exception
+ {
+ _jettyRunner = new JettyRunner("/", JETTY_PORT, "src/test-data/app1");
+
+ _server = new SeleniumServer();
+
+ _server.start();
+
+ _selenium = new DefaultSelenium("localhost",
SeleniumServer.DEFAULT_PORT, "*firefox",
+ BASE_URL);
+
+ _selenium.start();
+ }
+
+ @AfterClass
+ public void shutdownBackground() throws Exception
+ {
+ _selenium.stop();
+ _selenium = null;
+
+ _server.stop();
+ _server = null;
+
+ _jettyRunner.stop();
+ _jettyRunner = null;
+ }
+
+ @Test
+ public void issue_1141() throws Exception
+ {
+ _selenium.open(BASE_URL);
+
+ clickAndWait("link=TAPESTRY-1141");
+
+ assertTrue(_selenium.getTitle().contains("TAPESTRY-1141"));
+
+ String body = _selenium.getBodyText();
+
+ assertTrue(body.contains("[]"));
+
+ assertTrue(_selenium.isElementPresent("num"));
+
+ _selenium.type("num_1", "4");
+
+ _selenium.click("Submit");
+
+ waitForInnerHTML("testme", "[4]");
+
+ _selenium.type("num_1", "5");
+
+ submitFromTextfield("num_1");
+
+ waitForInnerHTML("testme", "[5]");
+
+ _selenium.type("num_1", "6");
+
+ _selenium.type("num_0", "2");
+
+ submitFromTextfield("num_0");
+
+ waitForInnerHTML("testme", "[6]");
+ }
+
+ @Test
+ public void issue_1129() throws Exception
+ {
+ _selenium.open(BASE_URL);
+
+ clickAndWait("link=TAPESTRY-1129");
+
+ assertTrue(_selenium.getTitle().contains("TAPESTRY-1129"));
+
+ String body = _selenium.getBodyText();
+
+ assertTrue(body.contains("false"));
+
+ _selenium.click("link=refresh");
+
+ waitForInnerHTML("flag", "true");
+
+ assertTrue(_selenium.isElementPresent("TextArea"));
+
+ assertTrue("".equals(_selenium.getValue("TextArea").trim()));
+ }
+
+ private void waitForInnerHTML(String elm, String content)
+ {
+
_selenium.waitForCondition("selenium.browserbot.getCurrentWindow().document.getElementById('"
+ + elm + "').innerHTML=='" + content + "'","6000");
+ }
+
+ private void submitFromTextfield(String field)
+ {
+ _selenium.keyPress(field, "13");
+ //_selenium.fireEvent(field, "command");
+ /*_selenium.click(field);
+ _selenium.keyDown(field, "13");
+ _selenium.keyPress(field, "0");
+ _selenium.keyUp(field, "13");*/
+ }
+
+ private void clickAndWait(String link)
+ {
+ _selenium.click(link);
+ _selenium.waitForPageToLoad(PAGE_LOAD_TIMEOUT);
+ }
+}
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/JettyRunner.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/JettyRunner.java?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/JettyRunner.java
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/JettyRunner.java
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,117 @@
+// Copyright 2006 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.integration;
+
+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;
+
+/**
+ *
+ */
+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;
+
+ public static void main(String[] args)
+ {
+ new JettyRunner("src/test-data/app1");
+ }
+
+ /** 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-data/conf/webdefault.xml");
+
+ server.start();
+
+ return server;
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Failure starting Jetty instance: " +
ex.toString(), ex);
+ }
+ }
+}
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Home.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Home.java?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Home.java
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Home.java
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,27 @@
+// Copyright 2006 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.integration.app1.pages;
+
+import org.apache.tapestry.html.BasePage;
+
+/**
+ * Simple page, to be the base class of the integration test pages.
+ */
+public abstract class Home extends BasePage {
+
+ public void doNothing()
+ {
+ }
+}
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1129.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1129.java?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1129.java
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1129.java
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,28 @@
+// Copyright 2006 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.integration.app1.pages;
+
+public abstract class Tap1129 extends Home {
+ public abstract String getText();
+ public abstract void setText(String text);
+
+ public abstract boolean getFlag();
+ public abstract void setFlag(boolean flag);
+
+ public void doRefresh()
+ {
+ setFlag(!getFlag());
+ }
+}
Added:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1141.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1141.java?view=auto&rev=473166
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1141.java
(added)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/app1/pages/Tap1141.java
Thu Nov 9 17:57:36 2006
@@ -0,0 +1,27 @@
+// Copyright 2006 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.integration.app1.pages;
+
+public abstract class Tap1141 extends Home {
+ public abstract String getText();
+ public abstract void setText(String text);
+ public abstract String getNum();
+ public abstract void setNum(String num);
+
+ public void doProcess()
+ {
+ setText(getNum());
+ }
+}