| 1864 |
gzemunik |
1 |
<project name="ant-junitee">
|
|
|
2 |
|
|
|
3 |
<description>
|
|
|
4 |
Example usage:
|
|
|
5 |
<!--
|
| 1868 |
egunawan |
6 |
<run-junitee-tests jar="myejb.jar" appxml="${basedir}/src/etc/application.xml" testserver="mytestserver">
|
| 1864 |
gzemunik |
7 |
<junitee-war>
|
|
|
8 |
<classes dir="${basedir}/build/classes/test">
|
|
|
9 |
<include name="**/*Test.class"/>
|
|
|
10 |
</classes>
|
|
|
11 |
<testcases dir="${basedir}/build/classes/test">
|
|
|
12 |
<include name="**/*Test.class"/>
|
|
|
13 |
</testcases>
|
|
|
14 |
</junitee-war>
|
|
|
15 |
</run-junitee-tests>
|
|
|
16 |
-->
|
|
|
17 |
|
|
|
18 |
</description>
|
| 1868 |
egunawan |
19 |
|
| 1864 |
gzemunik |
20 |
<!-- Note: The following are from jakarta-cactus 13.1.7.cots. This section needs to
|
| 1868 |
egunawan |
21 |
be kept up to date with the associated version of jakarta-cactus -->
|
|
|
22 |
<taskdef resource="cactus.tasks">
|
|
|
23 |
<classpath>
|
|
|
24 |
<pathelement location="${using.jakarta-cactus.basedir}/jar/cactus-1.7.jar"/>
|
|
|
25 |
<pathelement location="${using.jakarta-cactus.basedir}/jar/cactus-ant-1.7.jar"/>
|
|
|
26 |
<pathelement location="${using.jakarta-cactus.basedir}/jar/commons-httpclient-2.0.2.jar"/>
|
|
|
27 |
<pathelement location="${using.jakarta-cactus.basedir}/jar/commons-logging-1.0.4.jar"/>
|
|
|
28 |
<pathelement location="${using.jakarta-cactus.basedir}/jar/aspectjrt-1.2.1.jar"/>
|
|
|
29 |
<pathelement location="${using.junit.basedir}/jar/junit.jar"/>
|
|
|
30 |
<pathelement location="${using.ant-junit.basedir}/jar/ant-junit.jar"/>
|
|
|
31 |
</classpath>
|
| 1864 |
gzemunik |
32 |
</taskdef>
|
| 1868 |
egunawan |
33 |
|
| 1864 |
gzemunik |
34 |
<taskdef name="junitee" classname="org.junitee.anttask.JUnitEETask">
|
|
|
35 |
<classpath>
|
|
|
36 |
<pathelement location="${using.junitee.basedir}/jar/junitee-anttask.jar"/>
|
|
|
37 |
</classpath>
|
|
|
38 |
</taskdef>
|
|
|
39 |
|
|
|
40 |
<taskdef name="juniteewar" classname="org.junitee.anttask.JUnitEEWarTask">
|
|
|
41 |
<classpath>
|
|
|
42 |
<pathelement location="${using.junitee.basedir}/jar/junitee-anttask.jar"/>
|
|
|
43 |
</classpath>
|
|
|
44 |
</taskdef>
|
|
|
45 |
|
|
|
46 |
<macrodef name="run-junitee-tests">
|
|
|
47 |
|
| 1866 |
egunawan |
48 |
<attribute name="jar" default="${ant.project.name}.jar"/>
|
|
|
49 |
<attribute name="war" default="unit-test.war"/>
|
|
|
50 |
<attribute name="appxml" default="${basedir}/src/etc/application.xml"/>
|
| 1868 |
egunawan |
51 |
<attribute name="testserver" default="${ant.project.name}"/>
|
| 1864 |
gzemunik |
52 |
<element name="junitee-war"/>
|
| 1866 |
egunawan |
53 |
<element name="dependencies" optional="true"/>
|
| 1864 |
gzemunik |
54 |
|
|
|
55 |
<sequential>
|
|
|
56 |
|
|
|
57 |
<mkdir dir="${basedir}/build/jar"/>
|
|
|
58 |
|
| 1866 |
egunawan |
59 |
<juniteewar destFile="${basedir}/build/jar/@{war}">
|
| 1864 |
gzemunik |
60 |
<lib dir="${using.junitee.basedir}/jar" includes="junitee.jar"/>
|
|
|
61 |
<lib dir="${using.junit.basedir}/jar" includes="junit.jar"/>
|
|
|
62 |
<junitee-war/>
|
|
|
63 |
</juniteewar>
|
|
|
64 |
|
|
|
65 |
<ear destfile="${basedir}/build/jar/${ant.project.name}-junitee.ear" appxml="@{appxml}">
|
|
|
66 |
<fileset dir="${basedir}/build/pkg/jar">
|
|
|
67 |
<include name="@{jar}" />
|
|
|
68 |
</fileset>
|
|
|
69 |
<fileset dir="${basedir}/build/jar">
|
| 1866 |
egunawan |
70 |
<include name="@{war}" />
|
| 1864 |
gzemunik |
71 |
</fileset>
|
|
|
72 |
<dependencies/>
|
|
|
73 |
</ear>
|
|
|
74 |
|
|
|
75 |
<!-- This is the trick bit. If you just use antcall to -runservertests, it will complain that -junitee-deploy does not exist in the project.
|
|
|
76 |
- If you explicitly import this file from the main build file after using, then it will work, but just relying on the import done in the
|
|
|
77 |
- using ant-junitee call will not. Go figure?
|
|
|
78 |
-->
|
|
|
79 |
<ant antfile = "${using.ant-junitee.basedir}/ant-junitee.xml"
|
|
|
80 |
dir = "${basedir}"
|
|
|
81 |
target = "-runservertests"
|
|
|
82 |
inheritAll = "false"
|
|
|
83 |
inheritRefs = "false">
|
|
|
84 |
|
|
|
85 |
<reference refid = "using.junitee.path"/>
|
|
|
86 |
<reference refid = "using.jakarta-cactus.path"/>
|
| 1868 |
egunawan |
87 |
<property name = "using.junitee.basedir" value="${using.junitee.basedir}"/>
|
|
|
88 |
<property name = "test.project.name" value="${ant.project.name}"/>
|
|
|
89 |
<property name = "test.server" value="@{testserver}"/>
|
|
|
90 |
<property name = "env" environment="env" value="env"/>
|
| 1864 |
gzemunik |
91 |
|
|
|
92 |
</ant>
|
|
|
93 |
|
|
|
94 |
</sequential>
|
|
|
95 |
</macrodef>
|
|
|
96 |
|
|
|
97 |
<target name="-runservertests">
|
|
|
98 |
<runservertests testURL="http://${env.COMPUTERNAME}:8080/unit-test/TestServlet"
|
|
|
99 |
startTarget = "-junitee-deploy"
|
|
|
100 |
stopTarget = "-junitee-undeploy"
|
|
|
101 |
testTarget = "-junitee-run" />
|
|
|
102 |
</target>
|
|
|
103 |
|
|
|
104 |
<!--
|
|
|
105 |
- Start unit test deployment
|
|
|
106 |
-->
|
|
|
107 |
<target name="-junitee-deploy">
|
|
|
108 |
<echo message="DEPLOYING: ${deployment.filename}"/>
|
|
|
109 |
<echo message="DEPLOYING TO: ${deployment.location}"/>
|
|
|
110 |
<copy file="${basedir}/build/jar/${test.project.name}-junitee.ear"
|
| 1868 |
egunawan |
111 |
todir="${env.JBOSS_HOME}/server/${test.server}/deploy"/>
|
| 1864 |
gzemunik |
112 |
|
|
|
113 |
<java jar="${env.JBOSS_HOME}/bin/run.jar" fork="true" taskname="jboss">
|
|
|
114 |
<arg value="-c" />
|
| 1868 |
egunawan |
115 |
<arg value="${test.server}" />
|
| 1864 |
gzemunik |
116 |
</java>
|
|
|
117 |
</target>
|
|
|
118 |
|
|
|
119 |
<!--
|
|
|
120 |
- Stop unit test deployment
|
|
|
121 |
-->
|
|
|
122 |
<target name="-junitee-undeploy">
|
|
|
123 |
|
| 1868 |
egunawan |
124 |
<echo message="Undeploying ${env.JBOSS_HOME}/server/${test.server}/deploy/${test.project.name}-junitee.ear"/>
|
|
|
125 |
<delete file="${env.JBOSS_HOME}/server/${test.server}/deploy/${test.project.name}-junitee.ear"/>
|
| 1864 |
gzemunik |
126 |
|
|
|
127 |
<!-- This doesn't quite work yet...
|
|
|
128 |
<java jar="${env.JBOSS_HOME}/bin/shutdown.jar" fork="true">
|
|
|
129 |
<arg value="-s localhost"/>
|
|
|
130 |
<classpath>
|
|
|
131 |
<pathelement location="${env.JBOSS_HOME}/client/jnet.jar"/>
|
|
|
132 |
</classpath>
|
|
|
133 |
</java-->
|
|
|
134 |
</target>
|
|
|
135 |
|
|
|
136 |
<!--
|
|
|
137 |
- Run server-side unit tests
|
|
|
138 |
-->
|
|
|
139 |
<target name="-junitee-run">
|
|
|
140 |
|
|
|
141 |
<delete dir="${basedir}/build/junit"/>
|
|
|
142 |
|
|
|
143 |
<mkdir dir="${basedir}/build/junit"/>
|
|
|
144 |
|
|
|
145 |
<echo message="Running Unit tests.... Please wait....."/>
|
|
|
146 |
<junitee url="http://${env.COMPUTERNAME}:8080/unit-test/TestServlet" printsummary="true">
|
|
|
147 |
<formatter type="xml"/>
|
|
|
148 |
<test runall="true" todir="${basedir}/build/junit"/>
|
|
|
149 |
</junitee>
|
|
|
150 |
</target>
|
|
|
151 |
|
|
|
152 |
</project>
|