2012-02-02 10:20:29 +01:00
<?xml version="1.0"?>
2013-09-16 13:31:37 +02:00
<project xmlns:antcontrib= "antlib:net.sf.antcontrib" xmlns:ivy= "antlib:org.apache.ivy.ant" name= "Vaadin Integration Tests" basedir= "." default= "integration-test-all" >
2013-05-30 16:06:30 +02:00
<!-- Import common targets -->
2017-02-01 16:17:15 +01:00
<import file= "common.xml" />
2013-06-10 19:15:35 +02:00
<dirname file= "${ant.file.Vaadin Integration Tests}" property= "integration_test.dir" />
2013-05-30 16:06:30 +02:00
<!-- Target deploying demo.war -->
2013-06-10 19:15:35 +02:00
<fail unless= "test.integration.server" message= "test.integration.server must be set for integration tests to run" />
2013-05-30 16:06:30 +02:00
2013-06-10 19:15:35 +02:00
<fail unless= "test.integration.user" message= "test.integration.user must be set for integration tests to run" />
<fail unless= "test.integration.antfile" message= "test.integration.antfile must be set for integration tests to run" />
2013-05-30 16:06:30 +02:00
<!-- Test with these browsers -->
<property name= "test_browsers" value= "winxp-firefox17-esr" />
<!-- Path to key file. Default value -->
<property name= "sshkey.file" value= "id_dsa" />
<!-- path and name for demo.war to be deployed -->
<property name= "demo.war" value= "demo.war" />
<!-- Host running Testbench RC or Testbench Hub. Default value -->
<property name= "com.vaadin.testbench.tester.host" value= "127.0.0.1" />
<!-- Base url where the testable application is deployed -->
<property name= "deployment.url" value= "http://${test.integration.server}:8080" />
2015-02-12 13:57:13 +01:00
<!-- TestBench license parameter -->
<property name= "vaadin.testbench.developer.license" value= "" />
2013-11-04 17:10:05 +01:00
2017-02-01 16:17:15 +01:00
<property name= "report.dir" location= "${vaadin.basedir}/result/reports-integration" />
2013-11-04 17:10:05 +01:00
2013-05-30 16:06:30 +02:00
<!-- ssh host values -->
<property name= "ant.hub" value= "${test.integration.antfile}" />
<property name= "user" value= "${test.integration.user}" />
<property name= "passphrase" value= "" />
2013-09-16 13:31:37 +02:00
<ivy:resolve file= "ivy.xml" conf= "build, build-provided" />
<ivy:cachepath pathid= "classpath.tb3.lib" conf= "build, build-provided" />
<path id= "classpath.tb3" >
2016-05-03 16:03:10 +02:00
<path location= "target/test-classes" />
2013-09-16 13:31:37 +02:00
<path refid= "classpath.tb3.lib" />
2016-04-22 22:09:51 +02:00
<path location= "target/classes" />
2013-09-16 13:31:37 +02:00
</path>
2013-05-30 16:06:30 +02:00
<!-- Upload war to deploy to ssh host -->
<target name= "integration-test-upload-demo" >
2013-06-10 19:15:35 +02:00
<scp file= "${demo.war}" todir= "${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile= "${sshkey.file}" passphrase= "${passphrase}" />
2013-05-30 16:06:30 +02:00
</target>
2013-09-16 13:31:37 +02:00
<target name= "run-tb3-servlet-test" >
<antcall target= "run-tb3-test" inheritall= "true" >
2017-02-01 16:17:15 +01:00
<param name= "junit.test.suite" value= "com.vaadin.tests.integration.ServletIntegrationTests" />
2013-09-16 13:31:37 +02:00
</antcall>
</target>
<target name= "run-tb3-test" >
2017-10-05 09:09:22 +02:00
<fail unless= "phantomjs.binary.path" message= "Define PhantomJS binary using -Dphantomjs.binary.path" />
2013-09-16 13:31:37 +02:00
<fail unless= "server-name" message= "Server name must be defined in server-name" />
<fail unless= "deployment.url" message= "Deplyoment url must be defined in deployment.url" />
<fail unless= "com.vaadin.testbench.screenshot.directory" message= "Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
2017-09-22 09:27:29 +02:00
<property name= "server.report.dir" location= "${report.dir}/integration-test-tb3/${server-name}" />
<!-- The junit task does not create the report dir... -->
2013-11-04 17:10:05 +01:00
<mkdir dir= "${server.report.dir}" />
2014-04-02 07:51:27 +02:00
2013-11-04 17:10:05 +01:00
<junit showoutput= "no" printsummary= "no" fork= "yes" >
<formatter type= "xml" />
2013-09-16 13:31:37 +02:00
<classpath refid= "classpath.tb3" />
<jvmarg value= "-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
<jvmarg value= "-Ddeployment.url=${deployment.url}" />
<jvmarg value= "-Dserver-name=${server-name}" />
<jvmarg value= "-Djava.awt.headless=true" />
2014-04-02 07:51:27 +02:00
<jvmarg value= "-Ddemo.war=${demo.war}" />
2015-02-12 13:57:13 +01:00
<jvmarg value= "-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
2017-10-05 09:09:22 +02:00
<jvmarg value= "-Dphantomjs.binary.path=${phantomjs.binary.path}" />
2013-11-04 17:10:05 +01:00
<test name= "${junit.test.suite}" todir= "${server.report.dir}" />
2013-09-16 13:31:37 +02:00
</junit>
</target>
2013-05-30 16:06:30 +02:00
2017-10-09 14:51:34 +02:00
<!--
2013-05-30 16:06:30 +02:00
<target name= "integration-test-tomcat7" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "tomcat7" />
</antcall>
</target>
2017-10-09 14:51:34 +02:00
-->
2014-02-04 22:12:38 +01:00
<target name= "integration-test-tomcat7apacheproxy" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "tomcat7apacheproxy" />
</antcall>
</target>
2017-10-09 14:51:34 +02:00
<!--
2013-10-07 19:49:18 +02:00
<target name= "integration-test-tomcat8" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "tomcat8" />
</antcall>
</target>
2013-05-30 16:06:30 +02:00
<target name= "integration-test-jetty8" >
<antcall target= "run-generic-integration-test" >
2016-12-19 10:43:00 +01:00
<param name= "startDelay" value= "90" />
2013-05-30 16:06:30 +02:00
<param name= "target-server" value= "jetty8" />
</antcall>
</target>
2013-06-25 09:54:08 +02:00
<target name= "integration-test-jetty9" >
<antcall target= "run-generic-integration-test" >
2016-12-19 10:43:00 +01:00
<param name= "startDelay" value= "90" />
2013-06-25 09:54:08 +02:00
<param name= "target-server" value= "jetty9" />
</antcall>
</target>
2017-10-05 09:09:22 +02:00
-->
2013-11-06 12:34:18 +01:00
<target name= "integration-test-jboss-eap6" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "jbosseap6" />
2017-02-03 16:28:07 +01:00
<param name= "demo.war" value= "${demo.jboss6.war}" />
2013-11-06 12:34:18 +01:00
</antcall>
</target>
2017-10-09 14:51:34 +02:00
<!--
2014-02-04 22:13:16 +01:00
<target name= "integration-test-wildfly8" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "wildfly8" />
</antcall>
</target>
2015-06-16 21:19:53 +02:00
<target name= "integration-test-wildfly9" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "wildfly9" />
</antcall>
</target>
2016-02-07 16:05:01 +01:00
<target name= "integration-test-wildfly10" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "wildfly10" />
</antcall>
</target>
2017-10-05 09:09:22 +02:00
-->
2015-09-01 13:19:50 +02:00
<target name= "integration-test-wildfly9-nginx" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "wildfly9-nginx" />
<param name= "target-port" value= "80" />
</antcall>
</target>
2017-10-09 14:51:34 +02:00
<!--
2013-06-13 21:02:30 +02:00
<target name= "integration-test-glassfish4" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "glassfish4" />
</antcall>
</target>
2016-05-07 20:28:18 +02:00
<target name= "integration-test-payara" >
<antcall target= "run-generic-integration-test" >
<param name= "startDelay" value= "10" />
<param name= "target-server" value= "payara" />
</antcall>
</target>
2017-10-09 14:51:34 +02:00
-->
2013-05-30 16:06:30 +02:00
<target name= "integration-test-weblogic12" >
<antcall target= "run-generic-integration-test" >
2016-12-19 10:43:00 +01:00
<param name= "startDelay" value= "60" />
2013-05-30 16:06:30 +02:00
<param name= "target-port" value= "7001" />
<param name= "target-server" value= "weblogic12" />
</antcall>
</target>
2014-04-02 07:51:27 +02:00
<!-- Upload demo, clean error screenshots and test deployment on all
2013-05-30 16:06:30 +02:00
servers -->
2013-09-16 13:31:37 +02:00
<target name= "integration-test-all" unless= "tests.integration.skip" >
2013-05-30 16:06:30 +02:00
<property name= "passphrase" value= "${passphrase}" />
<fail unless= "sshkey.file" message= "You must define an ssh.keyfile parameter" />
2013-06-10 19:15:35 +02:00
<fail unless= "com.vaadin.testbench.screenshot.directory" message= "You must define a com.vaadin.testbench.screenshot.directory parameter" />
2013-11-04 17:10:05 +01:00
<delete dir= "${report.dir}" />
<mkdir dir= "${report.dir}" />
2013-05-30 16:06:30 +02:00
<parallel >
<antcall target= "integration-test-weblogic12" />
2017-10-09 14:51:34 +02:00
<!--
2013-06-13 21:02:30 +02:00
<antcall target= "integration-test-glassfish4" />
2017-10-09 14:51:34 +02:00
<antcall target= "integration-test-payara" />
-->
2013-11-06 12:34:18 +01:00
<antcall target= "integration-test-jboss-eap6" />
2017-10-09 14:51:34 +02:00
<!--
2014-02-04 22:13:16 +01:00
<antcall target= "integration-test-wildfly8" />
2017-10-09 14:51:34 +02:00
<antcall target= "integration-test-wildfly9" />
<antcall target= "integration-test-wildfly10" />
2013-05-30 16:06:30 +02:00
<antcall target= "integration-test-jetty8" />
2017-10-09 14:51:34 +02:00
<antcall target= "integration-test-jetty9" />
2013-05-30 16:06:30 +02:00
<antcall target= "integration-test-tomcat7" />
2013-10-07 19:49:18 +02:00
<antcall target= "integration-test-tomcat8" />
2017-10-09 14:51:34 +02:00
-->
2014-02-04 22:12:38 +01:00
<antcall target= "integration-test-tomcat7apacheproxy" />
2013-05-30 16:06:30 +02:00
</parallel>
</target>
<target name= "do-run-generic-test" >
<property name= "target-host" value= "${target-server}.devnet.vaadin.com" />
<property name= "target-port" value= "8080" />
<antcontrib:if >
<isset property= "startDelay" />
<then >
2016-08-17 13:10:11 +02:00
<echo > Delaying startup of ${target-server} with ${startDelay} seconds</echo>
<sleep seconds= "${startDelay}" />
2013-05-30 16:06:30 +02:00
</then>
</antcontrib:if>
2013-06-10 19:15:35 +02:00
<scp todir= "${user}@${target-host}:." keyfile= "${sshkey.file}" trust= "yes" passphrase= "${passphrase}" >
2013-05-30 16:06:30 +02:00
<fileset dir= "integration_base_files" >
<include name= "*" />
</fileset>
</scp>
2014-04-02 07:51:27 +02:00
<!-- trycatch probably not needed any more as it just fails with
2013-05-30 16:06:30 +02:00
the original message and doesn't do anything in the finally block -->
<antcontrib:trycatch property= "error_message" >
<try >
2014-04-02 07:51:27 +02:00
<!-- timeout in one hour (remote end should timeout in 55
2013-05-30 16:06:30 +02:00
minutes) -->
2013-06-10 19:15:35 +02:00
<sshexec host= "${target-host}" outputproperty= "lock-output" timeout= "3600000" username= "${user}" keyfile= "${sshkey.file}" trust= "yes" command= "chmod +x *.sh; ant -f deploy.xml get-lock" />
2013-05-30 16:06:30 +02:00
<antcall target= "echo-prefix" >
<param name= "prefix" value= "${target-server}: " />
<param name= "message" value= "${lock-output}" />
</antcall>
2013-06-10 19:15:35 +02:00
<scp file= "${demo.war}" todir= "${user}@${target-host}:demo.war" keyfile= "${sshkey.file}" trust= "yes" passphrase= "${passphrase}" />
2013-05-30 16:06:30 +02:00
<!-- timeout in 15 minutes -->
2013-06-10 19:15:35 +02:00
<sshexec host= "${target-host}" outputproperty= "start-output" timeout= "900000" username= "${user}" keyfile= "${sshkey.file}" trust= "yes" command= "ant -f deploy.xml startup-and-deploy" failonerror= "false" />
2013-05-30 16:06:30 +02:00
<antcall target= "echo-prefix" >
<param name= "prefix" value= "${target-server}: " />
<param name= "message" value= "${start-output}" />
</antcall>
<fail message= "${start-output}" >
<condition >
<not >
2013-06-10 19:15:35 +02:00
<contains string= "${start-output}" substring= "Demo deployed successfully" />
2013-05-30 16:06:30 +02:00
</not>
</condition>
</fail>
2016-08-17 23:08:12 +02:00
<echo > Starting TB3 test for ${target-server}</echo>
<antcall target= "run-tb3-servlet-test" >
<param name= "server-name" value= "${target-server}" />
<param name= "deployment.url" value= "http://${target-host}:${target-port}" />
</antcall>
2013-05-30 16:06:30 +02:00
<!-- timeout in five minutes -->
2013-06-10 19:15:35 +02:00
<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" />
2013-05-30 16:06:30 +02:00
<antcall target= "echo-prefix" >
<param name= "prefix" value= "${target-server}: " />
<param name= "message" value= "${stop-output}" />
</antcall>
</try>
<catch >
<fail message= "${error_message}" />
</catch>
</antcontrib:trycatch>
</target>
<target name= "echo-prefix" >
2013-06-10 19:15:35 +02:00
<antcontrib:propertyregex property= "message-prefixed" input= "${prefix}${message}" regexp= "\n" replace= "\0${prefix}" global= "true" defaultValue= "${prefix}${message}" />
2013-05-30 16:06:30 +02:00
<echo message= "${message-prefixed}" />
</target>
<target name= "run-generic-integration-test" >
2013-06-10 19:16:05 +02:00
<concat > ##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
2013-05-30 16:06:30 +02:00
<antcontrib:trycatch property= "tried" >
<try >
<antcall target= "do-run-generic-test" />
</try>
<catch >
2013-06-10 19:15:35 +02:00
<antcontrib:antcallback target= "teamcity-escape" return= "tried-escaped" >
2013-05-30 16:06:30 +02:00
<param name= "returnTo" value= "tried-escaped" />
<param name= "message" value= "${tried}" />
</antcontrib:antcallback>
2013-06-10 19:16:05 +02:00
<concat > ##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
2013-05-30 16:06:30 +02:00
</catch>
</antcontrib:trycatch>
2013-06-10 19:16:05 +02:00
<concat > ##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
2013-05-30 16:06:30 +02:00
</target>
<target name= "teamcity-escape" >
<property name= "returnTo" value= "return" />
2014-04-02 07:51:27 +02:00
<!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
2013-05-30 16:06:30 +02:00
- see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
<!-- Immutable properties - > needs to create a new one every time -->
2013-06-10 19:15:35 +02:00
<antcontrib:propertyregex property= "details-escaped1" input= "${message}" regexp= "['|\[\]]" replace= "|\0" global= "true" defaultValue= "${message}" />
<antcontrib:propertyregex property= "details-escaped2" input= "${details-escaped1}" regexp= "\n" replace= "|n" global= "true" defaultValue= "${details-escaped1}" />
<antcontrib:propertyregex property= "details-escaped3" input= "${details-escaped2}" regexp= "\r" replace= "|r" global= "true" defaultValue= "${details-escaped2}" />
2013-05-30 16:06:30 +02:00
<property name= "${returnTo}" value= "${details-escaped3}" />
</target>
<target name= "run-integration-test" >
2013-06-10 19:16:05 +02:00
<concat > ##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
2013-05-30 16:06:30 +02:00
<antcontrib:trycatch property= "tried" >
<try >
<antcall target= "integration-test-${target-server}" />
</try>
<catch >
2013-06-10 19:15:35 +02:00
<antcallback target= "teamcity-escape" return= "tried-escaped" >
2013-05-30 16:06:30 +02:00
<param name= "returnTo" value= "tried-escaped" />
<param name= "message" value= "${tried}" />
</antcallback>
2013-06-10 19:16:05 +02:00
<concat > ##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
2013-05-30 16:06:30 +02:00
</catch>
</antcontrib:trycatch>
2013-06-10 19:16:05 +02:00
<concat > ##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
2013-05-30 16:06:30 +02:00
</target>
<target name= "integration-test-get-lock" >
2013-06-10 19:15:35 +02:00
<sshexec host= "${test.integration.server}" username= "${user}" keyfile= "${sshkey.file}" command= "ant -f ${ant.hub} get-lock" />
2013-05-30 16:06:30 +02:00
</target>
<target name= "integration-test-release-lock" >
2013-06-10 19:15:35 +02:00
<sshexec host= "${test.integration.server}" username= "${user}" keyfile= "${sshkey.file}" command= "ant -f ${ant.hub} release-lock" />
2013-05-30 16:06:30 +02:00
</target>
<!-- Remove demo.war -->
<target name= "integration-test-clean" >
2013-06-10 19:15:35 +02:00
<sshexec host= "${test.integration.server}" username= "${user}" keyfile= "${sshkey.file}" command= "ant -f ${ant.hub} clean" />
2013-05-30 16:06:30 +02:00
</target>
2011-11-08 16:28:27 +01:00
</project>