diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-31 13:54:26 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-09-09 11:23:04 +0300 |
commit | d8a5f96b36946ed315dcf48cc32701e0435bdfaa (patch) | |
tree | f7fcf075a47430a9f45cfda652d91f576e32c98c /uitest | |
parent | eef56b04b46c6ad202beef58c342dbb5ea0e4f5d (diff) | |
download | vaadin-framework-d8a5f96b36946ed315dcf48cc32701e0435bdfaa.tar.gz vaadin-framework-d8a5f96b36946ed315dcf48cc32701e0435bdfaa.zip |
Support running JUnit tests (#9299)
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/build.xml | 87 | ||||
-rw-r--r-- | uitest/ivy.xml | 70 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java | 9 | ||||
-rw-r--r-- | uitest/vaadin-server.xml | 2 |
4 files changed, 148 insertions, 20 deletions
diff --git a/uitest/build.xml b/uitest/build.xml new file mode 100644 index 0000000000..6b8a6934c3 --- /dev/null +++ b/uitest/build.xml @@ -0,0 +1,87 @@ +<?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" /> + + <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="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" /> + + + <mkdir dir="${deps.dir}" /> + <copy todir="${deps.dir}" flatten="true"> + <path refid="classpath.compile.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="WEB-INF/*.xml" /> + </fileset> + <classes dir="${classes}" /> + <lib dir="${deps.dir}" /> + </war> + + </target> + + <target name="publish-local" depends="war"> + <antcall target="common.publish-local" /> + </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/ivy.xml b/uitest/ivy.xml index 2b543885c6..2e4829b721 100644 --- a/uitest/ivy.xml +++ b/uitest/ivy.xml @@ -1,16 +1,56 @@ -<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"> + + <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" /> + <conf name="ide" /> + </configurations> + <publications> + <artifact type="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-provided,ide -> default" /> + <!--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-theme-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" /> + <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/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/vaadin-server.xml b/uitest/vaadin-server.xml index 5f2aa06303..226965c642 100644 --- a/uitest/vaadin-server.xml +++ b/uitest/vaadin-server.xml @@ -31,7 +31,7 @@ <property name="webroot" value="${testing.testarea}/${package.name}/WebContent"></property> <ivy:resolve file="ivy.xml"/> - <ivy:cachepath pathid="server" conf="server" /> + <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> |