Skip to content

Commit bda906e

Browse files
author
Ryan
committed
added test-single - allows for single classes to be tested (during dev).
1 parent 8270eb5 commit bda906e

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

build.xml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<property name="targetdir" location="target"/>
66
<property name="testdir" location="${targetdir}/test"/>
77
<dirname property="javabase" file="${java.home}"/>
8-
8+
99
<path id="classpath">
1010
<fileset dir="lib">
1111
<include name="**/*.jar"/>
@@ -40,7 +40,7 @@
4040
encoding="ISO-8859-1"
4141
memoryMaximumSize="256M"
4242
fork="true"
43-
debug="on"
43+
debug="on"
4444
includeantruntime="false">
4545

4646
<compilerarg value="-Xlint:all,-fallthrough"/>
@@ -142,21 +142,15 @@
142142
<fileset dir="docs/${version}" />
143143
</jar>
144144

145-
146-
147145
</target>
148146

149147
<target name="rebuild" depends="clean, compile"/>
150148

151149
<!-- - - - - - - - - - - - - - - - - - - - - - -->
152-
<!-- test stuff -->
150+
<!-- test targets -->
153151
<!-- - - - - - - - - - - - - - - - - - - - - - -->
154152

155-
<taskdef name="testng"
156-
classpathref="classpath"
157-
classname="org.testng.TestNGAntTask"
158-
>
159-
</taskdef>
153+
<taskdef name="testng" classpathref="classpath" classname="org.testng.TestNGAntTask" />
160154

161155
<target name="test" depends="compile">
162156
<testng classpathref="classpath" outputdir="${testdir}" listeners="com.mongodb.util.TestNGListener" haltonfailure="true" >
@@ -165,6 +159,30 @@
165159
</testng>
166160
</target>
167161

162+
<target name="test-single" depends="compile">
163+
<condition property="propsSpecified">
164+
<and>
165+
<isset property="class.name" />
166+
</and>
167+
</condition>
168+
<fail unless="propsSpecified" message="class.name roperty not specified."/>
169+
170+
<copy todir="build/test" file="testng-single.xml" overwrite="true">
171+
<filterset>
172+
<filter token="CLASS" value="${class.name}"/>
173+
</filterset>
174+
</copy>
175+
176+
<testng classpathref="classpath" outputdir="${testdir}" haltonfailure="true" verbose="1">
177+
<jvmarg value="-Xmx512M" />
178+
<xmlfileset dir="build/test" includes="testng-single.xml"/>
179+
</testng>
180+
</target>
181+
182+
<!-- - - - - - - - - - - - - - - - - - - - - - -->
183+
<!-- misc targets -->
184+
<!-- - - - - - - - - - - - - - - - - - - - - - -->
185+
168186
<target name="examples" depends="compile">
169187

170188
<javac srcdir="examples"
@@ -173,7 +191,7 @@
173191
deprecation="off"
174192
source="1.5"
175193
encoding="ISO-8859-1"
176-
debug="on"
194+
debug="on"
177195
includeantruntime="false">
178196
<classpath refid="classpath"/>
179197
</javac>
@@ -196,29 +214,34 @@
196214
deprecation="off"
197215
source="1.5"
198216
encoding="ISO-8859-1"
199-
debug="on"
217+
debug="on"
200218
includeantruntime="false">
201219
<classpath refid="classpath"/>
202220
</javac>
203221

204-
<java classname="examples.ReadOplog"
205-
fork="true">
222+
<java classname="examples.ReadOplog" fork="true">
206223
<classpath refid="classpath"/>
207224
</java>
208225

209226
</target>
210227

228+
<!-- - - - - - - - - - - - - - - - - - - - - - -->
229+
<!-- reporting targets -->
230+
<!-- - - - - - - - - - - - - - - - - - - - - - -->
231+
211232
<target name="junit-reports" depends="test">
212233
<junitreport todir="${testdir}">
213234
<fileset dir="${testdir}">
214235
<include name="*/*.xml"/>
215236
</fileset>
216-
237+
217238
<report format="noframes" todir="${testdir}"/>
218239
</junitreport>
219240
</target>
220241

221-
242+
<!-- - - - - - - - - - - - - - - - - - - - - - -->
243+
<!-- publish targets -->
244+
<!-- - - - - - - - - - - - - - - - - - - - - - -->
222245

223246
<target name="publish">
224247
<exec dir="." executable="python">

0 commit comments

Comments
 (0)