-
Notifications
You must be signed in to change notification settings - Fork 0
/
server-build.xml
138 lines (125 loc) · 5.48 KB
/
server-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
<?xml version="1.0"?>
<project name="testdwr" default="test">
<path id="cp">
<fileset dir="${basedir}/main/lib" includes="**/*.jar"/>
<pathelement location="${target}/classes"/>
</path>
<!-- ===================================================================== -->
<!-- depends="update-dwr" -->
<target name="test" depends="build-testdwr" description="Run the full test suite">
<test-server name="apache-tomcat-6.0.16"/>
</target>
<!-- ===================================================================== -->
<macrodef name="test-server">
<attribute name="name"/>
<sequential>
<!-- Install the latest test war file -->
<copy file="${dwr.home}/target/ant/testdwr.war" todir="${servers}/@{name}/webapps"/>
<parallel>
<!-- Start the 2 servers -->
<selenium-proxy-start/>
<server-start name="@{name}"/>
<sequential>
<waitfor maxwait="2" maxwaitunit="minute" checkevery="100" checkeveryunit="millisecond">
<http url="http://localhost:4444/selenium-server/driver/?cmd=testComplete"/>
</waitfor>
<echo taskname="waitfor" message="Proxy server contacted on port 4444" />
<waitfor maxwait="2" maxwaitunit="minute" checkevery="100" checkeveryunit="millisecond">
<http url="http://localhost:8080/testdwr/test/dhtml.html"/>
</waitfor>
<echo taskname="waitfor" message="Web server contacted on port 8080" />
<!-- Run the actual tests -->
<!--<junit-dwr/>-->
<testng-dwr/>
<!-- Stop the servers -->
<server-stop name="@{name}"/>
<selenium-proxy-stop/>
</sequential>
</parallel>
</sequential>
</macrodef>
<!-- ===================================================================== -->
<!-- depends="prepare" -->
<target name="build-testdwr" description="Build our test suites">
<mkdir dir="${target}/classes/"/>
<javac srcdir="${basedir}/main/java" destdir="${target}/classes" debug="on" classpathref="cp"/>
</target>
<!-- ===================================================================== -->
<macrodef name="junit-dwr">
<sequential>
<mkdir dir="${target}/junit"/>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="cp"/>
<batchtest todir="${target}/junit">
<formatter type="xml"/>
<fileset dir="${basedir}/main/java">
<include name="**/*Test*.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</sequential>
</macrodef>
<!-- ===================================================================== -->
<!-- depends="prepare" -->
<target name="install-servers" description="Download Free App Servers">
<install-server name="apache-tomcat-6.0.16"/>
<install-server name="apache-tomcat-5.5.26"/>
<install-server name="jetty-6.1.9"/>
</target>
<!-- ===================================================================== -->
<target name="download-servers" description="Download Free App Servers">
<!--
You shouldn't need to do this, because we're storing them in SVN, but it
might be a decent way to document important servers to test with
-->
<get dest="${downloads}/apache-tomcat-6.0.16.zip" src="http://www.apache.org/dist/tomcat/tomcat-6/v6.0.16/bin/apache-tomcat-6.0.16.zip"/>
<get dest="${downloads}/apache-tomcat-5.5.26.zip" src="http://www.apache.org/dist/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip"/>
<get dest="${downloads}/jetty-6.1.9.zip" src="http://dist.codehaus.org/jetty/jetty-6.1.9/jetty-6.1.9.zip"/>
</target>
<!-- ===================================================================== -->
<macrodef name="install-server">
<attribute name="name"/>
<sequential>
<mkdir dir="${servers}"/>
<unzip dest="${servers}" src="${downloads}/@{name}.zip"/>
<chmod perm="755">
<fileset dir="${servers}/@{name}/bin" includes="*.sh"/>
</chmod>
</sequential>
</macrodef>
<!-- ===================================================================== -->
<macrodef name="selenium-proxy-start" description="Launches the Selenium Proxy Server">
<sequential>
<echo>Selenium Server Starting</echo>
<java jar="${basedir}/main/selenium-server/selenium-server.jar" spawn="true" fork="true" />
</sequential>
</macrodef>
<!-- ===================================================================== -->
<macrodef name="selenium-proxy-stop" description="Launches the Selenium Proxy Server">
<sequential>
<echo>Selenium Server Stopping</echo>
<get taskname="selenium-shutdown" src="http://localhost:4444/selenium-server/driver/?cmd=shutDown"
dest="${basedir}/target/shutdown-ignore.txt" ignoreerrors="true"/>
</sequential>
</macrodef>
<!-- ===================================================================== -->
<macrodef name="server-start">
<attribute name="name"/>
<sequential>
<java jar="${servers}/@{name}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${servers}/@{name}"/>
</java>
</sequential>
</macrodef>
<!-- ===================================================================== -->
<macrodef name="server-stop">
<attribute name="name"/>
<sequential>
<java jar="${servers}/@{name}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${servers}/@{name}"/>
<arg line="stop"/>
</java>
</sequential>
</macrodef>
</project>