forked from eclipse-ee4j/cditck-porting
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcommon.xml
483 lines (429 loc) · 19.8 KB
/
common.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
<?xml version="1.0"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<project name="Commonxml" basedir=".">
<property name="server.start.delay.mins" value="1"/>
<property name="server" value="server"/>
<property name="resources.dottedname.prefix" value="domain.resources"/>
<property name="server.policy" value="server.policy" />
<property name="server.policy.orig" value="${server.policy}_orig"/>
<property name="client.policy" value="client.policy" />
<property name="client.policy.orig" value="${client.policy}_orig"/>
<property name="sun-acc.xml.template" value="sun-acc.xml.template" />
<property name="sun-acc.xml.template.orig" value="sun-acc.xml.template.orig" />
<property name="timer.poolName" value="cts-derby-XA-pool"/>
<property name="keystore.password" value="changeit"/>
<property name="server.cert.alias" value="s1as"/>
<property name="client.cert.alias" value="cts"/>
<property name="NSSConfigDir" value="${s1as.domain.dir}/${s1as.domain.name}/config" />
<property name="appclient.log.level" value="INFO"/>
<property name="appclient.log.dir" value="${ts.home}/tmp/appclient"/>
<property name="s1as.admin" value="${glassfish.home}/bin/asadmin"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"
classpath="./lib/ant-contrib.jar"/>
<!--
checkPlatform determines which OS is being utilized.
Also determine if this is the Java EE RI or S1AS
-->
<target name="checkPlatform" >
<condition property ="isUnixPlatform">
<os family="unix"/>
</condition>
<condition property ="isWindowsPlatform">
<os family="windows"/>
</condition>
<condition property ="os" value="unix">
<os family="unix"/>
</condition>
<condition property ="os" value="windows">
<os family="windows"/>
</condition>
<condition property ="isMac">
<os family="mac"/>
</condition>
<!-- Is the the Java EE RI or S1AS? -->
<condition property="is.ri">
<and>
<available file="${server.home}/README.install"/>
<available file="${server.home}/setup.xml"/>
</and>
</condition>
</target>
<!--
Check to see if we are using the pointbase pool, if so
we will skip pinging the connection pool.
-->
<target name="checkIfUsingDerbyPool" >
<condition property="usingDerbyPool">
<equals arg1="${jdbc.poolName}" arg2="${derby.poolName}" casesensitive="true" trim="true"/>
</condition>
</target>
<!--
configUnix will be invoked when ant is being run on
unix/Linux. It will configure the values for ${os}
and ${dir.sep}
Due to differences on how ant invokes external commands
on windows, we need to execute asadmin and imqusermgr
differently on each platform.
-->
<target name="configUnix" depends="checkPlatform" if="isUnixPlatform" >
<echo message="on unix"/>
<property name="dir.sep" value="/"/>
<property name="exec.asadmin" value="${cli.path}" />
<property name="exec.asadmin.part2" value="" />
<property name="exec.imqusermgr" value="${imqbin.loc}/imqusermgr" />
<property name="exec.imqusermgr.part2" value="" />
<property name="cert.file" value="${bin.dir}/certificates/cts_cert"/>
<property name="server.config.dir.path" value="${server.domain}/${server.config.dir}" />
<property name="cacerts.jks" value="${server.config.dir.path}/cacerts.jks"/>
<property name="keystore.jks" value="${server.config.dir.path}/keystore.jks"/>
<property name="cert8.db" value="${server.config.dir.path}/cert8.db"/>
<property name="key3.db" value="${server.config.dir.path}/key3.db"/>
<property name="secmod.db" value="${server.config.dir.path}/secmod.db"/>
<property name="exec.keytool" value= "${java.home}/bin/keytool" />
<property name="exec.keytool.part2" value= "" />
<property name="exec.certutil" value= "${server.home}/lib/certutil" />
<property name="exec.certutil.part2" value= "" />
<property name="password.file.template"
value="${common.bin.dir}/xml/impl/glassfish/templates/password.template"/>
<property name="password.file" value="${bin.dir}/password.txt"/>
<property name="nodeagent.path" value="" />
</target>
<!--
configWindows will be invoked when ant is being run on
windows. It will configure the values for ${os}
and ${dir.sep}
Due to differences on how ant invokes external commands
on windows, we need to execute asadmin and imqusermgr
differently on each platform.
-->
<target name="configWindows" depends="checkPlatform" if="isWindowsPlatform" >
<echo message="on windows"/>
<property name="dir.sep" value="\\"/>
<property name="exec.asadmin" value="cmd.exe" />
<property name="exec.asadmin.part2" value= " /c ${cli.path}" />
<property name="exec.imqusermgr" value="cmd.exe" />
<property name="exec.imqusermgr.part2" value="/c ${imqbin.loc}\imqusermgr" />
<property name="cert.file" value="${ts.home}\bin\certificates\cts_cert"/>
<property name="server.config.dir.path" value="${server.domain}\${server.config.dir}" />
<property name="cacerts.jks" value="${server.config.dir.path}\cacerts.jks"/>
<property name="keystore.jks" value="${server.config.dir.path}\keystore.jks"/>
<property name="cert8.db" value="${server.config.dir.path}\cert8.db"/>
<property name="key3.db" value="${server.config.dir.path}\key3.db"/>
<property name="secmod.db" value="${server.config.dir.path}\secmod.db"/>
<property name="exec.keytool" value="cmd.exe" />
<property name="exec.keytool.part2" value= " /c ${java.home}\bin\keytool" />
<property name="exec.certutil" value= "${server.home}\lib\certutil" />
<property name="exec.certutil.part2" value= " /c ${server.home}/lib/certutil" />
<property name="password.file.template"
value="${ts.home}\bin\xml\impl\glassfish\templates\password.template"/>
<property name="password.file" value="${ts.home}\bin\password.txt"/>
<property name="nodeagent.path" value="--agentdir ${drive}\${sjsas.node.agent.dir.name}" />
</target>
<!--
Start The App Server by calling the appropriate target
depending on whether we are on unix/linux or windows.
-->
<target name="start.appserver" depends="configPlatform" >
<antcall target="start.appserver.unix"/>
<antcall target="start.appserver.win"/>
</target>
<!--
Start The App Server on unix/linux
-->
<target name="start.appserver.unix" depends="configPlatform" if="isUnixPlatform">
<exec executable="${exec.asadmin}" failifexecutionfails="false">
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" start-domain"/>
<arg line=" ${server.domain.name}"/>
</exec>
<echo message=" The App Server is now available." />
</target>
<!--
Start the App Server on windoze
-->
<target name="start.appserver.win" depends="configPlatform" if="isWindowsPlatform">
<spawn executable="${exec.asadmin}" failifexecutionfails="false">
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" start-domain"/>
<arg line=" ${server.domain.name}"/>
</spawn>
<echo message=" ...Waiting for server to be up ...(sleeping for ${server.start.delay.mins} minutes) " />
<!--
Currently the waitfor task allocates a port everytime it checks the admin server URL.
If one of the server ports is allocated to the waitfor task we get a server startup error.
Asadmin start-domain is a synchronous call but in the case of ant on windows the asadmin
start-domain never returns to the ant exec task so it hangs forever. For now we simply
sleep for server.start.delay.mins minutes to give the app server more than enough time to come up. This is
a temparay fix until we implement something better.
-->
<sleep minutes="${server.start.delay.mins}"/>
<echo message=" HTTP server is now available at http://${server.host}:${server.port}" />
</target>
<!--
Create cts-asadmin.bat for the harness:
Appends an echo statement to the asadmin.bat file on windows only.
This is done so the CTS porting can read the return status of
the exec'ed asadmin command. On Unix the return value is propogated
back to the exec'ed process.
-->
<target name="create.asadmin.bat" depends="configPlatform" if="isWindowsPlatform">
<concat destfile="${server.home}/bin/cts-asadmin.bat">
<filelist dir="${server.home}/bin" files="asadmin.bat" />
<filelist dir="${bin.dir}/xml/impl/glassfish/templates" files="asadmin.bat.concat.template" />
</concat>
</target>
<!--
Stop The App Server
-->
<target name="stop-domain" depends="configPlatform">
<exec executable="${exec.asadmin}" failifexecutionfails="false">
<arg line="${exec.asadmin.part2}" />
<arg line=" stop-domain"/>
<arg line=" ${server.domain.name}"/>
</exec>
</target>
<!--
Add a jvm option to the server
-->
<target name="create-jvm-options" depends="delete-jvm-options">
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
<arg line=" create-jvm-options "/>
<arg line=" ${jvm.options}"/>
</exec>
</target>
<!--
Remove a jvm option that was prevously added
-->
<target name="delete-jvm-options">
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
<arg line=" delete-jvm-options "/>
<arg line=" ${jvm.options}"/>
</exec>
</target>
<!--
this is best used for the case where we want to delete a single
JVM option that happens to contain a file or path. The reason for
using this over the 'create-jvm-options' target is that this is
designed to better handle paths on Windows platform where
the paths may contain a colon (":") character. The colon char
requires special escape char handling in (GF) asadmin command.
Bottom line - use this for creating a JVM option that contains
a file/dir path AND use its counterpart for deleting that same
JVM option. (the counterpart is 'delete-one-jvm-option')
-->
<target name="create-one-jvm-option" depends="checkPlatform,delete-one-jvm-option">
<if> <or>
<istrue value="isWindowsPlatform"/>
<os family="windows"/>
<os family="dos"/>
</or>
<then>
<propertyregex property="the.jvm.option"
input="${jvm.options}"
regexp=":"
replace="\\\\:"
defaultvalue="${jvm.options}"
override="true"/>
</then>
<else>
<property name="the.jvm.option" value="${jvm.options}"/>
</else>
</if>
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" create-jvm-options "/>
<arg line=" ${the.jvm.option}"/>
</exec>
</target>
<target name="delete-one-jvm-option" depends="checkPlatform">
<if> <or>
<istrue value="isWindowsPlatform"/>
<os family="windows"/>
<os family="dos"/>
</or>
<then>
<propertyregex property="the.jvm.option"
input="${jvm.options}"
regexp=":"
replace="\\\\:"
defaultvalue="${jvm.options}"
override="true"/>
</then>
<else>
<property name="the.jvm.option" value="${jvm.options}"/>
</else>
</if>
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" delete-jvm-options "/>
<arg line=" ${the.jvm.option}"/>
</exec>
</target>
<!--
Set an attribute for an existing domain element
-->
<target name="set" >
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
<arg line=" set"/>
<arg line=" ${set.value}"/>
</exec>
</target>
<!--
rerestart.server reconfigures and restarts the App Server
-->
<target name="restart.server" depends="configPlatform">
<antcall target="stop-domain"/>
<delete quiet="true">
<fileset dir="${s1as.domain}/logs" includes="jacc_log*"/>
</delete>
<antcall target="start.appserver"/>
</target>
<!--
Modify the applicationRoot. Needed for windows tests.
-->
<target name="change.applicationRoot" depends="configPlatform" if="isWindowsPlatform">
<antcall target="set" >
<param name="set.value" value=" domain.application_root=${drive}"/>
</antcall>
<antcall target="restart.server"/>
</target>
<!--
targets to stop and start Derby
It may be necessary to add the following system property to the JavaDB startup when running on the Mac.
The bug is suppossed to be fixed, making the property unnecessary, but one never knows.
This URL describes the issue and the fix: http://db.apache.org/derby/faq.html#createdb_OS_X
<sysproperty key="derby.storage.fileSyncTransactionLog" value="true"/>
-->
<target name="start.javadb" depends="configPlatform">
<echo message="*** Starting Derby "/>
<java classname="org.apache.derby.drda.NetworkServerControl"
classpath="${ts.home}/lib/dbprocedures.jar${pathsep}${derby.home}/lib/derbynet.jar" fork="true" spawn="true">
<sysproperty key="derby.system.home" value="${derby.home}/databases"/>
<arg line="-h ${use.derby.server} -p ${use.derby.port} start"/>
</java>
<sleep seconds="${derby.startup.delay}"/>
<echo message="*** Checking if Derby was started "/>
<antcall target="is.derby.running"/>
</target>
<target name="stop.javadb" depends="configPlatform">
<echo message="*** Stopping JavaDB"/>
<java classname="org.apache.derby.drda.NetworkServerControl"
classpath="${ts.home}/lib/dbprocedures.jar${pathsep}${derby.home}/lib/derbynet.jar" fork="true" spawn="true">
<arg line="-h ${use.derby.server} -p ${use.derby.port} shutdown"/>
</java>
</target>
<target name="is.derby.running" depends="configPlatform">
<!-- check that we can actually get to the DB -->
<sql classpath="${derby.home}/lib/derbyclient.jar"
driver="${derby.driver}" url="${derby.url}"
userid="${derby.user}" password="${derby.passwd}"
errorproperty="derby.sql.test.error" >
values user;
</sql>
<if>
<not>
<isset property="derby.sql.test.error"/>
</not>
<then>
<echo message="*** JavaDB is running and can be connected to."/>
</then>
<else>
<echo message="*** There was a problem connecting to DB at ${use.derby.server}:${use.derby.port}"/>
</else>
</if>
</target>
<!--
Determine whether we are running the Java EE RI, PE, SE or EE
edition.
-->
<target name="get.platform.edition" depends="configPlatform">
<exec executable="${exec.asadmin}" outputproperty="viVersion">
<arg line="${exec.asadmin.part2}" />
<arg line=" version"/>
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
</exec>
<condition property="foundPE">
<or>
<contains string="${viVersion}"
substring="Reference Implementation"/>
<contains string="${viVersion}"
substring="Platform Edition"/>
</or>
</condition>
</target>
<!--
Get the platform version and store the return value in
the property "platformVersion". Currently this method is only
required by the target start.appserver
-->
<target name="get.platform.version" depends="configPlatform" unless="gotVersion">
<exec executable="${exec.asadmin}" outputproperty="platformVersion">
<arg line="${exec.asadmin.part2}" />
<arg line=" version"/>
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
</exec>
</target>
<target name="create-file-user">
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
<arg line=" create-file-user"/>
<arg line=" --groups ${usergroups}"/>
<arg line=" ${userName}"/>
</exec>
</target>
<target name="delete-file-user" >
<exec executable="${exec.asadmin}" >
<arg line="${exec.asadmin.part2}" />
<arg line="${asadmin.user.line}"/>
<arg line="${asadmin.password.line}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.port}"/>
<arg line=" delete-file-user"/>
<arg line=" ${userName}"/>
</exec>
</target>
</project>