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