/
build.xml
240 lines (194 loc) · 10.7 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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE project [
<!--
Copyright (c) 2017, 2022 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
-->
<!ENTITY commonSetup SYSTEM "./../../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "./../../../../config/common.xml">
<!ENTITY commonRun SYSTEM "./../../../../config/run.xml">
<!ENTITY commonSecurity SYSTEM "../../common.xml">
<!ENTITY testproperties SYSTEM "./build.properties">
]>
<project name="security-jmac-soap" default="usage" basedir=".">
&commonSetup;
&commonBuild;
&commonRun;
&testproperties;
&commonSecurity;
<target name="all" depends="clean, build-providers, setup, build-deploy, run, undeploy, unsetup"/>
<target name="clean" depends="init-common">
<antcall target="clean-common"/>
</target>
<target name="build-providers" depends="init-common">
<antcall target="compile-common">
<param name="src" value="authmodule"/>
<param name="build.classes.dir" value="${build.classes.dir}/authmodule"/>
</antcall>
<mkdir dir="${assemble.dir}"/>
<jar jarfile="${assemble.dir}/test-${appname}-provider.jar">
<fileset dir="${build.classes.dir}/authmodule"/>
</jar>
</target>
<target name="setup" depends="init-common">
<!-- exports certdb stuff and imports into keystore -->
<antcall target="prepare-store-nickname-common">
<param name="cert.nickname" value="s1as"/>
</antcall>
<copy file="${assemble.dir}/test-${appname}-provider.jar"
todir="${env.S1AS_HOME}/lib"/>
<antcall target="asadmin-common">
<param name="admin.command" value="create-message-security-provider"/>
<param name="as.props" value="${as.props} --classname com.sun.s1asdev.security.jmac.soap.SOAPTestServerAuthModule --layer SOAP --providertype server --requestauthsource sender"/>
<param name="operand.props" value="SOAPTestServerAuthModule"/>
</antcall>
<antcall target="asadmin-common">
<param name="admin.command" value="create-message-security-provider"/>
<param name="as.props" value="${as.props} --classname com.sun.s1asdev.security.jmac.soap.SOAPTestClientAuthModule --layer SOAP --providertype client --requestauthsource sender"/>
<param name="operand.props" value="SOAPTestClientAuthModule"/>
</antcall>
<!--antcall target="restart"/-->
<copy file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml"
tofile="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml.ORIG"/>
<replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml">
<replacetoken><![CDATA[</message-security-config>]]></replacetoken>
<replacevalue><![CDATA[<provider-config class-name="com.sun.s1asdev.security.jmac.soap.SOAPTestClientAuthModule" provider-id="SOAPTestClientAuthModule" provider-type="client">
<request-policy auth-source="sender"/>
</provider-config>
</message-security-config>]]></replacevalue>
</replace>
</target>
<target name="build-deploy" depends="init-common">
<antcall target="build-server"/>
<antcall target="deploy-common-libraries">
<param name="as.props" value="${as.props}"/>
<param name="libraries" value="${env.S1AS_HOME}/lib/test-${appname}-provider.jar"/>
</antcall>
<antcall target="build-client"/>
<antcall target="deploy-client-common"/>
</target>
<target name="compile-server" depends="clean">
<antcall target="compile-common">
<param name="src" value="ejbws"/>
<param name="build.classes.dir" value="${build.classes.dir}/ejbws"/>
</antcall>
<antcall target="compile-common">
<param name="src" value="servletws"/>
<param name="build.classes.dir" value="${build.classes.dir}/servletws/WEB-INF/classes"/>
</antcall>
</target>
<target name="build-server" depends="compile-server">
<mkdir dir="${assemble.dir}"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<antcall target="package-ejbjar-common">
<param name="ejbjar.files" value="${build.classes.dir}/ejbws"/>
<param name="ejb.jar" value="${assemble.dir}/${appname}-ejb.jar"/>
<param name="ejbjar.classes" value="com/sun/**/*.class"/>
</antcall>
<copy file="${web.xml}" tofile="${build.classes.dir}/servletws/WEB-INF/web.xml" failonerror="true"/>
<copy file="${sun-web.xml}" tofile="${build.classes.dir}/servletws/WEB-INF/sun-web.xml" failonerror="true"/>
<jar destfile="${assemble.dir}/${appname}-web.war">
<fileset dir="${build.classes.dir}/servletws"/>
</jar>
<copy file="${sun-application.xml}" tofile="${build.classes.dir}/META-INF/sun-application.xml" failonerror="false"/>
<jar jarfile="${assemble.dir}/${appname}App.ear">
<fileset dir="${assemble.dir}">
<include name="*.jar"/>
<include name="*.war"/>
</fileset>
<fileset dir="${build.classes.dir}">
<include name="META-INF/sun-application.xml"/>
</fileset>
</jar>
</target>
<target name="compile-client">
<mkdir dir="${build.classes.dir}/client"/>
<antcall target="wsimport">
<param name="wsimport.args"
value="-keep -d ${build.classes.dir}/client http://${http.host}:${http.port}/JmacSoapEjbService/HelloEjb?WSDL"/>
</antcall>
<antcall target="wsimport">
<param name="wsimport.args"
value="-keep -d ${build.classes.dir}/client http://${http.host}:${http.port}/security-jmac-soap-web/webservice/JmacSoapServletService/HelloServlet?WSDL"/>
</antcall>
<delete file="client/Client.java" failonerror="false"/>
<copy file="client/Client.java.template" tofile="client/Client.java"/>
<replace file="client/Client.java">
<replacefilter token="@HOST@" value="${http.host}"/>
<replacefilter token="@PORT@" value="${http.port}"/>
</replace>
<javac srcdir="client" destdir="${build.classes.dir}/client"
classpath="${env.APS_HOME}/lib/reporter.jar:${env.S1AS_HOME}/lib/jakartaee.jar:${env.S1AS_HOME}/modules/webservices-osgi.jar:${build.classes.dir}/client"
debug="on" failonerror="true"/>
</target>
<target name="build-client" depends="compile-client">
<mkdir dir="${assemble.dir}"/>
<unjar src="${env.APS_HOME}/lib/reporter.jar" dest="${build.classes.dir}/client"/>
<copy file="${client-handler.xml}" todir="${build.classes.dir}/client/com/sun/s1asdev/security/jmac/soap/client" failonerror="true"/>
<antcall target="package-appclientjar-common">
<param name="appclientjar.files"
value="${build.classes.dir}/client"/>
<param name="appclient.jar"
value="${assemble.dir}/${appname}-client.jar"/>
<param name="appclientjar.classes"
value="com/sun/**/*.class, com/sun/**/*.xml"/>
</antcall>
</target>
<target name="run" depends="init-common" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="vmargs.base" value="-Djavax.net.ssl.keyStore=${mykeystore.db.file} -Djavax.net.ssl.trustStore=${mytruststore.db.file} -Djavax.net.ssl.keyStorePassword=${ssl.password} -Djavax.net.ssl.trustStorePassword=${ssl.password}"/>
<property name="vmargs.suspend" value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=9007"/>
<property name="vmargs" value="${vmargs.base} ${vmargs.suspend}" if:set="env.client_suspend"/>
<property name="vmargs" value="${vmargs.base}" unless:set="env.client_suspend"/>
<echo>${line.separator} RUNNING ${APPCLIENT}${line.separator}${line.separator} vmargs: ${vmargs} ${line.separator}${line.separator} client: -client ${assemble.dir}/${appname}-clientClient.jar</echo>
<exec executable="${APPCLIENT}">
<env key="APPCPATH" value="${env.S1AS_HOME}/lib/test-${appname}-provider.jar"/>
<env key="VMARGS" value="${vmargs}"/>
<arg line="-client" />
<arg line="${assemble.dir}/${appname}-clientClient.jar"/>
<arg line="-texauth"/>
<arg line="-user" />
<arg line="javaee" />
<arg line="-password" />
<arg line="javaee" />
</exec>
</target>
<target name="undeploy" depends="init-common">
<antcall target="undeploy-common"/>
<antcall target="undeploy-client-common"/>
</target>
<target name="unsetup" depends="init-common">
<antcall target="asadmin-common">
<param name="admin.command" value="delete-message-security-provider"/>
<param name="as.props" value="${as.props} --layer SOAP"/>
<param name="operand.props" value="SOAPTestServerAuthModule"/>
</antcall>
<antcall target="asadmin-common">
<param name="admin.command" value="delete-message-security-provider"/>
<param name="as.props" value="${as.props} --layer SOAP"/>
<param name="operand.props" value="SOAPTestClientAuthModule"/>
</antcall>
<replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml">
<replacetoken><![CDATA[<provider-config class-name="com.sun.s1asdev.security.jmac.soap.SOAPTestClientAuthModule" provider-id="SOAPTestClientAuthModule" provider-type="client">
<request-policy auth-source="sender"/>
</provider-config>
</message-security-config>]]></replacetoken>
<replacevalue><![CDATA[</message-security-config>]]></replacevalue>
</replace>
<!-- may not be able to delete this file in PC environment -->
<delete file="${env.S1AS_HOME}/lib/test-${appname}-provider.jar" failonerror="false"/>
</target>
<target name="restart">
<antcall target="restart-server-instance-common"/>
</target>
<target name="usage">
<antcall target="usage-common"/>
</target>
</project>