diff options
author | Artur Signell <artur@vaadin.com> | 2012-09-04 14:49:30 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-09-09 11:23:12 +0300 |
commit | b2b384b531eff28e1fe33bdb91f77edd509970a8 (patch) | |
tree | d3c4cfb8bf30388b5fa985ce3f265da07503e097 | |
parent | f73ff78c95ef6184e8365ada272bbbc147bdcd10 (diff) | |
download | vaadin-framework-b2b384b531eff28e1fe33bdb91f77edd509970a8.tar.gz vaadin-framework-b2b384b531eff28e1fe33bdb91f77edd509970a8.zip |
Support running TestBench tests with the vaadin-uitest war (#9299)
Server is now launched using jetty-runner instead of a custom DemoLauncher
-rw-r--r-- | build/ivy/ivy.xml | 4 | ||||
-rw-r--r-- | common.xml | 4 | ||||
-rw-r--r-- | uitest/build.xml | 23 | ||||
-rw-r--r-- | uitest/ivy.xml | 22 | ||||
-rw-r--r-- | uitest/src/com/vaadin/launcher/DemoLauncher.java | 227 | ||||
-rw-r--r-- | uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java | 12 | ||||
-rw-r--r-- | uitest/src/com/vaadin/launcher/jetty-webdefault.xml | 281 | ||||
-rw-r--r-- | uitest/test.xml | 100 | ||||
-rw-r--r-- | uitest/vaadin-server.xml | 72 |
9 files changed, 118 insertions, 627 deletions
diff --git a/build/ivy/ivy.xml b/build/ivy/ivy.xml index 4231633e98..df30458e25 100644 --- a/build/ivy/ivy.xml +++ b/build/ivy/ivy.xml @@ -44,10 +44,6 @@ <dependency org="org.apache.maven" name="maven-ant-tasks" rev="2.0.10" conf="taskdefs ->master"/> <dependency org="com.googlecode.jarjar" name="jarjar" rev="1.3" conf="taskdefs ->master"/> - <!-- Emma --> - <dependency org="emma" name="emma_ant" rev="2.0.5312" conf="server.tests.extdep,taskdefs ->master"/> - <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="server.tests.extdep,taskdefs ->*"/> - <!-- Bean Validation implementation --> <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1" conf="server.tests.extdep -> default"/> <dependency org="org.hibernate" name="hibernate-validator" rev="4.2.0.Final" conf="server.tests.extdep -> default"/> diff --git a/common.xml b/common.xml index 91a907f003..1e7c050dee 100644 --- a/common.xml +++ b/common.xml @@ -204,8 +204,8 @@ <target name="publish-local" description="Publishes the given module to the local repository"> <fail unless="result.dir" message="No result.dir parameter given" /> <property name="conf" value="*(public)" /> - - <ivy:resolve /> + + <ivy:resolve conf="${conf}"/> <ivy:publish conf="${conf}" resolver="build-temp" overwrite="true" forcedeliver="true"> <!-- <artifacts pattern="${result.dir}/[artifact]-[revision].[ext]" />--> <artifacts pattern="${result.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" /> diff --git a/uitest/build.xml b/uitest/build.xml index 9090df7dcc..7d0f2ca9d1 100644 --- a/uitest/build.xml +++ b/uitest/build.xml @@ -10,6 +10,7 @@ <!-- global properties --> <property name="module.name" value="vaadin-uitest" /> <property name="result.dir" value="result" /> + <property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" /> <path id="classpath.compile.custom"> </path> @@ -17,8 +18,8 @@ <target name="dependencies"> <!-- This is copied from common.xml to be able to add server.tests.source to the source path --> - <ivy:resolve resolveid="common" conf="build" /> - <ivy:cachepath pathid="classpath.compile.dependencies" conf="build" /> + <ivy:resolve resolveid="common" conf="build, build-provided" /> + <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" /> </target> <target name="compile" description="Compiles the module" depends="dependencies"> @@ -51,7 +52,6 @@ <target name="war" depends="compile, dependencies"> <property name="result.dir" location="result" /> <property name="classes" location="${result.dir}/classes" /> - <property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" /> <property name="WebContent.dir" location="${vaadin.basedir}/WebContent" /> <property name="deps.dir" location="${result.dir}/deps" /> @@ -66,20 +66,32 @@ </copy> <war destfile="${result.war}" duplicate="fail" index="true"> - <manifest><attribute name="Class-Path" value="WEB-INF/classes"/></manifest> + <manifest> + <attribute name="Class-Path" value="WEB-INF/classes" /> + </manifest> <fileset refid="common.files.for.all.jars" /> <fileset dir="${WebContent.dir}"> <include name="statictestfiles/**" /> + <include name="VAADIN/themes/tests-tickets/**" /> <include name="WEB-INF/*.xml" /> </fileset> <classes dir="${classes}" /> <lib dir="${deps.dir}" /> + <!-- Include files required by the DemoLauncher/DevelopmentServerLauncher --> + <!--<fileset dir="src"> + <include name="**/launcher/jetty-webdefault.xml" /> + <include name="**/launcher/keystore" /> + </fileset> + --> + </war> </target> <target name="publish-local" depends="war"> - <antcall target="common.publish-local" /> + <antcall target="common.publish-local"> + <param name="conf" value="build" /> + </antcall> </target> <target name="clean"> @@ -89,4 +101,5 @@ <!--<antcall target="common.tests.run" />--> <echo>WHAT? No JUnit tests for ${module.name}!</echo> </target> + </project>
\ No newline at end of file diff --git a/uitest/ivy.xml b/uitest/ivy.xml index b243dfd8ec..5dbb5dd6fc 100644 --- a/uitest/ivy.xml +++ b/uitest/ivy.xml @@ -8,7 +8,9 @@ <configurations> <conf name="build" /> + <conf name="build-provided" visibility="private" /> <conf name="ide" visibility="private" /> + <conf name="jetty-run" extends="build" visibility="private" /> </configurations> <publications> <artifact type="war" /> @@ -16,16 +18,16 @@ <dependencies defaultconf="build" defaultconfmapping="build,ide->default"> <!-- API DEPENDENCIES --> <dependency org="javax.portlet" name="portlet-api" - rev="2.0" conf="build,ide -> default" /> + rev="2.0" conf="build-provided,ide -> default" /> <dependency org="javax.validation" name="validation-api" rev="1.0.0.GA" conf="build,ide -> default" /> <!--Servlet API version 2.5 --> <dependency org="javax.servlet" name="servlet-api" - rev="2.5" conf="build,ide -> default" /> + rev="2.5" conf="build-provided,ide -> default" /> <!-- Google App Engine --> <dependency org="com.google.appengine" name="appengine-api-1.0-sdk" - rev="1.2.1" conf="build,ide -> default" /> + rev="1.2.1" conf="build-provided,ide -> default" /> <!-- LIBRARY DEPENDENCIES (compile time) --> <!-- Project modules --> @@ -38,10 +40,16 @@ <dependency org="com.vaadin" name="vaadin-themes-compiled" rev="${vaadin.version}" conf="build->build"></dependency> - <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.11" - conf="build,ide->default" /> - <dependency org="org.mortbay.jetty" name="jetty-util" - rev="6.1.11" conf="build,ide->default" /> + <!-- Newest Jetty does not work with Ivy currently (orbit -> jar + mapping problem) --> + <dependency org="org.eclipse.jetty" name="jetty-server" + rev="7.4.5.v20110725" conf="build-provided, ide, jetty-run->default" /> + <!-- <dependency org="org.mortbay.jetty" name="jetty-util" --> + <!-- rev="8.1.5.v20120716" conf="build,ide,jetty-run->default" /> --> + <dependency org="org.eclipse.jetty" name="jetty-webapp" + rev="7.4.5.v20110725" conf="build-provided, ide,jetty-run->default" /> + <dependency org="org.mortbay.jetty" name="jetty-runner" + rev="7.4.5.v20110725" conf="jetty-run->default" /> <dependency org="junit" name="junit" rev="4.5" conf="build,ide -> default" /> diff --git a/uitest/src/com/vaadin/launcher/DemoLauncher.java b/uitest/src/com/vaadin/launcher/DemoLauncher.java deleted file mode 100644 index d858b91483..0000000000 --- a/uitest/src/com/vaadin/launcher/DemoLauncher.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright 2011 Vaadin Ltd. - * - * 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 com.vaadin.launcher; - -import java.awt.FlowLayout; -import java.awt.HeadlessException; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Map; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.WindowConstants; - -import com.vaadin.launcher.util.BrowserLauncher; - -/** - * This class starts servlet container and opens a simple control dialog. - * - */ -public class DemoLauncher { - - public static void main(String[] args) throws Exception { - - final Map<String, String> serverArgs = DevelopmentServerLauncher - .parseArguments(args); - boolean deployed = false; - try { - // Default deployment: embedded.war - deployed = deployEmbeddedWarfile(serverArgs); - } catch (final IOException e1) { - e1.printStackTrace(); - deployed = false; - } - - // Check if deployment was succesful - if (!deployed && !serverArgs.containsKey("webroot")) { - // Default deployment failed, try other means - if (new File("WebContent").exists()) { - // Using WebContent directory as webroot - serverArgs.put("webroot", "WebContent"); - } else { - System.err.print("Failed to deploy Vaadin application. " - + "Please add --webroot parameter. Exiting."); - return; - } - } - - // Start the Jetty servlet container - final String url = DevelopmentServerLauncher.runServer(serverArgs, - "Demo Server"); - - if (!serverArgs.containsKey("nogui") && url != null) { - - // Open browser into application URL - BrowserLauncher.openBrowser(url); - - // Open control dialog - /* - * Swing components should never be manipulated outside the event - * dispatch thread. - */ - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - try { - openServerControlDialog(url); - } catch (HeadlessException e) { - // nop, starting from console - } - } - }); - } - } - - /** - * Open a control dialog for embedded server. - * - * @param applicationUrl - * Application URL - */ - private static void openServerControlDialog(final String applicationUrl) { - - // Main frame - final String title = "Desktop Server"; - final JFrame frame = new JFrame(title); - frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - - // Create link label and listen mouse click - final JLabel link = new JLabel("<html>" - + "<center>Desktop Server is running at: <br>" + "<a href=\"" - + applicationUrl + "\">" + applicationUrl - + "</a><br>Close this window to shutdown the server.</center>" - + "</html>"); - link.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - BrowserLauncher.openBrowser(applicationUrl); - } - }); - - // Create a panel and add components to it. - final JPanel contentPane = new JPanel(new FlowLayout()); - frame.setContentPane(contentPane); - contentPane.add(link); - - // Close confirmation - final JLabel question = new JLabel( - "This will stop the server. Are you sure?"); - final JButton okButton = new JButton("OK"); - final JButton cancelButton = new JButton("Cancel"); - - // List for close verify buttons - final ActionListener buttonListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (e.getSource() == okButton) { - System.exit(0); - } else { - Rectangle bounds = frame.getBounds(); - frame.setTitle(title); - contentPane.removeAll(); - contentPane.add(link); - contentPane.setBounds(bounds); - frame.setBounds(bounds); - frame.setVisible(true); - frame.repaint(); - } - } - }; - okButton.addActionListener(buttonListener); - cancelButton.addActionListener(buttonListener); - - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - final Rectangle bounds = frame.getBounds(); - frame.setTitle("Confirm close"); - contentPane.removeAll(); - contentPane.add(question); - contentPane.add(okButton); - contentPane.add(cancelButton); - frame.setBounds(bounds); - frame.setVisible(true); - frame.repaint(); - } - }); - - // Position the window nicely - final java.awt.Dimension screenSize = java.awt.Toolkit - .getDefaultToolkit().getScreenSize(); - final int w = 270; - final int h = 95; - final int margin = 20; - frame.setBounds(new Rectangle(screenSize.width - w - margin, - screenSize.height - h - margin * 2, w, h)); - frame.toFront(); - frame.setVisible(true); - } - - /** - * Deploy file named "embedded.war" from classpath (inside jar file). - * - * @param args - * @return - * @throws IOException - */ - protected static boolean deployEmbeddedWarfile(Map<String, String> args) - throws IOException { - final String embeddedWarfileName = "/embedded.war"; - final InputStream embeddedWarfile = DemoLauncher.class - .getResourceAsStream(embeddedWarfileName); - if (embeddedWarfile != null) { - final File tempWarfile = File.createTempFile("embedded", ".war") - .getAbsoluteFile(); - tempWarfile.getParentFile().mkdirs(); - tempWarfile.deleteOnExit(); - - final String embeddedWebroot = "winstoneEmbeddedWAR"; - final File tempWebroot = new File(tempWarfile.getParentFile(), - embeddedWebroot); - tempWebroot.mkdirs(); - - final OutputStream out = new FileOutputStream(tempWarfile, true); - int read = 0; - final byte buffer[] = new byte[2048]; - while ((read = embeddedWarfile.read(buffer)) != -1) { - out.write(buffer, 0, read); - } - out.close(); - embeddedWarfile.close(); - - args.put("warfile", tempWarfile.getAbsolutePath()); - args.put("webroot", tempWebroot.getAbsolutePath()); - args.remove("webappsDir"); - args.remove("hostsDir"); - return true; - } - return false; - } -} diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java index f45aac8173..89cb420dc2 100644 --- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -25,11 +25,11 @@ import java.net.Socket; import java.util.HashMap; import java.util.Map; -import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.nio.SelectChannelConnector; -import org.mortbay.jetty.security.SslSocketConnector; -import org.mortbay.jetty.webapp.WebAppContext; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.eclipse.jetty.server.ssl.SslSocketConnector; +import org.eclipse.jetty.webapp.WebAppContext; import com.vaadin.launcher.util.BrowserLauncher; @@ -156,8 +156,6 @@ public class DevelopmentServerLauncher { final WebAppContext webappcontext = new WebAppContext(); String path = DevelopmentServerLauncher.class.getPackage().getName() .replace(".", File.separator); - webappcontext.setDefaultsDescriptor(path + File.separator - + "jetty-webdefault.xml"); webappcontext.setContextPath(serverArgs.get("context")); webappcontext.setWar(serverArgs.get("webroot")); server.setHandler(webappcontext); diff --git a/uitest/src/com/vaadin/launcher/jetty-webdefault.xml b/uitest/src/com/vaadin/launcher/jetty-webdefault.xml deleted file mode 100644 index 5a2465af5a..0000000000 --- a/uitest/src/com/vaadin/launcher/jetty-webdefault.xml +++ /dev/null @@ -1,281 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<!-- ===================================================================== --> -<!-- This file contains the default descriptor for web applications. --> -<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> -<!-- The intent of this descriptor is to include jetty specific or common --> -<!-- configuration for all webapps. If a context has a webdefault.xml --> -<!-- descriptor, it is applied before the contexts own web.xml file --> -<!-- --> -<!-- A context may be assigned a default descriptor by: --> -<!-- + Calling WebApplicationContext.setDefaultsDescriptor --> -<!-- + Passed an arg to addWebApplications --> -<!-- --> -<!-- This file is used both as the resource within the jetty.jar (which is --> -<!-- used as the default if no explicit defaults descriptor is set) and it --> -<!-- is copied to the etc directory of the Jetty distro and explicitly --> -<!-- by the jetty.xml file. --> -<!-- --> -<!-- ===================================================================== --> -<web-app - xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - metadata-complete="true" - version="2.5"> - - <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> - --> - - <context-param> - <param-name>org.mortbay.jetty.webapp.NoTLDJarPattern</param-name> - <param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar</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. --> - <!-- --> - <!-- redirectWelcome If true, redirect welcome file requests --> - <!-- else use request dispatcher forwards --> - <!-- --> - <!-- gzip If set to true, then static content 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. --> - <!-- --> - <!-- useFileMappedBuffer --> - <!-- If set to true (the default), a memory mapped --> - <!-- file buffer will be used to serve static content --> - <!-- when using an NIO connector. Setting this value --> - <!-- to false means that a direct buffer will be used --> - <!-- instead. If you are having trouble with Windows --> - <!-- file locking, set this to false. --> - <!-- --> - <!-- cacheControl If set, all static content will have this value --> - <!-- set as the cache-control header. --> - <!-- --> - <!-- maxCacheSize Maximum size of the static resource cache --> - <!-- --> - <!-- maxCachedFileSize Maximum size of any single file in the cache --> - <!-- --> - <!-- maxCachedFiles Maximum number of files in the cache --> - <!-- --> - <!-- cacheType "nio", "bio" or "both" to determine the type(s) --> - <!-- of resource cache. A bio cached buffer may be used--> - <!-- by nio but is not as efficient as a nio buffer. --> - <!-- An nio cached buffer may not be used by bio. --> - <!-- --> - <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - <servlet> - <servlet-name>default</servlet-name> - <servlet-class>org.mortbay.jetty.servlet.DefaultServlet</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>redirectWelcome</param-name> - <param-value>false</param-value> - </init-param> - <init-param> - <param-name>maxCacheSize</param-name> - <param-value>256000000</param-value> - </init-param> - <init-param> - <param-name>maxCachedFileSize</param-name> - <param-value>10000000</param-value> - </init-param> - <init-param> - <param-name>maxCachedFiles</param-name> - <param-value>1000</param-value> - </init-param> - <init-param> - <param-name>cacheType</param-name> - <param-value>both</param-value> - </init-param> - <init-param> - <param-name>gzip</param-name> - <param-value>true</param-value> - </init-param> - <init-param> - <param-name>useFileMappedBuffer</param-name> - <param-value>false</param-value> - </init-param> - <!-- - <init-param> - <param-name>cacheControl</param-name> - <param-value>max-age=3600,public</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> - - - <!-- ==================================================================== --> - <!-- Dynamic Servlet Invoker. --> - <!-- This servlet invokes anonymous servlets that have not been defined --> - <!-- in the web.xml or by other means. The first element of the pathInfo --> - <!-- of a request passed to the envoker is treated as a servlet name for --> - <!-- an existing servlet, or as a class name of a new servlet. --> - <!-- This servlet is normally mapped to /servlet/* --> - <!-- This servlet support the following initParams: --> - <!-- --> - <!-- nonContextServlets If false, the invoker can only load --> - <!-- servlets from the contexts classloader. --> - <!-- This is false by default and setting this --> - <!-- to true may have security implications. --> - <!-- --> - <!-- verbose If true, log dynamic loads --> - <!-- --> - <!-- * All other parameters are copied to the --> - <!-- each dynamic servlet as init parameters --> - <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - <!-- Uncomment for dynamic invocation - <servlet> - <servlet-name>invoker</servlet-name> - <servlet-class>org.mortbay.jetty.servlet.Invoker</servlet-class> - <init-param> - <param-name>verbose</param-name> - <param-value>false</param-value> - </init-param> - <init-param> - <param-name>nonContextServlets</param-name> - <param-value>false</param-value> - </init-param> - <init-param> - <param-name>dynamicParam</param-name> - <param-value>anyValue</param-value> - </init-param> - <load-on-startup>0</load-on-startup> - </servlet> - - <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> - --> - - - - <!-- ==================================================================== --> - <session-config> - <session-timeout>30</session-timeout> - </session-config> - - <!-- ==================================================================== --> - <!-- Default MIME mappings --> - <!-- The default MIME mappings are provided by the mime.properties --> - <!-- resource in the org.mortbay.jetty.jar file. Additional or modified --> - <!-- mappings may be specified here --> - <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - <!-- UNCOMMENT TO ACTIVATE - <mime-mapping> - <extension>mysuffix</extension> - <mime-type>mymime/type</mime-type> - </mime-mapping> - --> - - <!-- ==================================================================== --> - <welcome-file-list> - <welcome-file>index.html</welcome-file> - <welcome-file>index.htm</welcome-file> - <welcome-file>index.jsp</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> - - <security-constraint> - <web-resource-collection> - <web-resource-name>Disable TRACE</web-resource-name> - <url-pattern>/</url-pattern> - <http-method>TRACE</http-method> - </web-resource-collection> - <auth-constraint/> - </security-constraint> - -</web-app> - diff --git a/uitest/test.xml b/uitest/test.xml index b65926ff5b..fca4d1c299 100644 --- a/uitest/test.xml +++ b/uitest/test.xml @@ -1,12 +1,15 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" - xmlns:ivy="antlib:org.apache.ivy.ant" - name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up"> - - <property name="project.root" value=".."/> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up"> + + <property name="project.root" value=".." /> <!-- Import common targets --> - <import file="../build/common.xml" /> - + <!--<import file="../build/common.xml" />--> + <!-- ant contrib required for flow control (for loop, if, property override) --> + <!-- Note that we have to use a namespace to avoid clash when running sub-ant. --> + <ivy:resolve file="${project.root}/build/ivy/ivy.xml" conf="taskdefs" /> + <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" /> + <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" /> + <!-- ================================================================== --> <!-- Configuration --> <!-- ================================================================== --> @@ -16,7 +19,7 @@ <property name="browsers-mac" value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" /> <property name="browsers" value="${browsers-windows}" /> - + <!-- Number of times to retry a test if it fails --> <property name="retries" value="2" /> @@ -29,38 +32,35 @@ <!-- Host running Testbench Hub --> <property name="com.vaadin.testbench.tester.host" value="testbench-hub.intra.itmill.com" /> - <property name="com.vaadin.testbench.screenshot.block.error" value="0.025"/> - <property name="com.vaadin.testbench.debug" value="false"/> - - <!-- Temporary output directory, created and removed by this script --> - <fail unless="test-output-dir" message="The 'test-output-dir' property must be defined." /> - - <property name="class-dir" value="${test-output-dir}/classes" /> - - <target name="initialize" depends="common.init-deps"> - <ivy:resolve conf="emma"/> - <ivy:cachepath pathid="emma.lib" conf="emma" /> - <!-- classpath must include test bench jar and its dependencies --> - <path id="classpath"> - <fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" /> - <path refid="emma.lib" /> - </path> - </target> + <property name="com.vaadin.testbench.screenshot.block.error" value="0.025" /> + <property name="com.vaadin.testbench.debug" value="false" /> + + + <target name="initialize"> + <!-- classpath must include test bench jar and its dependencies --> + <path id="classpath"> + <fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" /> + </path> + </target> <!-- fileset containing all TestBench tests to run --> <fileset dir=".." id="html-test-files"> - <include name="uitest/**/**.html" /> + <include name="uitest/**/AbsoluteLayoutClip**.html" /> <exclude name="uitest/integration-testscripts/**" /> </fileset> <!-- This target converts HTML tests files to java junit tests. One test file for each browser is created. --> <target name="create-tests" depends="initialize, remove-temp-testclasses"> + <!-- Temporary output directory, created and removed by this script --> + <fail unless="test-output-dir" message="The 'test-output-dir' property must be defined." /> + <property name="class-dir" value="${test-output-dir}/classes" /> + <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath" fork="true"> <sysproperty key="com.vaadin.testbench.test.retries" value="${retries}" /> - <jvmarg value="-Duser.language=en"/> - <jvmarg value="-Duser.country=US"/> + <jvmarg value="-Duser.language=en" /> + <jvmarg value="-Duser.country=US" /> <arg value="${test-output-dir}" /> <arg value="${browsers}" /> <arg line="${testfiles}" /> @@ -92,7 +92,7 @@ <fileset dir="${test-output-dir}" id="tests-fileset"> <include name="**/**.java" /> </fileset> - + <antcontrib:for threadCount="30" parallel="true" keepgoing="true" param="target"> <path> <fileset refid="tests-fileset" /> @@ -113,8 +113,8 @@ <path refid="classpath" /> <pathelement path="${class-dir}" /> </classpath> - - <formatter usefile="false" type="plain"/> + + <formatter usefile="false" type="plain" /> <jvmarg value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" /> <jvmarg value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" /> @@ -167,17 +167,29 @@ <!-- The default target. --> <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" /> - <!-- Also starts the server. --> - <target name="test-package"> - <parallel> - <daemons> - <ant antfile="vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" /> - </daemons> - <sequential> - <ant antfile="vaadin-server.xml" target="wait-for-startup" /> - <antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" /> - <move file="${testing.testarea}/${package.name}/war.ec" todir="../build/result" failonerror="false" /> - </sequential> - </parallel> - </target> + + <!-- Starts the server and runs all TestBench tests --> + <target name="test-package"> + <fail unless="war.file" message="No 'war.file' parameter given." /> + <property name="test-output-dir" location="result/testbench-junit-classes" /> + <property name="retries" value="2" /> + + <!-- Parameters for the test.xml script. --> + <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined." /> + <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." /> + <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined." /> + <property name="com.vaadin.testbench.screenshot.block.error" value="0.025" /> + <property name="com.vaadin.testbench.debug" value="false" /> + + + <parallel> + <daemons> + <ant antfile="vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" /> + </daemons> + <sequential> + <ant antfile="vaadin-server.xml" target="wait-for-startup" /> + <antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" /> + </sequential> + </parallel> + </target> </project> diff --git a/uitest/vaadin-server.xml b/uitest/vaadin-server.xml index 226965c642..f07ff49e50 100644 --- a/uitest/vaadin-server.xml +++ b/uitest/vaadin-server.xml @@ -1,56 +1,28 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" - xmlns:ivy="antlib:org.apache.ivy.ant" - name="vaadin-server" - default="deploy-and-start" basedir="."> - - <!-- Import common targets --> - <import file="../build/common.xml" /> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="vaadin-server" default="deploy-and-start" basedir="."> + <include file="../common.xml" /> + + <target name="deploy-and-start"> + <fail unless="war.file" message="No war file given in 'war.file'" /> + + <ivy:resolve file="ivy.xml" /> + <ivy:cachepath pathid="classpath.jetty" conf="jetty-run" /> + <java classname="org.mortbay.jetty.runner.Runner" fork="yes"> + <arg value="--port" /> + <arg value="8888" /> + <arg value="${war.file}" /> + <classpath refid="classpath.jetty" /> + <jvmarg value="-ea" /> + </java> - <target name="check-params"> - <fail unless="output-dir" message="The 'output-dir' (usually build/result/vaadin-xxx) should be given to test script." /> - <fail unless="package.name" message="The 'package.name' property must be defined." /> - <fail unless="package.filename" message="The 'package.filename' property must be defined." /> - <fail unless="testing.testarea" message="The 'testing.testarea' property must be defined." /> - <property name="webroot" value="${testing.testarea}/${package.name}/WebContent" /> </target> - - <target name="prepare-testing-area" depends="check-params"> - <echo> Package name: ${package.name}</echo> - <echo> Package filename: ${package.filename}</echo> - <echo> Testing area: ${testing.testarea}</echo> - <echo> test-output-dir: ${test-output-dir}</echo> - <delete dir="${testing.testarea}/${package.name}" /> - <mkdir dir="${testing.testarea}/${package.name}/WebContent" /> - <echo>Extracting Vaadin package ${package.filename} to testing area ${testing.testarea}</echo> - <unzip src="${package.filename}" dest="${testing.testarea}/${package.name}/WebContent" /> - </target> + <target name="wait-for-startup"> + <echo>Waiting for Servlet Container to start up.</echo> + <waitfor maxwait="60" maxwaitunit="second" checkevery="5" checkeveryunit="second" timeoutproperty="server.start.failed"> + <http url="http://localhost:8888" /> + </waitfor> + <fail if="server.start.failed" message="Server startup failed" /> + </target> - <target name="deploy-and-start" depends="init-deps, prepare-testing-area"> - <property name="webroot" value="${testing.testarea}/${package.name}/WebContent"></property> - - <ivy:resolve file="ivy.xml"/> - <ivy:cachepath pathid="server" conf="build" /> - <java classname="com.vaadin.launcher.DemoLauncher" fork="yes" dir="${testing.testarea}/${package.name}" resultproperty="server.start.result"> - <arg value="--nogui=1" /> - <classpath> - <path location="${webroot}/WEB-INF/classes" /> - <fileset dir="${webroot}/WEB-INF/lib/" includes="*.jar" /> - <path refid="server" /> - </classpath> - <jvmarg value="-Demma.coverage.out.file=${testing.testarea}/${package.name}/war.ec"/> - <jvmarg value="-Djava.awt.headless=true"/> - <jvmarg value="-ea" /> - </java> - </target> - - <target name="wait-for-startup"> - <echo>Waiting for Servlet Container to start up.</echo> - <waitfor maxwait="60" maxwaitunit="second" checkevery="5" checkeveryunit="second" timeoutproperty="server.start.failed"> - <http url="http://localhost:8888"/> - </waitfor> - <fail if="server.start.failed" message="Server startup failed" /> - </target> - </project> |