-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.xml
709 lines (672 loc) · 34.5 KB
/
build.xml
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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<project name="callimachus" default="help" basedir=".">
<!-- set global properties for this build -->
<property name="artifact.name" value="callimachus" />
<property name="vendor" value="3 Round Stones Inc." />
<property name="src" location="src" />
<property name="build" location="build" />
<property name="build.tests" location="build/test" />
<property name="dist" location="dist" />
<property name="lib" location="lib" />
<property name="bin" location="bin" />
<property name="etc" location="etc" />
<property name="log" location="log" />
<property name="tmp" location="tmp" />
<property name="downloads" location="downloads" />
<property name="reports.tests" location="tmp" />
<property name="src.tests" location="test" />
<property name="lib.tests" location="test/lib" />
<property name="webapp" location="webapp" />
<property name="home" location="." />
<property name="pid" location="run/callimachus.pid" />
<property name="logging" location="etc/logging.properties" />
<property name="mail" location="etc/mail.properties" />
<property name="tools.jar" location="${java.home}/../lib/tools.jar" />
<property name="triples.file" location="repositories/callimachus/triples-spoc.dat" />
<property file="src/META-INF/callimachusproject.properties" />
<property file="dependencies.properties" />
<property name="main" value="org.openrdf.http.object.Server" />
<property name="setup" value="org.callimachusproject.Setup" />
<property name="server" value="org.openrdf.http.object.Server" />
<property name="main-control" value="org.openrdf.http.object.ServerControl" />
<property name="jvmargs" value="-ea -server -mx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:+CMSClassUnloadingEnabled -Dfile.encoding=UTF-8 -Duser.home=${home} -Djava.mail.properties=${mail} -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Djava.io.tmpdir=${tmp}" />
<property name="curl" value="curl" />
<property name="curl.args" value="-fSs --digest http://localhost:8080/callimachus/1.5/?archive" />
<property name="setup.args" value="-c etc/callimachus.conf -g /auth/groups/super" />
<property name="args" value="--pid ${pid} -d ./ -p 8080" />
<property name="functionaltest.port" value="8081" />
<property name="functionaltest.jmxport" value="1091" />
<target name="help">
<exec executable="ant">
<arg value="-p"/>
</exec>
</target>
<target name="package" depends="clean,dist" description="Create a package ready for release">
<echo>Artifact ready: ${dist}/${artifact.name}-${Version}.zip</echo>
</target>
<target name="clean" description="clean up temporary files">
<!-- Delete the directory trees -->
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${lib}" />
<delete dir="${bin}" />
<delete dir="${reports.tests}" />
<delete dir="${build.tests}" />
<delete dir="${lib.tests}" />
<delete dir="${tmp}" />
</target>
<target name="dist-clean" depends="clean">
<delete dir="${downloads}" />
</target>
<target name="init">
<!-- Create the time stamp and build directory -->
<tstamp />
<mkdir dir="${build}" />
<available file="${lib}" property="lib.present" />
<available file="${lib.tests}" property="lib.tests.present" />
<property file="build.properties" />
<condition property="os.mac">
<os family="mac"/>
</condition>
<condition property="os.windows">
<os family="windows"/>
</condition>
<condition property="os.linux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<property environment="env" />
<condition property="curl.available">
<or>
<available file="${curl}" filepath="${env.PATH}"/>
<available file="${curl}.exe" filepath="${env.Path}"/>
<available file="${curl}.exe" filepath="${env.PATH}"/>
</or>
</condition>
<script language="javascript">
var property = project.createTask("property");
property.name = "hostname";
try {
property.value = java.net.InetAddress.getLocalHost().getHostName().toLowerCase();
} catch (e) {
property.value = "localhost";
}
property.perform();
</script>
</target>
<target name="dependencies" depends="dist-dependencies,test-dependencies" description="Download all dependencies" />
<target name="dist-dependencies" depends="init">
<basename file="${sesame.url}" property="openrdf-sesame.jar" />
<basename file="${alibaba.url}" property="openrdf-alibaba.zip" />
<basename file="${jchardet.url}" property="jchardet.zip" />
<basename file="${daemon.url}" property="daemon.zip" />
<basename file="${daemon-linux-i686.url}" property="daemon-linux-i686.tar.gz" />
<basename file="${calabash.url}" property="calabash.zip" />
<basename file="${closure.url}" property="closure.zip" />
<basename file="${download-lunix-x86_64.url}" property="daemon-linux-x86_64.tar.gz" />
<basename file="${mail.url}" property="mail.jar" />
<basename file="${compress.url}" property="compress.tar.gz" />
<basename file="${httpclient.url}" property="httpclient.zip" />
<basename file="${tagsoup.url}" property="tagsoup.jar" />
<basename file="${htmlparser.url}" property="htmlparser.zip" />
<basename file="${pool.url}" property="pool.zip" />
<basename file="${dbcp.url}" property="dbcp.zip" />
<basename file="${sacjava.url}" property="sacjava.zip" />
<basename file="${cssparser.url}" property="cssparser.jar" />
<basename file="${jsonld-java-sesame.url}" property="jsonld-java-sesame.jar" />
<basename file="${jsonld-java.url}" property="jsonld-java.jar" />
<basename file="${jackson-core.url}" property="jackson-core.jar" />
<basename file="${jackson-databind.url}" property="jackson-databind.jar" />
<basename file="${jackson-annotations.url}" property="jackson-annotations.jar" />
<basename file="${rdf.core.url}" property="rdf.core.jar" />
<basename file="${markdownj.url}" property="markdownj.jar" />
<mkdir dir="${downloads}" />
<get usetimestamp="true" skipexisting="${lib.present}" dest="${downloads}">
<url url="${sesame.url}" />
<url url="${alibaba.url}" />
<url url="${jchardet.url}" />
<url url="${daemon.url}" />
<url url="${daemon-linux-i686.url}" />
<url url="${calabash.url}" />
<url url="${closure.url}" />
<url url="${download-lunix-x86_64.url}" />
<url url="${mail.url}" />
<url url="${compress.url}" />
<url url="${tagsoup.url}" />
<url url="${htmlparser.url}" />
<url url="${httpclient.url}" />
<url url="${pool.url}" />
<url url="${dbcp.url}" />
<url url="${sacjava.url}" />
<url url="${cssparser.url}" />
<url url="${jsonld-java-sesame.url}" />
<url url="${jsonld-java.url}" />
<url url="${jackson-core.url}" />
<url url="${jackson-databind.url}" />
<url url="${jackson-annotations.url}" />
<url url="${rdf.core.url}" />
<url url="${markdownj.url}" />
</get>
<mkdir dir="${lib}" />
<mkdir dir="${bin}" />
<copy file="${downloads}/${openrdf-sesame.jar}" tofile="${lib}/${openrdf-sesame.jar}" />
<copy file="${downloads}/${mail.jar}" tofile="${lib}/${mail.jar}" />
<copy file="${downloads}/${tagsoup.jar}" tofile="${lib}/${tagsoup.jar}" />
<copy file="${downloads}/${cssparser.jar}" tofile="${lib}/${cssparser.jar}" />
<copy file="${downloads}/${jsonld-java-sesame.jar}" tofile="${lib}/${jsonld-java-sesame.jar}" />
<copy file="${downloads}/${jsonld-java.jar}" tofile="${lib}/${jsonld-java.jar}" />
<copy file="${downloads}/${jackson-core.jar}" tofile="${lib}/${jackson-core.jar}" />
<copy file="${downloads}/${jackson-databind.jar}" tofile="${lib}/${jackson-databind.jar}" />
<copy file="${downloads}/${jackson-annotations.jar}" tofile="${lib}/${jackson-annotations.jar}" />
<copy file="${downloads}/${rdf.core.jar}" tofile="${lib}/${rdf.core.jar}" />
<copy file="${downloads}/${markdownj.jar}" tofile="${lib}/${markdownj.jar}" />
<unzip overwrite="false" src="${downloads}/${sacjava.zip}" dest="${lib}">
<patternset>
<include name="**/*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${htmlparser.zip}" dest="${lib}">
<patternset>
<include name="*/htmlparser*.jar" />
<exclude name="*/htmlparser*-with-transitions.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${openrdf-alibaba.zip}" dest="${lib}">
<patternset>
<include name="lib/*.jar" />
<include name="dist/*.jar" />
<exclude name="lib/jackson-core-*.jar" />
<exclude name="lib/commons-codec-*.jar" />
<exclude name="lib/openrdf-sesame*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${httpclient.zip}" dest="${lib}">
<patternset>
<include name="**/lib/*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${jchardet.zip}" dest="${lib}">
<patternset>
<include name="*/dist/lib/*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${closure.zip}" dest="${lib}">
<patternset>
<include name="*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${daemon.zip}" dest="${lib}">
<patternset>
<include name="commons-daemon-*/commons-daemon-*.jar" />
<exclude name="commons-daemon-*/commons-daemon-*-sources.jar" />
<exclude name="commons-daemon-*/commons-daemon-*-javadoc.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<untar compression="gzip" overwrite="false" src="${downloads}/${daemon-linux-i686.tar.gz}" dest="${bin}">
<patternset>
<include name="jsvc" />
</patternset>
<mapper type="glob" from="jsvc" to="callimachus-linux-i686" />
</untar>
<untar compression="gzip" overwrite="false" src="${downloads}/${daemon-linux-x86_64.tar.gz}" dest="${bin}">
<patternset>
<include name="jsvc" />
</patternset>
<mapper type="glob" from="jsvc" to="callimachus-linux-x86_64" />
</untar>
<untar compression="gzip" overwrite="false" src="${downloads}/${compress.tar.gz}" dest="${lib}">
<patternset>
<include name="commons-compress-*/commons-compress-*.jar" />
<exclude name="commons-compress-*/commons-compress-*-sources.jar" />
<exclude name="commons-compress-*/commons-compress-*-javadoc.jar" />
</patternset>
<mapper type="flatten" />
</untar>
<unzip overwrite="false" src="${downloads}/${calabash.zip}" dest="${lib}">
<patternset>
<include name="*/lib/*.jar" />
<include name="*/*calabash*.jar" />
<exclude name="*/lib/commons-io*.jar" />
<exclude name="*/lib/commons-codec*.jar" />
<exclude name="*/lib/commons-logging*.jar" />
<exclude name="*/lib/http*.jar" />
<exclude name="*/lib/ant*.jar" />
<exclude name="*/lib/junit*.jar" />
<exclude name="*/lib/log4j-slf4j-impl*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${pool.zip}" dest="${lib}">
<patternset>
<include name="*/*.jar" />
<exclude name="*/*-sources.jar" />
<exclude name="*/*-javadoc.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${dbcp.zip}" dest="${lib}">
<patternset>
<include name="*/*.jar" />
<exclude name="*/*-sources.jar" />
<exclude name="*/*-javadoc.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
</target>
<target name="dist" depends="compile,car" description="generate the distribution" unless="jar.classpath">
<!-- Create the distribution directory and create the jar -->
<mkdir dir="${dist}" />
<property name="jar.file" value="${dist}/${artifact.name}-${Version}.jar" />
<tstamp>
<format property="build.number" pattern="ddHHmm" timezone="UTC" />
</tstamp>
<manifestclasspath property="jar.classpath" jarfile="${jar.file}">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</manifestclasspath>
<jar jarfile="${jar.file}">
<fileset dir="${build}" />
<manifest>
<attribute name="Main-Class" value="${main}" />
<attribute name="Class-Path" value="${jar.classpath}" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Implementation-Title" value="${artifact.name}" />
<attribute name="Implementation-Version" value="${Version}+${build.number}" />
<attribute name="Implementation-Vendor" value="${vendor}" />
</manifest>
</jar>
<zip destfile="${dist}/${artifact.name}-${Version}.zip">
<mappedresources>
<fileset file="${src}/META-INF/mime.types" />
<globmapper from="mime.types" to=".mime.types" />
</mappedresources>
<zipfileset dir="." includes="*.txt" />
<zipfileset dir="${src}" prefix="src" />
<zipfileset dir="${webapp}" prefix="src/webapp" />
<zipfileset dir="${bin}" prefix="bin" includes="*.sh,*.pl,callimachus-linux*" filemode="755" />
<zipfileset dir="${bin}" prefix="bin" excludes="*.sh,*.pl,callimachus-linux*" />
<zipfileset dir="${etc}" prefix="etc" excludes="mail.properties ssl.properties jmxremote.password callimachus.conf truststore" />
<zipfileset dir="${lib}" prefix="lib" />
<zipfileset file="${jar.file}" prefix="lib" />
<zipfileset file="${dist}/${artifact.name}-webapp-${Version}.car" prefix="lib" />
</zip>
<uptodate srcfile="${dist}/${artifact.name}-webapp-${Version}.car" targetfile="${triples.file}" property="repositories.uptodate" />
</target>
<target name="compile" depends="init,dist-dependencies" description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" source="1.7" target="1.7" debug="true" debuglevel="lines,source">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${build}">
<fileset dir="${src}" excludes="**/*.java *.*"/>
</copy>
<copy todir="${etc}">
<fileset dir="${src}" includes="*.conf *.properties *.ttl"/>
</copy>
<copy todir="${bin}">
<fileset dir="${src}" includes="*.sh *.bat *.pl"/>
</copy>
<fixcrlf srcdir="${bin}" includes="*.bat" eol="crlf" />
<chmod dir="${bin}" includes="*.sh,*.pl,*-linux*" perm="ugo+rx"/>
</target>
<target name="car">
<!-- Create the distribution directory and create the car -->
<mkdir dir="${dist}" />
<zip destfile="${dist}/${artifact.name}-webapp-${Version}.car">
<zipfileset dir="${webapp}" prefix="" includes="**/*.ttl" />
<zipfileset dir="${webapp}" prefix="" excludes="**/*.ttl" />
</zip>
<uptodate srcfile="${dist}/${artifact.name}-webapp-${Version}.car" targetfile="${triples.file}" property="repositories.uptodate" />
</target>
<target name="test" depends="unittest,integrationtest" description="run all the tests" />
<target name="test-dependencies" depends="init">
<basename file="${junit.url}" property="junit.jar" />
<basename file="${jersey-client.url}" property="jersey-client.jar" />
<basename file="${jersey-core.url}" property="jersey-core.jar" />
<basename file="${jsr311-api.url}" property="jsr311-api.jar" />
<basename file="${selenium.url}" property="selenium.zip" />
<basename file="${ant-contrib.url}" property="ant-contrib.zip" />
<basename file="${derby.url}" property="derby.zip" />
<mkdir dir="${downloads}" />
<get usetimestamp="true" skipexisting="${lib.tests.present}" dest="${downloads}">
<url url="${junit.url}" />
<url url="${jersey-client.url}" />
<url url="${jersey-core.url}" />
<url url="${jsr311-api.url}" />
<url url="${selenium.url}" />
<url url="${ant-contrib.url}" />
<url url="${derby.url}" />
</get>
<mkdir dir="${lib.tests}" />
<copy file="${downloads}/${junit.jar}" tofile="${lib.tests}/${junit.jar}" />
<copy file="${downloads}/${jersey-client.jar}" tofile="${lib.tests}/${jersey-client.jar}" />
<copy file="${downloads}/${jersey-core.jar}" tofile="${lib.tests}/${jersey-core.jar}" />
<copy file="${downloads}/${jsr311-api.jar}" tofile="${lib.tests}/${jsr311-api.jar}" />
<unzip overwrite="false" src="${downloads}/${selenium.zip}" dest="${lib.tests}">
<patternset>
<include name="**/*.jar" />
<exclude name="**/commons-codec*.jar" />
<exclude name="**/commons-io*.jar" />
<exclude name="**/commons-logging*.jar" />
<exclude name="**/httpclient*.jar" />
<exclude name="**/httpcore*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${ant-contrib.zip}" dest="${lib.tests}">
<patternset>
<include name="**/*.jar" />
<exclude name="**/commons-httpclient*.jar" />
<exclude name="**/commons-logging*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<unzip overwrite="false" src="${downloads}/${derby.zip}" dest="${tmp}">
<patternset>
<include name="**/*.jar" />
</patternset>
<mapper type="flatten" />
</unzip>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<fileset dir="${lib.tests}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</taskdef>
</target>
<target name="test-compile" depends="compile,test-dependencies">
<mkdir dir="${build.tests}" />
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src.tests}" destdir="${build.tests}" debug="true" debuglevel="lines,source">
<classpath>
<pathelement location="${build}/" />
<fileset dir="${lib.tests}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${build.tests}">
<fileset dir="${src.tests}" excludes="**/*.java"/>
</copy>
</target>
<target name="unittest" depends="dist,test-compile" description="run the unit tests">
<mkdir dir="${reports.tests}" />
<junit printsummary="on" haltonfailure="on" tempdir="${tmp}" fork="yes" forkmode="perBatch">
<jvmarg line="${jvmargs}" />
<classpath>
<fileset dir="${dist}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.tests}/" />
<fileset dir="${lib.tests}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="brief"/>
<batchtest todir="${reports.tests}">
<fileset dir="${src.tests}">
<include name="**/*Test*.java"/>
<exclude name="**/*Integration*.java"/>
<exclude name="**/*FunctionalTest*.java"/>
<exclude name="**/*TestCase.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="integrationtest" depends="dist,test-compile" description="run the integration tests">
<mkdir dir="${reports.tests}" />
<junit printsummary="on" haltonfailure="on" tempdir="${tmp}" fork="yes" forkmode="perBatch">
<jvmarg line="${jvmargs} -Dorg.callimachusproject.config.webapp=${dist}/${artifact.name}-webapp-${Version}.car" />
<classpath>
<fileset dir="${dist}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.tests}/" />
<fileset dir="${lib.tests}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="brief"/>
<batchtest todir="${reports.tests}">
<fileset dir="${src.tests}">
<include name="**/*IntegrationTest*.java"/>
<exclude name="**/*FunctionalTest*.java"/>
<exclude name="**/*TestCase.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="functionaltest" depends="functionaltest-setup,functionaltest-run,functionaltest-all,functionaltest-teardown" description="run the functional tests" />
<target name="functionaltest-setup" depends="dist,test-compile" unless="callimachus.url">
<delete dir="${tmp}/functionaltest" />
<mkdir dir="${tmp}/functionaltest" />
<unzip src="${dist}/${artifact.name}-${Version}.zip" dest="${tmp}/functionaltest" />
<copy file="${tmp}/functionaltest/etc/callimachus-defaults.conf" tofile="${tmp}/functionaltest/etc/callimachus.conf" />
<replace file="${tmp}/functionaltest/etc/callimachus.conf" token="#PORT=8080" value="PORT=${functionaltest.port}" />
<replace file="${tmp}/functionaltest/etc/callimachus.conf" token="#ORIGIN=http://localhost:8080" value="ORIGIN=http://${hostname}:${functionaltest.port}" />
<replace file="${tmp}/functionaltest/etc/jmxremote.properties" token="com.sun.management.jmxremote.port=1090" value="com.sun.management.jmxremote.port=${functionaltest.jmxport}" />
<!-- setup script -->
<exec executable="/bin/sh" dir="${tmp}/functionaltest" logError="true" failonerror="true" osfamily="unix">
<arg line="bin/callimachus-setup.sh -L -u ${callimachus.username}:${callimachus.password} -e ${callimachus.email}" />
</exec>
<exec executable="cmd" dir="${tmp}/functionaltest" logError="true" failonerror="true" osfamily="windows">
<arg line="/c bin\callimachus-setup.bat -L -u ${callimachus.username}:${callimachus.password} -e ${callimachus.email}" />
</exec>
<!-- start script -->
<exec executable="/bin/sh" dir="${tmp}/functionaltest" logError="true" failonerror="true" osfamily="unix">
<arg line="bin/callimachus-start.sh" />
</exec>
<exec executable="cmd" dir="${tmp}/functionaltest" logError="true" failonerror="true" osfamily="windows">
<arg line="/c bin\callimachus-start.bat" />
</exec>
<get src="http://${hostname}:${functionaltest.port}/callimachus/scripts.js" dest="${tmp}/scripts.js" />
<delete file="${tmp}/scripts.js" />
<get src="http://${hostname}:${functionaltest.port}/callimachus/1.5/styles/callimachus.less?less" dest="${tmp}/styles.css" />
<delete file="${tmp}/styles.css" />
</target>
<target name="functionaltest-teardown" unless="callimachus.url">
<!-- stop script -->
<exec executable="/bin/sh" dir="${tmp}/functionaltest" logError="true" failonerror="true" osfamily="unix">
<arg line="bin/callimachus-stop.sh" />
</exec>
<exec executable="cmd" dir="${tmp}/functionaltest" logError="true" failonerror="true" osfamily="windows">
<arg line="/c bin\callimachus-stop.bat" />
</exec>
</target>
<target name="functionaltest-all" unless="callimachus.webdriver">
<condition property="test.arg" value="-Dorg.callimachusproject.test.service=${callimachus.url}" else="-Dorg.callimachusproject.test.service=http://${hostname}:${functionaltest.port}/">
<isset property="callimachus.url" />
</condition>
<condition property="build.arg" value="-Dorg.callimachusproject.test.build=${callimachus.build}" else="">
<isset property="callimachus.build" />
</condition>
<junit printsummary="on" showoutput="yes" haltonfailure="off" tempdir="${tmp}" fork="yes" forkmode="perBatch">
<jvmarg line="${jvmargs} -Dorg.callimachusproject.config.webapp=${dist}/${artifact.name}-webapp-${Version}.car -Dorg.callimachusproject.test.username=${callimachus.username} -Dorg.callimachusproject.test.email=${callimachus.email} -Dorg.callimachusproject.test.password=${callimachus.password} ${test.arg} ${build.arg}" />
<classpath>
<fileset dir="${dist}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.tests}/" />
<fileset dir="${lib.tests}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="brief"/>
<batchtest todir="${reports.tests}">
<fileset dir="${src.tests}">
<include name="**/*FunctionalTest*.java"/>
<exclude name="**/*TestCase.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="functionaltest-run" depends="dist,test-compile" if="callimachus.webdriver">
<mkdir dir="${reports.tests}" />
<condition property="test.arg" value="-Dorg.callimachusproject.test.service=${callimachus.url}" else="-Dorg.callimachusproject.test.service=http://${hostname}:${functionaltest.port}/">
<isset property="callimachus.url" />
</condition>
<condition property="build.arg" value="-Dorg.callimachusproject.test.build=${callimachus.build}" else="">
<isset property="callimachus.build" />
</condition>
<foreach target="functionaltest-single" maxthreads="3" inheritall="true" inheritrefs="true" parallel="true" param="test.file">
<path>
<fileset dir="${src.tests}">
<include name="**/*FunctionalTest*.java"/>
<exclude name="**/*TestCase.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</path>
</foreach>
</target>
<target name="functionaltest-single">
<!-- we need to have relative path -->
<pathconvert property="test.file.relative">
<fileset file="${test.file}" />
<map from="${src.tests}/" to="" />
</pathconvert>
<junit printsummary="on" showoutput="yes" haltonfailure="off" tempdir="${tmp}" fork="yes" forkmode="perBatch">
<jvmarg line="${jvmargs} -Dorg.callimachusproject.config.webapp=${dist}/${artifact.name}-webapp-${Version}.car -Dorg.callimachusproject.test.username=${callimachus.username} -Dorg.callimachusproject.test.email=${callimachus.email} -Dorg.callimachusproject.test.password=${callimachus.password} -Dorg.callimachusproject.test.remotewebdriver=${callimachus.webdriver} ${test.arg} ${build.arg}" />
<classpath>
<fileset dir="${dist}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.tests}/" />
<fileset dir="${lib.tests}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="brief"/>
<batchtest todir="${reports.tests}">
<fileset dir="${src.tests}">
<filename name="${test.file.relative}" />
</fileset>
</batchtest>
</junit>
</target>
<target name="setup" depends="dist" unless="repositories.uptodate">
<fail message="build.properties is not setup properly, please read README.txt" unless="callimachus.username" />
<fail message="build.properties is missing email, please read README.txt" unless="callimachus.email" />
<fail message="build.properties is missing password, please read README.txt" unless="callimachus.password" />
<java classname="${setup}" fork="true" failonerror="true">
<jvmarg line="${jvmargs} -Dorg.callimachusproject.config.webapp=${dist}/${artifact.name}-webapp-${Version}.car" />
<arg line="${setup.args} -u ${callimachus.username}:${callimachus.password} -e ${callimachus.email}" />
<classpath>
<pathelement location="${jar.file}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="start" depends="dist,setup" description="Start the server in the background">
<mkdir dir="${log}" />
<java classname="${server}" fork="true" spawn="true">
<jvmarg line="${jvmargs} -Djava.util.logging.config.file=${logging} -Dorg.callimachusproject.config.webapp=${dist}/${artifact.name}-webapp-${Version}.car" />
<arg line="${args} -q" />
<classpath>
<pathelement location="${jar.file}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="pull" depends="init" description="Pull down the callimachus folder from the running server using the curl program" if="curl.available">
<fail message="build.properties is not setup properly, please read README.txt" unless="callimachus.username" />
<fail message="build.properties is missing password, please read README.txt" unless="callimachus.password" />
<mkdir dir="${downloads}" />
<exec executable="${curl}" output="${downloads}/${artifact.name}-webapp.car" logError="true" failonerror="true">
<arg line="--user ${callimachus.username}:${callimachus.password} ${curl.args}" />
</exec>
<unzip src="${downloads}/${artifact.name}-webapp.car" dest="${webapp}" />
<delete file="${downloads}/${artifact.name}-webapp.car" />
<antcall target="car" />
<touch file="${triples.file}" />
</target>
<target name="stop" depends="dist,pull" description="Stop the server">
<java classname="${main-control}" fork="true" resultproperty="ret">
<jvmarg line="${jvmargs}" />
<arg line="--stop --pid ${pid}" />
<classpath>
<pathelement location="${jar.file}" />
<pathelement location="${tools.jar}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
<condition property="stopped">
<equals arg1="${ret}" arg2="0"/>
</condition>
<antcall target="kill" />
</target>
<target name="kill" unless="stopped">
<echo>The stop target may not be supported on your platform. You must </echo>
<echo>kill the process manually listed in ${pid}. </echo>
<echo>Use the run target next time to avoid this message.</echo>
</target>
<target name="run" depends="dist,setup" description="Run the server in the foreground">
<java classname="${server}" fork="true" failonerror="true">
<jvmarg line="${jvmargs} -Dorg.callimachusproject.config.webapp=${dist}/${artifact.name}-webapp-${Version}.car" />
<arg line="${args}" />
<classpath>
<pathelement location="${jar.file}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="reset" description="Reset the running server's internal cache">
<java classname="${main-control}" fork="true" resultproperty="ret">
<jvmarg line="${jvmargs}" />
<arg line="--pid ${pid} --reset" />
<classpath>
<pathelement location="${dist}/${artifact.name}-${Version}.jar" />
<pathelement location="${tools.jar}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
</project>