You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

integration_tests.xml 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <?xml version="1.0"?>
  2. <project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Vaadin Integration Tests" basedir="." default="integration-test-all">
  3. <!-- Import common targets -->
  4. <import file="../common.xml" />
  5. <dirname file="${ant.file.Vaadin Integration Tests}" property="integration_test.dir" />
  6. <!-- Target deploying demo.war -->
  7. <fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" />
  8. <fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" />
  9. <fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" />
  10. <!-- Test with these browsers -->
  11. <property name="test_browsers" value="winxp-firefox17-esr" />
  12. <!-- Path to key file. Default value -->
  13. <property name="sshkey.file" value="id_dsa" />
  14. <!-- path and name for demo.war to be deployed -->
  15. <property name="demo.war" value="demo.war" />
  16. <!-- Host running Testbench RC or Testbench Hub. Default value -->
  17. <property name="com.vaadin.testbench.tester.host" value="127.0.0.1" />
  18. <!-- Base url where the testable application is deployed -->
  19. <property name="deployment.url" value="http://${test.integration.server}:8080" />
  20. <property name="report.dir" location="${integration_test.dir}/result/reports-integration" />
  21. <!-- ssh host values -->
  22. <property name="ant.hub" value="${test.integration.antfile}" />
  23. <property name="user" value="${test.integration.user}" />
  24. <property name="passphrase" value="" />
  25. <ivy:resolve file="ivy.xml" conf="build, build-provided" />
  26. <ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
  27. <path id="classpath.tb3">
  28. <path refid="classpath.tb3.lib" />
  29. <path location="result/classes" />
  30. </path>
  31. <!-- Upload war to deploy to ssh host -->
  32. <target name="integration-test-upload-demo">
  33. <scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
  34. </target>
  35. <!-- Run basic integration test test -->
  36. <target name="legacy-integration-test">
  37. <fail unless="testfiles" message="You need to specify the files to run using the 'testfiles' property" />
  38. <subant target="run-tb2-tests" failonerror="false" antfile="test.xml">
  39. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  40. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  41. <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
  42. <property name="server.start.succeeded" value="1" />
  43. <property name="browsers" value="${test_browsers}" />
  44. <property name="testfiles" value="${testfiles}" />
  45. <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
  46. <property name="retries" value="0" />
  47. <property name="report.qualifier" value="integration-tb2/${server-name}" />
  48. <fileset dir="." includes="test.xml" />
  49. </subant>
  50. </target>
  51. <target name="integration-test-theme">
  52. <subant target="run-tb2-tests" failonerror="false" antfile="test.xml">
  53. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  54. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  55. <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
  56. <property name="server.start.succeeded" value="1" />
  57. <property name="testfiles" value="${testfiles-theme}" />
  58. <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
  59. <property name="report.qualifier" value="integration-theme-tb2/${server-name}" />
  60. <fileset dir="." includes="test.xml" />
  61. </subant>
  62. </target>
  63. <!-- Run integration test on GAE -->
  64. <target name="integration-test-test-GAE">
  65. <fileset dir="integration-testscripts" id="html-test-files" includes="GoogleAppEngine/integration-test-GAE.html" />
  66. <pathconvert pathsep=" " property="test-GAE" refid="html-test-files" />
  67. <subant target="run-tb2-tests" failonerror="false" antfile="test.xml">
  68. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  69. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  70. <property name="com.vaadin.testbench.deployment.url" value="http://vaadin-integration-test.appspot.com/" />
  71. <property name="server.start.succeeded" value="1" />
  72. <property name="browsers" value="${test_browsers}" />
  73. <property name="testfiles" value="${test-GAE}" />
  74. <property name="test-output-dir" value="../build/integration-test-gae-output" />
  75. <property name="report.qualifier" value="integration-gae-tb2/${server-name}" />
  76. <fileset dir="." includes="test.xml" />
  77. </subant>
  78. </target>
  79. <target name="integration-test-deploy-to-GAE">
  80. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" />
  81. </target>
  82. <target name="run-tb3-servlet-test">
  83. <antcall target="run-tb3-test" inheritall="true">
  84. <param name="junit.test.suite" value="com.vaadin.tests.tb3.ServletIntegrationTests" />
  85. </antcall>
  86. </target>
  87. <target name="run-tb3-test">
  88. <fail unless="server-name" message="Server name must be defined in server-name" />
  89. <fail unless="deployment.url" message="Deplyoment url must be defined in deployment.url" />
  90. <fail unless="com.vaadin.testbench.screenshot.directory" message="Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
  91. <property name="server.report.dir" location="${report.dir}/integration-test-tb3/${server-name}" />
  92. <!-- The junit task does not create the report dir... -->
  93. <mkdir dir="${server.report.dir}" />
  94. <junit showoutput="no" printsummary="no" fork="yes">
  95. <formatter type="xml" />
  96. <classpath refid="classpath.tb3" />
  97. <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
  98. <jvmarg value="-Ddeployment.url=${deployment.url}" />
  99. <jvmarg value="-Dserver-name=${server-name}" />
  100. <jvmarg value="-Djava.awt.headless=true" />
  101. <jvmarg value="-Ddemo.war=${demo.war}" />
  102. <test name="${junit.test.suite}" todir="${server.report.dir}" />
  103. </junit>
  104. </target>
  105. <target name="integration-test-tomcat7">
  106. <antcall target="run-generic-integration-test">
  107. <param name="startDelay" value="10" />
  108. <param name="target-server" value="tomcat7" />
  109. </antcall>
  110. </target>
  111. <target name="integration-test-tomcat7apacheproxy">
  112. <antcall target="run-generic-integration-test">
  113. <param name="startDelay" value="10" />
  114. <param name="target-server" value="tomcat7apacheproxy" />
  115. </antcall>
  116. </target>
  117. <target name="integration-test-tomcat8">
  118. <antcall target="run-generic-integration-test">
  119. <param name="startDelay" value="10" />
  120. <param name="target-server" value="tomcat8" />
  121. </antcall>
  122. </target>
  123. <target name="integration-test-tomcat6">
  124. <antcall target="run-generic-integration-test">
  125. <param name="startDelay" value="10" />
  126. <param name="target-server" value="tomcat6" />
  127. </antcall>
  128. </target>
  129. <target name="integration-test-jetty7">
  130. <antcall target="run-generic-integration-test">
  131. <param name="target-server" value="jetty7" />
  132. </antcall>
  133. </target>
  134. <target name="integration-test-jetty8">
  135. <antcall target="run-generic-integration-test">
  136. <param name="startDelay" value="300" />
  137. <param name="target-server" value="jetty8" />
  138. </antcall>
  139. </target>
  140. <target name="integration-test-jetty9">
  141. <antcall target="run-generic-integration-test">
  142. <param name="startDelay" value="300" />
  143. <param name="target-server" value="jetty9" />
  144. </antcall>
  145. </target>
  146. <target name="integration-test-jboss4">
  147. <antcall target="run-generic-integration-test">
  148. <param name="startDelay" value="10" />
  149. <param name="target-server" value="jboss4" />
  150. </antcall>
  151. </target>
  152. <target name="integration-test-jboss5">
  153. <antcall target="run-generic-integration-test">
  154. <param name="startDelay" value="10" />
  155. <param name="target-server" value="jboss5" />
  156. </antcall>
  157. </target>
  158. <target name="integration-test-jboss6">
  159. <antcall target="run-generic-integration-test">
  160. <param name="startDelay" value="10" />
  161. <param name="target-server" value="jboss6" />
  162. </antcall>
  163. </target>
  164. <target name="integration-test-jboss7">
  165. <antcall target="run-generic-integration-test">
  166. <param name="startDelay" value="10" />
  167. <param name="target-server" value="jboss7" />
  168. </antcall>
  169. </target>
  170. <target name="integration-test-jboss-eap6">
  171. <antcall target="run-generic-integration-test">
  172. <param name="startDelay" value="10" />
  173. <param name="target-server" value="jbosseap6" />
  174. </antcall>
  175. </target>
  176. <target name="integration-test-wildfly8">
  177. <antcall target="run-generic-integration-test">
  178. <param name="startDelay" value="10" />
  179. <param name="target-server" value="wildfly8" />
  180. </antcall>
  181. </target>
  182. <target name="integration-test-glassfish3">
  183. <antcall target="run-generic-integration-test">
  184. <param name="startDelay" value="10" />
  185. <param name="target-server" value="glassfish3" />
  186. </antcall>
  187. </target>
  188. <target name="integration-test-glassfish4">
  189. <antcall target="run-generic-integration-test">
  190. <param name="startDelay" value="10" />
  191. <param name="target-server" value="glassfish4" />
  192. </antcall>
  193. </target>
  194. <target name="integration-test-liferay6">
  195. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" />
  196. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  197. <antcall target="run-generic-integration-test">
  198. <param name="startDelay" value="600" />
  199. <param name="test_browsers" value="winxp-firefox17-esr" />
  200. <param name="target-server" value="liferay6" />
  201. </antcall>
  202. </target>
  203. <target name="integration-test-liferay6-theme">
  204. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
  205. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  206. <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" />
  207. <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
  208. <antcall target="run-generic-integration-test">
  209. <param name="startDelay" value="600" />
  210. <param name="test_browsers" value="winxp-firefox17-esr" />
  211. <param name="target-server" value="liferay6" />
  212. </antcall>
  213. </target>
  214. <target name="integration-test-liferay5">
  215. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" />
  216. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  217. <antcall target="run-generic-integration-test">
  218. <param name="startDelay" value="600" />
  219. <param name="test_browsers" value="winxp-firefox17-esr" />
  220. <param name="target-server" value="liferay5" />
  221. </antcall>
  222. </target>
  223. <target name="integration-test-liferay6ee">
  224. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" />
  225. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  226. <antcall target="run-generic-integration-test">
  227. <param name="startDelay" value="600" />
  228. <param name="test_browsers" value="winxp-firefox17-esr" />
  229. <param name="target-server" value="liferay6ee" />
  230. </antcall>
  231. </target>
  232. <target name="integration-test-liferay6ee-theme">
  233. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
  234. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  235. <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" />
  236. <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
  237. <antcall target="run-generic-integration-test">
  238. <param name="startDelay" value="600" />
  239. <param name="test_browsers" value="winxp-firefox17-esr" />
  240. <param name="target-server" value="liferay6ee" />
  241. </antcall>
  242. </target>
  243. <target name="integration-test-gatein3">
  244. <fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" />
  245. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  246. <antcall target="run-generic-integration-test">
  247. <param name="startDelay" value="600" />
  248. <param name="test_browsers" value="winxp-googlechrome21" />
  249. <param name="target-server" value="gatein3" />
  250. </antcall>
  251. </target>
  252. <target name="integration-test-exo3">
  253. <fileset dir="integration-testscripts" id="html-test-files" includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" />
  254. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  255. <antcall target="run-generic-integration-test">
  256. <param name="startDelay" value="600" />
  257. <param name="test_browsers" value="winxp-firefox17-esr" />
  258. <param name="target-server" value="exo3" />
  259. </antcall>
  260. </target>
  261. <target name="integration-test-websphere8">
  262. <antcall target="run-generic-integration-test">
  263. <param name="startDelay" value="600" />
  264. <param name="target-port" value="9080" />
  265. <param name="target-server" value="websphere8" />
  266. </antcall>
  267. </target>
  268. <target name="integration-test-websphereportal8">
  269. <concat>##teamcity[testStarted name='websphereportal8' flowId='websphereportal8']</concat>
  270. <antcall target="run-tb3-test" inheritall="true">
  271. <param name="junit.test.suite" value="com.vaadin.tests.integration.WebSpherePortalIntegrationTest" />
  272. <param name="server-name" value="websphereportal8" />
  273. <!-- Fill out dummy values for params required by run-tb3-test target -->
  274. <param name="test.integration.server" value="" />
  275. <param name="test.integration.user" value="" />
  276. <param name="test.integration.antfile" value="" />
  277. </antcall>
  278. <concat>##teamcity[testFinished name='websphereportal8' flowId='websphereportal8']"</concat>
  279. </target>
  280. <target name="integration-test-weblogic10">
  281. <antcall target="run-generic-integration-test">
  282. <param name="startDelay" value="600" />
  283. <param name="target-port" value="7001" />
  284. <param name="target-server" value="weblogic10" />
  285. </antcall>
  286. </target>
  287. <target name="integration-test-weblogic12">
  288. <antcall target="run-generic-integration-test">
  289. <param name="startDelay" value="600" />
  290. <param name="target-port" value="7001" />
  291. <param name="target-server" value="weblogic12" />
  292. </antcall>
  293. </target>
  294. <target name="integration-test-weblogicPortal">
  295. <fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
  296. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  297. <antcall target="run-generic-integration-test">
  298. <param name="startDelay" value="600" />
  299. <param name="target-port" value="7001" />
  300. <param name="target-server" value="weblogicportal" />
  301. </antcall>
  302. </target>
  303. <target name="integration-test-GAE">
  304. <antcall target="integration-test-deploy-to-GAE" />
  305. <antcall target="integration-test-test-GAE" />
  306. </target>
  307. <!-- Upload demo, clean error screenshots and test deployment on all
  308. servers -->
  309. <target name="integration-test-all" unless="tests.integration.skip">
  310. <property name="passphrase" value="${passphrase}" />
  311. <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
  312. <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
  313. <delete dir="${report.dir}" />
  314. <mkdir dir="${report.dir}" />
  315. <parallel>
  316. <antcontrib:trycatch property="tried">
  317. <try>
  318. <!-- Still running GAE test from the old server which
  319. requires its own lock -->
  320. <echo message="Getting lock" />
  321. <antcall target="integration-test-get-lock" />
  322. <echo message="Got lock" />
  323. <antcall target="integration-test-upload-demo" />
  324. <antcall target="run-integration-test">
  325. <param name="target-server" value="GAE" />
  326. </antcall>
  327. <antcall target="integration-test-clean" />
  328. <echo message="Getting lock" />
  329. <antcall target="integration-test-release-lock" />
  330. <echo message="Lock released" />
  331. </try>
  332. <catch>
  333. <echo message="Uploading of demo.war failed. ${tried}" />
  334. </catch>
  335. </antcontrib:trycatch>
  336. <antcall target="integration-test-liferay6" />
  337. <antcall target="integration-test-liferay6ee" />
  338. <antcall target="integration-test-liferay6-theme" />
  339. <antcall target="integration-test-liferay6ee-theme" />
  340. <antcall target="integration-test-exo3" />
  341. <antcall target="integration-test-weblogicPortal" />
  342. <antcall target="integration-test-liferay5" />
  343. <antcall target="integration-test-weblogic10" />
  344. <antcall target="integration-test-weblogic12" />
  345. <antcall target="integration-test-gatein3" />
  346. <antcall target="integration-test-glassfish3" />
  347. <antcall target="integration-test-glassfish4" />
  348. <antcall target="integration-test-jboss4" />
  349. <antcall target="integration-test-jboss5" />
  350. <antcall target="integration-test-jboss6" />
  351. <antcall target="integration-test-jboss7" />
  352. <antcall target="integration-test-jboss-eap6" />
  353. <antcall target="integration-test-wildfly8" />
  354. <antcall target="integration-test-jetty7" />
  355. <antcall target="integration-test-jetty8" />
  356. <antcall target="integration-test-jetty9" />
  357. <antcall target="integration-test-tomcat6" />
  358. <antcall target="integration-test-tomcat7" />
  359. <antcall target="integration-test-tomcat8" />
  360. <antcall target="integration-test-tomcat7apacheproxy" />
  361. <antcall target="integration-test-websphere8" />
  362. <antcall target="integration-test-websphereportal8" />
  363. </parallel>
  364. </target>
  365. <target name="do-run-generic-test">
  366. <property name="target-host" value="${target-server}.devnet.vaadin.com" />
  367. <property name="target-port" value="8080" />
  368. <antcontrib:if>
  369. <isset property="startDelay" />
  370. <then>
  371. <antcontrib:math result="sleepTime" datatype="int">
  372. <op op="rint">
  373. <op op="*">
  374. <num value="${startDelay}" />
  375. <op op="random" />
  376. </op>
  377. </op>
  378. </antcontrib:math>
  379. <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo>
  380. <sleep seconds="${sleepTime}" />
  381. </then>
  382. </antcontrib:if>
  383. <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
  384. <fileset dir="integration_base_files">
  385. <include name="*" />
  386. </fileset>
  387. </scp>
  388. <!-- trycatch probably not needed any more as it just fails with
  389. the original message and doesn't do anything in the finally block -->
  390. <antcontrib:trycatch property="error_message">
  391. <try>
  392. <!-- timeout in one hour (remote end should timeout in 55
  393. minutes) -->
  394. <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" />
  395. <antcall target="echo-prefix">
  396. <param name="prefix" value="${target-server}: " />
  397. <param name="message" value="${lock-output}" />
  398. </antcall>
  399. <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
  400. <!-- timeout in 15 minutes -->
  401. <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" />
  402. <antcall target="echo-prefix">
  403. <param name="prefix" value="${target-server}: " />
  404. <param name="message" value="${start-output}" />
  405. </antcall>
  406. <fail message="${start-output}">
  407. <condition>
  408. <not>
  409. <contains string="${start-output}" substring="Demo deployed successfully" />
  410. </not>
  411. </condition>
  412. </fail>
  413. <antcontrib:if>
  414. <isset property="testfiles" />
  415. <antcontrib:then>
  416. <echo>Starting legacy (TB2) test for ${target-server}</echo>
  417. <antcall target="legacy-integration-test">
  418. <param name="server-name" value="${target-server}" />
  419. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  420. </antcall>
  421. </antcontrib:then>
  422. <antcontrib:else>
  423. <echo>Starting TB3 test for ${target-server}</echo>
  424. <antcall target="run-tb3-servlet-test">
  425. <param name="server-name" value="${target-server}" />
  426. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  427. </antcall>
  428. </antcontrib:else>
  429. </antcontrib:if>
  430. <!-- Run theme tests in all browsers if there's a property
  431. with the test files -->
  432. <antcontrib:if>
  433. <isset property="testfiles-theme" />
  434. <antcontrib:then>
  435. <antcall target="integration-test-theme">
  436. <param name="server-name" value="${target-server}" />
  437. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  438. </antcall>
  439. </antcontrib:then>
  440. </antcontrib:if>
  441. <!-- timeout in five minutes -->
  442. <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" />
  443. <antcall target="echo-prefix">
  444. <param name="prefix" value="${target-server}: " />
  445. <param name="message" value="${stop-output}" />
  446. </antcall>
  447. </try>
  448. <catch>
  449. <fail message="${error_message}" />
  450. </catch>
  451. </antcontrib:trycatch>
  452. </target>
  453. <target name="echo-prefix">
  454. <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
  455. <echo message="${message-prefixed}" />
  456. </target>
  457. <target name="run-generic-integration-test">
  458. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  459. <antcontrib:trycatch property="tried">
  460. <try>
  461. <antcall target="do-run-generic-test" />
  462. </try>
  463. <catch>
  464. <antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
  465. <param name="returnTo" value="tried-escaped" />
  466. <param name="message" value="${tried}" />
  467. </antcontrib:antcallback>
  468. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
  469. </catch>
  470. </antcontrib:trycatch>
  471. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  472. </target>
  473. <target name="teamcity-escape">
  474. <property name="returnTo" value="return" />
  475. <!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
  476. - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
  477. <!-- Immutable properties -> needs to create a new one every time -->
  478. <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
  479. <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
  480. <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
  481. <property name="${returnTo}" value="${details-escaped3}" />
  482. </target>
  483. <target name="run-integration-test">
  484. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  485. <antcontrib:trycatch property="tried">
  486. <try>
  487. <antcall target="integration-test-${target-server}" />
  488. </try>
  489. <catch>
  490. <antcallback target="teamcity-escape" return="tried-escaped">
  491. <param name="returnTo" value="tried-escaped" />
  492. <param name="message" value="${tried}" />
  493. </antcallback>
  494. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
  495. </catch>
  496. </antcontrib:trycatch>
  497. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  498. </target>
  499. <target name="integration-test-get-lock">
  500. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
  501. </target>
  502. <target name="integration-test-release-lock">
  503. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
  504. </target>
  505. <!-- Remove demo.war -->
  506. <target name="integration-test-clean">
  507. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
  508. </target>
  509. </project>