forked from modcluster/mod_cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-test.xml
434 lines (363 loc) · 19.5 KB
/
build-test.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
<?xml version="1.0" encoding="UTF-8"?>
<!--======================================================================-->
<!-- -->
<!-- JBoss, the OpenSource J2EE webOS -->
<!-- -->
<!-- Distributable under LGPL license. -->
<!-- See terms of license at http://www.gnu.org. -->
<!-- -->
<!--======================================================================-->
<project default="main" name="JBoss/mod_cluster Tests" xmlns:server="http://jboss.org/ns/test/ant/server">
<!-- ======================================================== -->
<!-- Initialization -->
<!-- ======================================================== -->
<tstamp>
<format property="TIMENOW" pattern="yyyy-MM-dd.HH-mm" timezone="GMT"/>
</tstamp>
<echo message="${TIMENOW}" file="run.tstamp"/>
<!-- =================== -->
<!-- Basic Configuration -->
<!-- =================== -->
<property name="buildlog.level" value="info"/>
<property environment="env"/>
<!--
Set a hostname property based on COMPUTERNAME for win32, HOSTNAME
otherwise and initialize the node0/node1 cluster hostnames to
localhost and ${hostname} by default. If you cannot route multicast
traffic between localhost and hostname, then you need to specify node0
and node1 binding in the local.properties that can in order to be able
to run the clustering tests.
-->
<condition property="hostname" value="${env.COMPUTERNAME}">
<os family="windows"/>
</condition>
<condition property="hostname" value="${env.HOSTNAME}">
<not><os family="windows"/></not>
</condition>
<!--
We will use local.properties file to provide some configuration to the
testsuite mainly for the Clustering framework. Please do not checkin
your local.properties file into CVS
-->
<property file="local.properties" />
<!-- Cluster node defaults -->
<property name="node0" value="localhost" />
<property name="node0.http.url" value="http://${node0}:8080" />
<property name="node0.jndi.url" value="jnp://${node0}:1099" />
<property name="node0.jgroups.bind_addr" value="${node0}" />
<property name="node1" value="${hostname}" />
<property name="node1.http.url" value="http://${node1}:8080" />
<property name="node1.jndi.url" value="jnp://${node1}:1099" />
<property name="node1.jgroups.bind_addr" value="${node1}" />
<!--property name="node2" value="${env.MYTESTIP_3}" />
<property name="node2.http.url" value="http://${node2}:8080" />
<property name="node2.jndi.url" value="jnp://${node2}:1099" />
<property name="node2.jgroups.bind_addr" value="${node2}" />
<property name="node3" value="${env.MYTESTIP_4}" />
<property name="node3.http.url" value="http://${node3}:8080" />
<property name="node3.jndi.url" value="jnp://${node3}:1099" />
<property name="node3.jgroups.bind_addr" value="${node3}" /-->
<!-- UDP Group, must be done before server-config.xml -->
<!-- The value of the -u option passed to jboss -->
<!-- A blank value will prevent the -u option from being passed -->
<!--
Override this in the local.properties or pass to Ant as
-DupdGroup=128.x.x.x
-->
<property name="udpGroup" value="" />
<!-- Same thing, but passed to the client -->
<property name="jbosstest.udpGroup" value="${udpGroup}" />
<!-- Set "jboss.dist" to JBOSS_HOME -->
<property name="jboss.dist" value="${env.JBOSS_HOME}" />
<!-- Propagate the dist directory as a jbosstest system property -->
<property name="jbosstest.dist" value="${jboss.dist}" />
<!-- Externalized locations -->
<property name="location.resources.main" value="${basedir}/src/main/resources" />
<property name="location.resources.test" value="${basedir}/src/test/resources" />
<property name="location.target" value="${basedir}/target" />
<property name="location.artifact.tests" value="${location.target}/jboss-ejb3-testsuite-tests.jar" />
<property name="location.dependencies" value="${location.target}/dependencies" />
<property name="location.dependencies.unpacked" value="${location.dependencies}/unpacked" />
<property name="location.dependencies.unpacked.jboss-test:jboss.test" value="${location.dependencies.unpacked}/jboss-test" />
<property name="location.dependencies.lib" value="${location.dependencies}/lib" />
<property name="location.dependencies.lib.jboss-test:jboss-test" value="${location.dependencies.lib}/jboss-test.jar" />
<property name="location.dependencies.lib.org.jboss.jbossas:server-manager" value="${location.dependencies.lib}/jboss-server-manager.jar"/>
<property name="location.dependencies.lib.junit:junit" value="${location.dependencies.lib}/junit.jar" />
<property name="location.dependencies.lib.apache-httpclient:commons-httpclient" value="${location.dependencies.lib}/commons-httpclient.jar" />
<property name="location.dependencies.lib.org.jboss.naming:jnp-client" value="${location.dependencies.lib}/jnp-client.jar" />
<property name="location.dependencies.lib.org.jboss.logging:jboss-logging-spi" value="${location.dependencies.lib}/jboss-logging-spi.jar" />
<property name="location.apache.httpd" value="/usr/sbin"/>
<property name="location.apache.serverroot" value="${user.home}/httpd"/>
<property name="location.apache.config" value="conf/mod_cluster-httpd.conf"/>
<path id="server.taskdef.classpath">
<pathelement path="${location.dependencies.lib.jboss-test:jboss-test}"/>
<pathelement path="${location.dependencies.lib.org.jboss.jbossas:server-manager}"/>
<pathelement path="${location.dependencies.lib.org.jboss.logging:jboss-logging-spi}"/>
<pathelement path="${location.dependencies.lib.org.jboss.naming:jnp-client}"/>
</path>
<!-- Import the jboss server run targets -->
<import file="${location.dependencies.unpacked.jboss-test:jboss.test}/server-config.xml" />
<!-- Module name(s) & version -->
<property name="module.name" value="mod_cluster" />
<property name="module.Name" value="JBoss Testsuite" />
<property name="module.version" value="DEV" />
<property name="module.source" value="${basedir}/src" />
<property name="module.output" value="${basedir}/target" />
<!-- Where source files live -->
<property name="source.resources" value="${module.source}/test/resources"/>
<!-- Where build generated files will go -->
<property name="build.classes" value="${module.output}/test-classes"/>
<property name="build.lib" value="${module.output}/test-lib"/>
<property name="build.resources" value="${module.output}/resources"/>
<property name="build.reports" value="${module.output}/reports"/>
<property name="build.testlog" value="${module.output}/log"/>
<!-- Define common JVM Arguments for all mod_cluster JBossAS Runtimes -->
<property name="mod_cluster.jboss.jvmargs" value="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dresolve.dns=false" />
<property name="junit.timeout" value="300000"/>
<!--
Define Server Configurations for mod_cluster Integration Tests
-->
<server:config javaHome="${env.JAVA_HOME}" jbossHome="${jboss.dist}" udpGroup="${udpGroup}">
<server name="mod_cluster-0" host="${node0}">
<jvmarg value="${mod_cluster.jboss.jvmargs}" />
<sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
<sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
<sysproperty key="jboss.messaging.ServerPeerID" value="0" />
</server>
<server name="mod_cluster-1" host="${node1}">
<jvmarg value="${mod_cluster.jboss.jvmargs}" />
<sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
<sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
<sysproperty key="jboss.messaging.ServerPeerID" value="1" />
</server>
<server name="mod_cluster-2" host="${node2}">
<jvmarg value="${mod_cluster.jboss.jvmargs}" />
<sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
<sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
<sysproperty key="jboss.messaging.ServerPeerID" value="2" />
</server>
<server name="mod_cluster-3" host="${node3}">
<jvmarg value="${mod_cluster.jboss.jvmargs}" />
<sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
<sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
<sysproperty key="jboss.messaging.ServerPeerID" value="3" />
</server>
</server:config>
<!-- ===================== -->
<!-- Paths and Patternsets -->
<!-- ===================== -->
<!-- Define test Classpath -->
<path id="jboss.test.classpath">
<pathelement path="${jboss.test.path}"/>
<pathelement path="${location.dependencies.lib.junit:junit}"/>
<pathelement path="${location.dependencies.lib.jboss-test:jboss-test}"/>
<pathelement path="${location.dependencies.lib.org.jboss.naming:jnp-client}"/>
<pathelement path="${location.dependencies.lib.org.jboss.logging:jboss-logging-spi}"/>
</path>
<!-- Classpath used by the Test Client -->
<path id="client.classpath">
<!-- JBoss Client Binaries -->
</path>
<!--
Define the Path to Server Task Definitions, used by the JBoss Server
Run targets
-->
<patternset id="jboss.server.all.includes">
<include name="conf/**" />
<include name="deploy/**" />
<include name="deployers/**" />
<include name="deploy-hasingleton/**" />
<include name="lib/**" />
</patternset>
<!-- Define the test pattern sets Here -->
<patternset id="apache.integration.test.includes">
<include name="org/jboss/modcluster/test/*TestCase.class" />
</patternset>
<!-- Add exclude elements for any tests that should be excluded -->
<patternset id="badtest.excludes"/>
<!-- ============================================== -->
<!-- Macros -->
<!-- ============================================== -->
<macrodef name="httpd">
<attribute name="location" default="/usr/sbin"/>
<attribute name="action-type" default="start"/>
<attribute name="server-root"/>
<attribute name="config" default="conf/mod_cluster-httpd.conf"/>
<attribute name="failonerror" default="true"/>
<sequential>
<echo message="Will @{action-type} the apache instance at @{location} using -d @{server-root} -f @{config}"/>
<echo message="If you need apache to run on port 80, then"/>
<echo message="you need to start apache with admin/root rights."/>
<echo message="If so, start/stop apache independent of this testsuite"/>
<exec executable="@{location}/httpd" failonerror="@{failonerror}" failifexecutionfails="@{failonerror}">
<arg value="-k"/>
<arg value="@{action-type}"/>
<arg value="-d"/>
<arg value="@{server-root}"/>
<arg value="-f"/>
<arg value="@{config}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="create-httpd">
<attribute name="server-root" description="the httpd serverroot to which newconf-src should be copied"/>
<attribute name="newconf-src" description="The name of the tests-config to copy"/>
<sequential>
<echo message="Updating httpd config at @{server-root}" />
<copy todir="@{server-root}" overwrite="true" failonerror="false">
<fileset dir="${build.resources}/test-configs/@{newconf-src}" />
</copy>
</sequential>
</macrodef>
<!-- ============================================== -->
<!-- Targets -->
<!-- ============================================== -->
<!-- Import the test jars build targets -->
<import file="test-jars.xml"/>
<!-- "main" is the default target; depends on "jars" which is imported from test-jars.xml -->
<target name="main"
description="Executes the default target (jars)."
depends="init, compile-resources, jars"/>
<target name="init">
<record name="${basedir}/build.log" append="yes" action="start" loglevel="error"/>
</target>
<!-- Compile resource files -->
<target name="compile-resources">
<mkdir dir="${build.resources}"/>
<copy todir="${build.resources}" filtering="no">
<fileset dir="${source.resources}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${build.lib}"/>
</target>
<target name="tests-apache-integration"
description="Execute integration tests requiring an apache load balanced two JBoss nodes.">
<!--
Determine whether we are configured to ignore failures and
pass the appropriate property to tests-clustering-junit.
One property we check below and fail the build; the other is ignored.
-->
<condition property="apache.integration.junit.failure.property"
value="apache.integration.junit.failure"
else="apache.integration.junit.failure.ignored">
<and>
<isset property="ignore.integration.test.failures"/>
<equals arg1="${ignore.integration.test.failures}" arg2="true" casesensitive="false" trim="true"/>
</and>
</condition>
<echo message="Setting up httpd config in ${location.apache.serverroot}"/>
<create-httpd server-root="${location.apache.serverroot}" newconf-src="mod_cluster-httpd"/>
<create-config baseconf="all" newconf="mod_cluster-0" newconf-src="mod_cluster-jbossas">
<patternset id="jboss.server.all.includes">
<include name="conf/**" />
<include name="deploy/**" />
<include name="deployers/**" />
<include name="deploy-hasingleton/**" />
<include name="lib/**" />
</patternset>
</create-config>
<copy todir="${jboss.dist}/server/mod_cluster-0/deploy">
<fileset dir="${location.target}/mod_cluster.sar"></fileset>
</copy>
<create-config baseconf="all" newconf="mod_cluster-1" newconf-src="mod_cluster-jbossas">
<patternset id="jboss.server.all.includes">
<include name="conf/**" />
<include name="deploy/**" />
<include name="deployers/**" />
<include name="deploy-hasingleton/**" />
<include name="lib/**" />
</patternset>
</create-config>
<copy todir="${jboss.dist}/server/mod_cluster-1/deploy">
<fileset dir="${location.target}/mod_cluster.sar"></fileset>
</copy>
<!--httpd location="${location.apache.httpd}" server-root="${location.apache.serverroot}"
config="${location.apache.config}" action-type="start" /-->
<server:start name="mod_cluster-0" />
<!--server:start name="mod_cluster-1" /-->
<echo message="Nodes have started, waiting for cluster to stablize..." />
<echo message="Going to call target tests-clustering-unit" />
<antcall target="tests-clustering-unit">
<param name="cluster.includes.refid" value="apache.integration.test.includes" />
<param name="jboss-junit-configuration" value="ModCluster" />
<param name="tests-clustering-unit.failure.property" value="${apache.integration.junit.failure.property}"/>
</antcall>
<server:stop name="mod_cluster-0" />
<!--server:stop name="mod_cluster-1" /-->
<!--httpd location="${location.apache.httpd}" server-root="${location.apache.serverroot}"
config="${location.apache.config}" action-type="stop" /-->
<!-- See if junit set the failure property that triggers build failure -->
<fail message="JUnit tests failed; see test reports for details" if="apache.integration.junit.failure"/>
</target>
<!-- Executes a set of tests in a clustered environment -->
<target name="tests-clustering-unit">
<mkdir dir="${build.reports}" />
<mkdir dir="${build.testlog}" />
<junit dir="${module.output}" printsummary="on"
haltonerror="false" haltonfailure="false"
fork="true" timeout="${junit.timeout}"
failureProperty="${tests-clustering-unit.failure.property}">
<sysproperty key="java.net.preferIPv4Stack" value="true" />
<sysproperty key="jboss.internal-server.serverroot" value="${jboss.dist}/server" />
<sysproperty key="jbosstest.deploy.dir" file="${build.lib}" />
<sysproperty key="jbosstest.cluster.node0" value="${node0}" />
<sysproperty key="jbosstest.cluster.node0.http.url" value="${node0.http.url}" />
<sysproperty key="jbosstest.cluster.node0.jndi.url" value="${node0.jndi.url}" />
<sysproperty key="jbosstest.cluster.node0.serverroot" value="${jboss.dist}/server/${jbosstest.cluster.node0.config}" />
<sysproperty key="jbosstest.cluster.node1" value="${node1}" />
<sysproperty key="jbosstest.cluster.node1.http.url" value="${node1.http.url}" />
<sysproperty key="jbosstest.cluster.node1.jndi.url" value="${node1.jndi.url}" />
<sysproperty key="jbosstest.cluster.node1.serverroot" value="${jboss.dist}/server/${jbosstest.cluster.node1.config}" />
<sysproperty key="build.testlog" value="${build.testlog}" />
<sysproperty key="log4j.configuration" value="file:${build.resources}/log4j.xml" />
<!-- Pass along any jbosstest.* system properties -->
<syspropertyset>
<propertyref prefix="jbosstest." />
</syspropertyset>
<!-- Lets pass some parameters from local.properties file as system properties -->
<syspropertyset>
<propertyref prefix="org.apache." />
</syspropertyset>
<syspropertyset>
<propertyref prefix="apache" />
</syspropertyset>
<syspropertyset>
<propertyref prefix="node" />
</syspropertyset>
<!--jvmarg value="${junit.jvm.options}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8789,server=y,suspend=y"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/-->
<classpath>
<pathelement location="${build.classes}" />
<pathelement location="${build.resources}" />
<path refid="jboss.test.classpath"/>
</classpath>
<!-- definition of the property for keeping results between configuration -->
<sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}" />
<formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
usefile="${junit.formatter.usefile}" extension="-${jboss-junit-configuration}.xml" />
<batchtest todir="${build.reports}" haltonerror="false"
haltonfailure="false" fork="true">
<fileset dir="${build.classes}">
<patternset refid="${cluster.includes.refid}" />
<patternset refid="badtest.excludes" />
</fileset>
</batchtest>
</junit>
</target>
<!-- Launches a test assuming the AS instances are already running -->
<target name="one-cluster-test-nostart" if="test">
<property name="jboss-junit-configuration" value="ModCluster" />
<echo message="Going to call target tests-clustering-unit for ${test}" />
<antcall target="tests-clustering-unit">
<param name="cluster.includes.refid" value="one.test.includes" />
<param name="jboss-junit-configuration" value="${jboss-junit-configuration}" />
<param name="jbosstest.cluster.web.cache.config" value="standard-session-cache" />
<param name="jbosstest.cluster.node0.config" value="mod_cluster-0" />
<param name="jbosstest.cluster.node1.config" value="mod_cluster-1" />
</antcall>
</target>
</project>