|
1 <!-- |
|
2 # |
|
3 # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 # All rights reserved. |
|
5 # This component and the accompanying materials are made available |
|
6 # under the terms of "Eclipse Public License v1.0" |
|
7 # which accompanies this distribution, and is available |
|
8 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 # |
|
10 # Initial Contributors: |
|
11 # Nokia Corporation - initial contribution. |
|
12 # |
|
13 # Contributors: |
|
14 # |
|
15 # Description: |
|
16 # |
|
17 --> |
|
18 |
|
19 <project name="OMJSecurityTests" basedir="." default="deploy"> |
|
20 |
|
21 |
|
22 <import file="../../../../build/utilities.xml"/> |
|
23 |
|
24 <property environment="env"/> |
|
25 <property name="java.src.root" location="${env.JAVA_SRC_ROOT}"/> |
|
26 <property name="java.bin.root" location="${env.JAVA_BIN_ROOT}"/> |
|
27 |
|
28 <property name="src.dir" location="../javasrc"/> |
|
29 <property name="src.dir2" location="../javasrc_cldc1.1.1"/> |
|
30 <property name="build.dir" location="../build"/> |
|
31 <property name="classes.dir" location="${build.dir}/javabuild"/> |
|
32 <!--the name of the stub jar needs to be something which starts with a letter from [a-j], so that the JVM loads it before the javasecurity.jar--> |
|
33 <property name="omjsecuritystubs.jar.filename" value="omjsecuritystubs.jar"/> |
|
34 <property name="omjsecuritytests.jar.filename" value="omjsecuritytests.jar"/> |
|
35 <property name="junit.jar.dir" location="${java.src.root}/tools/junit"/> |
|
36 <property name="junit.jar.filename" value="j2meunit1.1.1.jar"/> |
|
37 <property name="junit.omj.jar.filename" value="j2meunitomj.jar"/> |
|
38 <property name="policy.editor.test.data.dir" location="../data"/> |
|
39 <property name="policyeditor.jar" location="${java.src.root}/javatools/javasecuritycustomization/policyeditor/bin/securitypolicyeditor.jar"/> |
|
40 <property name="external.policies.dir" location="../data/policies"/> |
|
41 <property name="certs.src.dir" location="${java.src.root}/javatools/testcerts"/> |
|
42 <property name="certs.dest.dir" location="/epoc32/winscw/c/private/200211dc/security/trustroots/device/certificates"/> |
|
43 <property name="certs.state.dest.dir" location="/epoc32/winscw/c/private/200211dc/security/trustroots/device/state"/> |
|
44 <property name="s60.networking.dir" location="/epoc32/winscw/c/private/101f7989/esock/"/> |
|
45 <property name="s60.networking.dir2" location="/epoc32/winscw/c/private/10202be9/persists/"/> |
|
46 <property name="test.tmp.dir" location="../tmp/"/> |
|
47 <property name="odc.dir" location="/epoc32/winscw/c/resource/ive/lib/jclcldc11/ext/"/> |
|
48 <property name="bootclasspath.cdc" location="${java.src.root}/javaruntime/jvm/ibm/j9_23/ibmdelivery/resource/lib/jclCdc11/classes.zip"/> |
|
49 <property name="ext1.policies.dir" location="/epoc32/winscw/c/resource/java/security/extensions/ext1/policies/"/> |
|
50 <property name="ext2.policies.dir" location="/epoc32/winscw/c/resource/java/security/extensions/ext2/policies/"/> |
|
51 <property name="jvmargsmodifier.default.dll" location="/epoc32/release/winscw/udeb/javajvmargsmodifier.dll"/> |
|
52 <property name="jvmargsmodifier.filebased.dll" location="/epoc32/release/winscw/udeb/javajvmargsmodifierfile.dll"/> |
|
53 <property name="javac.source" value="1.3"/> |
|
54 <property name="javac.target" value="1.3"/> |
|
55 |
|
56 <target name="backup" depends="init"> |
|
57 <mkdir dir="${test.tmp.dir}/certs"/> |
|
58 <mkdir dir="${test.tmp.dir}/state"/> |
|
59 <mkdir dir="${test.tmp.dir}/networking"/> |
|
60 <move todir="${test.tmp.dir}/certs" failonerror="false"> |
|
61 <fileset dir="${certs.dest.dir}"/> |
|
62 </move> |
|
63 <move todir="${test.tmp.dir}/state" failonerror="false"> |
|
64 <fileset dir="${certs.state.dest.dir}"/> |
|
65 </move> |
|
66 <copy todir="${certs.dest.dir}"> |
|
67 <fileset dir="${certs.src.dir}"/> |
|
68 </copy> |
|
69 <!--move file="${s60.networking.dir}/ip.tcpip.esk" todir="${test.tmp.dir}/networking"/> |
|
70 <move file="${s60.networking.dir2}/cccccc00.cre" todir="${test.tmp.dir}/networking"/> |
|
71 <unzip src="../data/wsock.zip" dest="/"/--> |
|
72 </target> |
|
73 |
|
74 <target name="cleanup" depends="init"> |
|
75 <delete dir="${certs.dest.dir}"/> |
|
76 <delete dir="${certs.state.dest.dir}"/> |
|
77 <mkdir dir="${certs.dest.dir}"/> |
|
78 <mkdir dir="${certs.state.dest.dir}"/> |
|
79 <copy todir="${certs.dest.dir}"> |
|
80 <fileset dir="${test.tmp.dir}/certs"/> |
|
81 </copy> |
|
82 <copy todir="${certs.state.dest.dir}"> |
|
83 <fileset dir="${test.tmp.dir}/state"/> |
|
84 </copy> |
|
85 <!--move file="${test.tmp.dir}/networking/ip.tcpip.esk" todir="${s60.networking.dir}"/> |
|
86 <move file="${test.tmp.dir}/networking/cccccc00.cre" todir="${s60.networking.dir2}"/> |
|
87 <delete file="/epoc32/release/winscw/udeb/wsock6.lib"/> |
|
88 <delete file="/epoc32/release/winscw/udeb/wsock6.prt"/> |
|
89 <delete file="/epoc32/release/winscw/udeb/wsock.lib"/> |
|
90 <delete file="/epoc32/release/winscw/udeb/wsock.prt"/> |
|
91 <delete file="/epoc32/release/winscw/udeb/wsocka.agt"/> |
|
92 <delete file="/epoc32/release/winscw/udeb/wsocka.lib"/> |
|
93 <delete file="/epoc32/release/winscw/udeb/wsocki.lib"/> |
|
94 <delete file="/epoc32/release/winscw/udeb/wsocki.nif"/--> |
|
95 <delete file="${vm.args.folder}installerargs.txt"/> |
|
96 <delete file="${odc.dir}/ext1.odc"/> |
|
97 <delete file="${odc.dir}/ext2.odc"/> |
|
98 <delete dir="${test.tmp.dir}"/> |
|
99 <delete dir="${ext1.policies.dir}"/> |
|
100 <delete dir="${ext2.policies.dir}"/> |
|
101 <delete dir="${security.test.data.dir}"/> |
|
102 </target> |
|
103 |
|
104 <target name="clean" depends="init.my.properties,close.ext.dir"> |
|
105 <delete dir="${classes.dir}"/> |
|
106 <delete file="${dist}/${omjsecuritytests.jar.filename}"/> |
|
107 <delete file="${dist}/${omjsecuritystubs.jar.filename}"/> |
|
108 <delete file="${dist}/midpsecuritypolicyeditortool.jar"/> |
|
109 <delete file="${dist}/${junit.jar.filename}"/> |
|
110 <delete file="${dist}/${junit.omj.jar.filename}"/> |
|
111 <exec executable="perl"> |
|
112 <env key="OMJ_PP_ROOT_DIR" value="../data/javasrc/invalidjars/"/> |
|
113 <arg line="cleanTestData.pl"/> |
|
114 </exec> |
|
115 <exec executable="perl"> |
|
116 <env key="OMJ_PP_ROOT_DIR" value="../data/javasrc/validjars/"/> |
|
117 <arg line="cleanTestData.pl"/> |
|
118 </exec> |
|
119 <delete dir="${security.test.data.dir}"/> |
|
120 </target> |
|
121 |
|
122 <target name="init.my.properties" depends="init.properties"> |
|
123 <property name="dist" location="${vm.extension.directory}"/> |
|
124 <condition property="security.test.data.dir" |
|
125 value="/epoc32/winscw/c/java/securitytestdata/" |
|
126 else="${env.JAVA_BIN_ROOT}/securitytestdata/"> |
|
127 <isset property="target.s60" /> |
|
128 </condition> |
|
129 <condition property="vm.args.folder" |
|
130 value="/epoc32/winscw/c/java/" |
|
131 else="${env.JAVA_BIN_ROOT}/"> |
|
132 <isset property="target.s60" /> |
|
133 </condition> |
|
134 <available file="${jvmargsmodifier.default.dll}_" property="jvmargsmodifier.changed"/> |
|
135 </target> |
|
136 |
|
137 <target name="init" depends="init.my.properties"> |
|
138 <property name="dist" location="${vm.extension.directory}"/> |
|
139 <mkdir dir="${security.test.data.dir}/security_tmp"/> |
|
140 <mkdir dir="${security.test.data.dir}/securitypolicies/testinputdata/validpolicies"/> |
|
141 <mkdir dir="${security.test.data.dir}/securitypolicies/testinputdata/invalidpolicies"/> |
|
142 <mkdir dir="${security.test.data.dir}/securitypolicies/testoutputdata/validpolicies"/> |
|
143 <mkdir dir="${security.test.data.dir}/securitypolicies/testoutputdata/invalidpolicies"/> |
|
144 <mkdir dir="${security.test.data.dir}/security/policies/"/> |
|
145 <mkdir dir="${security.test.data.dir}/packageprotection/invalidjars"/> |
|
146 <mkdir dir="${security.test.data.dir}/packageprotection/validjars"/> |
|
147 <mkdir dir="${security.test.data.dir}/packageprotection/robustness"/> |
|
148 <mkdir dir="${ext1.policies.dir}"/> |
|
149 <mkdir dir="${ext2.policies.dir}"/> |
|
150 <copy file="../data/HelloWorld.jar" tofile="${security.test.data.dir}/security_tmp/HelloWorld.jar"/> |
|
151 <copy file="../data/HelloTouch.jar" tofile="${security.test.data.dir}/security_tmp/HelloTouch.jar"/> |
|
152 <copy file="../data/app.jar" tofile="${security.test.data.dir}/security_tmp/app.jar"/> |
|
153 <copy file="../data/modified_app.jar" tofile="${security.test.data.dir}/security_tmp/modified_app.jar"/> |
|
154 <copy file="${policyeditor.jar}" tofile="${dist}/midpsecuritypolicyeditortool.jar"/> |
|
155 <copy file="../data/installerargs.txt" todir="${vm.args.folder}"/> |
|
156 <copy file="../data/ext1/ext1.odc" todir="${odc.dir}"/> |
|
157 <copy file="../data/ext2/ext2.odc" todir="${odc.dir}"/> |
|
158 </target> |
|
159 |
|
160 <target name="compile" depends="init, prepare_test_data"> |
|
161 <delete dir="${classes.dir}"/> |
|
162 <mkdir dir="${classes.dir}"/> |
|
163 <property name="jars.dir" location="${jarfiles.collect.root}"/> |
|
164 <property name="jars.dir.cdc" location="${jarfiles.collect.cdc.root}"/> |
|
165 <javac source="${javac.source}" target="${javac.target}" |
|
166 destdir="${classes.dir}" |
|
167 bootclasspath="${bootclasspath.cdc}" |
|
168 excludes="com/nokia/mj/impl/security/midp/authorization/PermissionMappingTable.java"> |
|
169 <classpath> |
|
170 <pathelement location="${policyeditor.jar}"/> |
|
171 <pathelement location="${impl.cldc.jar}"/> |
|
172 <pathelement location="${impl.cdc.jar}"/> |
|
173 <pathelement location="${junit.jar.dir}/${junit.jar.filename}"/> |
|
174 <pathelement location="${junit.jar.dir}/${junit.omj.jar.filename}"/> |
|
175 </classpath> |
|
176 <src path="${src.dir}"/> |
|
177 <src path="${src.dir2}"/> |
|
178 </javac> |
|
179 </target> |
|
180 |
|
181 <target name="prepare_test_data"> |
|
182 <exec executable="perl"> |
|
183 <env key="OMJ_PP_CP" value="${impl.cldc.jar}${path.separator}${impl.cdc.jar}"/> |
|
184 <env key="OMJ_PP_JAR_DIR" value="${security.test.data.dir}/packageprotection/invalidjars/"/> |
|
185 <env key="OMJ_PP_ROOT_DIR" value="../data/javasrc/invalidjars/"/> |
|
186 <arg line="prepareTestData.pl"/> |
|
187 </exec> |
|
188 <exec executable="perl"> |
|
189 <env key="OMJ_PP_CP" value="${impl.cldc.jar}${path.separator}${impl.cdc.jar}"/> |
|
190 <env key="OMJ_PP_JAR_DIR" value="${security.test.data.dir}/packageprotection/validjars/"/> |
|
191 <env key="OMJ_PP_ROOT_DIR" value="../data/javasrc/validjars/"/> |
|
192 <arg line="prepareTestData.pl"/> |
|
193 </exec> |
|
194 <unzip src="../../internal/tsrc/data/securityrobustnesstestingdata.zip" dest="${security.test.data.dir}/packageprotection/robustness/"/> |
|
195 </target> |
|
196 |
|
197 <target name="prepare_test_data2"> |
|
198 <javac source="${javac.source}" target="${javac.target}" |
|
199 destdir="${classes.dir}" |
|
200 bootclasspath="${bootclasspath.cdc}" |
|
201 includes="com/nokia/mj/impl/security/midp/authorization/PermissionMappingTable.java"> |
|
202 <classpath> |
|
203 <pathelement location="${impl.cldc.jar}"/> |
|
204 </classpath> |
|
205 <src path="${src.dir}"/> |
|
206 </javac> |
|
207 <java classname="com.nokia.mj.tools.security.midp.PolicyEditor" |
|
208 failonerror="true"> |
|
209 <sysproperty key="emma.properties" value="${emma.properties}"/> |
|
210 <arg value="${external.policies.dir}"/> |
|
211 <arg value="${security.test.data.dir}/security/policies/"/> |
|
212 <classpath> |
|
213 <!--javabuild as classpath is for the NewPermissionMapping--> |
|
214 <pathelement location="./javabuild"/> |
|
215 <pathelement location="${policyeditor.jar}"/> |
|
216 <pathelement location="${impl.cldc.jar}"/> |
|
217 <pathelement location="${impl.cdc.jar}"/> |
|
218 <pathelement path="${emma.dir}/emma.jar"/> |
|
219 </classpath> |
|
220 </java> |
|
221 <java classname="com.nokia.mj.tools.security.midp.PolicyEditor" |
|
222 failonerror="true"> |
|
223 <sysproperty key="emma.properties" value="${emma.properties}"/> |
|
224 <arg value="../data/ext1/policies/"/> |
|
225 <arg value="${ext1.policies.dir}"/> |
|
226 <classpath> |
|
227 <!--javabuild as classpath is for the NewPermissionMapping--> |
|
228 <pathelement location="./javabuild"/> |
|
229 <pathelement location="${policyeditor.jar}"/> |
|
230 <pathelement location="${impl.cldc.jar}"/> |
|
231 <pathelement location="${impl.cdc.jar}"/> |
|
232 <pathelement path="${emma.dir}/emma.jar"/> |
|
233 </classpath> |
|
234 </java> |
|
235 <java classname="com.nokia.mj.tools.security.midp.PolicyEditor" |
|
236 failonerror="true"> |
|
237 <sysproperty key="emma.properties" value="${emma.properties}"/> |
|
238 <arg value="../data/ext2/policies/"/> |
|
239 <arg value="${ext2.policies.dir}"/> |
|
240 <classpath> |
|
241 <!--javabuild as classpath is for the NewPermissionMapping--> |
|
242 <pathelement location="./javabuild"/> |
|
243 <pathelement location="${policyeditor.jar}"/> |
|
244 <pathelement location="${impl.cldc.jar}"/> |
|
245 <pathelement location="${impl.cdc.jar}"/> |
|
246 <pathelement path="${emma.dir}/emma.jar"/> |
|
247 </classpath> |
|
248 </java> |
|
249 </target> |
|
250 |
|
251 <target name="deploy" depends="compile, prepare_test_data2, open.ext.dir"> |
|
252 <mkdir dir="${dist}"/> |
|
253 <jar destfile="${dist}/${omjsecuritytests.jar.filename}" basedir="${classes.dir}" excludes="com/nokia/mj/impl/security/midp/authentication/OcspUserPreferences.class"/> |
|
254 <jar destfile="${dist}/${omjsecuritystubs.jar.filename}" basedir="${classes.dir}" includes="com/nokia/mj/impl/security/midp/authentication/OcspUserPreferences.class"/> |
|
255 <copy file="${junit.jar.dir}/${junit.jar.filename}" |
|
256 tofile="${dist}/${junit.jar.filename}"/> |
|
257 <copy file="${junit.jar.dir}/${junit.omj.jar.filename}" |
|
258 tofile="${dist}/${junit.omj.jar.filename}"/> |
|
259 <copy todir="${security.test.data.dir}/securitypolicies/testinputdata/invalidpolicies"> |
|
260 <fileset dir="${policy.editor.test.data.dir}/invalidpolicies"/> |
|
261 </copy> |
|
262 <copy todir="${security.test.data.dir}/securitypolicies/testinputdata/validpolicies"> |
|
263 <fileset dir="${policy.editor.test.data.dir}/validpolicies"/> |
|
264 </copy> |
|
265 <!--open up the extensions dir--> |
|
266 </target> |
|
267 |
|
268 <target name="open.ext.dir" unless="jvmargsmodifier.changed"> |
|
269 <!--open up the extensions dir--> |
|
270 <move file="${jvmargsmodifier.default.dll}" tofile="${jvmargsmodifier.default.dll}_"/> |
|
271 <move file="${jvmargsmodifier.filebased.dll}" tofile="${jvmargsmodifier.default.dll}"/> |
|
272 </target> |
|
273 |
|
274 <target name="close.ext.dir" if="jvmargsmodifier.changed"> |
|
275 <move file="${jvmargsmodifier.default.dll}" tofile="${jvmargsmodifier.filebased.dll}"/> |
|
276 <move file="${jvmargsmodifier.default.dll}_" tofile="${jvmargsmodifier.default.dll}"/> |
|
277 </target> |
|
278 |
|
279 <target name="main" depends="run"/> |
|
280 |
|
281 <target name="run" depends="deploy"> |
|
282 <echo>Running OMJSecurityTests</echo> |
|
283 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
284 <arg line="test -mainclass=com.nokia.mj.impl.security.OMJSecurityTests"/> |
|
285 </exec> |
|
286 <echo>Running SecurityCommonTests</echo> |
|
287 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
288 <arg line="test -mainclass=com.nokia.mj.impl.security.common.SecurityCommonTests"/> |
|
289 </exec> |
|
290 <echo>Running ApplicationAccessAuthorizationTests</echo> |
|
291 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
292 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.appaccessauthorization.ApplicationAccessAuthorizationTests"/> |
|
293 </exec> |
|
294 <echo>Running MIDPAuthenticationModuleTests</echo> |
|
295 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
296 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.authentication.AuthenticationModuleTests"/> |
|
297 </exec> |
|
298 <!-- TODO: uncomment this when Linux will support UI |
|
299 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
300 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.authentication.InteractiveAuthenticationModuleTests"/> |
|
301 </exec--> |
|
302 <echo>Running MIDPAuthorizationTests</echo> |
|
303 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
304 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.authorization.SecurityPolicyModuleTests"/> |
|
305 </exec> |
|
306 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
307 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.authorization.PermissionGranterTests"/> |
|
308 </exec> |
|
309 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
310 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.authorization.AccessControllerTests"/> |
|
311 </exec> |
|
312 <!-- TODO: uncomment this when Linux will support UI |
|
313 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
314 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.authorization.InteractiveAccessControllerTests"/> |
|
315 </exec--> |
|
316 <echo>Running MIDPSecurityCommonTests</echo> |
|
317 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
318 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.common.SecurityDescriptorAttributesTests"/> |
|
319 </exec> |
|
320 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
321 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.common.SecurityManifestAttributesTests"/> |
|
322 </exec> |
|
323 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
324 <arg line="test -mainclass=com.nokia.mj.impl.security.midp.storage.SecurityStorageTests"/> |
|
325 </exec> |
|
326 <echo>Running PackageProtectorTests</echo> |
|
327 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
328 <arg line="test -mainclass=com.nokia.mj.impl.security.packageprotection.PackageProtectorTests"/> |
|
329 </exec> |
|
330 <echo>Running MIDPSecurityPolicyEditorTests</echo> |
|
331 <exec executable="${java.bin.root}/bin/javainstaller"> |
|
332 <arg line="test -mainclass=com.nokia.mj.tools.security.midp.PolicyEditorTests"/> |
|
333 </exec> |
|
334 </target> |
|
335 |
|
336 </project> |