forked from TeamDev-Archive/OpenFaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
322 lines (279 loc) · 14.6 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
<project name="OpenFaces Project Build Script" default="build" basedir=".">
<property name="components.dir" location="openFaces"/>
<buildnumber file="build.number"/>
<property file="ofversion.properties"/>
<property name="of-version" value="${ofversion}.${build.number}"/>
<property name="build.compiler" value="javac1.5"/>
<property name="target.dir" location="target"/>
<property name="target-lib.dir" location="${target.dir}/lib"/>
<property name="openfaces-jar.file" location="${target-lib.dir}/openfaces-${of-version}.jar"/>
<property name="test-app-jsp.dir" location="testApp/jsp"/>
<property name="test-app-facelets.dir" location="testApp/facelets"/>
<property name="live-demo.dir" location="liveDemo/jsp"/>
<property name="live-demo-facelets.dir" location="liveDemo/facelets"/>
<property name="funcTests.dir" location="funcTests"/>
<property name="funcTests-source.dir" location="${funcTests.dir}/source"/>
<property name="funcTests-target.dir" location="${funcTests.dir}/target"/>
<property name="funcTests-target-reports.dir" location="${funcTests-target.dir}/test-reports"/>
<property name="funcTestsFramework.dir" location="openFacesInspectors"/>
<property name="funcTestsFramework-source.dir" location="${funcTestsFramework.dir}/source"/>
<property name="funcTestsFramework-target.dir" location="${funcTestsFramework.dir}/out"/>
<property name="funcTestsFramework-distrib.dir" location="${funcTestsFramework.dir}/distribution"/>
<property name="funcTestsFramework-temp.dir" location="${funcTestsFramework.dir}/temp"/>
<property name="openfaces-inspectors-jar.file" location="${funcTestsFramework-distrib.dir}/openfaces-inspectors.jar"/>
<property name="patched-selenium-server.file"
location="lib/seleniuminspector/selenium-server-standalone-2.14.0.jar"/>
<property name="funcTestsFrameworkManifest.file" location="${funcTestsFramework-target.dir}/manifest.mf"/>
<property name="webDriverFuncTests.dir" location="webDriverFuncTests"/>
<property name="webDriverFuncTests-source.dir" location="${webDriverFuncTests.dir}/source"/>
<property name="webDriverFuncTests-target.dir" location="${webDriverFuncTests.dir}/target"/>
<target name="init">
<tstamp/>
</target>
<!-- *** Public Targets ** -->
<target name="build" depends="clean" description="Build OpenFaces core and all the demo applications">
<mkdir dir="${target.dir}"/>
<echo>Building OpenFaces core...</echo>
<ant dir="${components.dir}" target="build" inheritall="false">
<property name="build.compiler" value="javac1.5"/>
<property name="target-jar.file" value="${openfaces-jar.file}"/>
<property name="lib.dir" value="../lib"/>
<property name="retain.classes.dir" value="true"/>
<property file="ofversion.properties"/>
</ant>
<echo>OpenFaces core built successfully.</echo>
<echo>Building Test Application (JSP-based version)...</echo>
<ant dir="${test-app-jsp.dir}" target="build" inheritall="false">
<property name="openfaces-jar.file" value="${openfaces-jar.file}"/>
<property name="ofversion" value="${ofversion}"/>
</ant>
<echo>Test Application (JSP-based version) built successfully.</echo>
<echo>Building Test Application (Facelets-based version)...</echo>
<ant dir="${test-app-facelets.dir}" target="build" inheritall="false">
<property name="openfaces-jar.file" value="${openfaces-jar.file}"/>
<property name="ofversion" value="${ofversion}"/>
</ant>
<echo>Test Application (Facelets-based version) built successfully.</echo>
<echo>Building Live Demo (JSP-based version)...</echo>
<ant dir="${live-demo.dir}" target="build" inheritall="false">
<property name="openfaces-jar.file" value="${openfaces-jar.file}"/>
<property name="ofversion" value="${ofversion}"/>
</ant>
<echo>Live Demo (JSP-based version) build successfully.</echo>
<echo>Building Live Demo (Facelets-based version)...</echo>
<ant dir="${live-demo-facelets.dir}" target="build" inheritall="false">
<property name="openfaces-jar.file" value="${openfaces-jar.file}"/>
<property name="ofversion" value="${ofversion}"/>
</ant>
<echo>Live Demo (Facelets-based version) build successfully.</echo>
</target>
<target name="clean" depends="init" description="clean up">
<delete dir="${target.dir}"/>
</target>
<target name="compile-func-test-framework" description="Compile framework required for functional testing">
<mkdir dir="${funcTestsFramework-target.dir}"/>
<javac srcdir="${funcTestsFramework-source.dir}" destdir="${funcTestsFramework-target.dir}" debug="true"
source="1.5" target="1.5">
<classpath>
<pathelement path="lib/seleniuminspector/selenium-java-2.14.0.jar"/>
<pathelement path="lib/seleniuminspector/selenium-server-standalone-2.14.0.jar"/>
<pathelement path="lib/seleniuminspector/selenium-inspector.jar"/>
<pathelement path="lib/mojarra/javax.faces-2.1.11.jar"/>
<pathelement path="testLib/junit.jar"/>
<fileset file="${openfaces-jar.file}"/>
</classpath>
</javac>
<manifest file="${funcTestsFrameworkManifest.file}">
<attribute name="Implementation-Title" value="OpenFaces Selenium Inspectors"/>
<attribute name="Implementation-Vendor" value="TeamDev Ltd."/>
</manifest>
<mkdir dir="${funcTestsFramework-distrib.dir}"/>
<jar jarfile="${openfaces-inspectors-jar.file}" basedir="${funcTestsFramework-target.dir}"/>
<copy file="lib/seleniuminspector/selenium-server-standalone-2.14.0.jar" todir="${funcTestsFramework-distrib.dir}"/>
<copy file="lib/seleniuminspector/selenium-java-2.14.0.jar" todir="${funcTestsFramework-distrib.dir}"/>
</target>
<target name="compile-func-tests" depends="compile-func-test-framework" description="Compile functional tests">
<delete dir="${funcTests-target.dir}/classes"/>
<mkdir dir="${funcTests-target.dir}/classes"/>
<javac srcdir="${funcTests-source.dir}" destdir="${funcTests-target.dir}/classes" debug="true" encoding="UTF-8">
<classpath>
<pathelement path="${openfaces-jar.file}"/>
<pathelement path="${openfaces-inspectors-jar.file}"/>
<pathelement path="testLib/junit.jar"/>
<pathelement path="testLib/jai/mlibwrapper_jai.jar"/>
<pathelement path="testLib/jai/jai_core.jar"/>
<pathelement path="testLib/jai/jai_codec.jar"/>
<pathelement path="lib/seleniuminspector/selenium-java-2.14.0.jar"/>
<pathelement path="lib/seleniuminspector/selenium-server-standalone-2.14.0.jar"/>
<pathelement path="lib/seleniuminspector/selenium-inspector.jar"/>
</classpath>
</javac>
<copy todir="${funcTests-target.dir}/classes">
<fileset dir="${funcTests-source.dir}">
<include name="**/*.properties"/>
<include name="**/*.lic"/>
<include name="**/*.png"/>
<include name="**/*.dll"/>
</fileset>
</copy>
</target>
<target name="run-func-tests" depends="compile-func-tests" description="Run functional tests">
<mkdir dir="${funcTests-target-reports.dir}"/>
<condition property="testAppContextPath" value="${context.path}">
<not>
<isset property="test.app.context.path"/>
</not>
</condition>
<condition property="testAppContextPath" value="${test.app.context.path}">
<isset property="test.app.context.path"/>
</condition>
<condition property="demoContextPath" value="${demoContext.path}">
<not>
<isset property="demo.context.path"/>
</not>
</condition>
<condition property="demoContextPath" value="${demo.context.path}">
<isset property="demo.context.path"/>
</condition>
<junit fork="yes" forkmode="once" failureproperty="junit_test_failed" dir="${funcTests-target.dir}">
<classpath>
<pathelement path="${openfaces-jar.file}"/>
<pathelement path="lib/seleniuminspector/selenium-server-standalone-2.14.0.jar"/>
<pathelement path="lib/seleniuminspector/selenium-java-2.14.0.jar"/>
<pathelement path="lib/seleniuminspector/selenium-inspector.jar"/>
<pathelement path="lib/mojarra/javax.faces-2.1.11.jar"/>
<pathelement location="${funcTests-target.dir}/classes"/>
<pathelement path="${openfaces-inspectors-jar.file}"/>
<pathelement path="testLib/junit.jar"/>
<pathelement path="testLib/jai/mlibwrapper_jai.jar"/>
<pathelement path="testLib/jai/jai_core.jar"/>
<pathelement path="testLib/jai/jai_codec.jar"/>
</classpath>
<formatter type="xml"/>
<formatter usefile="false" type="plain"/>
<batchtest todir="${funcTests-target-reports.dir}">
<fileset dir="${funcTests-source.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
<sysproperty key="test.app.jsf.implementation" value="${jsf.implementation}"/>
<sysproperty key="test.app.is.facelets" value="${is.facelets}"/>
<sysproperty key="test.app.context.path" value="${testAppContextPath}"/>
<sysproperty key="demo.context.path" value="${demoContextPath}"/>
</junit>
<copy todir="${funcTests-source.dir}">
<fileset dir="${funcTests-target.dir}/classes">
<include name="**/*.png"/>
</fileset>
</copy>
<fail if="junit_test_failed" message="FUNCTIONAL TEST(S) FAILED"/>
</target>
<target name="run-func-tests-jsp" description="Run functional tests in JSP-based JSF 2.0 environment">
<property name="jsf.implementation" value="SUN12"/>
<property name="is.facelets" value="false"/>
<property name="context.path" value="/TestAppJsp_3x"/>
<property name="demoContext.path" value="/LiveDemoJsp_3x"/>
<antcall target="run-func-tests"/>
</target>
<target name="run-func-tests-facelets" description="Run functional tests in Facelets-based JSF 2.0 environment">
<property name="jsf.implementation" value="SUN12"/>
<property name="is.facelets" value="true"/>
<property name="context.path" value="/TestAppFacelets_3x"/>
<property name="demoContext.path" value="/LiveDemoFacelets_3x"/>
<antcall target="run-func-tests"/>
</target>
<target name="build-webdriver-test">
<delete dir="${webDriverFuncTests-target.dir}/classes"/>
<mkdir dir="${webDriverFuncTests-target.dir}/classes"/>
<javac source="1.7" srcdir="${webDriverFuncTests-source.dir}" fork="true"
destdir="${webDriverFuncTests-target.dir}/classes">
<classpath>
<pathelement path="${openfaces-jar.file}"/>
<pathelement path="testLib/junit.jar"/>
<pathelement path="lib/selenium/selenium-java-2.44.0.jar"/>
<pathelement path="lib/selenium/selenium-server-standalone-2.44.0.jar"/>
<pathelement path="lib/selenium/selenide-2.14.jar"/>
</classpath>
</javac>
</target>
<target name="run-webdriver-test" depends="build-webdriver-test">
<delete dir="${webDriverFuncTests-target.dir}/report"/>
<mkdir dir="${webDriverFuncTests-target.dir}/report"/>
<mkdir dir="${webDriverFuncTests-target.dir}/report/xml"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement path="${openfaces-jar.file}"/>
<pathelement path="${webDriverFuncTests-target.dir}/classes"/>
<pathelement path="testLib/junit.jar"/>
<pathelement path="lib/selenium/selenium-java-2.44.0.jar"/>
<pathelement path="lib/selenium/selenium-server-standalone-2.44.0.jar"/>
</classpath>
<formatter type="xml"/>
<formatter usefile="false" type="plain"/>
<!--<test name="org.openfaces.test.KickOffTest" todir="${webDriverFuncTests-target.dir}/report/xml"/>-->
<batchtest todir="${webDriverFuncTests-target.dir}/report/xml">
<formatter type="xml"/>
<fileset dir="${webDriverFuncTests-source.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${webDriverFuncTests-target.dir}/report">
<fileset dir="${webDriverFuncTests-target.dir}/report/xml">
<include name="TEST*.xml"/>
</fileset>
<report format="frames" todir="${webDriverFuncTests-target.dir}/report/html"/>
</junitreport>
</target>
<!--Have to change this to your local Tomcat installation-->
<property name="tomcat.home" value="D:\tomcat7"/>
<target name="server-start">
<java classname="org.apache.catalina.startup.Bootstrap" fork="true" spawn="true">
<classpath path="${tomcat.home}/bin/bootstrap.jar:${tomcat.home}/bin/tomcat-juli.jar"/>
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
</java>
</target>
<target name="server-stop">
<java classname="org.apache.catalina.startup.Bootstrap" fork="true">
<classpath path="${tomcat.home}/bin/bootstrap.jar:${tomcat.home}/bin/tomcat-juli.jar"/>
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
<arg line="stop"/>
</java>
</target>
<property name="build-directory" value="liveDemo/facelets/target"/>
<property name="war-file-name" value="openfaces-demo-facelets.war"/>
<!--It deploys using "hot deploy". Anyway, it does not work as expected. So, commit it, I'd better copy war and start Tomcat.-->
<!--<target name="undeploy" description="undeploy from tomcat">-->
<!--<undeploy-->
<!--failonerror="no"-->
<!--url="${tomcat-manager-url}"-->
<!--path="/${project-name}"-->
<!--/>-->
<!--</target>-->
<!--<target name="deploy" description="deploy to tomcat">-->
<!--<echo>deploying from client</echo>-->
<!--<deploy-->
<!--username="${tomcat-manager-login}"-->
<!--password="${tomcat-manager-password}"-->
<!--url="${tomcat-manager-url}"-->
<!--path="/${project-name}"-->
<!--war="file:${build-directory}/${war-file-name}"-->
<!-->-->
<!--</deploy>-->
<!--</target>-->
<target name="deploy-demo-facelets" description="deploy Live Demo Facelets to tomcat">
<echo>Copy live demo facelets on Tomcat</echo>
<delete file="${tomcat.home}/webapps/${war-file-name}"/>
<copy todir="${tomcat.home}/webapps/" file="${build-directory}/${war-file-name}">
</copy>
</target>
<target name="run-demo-facelets-tests" depends="build">
<ant target="server-stop"/>
<sleep seconds="10"/>
<ant target="deploy-demo-facelets"/>
<ant target="server-start"/>
<sleep seconds="30"/>
<ant target="run-webdriver-test"/>
<ant target="server-stop"/>
</target>
</project>