diff options
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/build.xml | 136 | ||||
-rw-r--r-- | uitest/integration_tests.xml | 45 | ||||
-rw-r--r-- | uitest/ivy.xml | 82 | ||||
-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/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java | 9 | ||||
-rw-r--r-- | uitest/test.xml | 99 | ||||
-rw-r--r-- | uitest/vaadin-server.xml | 73 |
9 files changed, 312 insertions, 652 deletions
diff --git a/uitest/build.xml b/uitest/build.xml new file mode 100644 index 0000000000..bde98c36bd --- /dev/null +++ b/uitest/build.xml @@ -0,0 +1,136 @@ +<?xml version="1.0"?> + +<project name="vaadin-uitest" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> + <description> + Provides a uitest WAR containing Vaadin UI tests + </description> + <include file="../common.xml" as="common" /> + <include file="../build.xml" as="vaadin" /> + + <!-- 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> + + <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, build-provided" /> + <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" /> + </target> + + <target name="compile" description="Compiles the module" depends="dependencies"> + + <fail unless="module.name" message="No module name given" /> + <property name="result.dir" location="result" /> + <property name="src" location="${result.dir}/../src" /> + <property name="classes" location="${result.dir}/classes" /> + <property name="server.tests.sources" location="${result.dir}/../../server/tests/src" /> + <mkdir dir="${classes}" /> + + <!-- TODO: Get rid of this --> + <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false"> + <src path="${server.tests.sources}" /> + <include name="com/vaadin/tests/data/bean/**" /> + <include name="com/vaadin/tests/VaadinClasses.java" /> + <include name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" /> + <classpath refid="classpath.compile.dependencies" /> + <classpath refid="classpath.compile.custom" /> + </javac> + + <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false"> + <src path="${src}" /> + <classpath location="${classes}" /> + <classpath refid="classpath.compile.dependencies" /> + <classpath refid="classpath.compile.custom" /> + </javac> + </target> + + <target name="testing-widgetset" depends="dependencies,compile"> + <property name="module" value="com.vaadin.tests.widgetset.TestingWidgetSet" /> + <property name="style" value="OBF" /> + <property name="localWorkers" value="2" /> + <property name="extraParams" value="" /> + <property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" /> + <property name="work.dir" location="${result.dir}/work" /> + + <mkdir dir="${module.output.dir}" /> + + <echo>Compiling ${module} to ${module.output.dir}</echo> + + <!-- compile the module --> + <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies" failonerror="yes" fork="yes" maxmemory="512m"> + <classpath location="src" /> + <classpath location="${classes}" /> + <arg value="-workDir" /> + <arg value="${work.dir}" /> + <arg value="-logLevel" /> + <arg value="TRACE" /> + <arg value="-war" /> + <arg value="${module.output.dir}" /> + <arg value="-style" /> + <arg value="${style}" /> + + <arg value="-localWorkers" /> + <arg value="${localWorkers}" /> + <arg value="-strict" /> + <arg line="${extraParams}" /> + <arg value="${module}" /> + + <sysproperty key="vFailIfNotSerializable" value="true" /> + + <jvmarg value="-Xss8M" /> + <jvmarg value="-XX:MaxPermSize=256M" /> + <jvmarg value="-Djava.awt.headless=true" /> + </java> + + </target> + + <target name="war" depends="dependencies, compile, testing-widgetset"> + <property name="result.dir" location="result" /> + <property name="classes" location="${result.dir}/classes" /> + <property name="WebContent.dir" location="${vaadin.basedir}/WebContent" /> + <property name="deps.dir" location="${result.dir}/deps" /> + + <ivy:resolve resolveid="common" conf="build" /> + <ivy:cachepath pathid="classpath.runtime.dependencies" conf="build" /> + + <delete dir="${deps.dir}" /> + <mkdir dir="${deps.dir}" /> + + <copy todir="${deps.dir}" flatten="true"> + <path refid="classpath.runtime.dependencies" /> + </copy> + + <war destfile="${result.war}" duplicate="fail" index="true"> + <fileset refid="common.files.for.all.jars" /> + <fileset dir="${WebContent.dir}"> + <include name="statictestfiles/**" /> + <include name="VAADIN/themes/tests-*/**" /> + <include name="VAADIN/themes/reindeer-test/**" /> + <include name="WEB-INF/*.xml" /> + </fileset> + <classes dir="${classes}" /> + <lib dir="${deps.dir}" /> + </war> + + </target> + + <target name="publish-local" depends="war"> + <antcall target="common.publish-local"> + <param name="conf" value="build" /> + </antcall> + </target> + + <target name="clean"> + <antcall target="common.clean" /> + </target> + <target name="tests"> + <!--<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/integration_tests.xml b/uitest/integration_tests.xml index e8e978c1ea..15c54830d3 100644 --- a/uitest/integration_tests.xml +++ b/uitest/integration_tests.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" - name="Vaadin Integration Tests" basedir="." default="integration-test-all"> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" name="Vaadin Integration Tests" basedir="." default="integration-test-all"> - <!-- Import common targets --> - <import file="../build/common.xml" /> + <!-- Import common targets --> + <import file="../common.xml" /> + <dirname file="${ant.file.Vaadin Integration Tests}" property="integration_test.dir" /> <!-- Target deploying demo.war --> <fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" /> @@ -48,7 +48,7 @@ <property name="server.start.succeeded" value="1" /> <property name="browsers" value="${test_browsers}" /> <property name="testfiles" value="${testfiles}" /> - <property name="test-output-dir" value="../build/integration-test-output/${server-name}" /> + <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" /> <property name="retries" value="0" /> <fileset dir="." includes="test.xml" /> @@ -62,7 +62,7 @@ <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" /> <property name="server.start.succeeded" value="1" /> <property name="testfiles" value="${testfiles-theme}" /> - <property name="test-output-dir" value="../build/integration-test-output/${server-name}" /> + <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" /> <fileset dir="." includes="test.xml" /> </subant> @@ -243,14 +243,14 @@ <param name="target-server" value="weblogic9" /> </antcall> </target> - - <target name="integration-test-websphere8"> - <antcall target="run-generic-integration-test"> - <param name="startDelay" value="600" /> - <param name="target-port" value="9080" /> - <param name="target-server" value="websphere8" /> - </antcall> - </target> + + <target name="integration-test-websphere8"> + <antcall target="run-generic-integration-test"> + <param name="startDelay" value="600" /> + <param name="target-port" value="9080" /> + <param name="target-server" value="websphere8" /> + </antcall> + </target> <target name="integration-test-weblogic10"> <antcall target="run-generic-integration-test"> @@ -285,7 +285,10 @@ </target> <!-- Upload demo, clean error screenshots and test deployment on all servers --> - <target name="integration-test-all" depends="common.init-deps"> + <target name="integration-test-all"> + <property name="passphrase" value="${passphrase}" /> + <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" /> + <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" /> <parallel> <antcontrib:trycatch property="tried"> <try> @@ -303,7 +306,7 @@ <echo message="Getting lock" /> <antcall target="integration-test-release-lock" /> <echo message="Lock released" /> - + </try> <catch> <echo message="Uploading of demo.war failed. ${tried}" /> @@ -332,7 +335,7 @@ <antcall target="integration-test-tomcat6" /> <antcall target="integration-test-tomcat7" /> <antcall target="integration-test-websphere8" /> - + </parallel> </target> @@ -351,12 +354,12 @@ </op> </op> </antcontrib:math> - <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo> + <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo> <sleep seconds="${sleepTime}" /> </then> </antcontrib:if> - - <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" > + + <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}"> <fileset dir="integration_base_files"> <include name="*" /> </fileset> @@ -405,7 +408,7 @@ </antcall> </antcontrib:then> </antcontrib:if> - + <!-- timeout in five minutes --> <sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" /> <antcall target="echo-prefix"> diff --git a/uitest/ivy.xml b/uitest/ivy.xml index 2b543885c6..2a9bc6b2ef 100644 --- a/uitest/ivy.xml +++ b/uitest/ivy.xml @@ -1,16 +1,68 @@ -<ivy-module version="2.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd"> - - <info organisation="com.vaadin" module="vaadin-uitests"/> +<?xml version="1.0" encoding="UTF-8"?> +<ivy-module version="2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" + xmlns:m="http://ant.apache.org/ivy/maven"> + + <info organisation="com.vaadin" module="vaadin-uitest" + revision="${vaadin.version}" /> + <configurations> - <conf name="jetty" visibility="private" /> - <conf name="emma" visibility="private" /> - <conf name="server" visibility="private" /> - </configurations> - <publications /> - <dependencies> - <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.7" conf="server,jetty->default(*)" /> - <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="server,emma -> default(*)"/> - </dependencies> -</ivy-module>
\ No newline at end of file + <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" ext="war"/> + </publications> + <dependencies defaultconf="build" defaultconfmapping="build,ide->default"> + <!-- API DEPENDENCIES --> + <dependency org="javax.portlet" name="portlet-api" + rev="2.0" conf="build-provided,ide -> default" /> + + <dependency org="javax.validation" name="validation-api" + rev="1.0.0.GA" conf="build,ide -> default,sources" /> + <!--Servlet API version 2.5 --> + <dependency org="javax.servlet" name="servlet-api" + 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-provided,ide -> default" /> + + <!-- LIBRARY DEPENDENCIES (compile time) --> + <!-- Project modules --> + <dependency org="com.vaadin" name="vaadin-server" + rev="${vaadin.version}" conf="build->build"></dependency> + <dependency org="com.vaadin" name="vaadin-client" + rev="${vaadin.version}" conf="build->build"></dependency> + <dependency org="com.vaadin" name="vaadin-client-compiled" + rev="${vaadin.version}" conf="build->build"></dependency> + <dependency org="com.vaadin" name="vaadin-themes-compiled" + rev="${vaadin.version}" conf="build->build"></dependency> + + <!-- For compiling TestingWidgetSet --> + <dependency org="com.vaadin" name="vaadin-client-compiler" + rev="${vaadin.version}" conf="build-provided-> build"></dependency> + + <!-- 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" /> + + <dependency org="commons-codec" name="commons-codec" + rev="1.5" conf="build,ide->default" /> + <dependency org="commons-io" name="commons-io" rev="1.4" + conf="build,ide->default" /> + + </dependencies> + +</ivy-module> 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/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java index b7b1e74eb0..5b3b91da63 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java @@ -4,7 +4,7 @@ import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; -import com.vaadin.data.util.sqlcontainer.AllTests; +import com.vaadin.data.util.sqlcontainer.SQLTestsConstants; import com.vaadin.data.util.sqlcontainer.SQLContainer; import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool; import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool; @@ -32,7 +32,7 @@ class DatabaseHelper { // Will fail if table doesn't exist, which is OK. conn.rollback(); } - switch (AllTests.db) { + switch (SQLTestsConstants.db) { case HSQLDB: statement .execute("create table " @@ -78,8 +78,9 @@ class DatabaseHelper { private void initConnectionPool() { try { - connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver, - AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 5); + connectionPool = new SimpleJDBCConnectionPool( + SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL, + SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 5); } catch (SQLException e) { e.printStackTrace(); } diff --git a/uitest/test.xml b/uitest/test.xml index b65926ff5b..294d0130e4 100644 --- a/uitest/test.xml +++ b/uitest/test.xml @@ -1,12 +1,9 @@ <?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=".."/> - <!-- Import common targets --> - <import file="../build/common.xml" /> - +<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"> + + <include file="../common.xml" /> + <dirname property="test.xml.dir" file="${ant.file.Run Vaadin Testbench Tests}" /> + <!-- ================================================================== --> <!-- Configuration --> <!-- ================================================================== --> @@ -16,7 +13,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 +26,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" /> - <exclude name="uitest/integration-testscripts/**" /> + <fileset dir="${test.xml.dir}" id="html-test-files"> + <include name="src/**/*.html" /> + <exclude name="integration-testscripts/**/*.html" /> </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 +86,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 +107,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 +161,28 @@ <!-- 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="${test.xml.dir}/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="${test.xml.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" /> + </daemons> + <sequential> + <ant antfile="${test.xml.dir}/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 5f2aa06303..3628483436 100644 --- a/uitest/vaadin-server.xml +++ b/uitest/vaadin-server.xml @@ -1,56 +1,29 @@ <?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" /> + <dirname property="dir" file="${ant.file.vaadin-server}" /> + + <target name="deploy-and-start"> + <fail unless="war.file" message="No war file given in 'war.file'" /> + + <ivy:resolve file="${dir}/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="server" /> - <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> |