blob: 24b308b43e9331a80cbfb4d569f37edb0d2118a9 [file] [log] [blame]
cowtowncoder6b87a692009-12-01 03:15:28 +00001<?xml version="1.0" standalone='yes'?>
2<!-- This Ant build file fragment contains targets needed
3 to run unit tests
4 -->
5
6<project name="Jackson Unit tests" basedir=".">
7 <!-- Source directories -->
8 <property name="dir.src.test" location="${dir.src}/test" />
9 <!-- some support for perf testing -->
10 <property name="dir.build.classes.perf" location="${dir.build}/classes/perf" />
11 <!-- Unit Tests -->
12 <property name="dir.test" location="${basedir}/test" />
13 <property name="dir.test.classes" location="${dir.test}/classes" />
14 <property name="dir.test.results" location="${dir.test}/results" />
15 <property name="dir.test.xmlresults" location="${dir.test.results}/xml" />
16
17 <path id="test-libs">
18 <fileset dir="${dir.lib}">
19 <!-- for actual unit testing, junit -->
20 <include name="junit/*.jar" />
21 </fileset>
22 </path>
23 <!-- Libs only needed for tests that check optional interoperability
24 extensions
25 -->
26 <path id="test-libs-ext">
27 <fileset dir="${dir.lib}">
28 <!-- For 1.5, need JAXB API jar too (and related) -->
29 <include name="jaxb/*.jar" />
30 <!-- and some other misc libs for interoperability tests -->
31 <include name="ext/**/*.jar" />
32 </fileset>
33 </path>
34
35 <target name="test.prepare">
36 <!-- make test output directories -->
37 <mkdir dir="${dir.test}" />
38 <mkdir dir="${dir.test.classes}" />
39 <mkdir dir="${dir.test.results}" />
40 <mkdir dir="${dir.test.xmlresults}" />
41 </target>
42
43 <!--*********************************************************************-->
44 <!-- Tasks from here down are in support of junit tests. -->
45 <!--*********************************************************************-->
46 <target name="all-tests" depends="test" />
47
48 <!-- Compiling and running test cases
49 -->
50
cowtowncoder181ab0a2010-07-20 19:35:47 +000051 <target name="test.compile" depends="test.prepare, compile.mapper,
52compile.xc, compile.jaxrs, compile.smile, compile.mrbean">
cowtowncoder6b87a692009-12-01 03:15:28 +000053 <javac srcdir="${dir.src.test}" destdir="${dir.test.classes}"
54 source="1.5" target="1.5"
cowtowncoder6c00d662010-10-30 21:56:16 +000055 debug="true" includeantruntime="false"
cowtowncoder6b87a692009-12-01 03:15:28 +000056 >
cowtowncoder137ac3a2010-10-06 20:16:20 +000057 <exclude name="org/codehaus/jackson/map/ext/*.java" />
cowtowncoder6b87a692009-12-01 03:15:28 +000058 <exclude name="org/codehaus/jackson/map/interop/*.java" />
59 <include name="**/*.java" />
60 <classpath>
61 <pathelement path="${dir.build.classes.core}"/>
62 <pathelement path="${dir.build.classes.mapper}"/>
63 <pathelement path="${dir.build.classes.jaxrs}"/>
64 <pathelement path="${dir.build.classes.xc}"/>
cowtowncoder181ab0a2010-07-20 19:35:47 +000065 <pathelement path="${dir.build.classes.smile}"/>
cowtowncoder15f6b7f2010-07-16 15:34:30 +000066 <pathelement path="${dir.build.classes.mrbean}"/>
cowtowncoder6b87a692009-12-01 03:15:28 +000067 <path refid="test-libs"/>
68 <fileset dir="${dir.lib}/jaxrs">
69 <include name="*.jar" />
70 </fileset>
71 </classpath>
72 </javac>
73 <javac srcdir="${dir.src.test}" destdir="${dir.test.classes}"
74 source="1.5" target="1.5"
cowtowncoder6c00d662010-10-30 21:56:16 +000075 debug="true" includeantruntime="false"
cowtowncoder6b87a692009-12-01 03:15:28 +000076 >
cowtowncoder137ac3a2010-10-06 20:16:20 +000077 <include name="org/codehaus/jackson/map/ext/*.java" />
cowtowncoder6b87a692009-12-01 03:15:28 +000078 <include name="org/codehaus/jackson/map/interop/*.java" />
79 <classpath>
80 <pathelement path="${dir.build.classes.core}"/>
81 <pathelement path="${dir.build.classes.mapper}"/>
82 <path refid="test-libs"/>
83 <path refid="test-libs-ext"/>
84 </classpath>
85 </javac>
86 </target>
87
88
89 <target name="test" depends="test.run">
90 <junitreport todir="${dir.test.results}">
91 <fileset dir="${dir.test.xmlresults}">
92 <include name="TEST-*.xml" />
93 </fileset>
94 <report todir="${dir.test.results}" />
95 </junitreport>
96 </target>
97
cowtowncoder76c7aa12010-09-02 06:03:25 +000098 <target name="test.run" depends="test.run.main, test.run.interop, test.run.jaxrs, test.run.versions"
99 />
100 <target name="test.run.main" depends="test.compile">
cowtowncoder6b87a692009-12-01 03:15:28 +0000101 <!-- showoutput 'yes' to allow outputting debug msgs... -->
cowtowncoder76c7aa12010-09-02 06:03:25 +0000102 <junit fork="no" printsummary="yes" haltonfailure="no" showoutput="yes">
103 <sysproperty key="FROM_ANT" value="true"/>
cowtowncoderfd978812010-08-14 22:06:46 +0000104 <batchtest fork="no" todir="${dir.test.xmlresults}">
cowtowncoder6b87a692009-12-01 03:15:28 +0000105 <fileset dir="${dir.test.classes}">
106 <!-- Need to exclude inner classes... -->
107 <exclude name="**/*$*.class"/>
108 <!-- and also interop tests, run later on -->
109 <exclude name="org/codehaus/jackson/jaxrs/*.class"/>
cowtowncoder137ac3a2010-10-06 20:16:20 +0000110 <exclude name="org/codehaus/jackson/map/ext/Test*.class"/>
cowtowncoder6b87a692009-12-01 03:15:28 +0000111 <exclude name="org/codehaus/jackson/map/interop/Test*.class"/>
cowtowncoder027ee282010-09-07 03:09:21 +0000112 <exclude name="org/codehaus/jackson/version/*.class"/>
cowtowncoder6b87a692009-12-01 03:15:28 +0000113 <include name="**/Test*.class"/>
114 </fileset>
115 </batchtest>
116 <formatter type="xml" />
117 <classpath>
118 <pathelement path="${dir.build.classes.core}" />
119 <pathelement path="${dir.build.classes.mapper}" />
120 <pathelement path="${dir.build.classes.xc}" />
cowtowncoder181ab0a2010-07-20 19:35:47 +0000121 <pathelement path="${dir.build.classes.smile}" />
cowtowncoder49ffe762010-07-20 07:10:01 +0000122 <pathelement path="${dir.build.classes.mrbean}" />
cowtowncoder6b87a692009-12-01 03:15:28 +0000123 <pathelement location="${dir.test.classes}" />
124 <path refid="test-libs"/>
125 </classpath>
126 </junit>
cowtowncoder76c7aa12010-09-02 06:03:25 +0000127 </target>
cowtowncoder6b87a692009-12-01 03:15:28 +0000128
cowtowncoder76c7aa12010-09-02 06:03:25 +0000129 <target name="test.run.interop" depends="test.compile">
cowtowncoder6b87a692009-12-01 03:15:28 +0000130 <!-- for interop tests, yes, we need to fork (classloading issues) -->
131 <junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
132 <batchtest fork="no" todir="${dir.test.xmlresults}">
133 <fileset dir="${dir.test.classes}">
134 <exclude name="**/*$*.class"/>
cowtowncoder137ac3a2010-10-06 20:16:20 +0000135 <include name="org/codehaus/jackson/map/ext/Test*.class"/>
cowtowncoder6b87a692009-12-01 03:15:28 +0000136 <!-- 25-Nov-2009, tatu: Argh. Looks like classloading
137 is problematic for this test; works when run
138 separately as single test... but not in sequence
139 -->
140 <exclude name="org/codehaus/jackson/map/interop/TestHibernate.class"/>
141 <include name="org/codehaus/jackson/map/interop/Test*.class"/>
142 </fileset>
143 </batchtest>
144 <formatter type="xml" />
145 <classpath>
146 <pathelement path="${dir.build.classes.core}" />
147 <pathelement path="${dir.build.classes.mapper}" />
148 <pathelement location="${dir.test.classes}" />
149 <path refid="test-libs"/>
150 <path refid="test-libs-ext"/>
151 </classpath>
152 </junit>
cowtowncoder76c7aa12010-09-02 06:03:25 +0000153 </target>
154
155 <target name="test.run.jaxrs" depends="test.compile">
cowtowncoder6b87a692009-12-01 03:15:28 +0000156 <!-- And finally, minimal testing for jax-rs too -->
157 <junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
158 <batchtest fork="no" todir="${dir.test.xmlresults}">
159 <fileset dir="${dir.test.classes}">
160 <exclude name="**/*$*.class"/>
161 <include name="org/codehaus/jackson/jaxrs/*.class"/>
162 </fileset>
163 </batchtest>
164 <formatter type="xml" />
165 <classpath>
166 <pathelement path="${dir.build.classes.core}" />
167 <pathelement path="${dir.build.classes.mapper}" />
168 <pathelement path="${dir.build.classes.jaxrs}" />
169 <pathelement location="${dir.test.classes}" />
170 <path refid="test-libs"/>
171 <fileset dir="${dir.lib}/jaxrs">
172 <include name="*.jar" />
173 </fileset>
174 </classpath>
175 </junit>
176 </target>
177
cowtowncoder76c7aa12010-09-02 06:03:25 +0000178 <target name="test.run.versions" depends="test.compile">
179 <junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
180 <batchtest fork="no" todir="${dir.test.xmlresults}">
181 <fileset dir="${dir.test.classes}">
182 <include name="org/codehaus/jackson/version/*.class"/>
183 </fileset>
184 </batchtest>
185 <formatter type="xml" />
186 <classpath>
187 <pathelement path="${dir.build.classes.core}" />
188 <pathelement path="${dir.build.classes.mapper}" />
189 <pathelement path="${dir.build.classes.jaxrs}" />
190 <pathelement path="${dir.build.classes.xc}" />
191 <pathelement path="${dir.build.classes.mrbean}" />
192 <pathelement path="${dir.build.classes.smile}" />
193 <pathelement location="${dir.test.classes}" />
194 <path refid="test-libs"/>
195 <fileset dir="${dir.lib}/jaxrs">
196 <include name="*.jar" />
197 </fileset>
198 </classpath>
199 </junit>
200 </target>
201
cowtowncoder6b87a692009-12-01 03:15:28 +0000202 <!-- Running a single Unit Test -->
203 <target name="test.single" depends="test.compile">
204 <fail unless="test" message="Must define -Dtest" />
205 <!-- showoutput 'yes' to allow outputting debug msgs... -->
cowtowncoder34e5cfd2010-04-09 20:26:39 +0000206 <!-- 09-Apr-2010, tatu: Looks like we must fork, otherwise there may be
207 issues with junit version?
208 -->
209 <junit fork="yes" maxmemory="128M" showoutput="yes" printsummary="yes">
cowtowncoder76c7aa12010-09-02 06:03:25 +0000210 <sysproperty key="FROM_ANT" value="true"/>
cowtowncoder6b87a692009-12-01 03:15:28 +0000211 <formatter type="plain" usefile="no" />
212 <test name="${test}" />
213 <classpath>
214 <pathelement path="${dir.build.classes.core}" />
215 <pathelement path="${dir.build.classes.mapper}" />
cowtowncoder6b87a692009-12-01 03:15:28 +0000216 <pathelement path="${dir.build.classes.xc}" />
cowtowncoder6b87a692009-12-01 03:15:28 +0000217 <pathelement path="${dir.build.classes.jaxrs}" />
cowtowncoder181ab0a2010-07-20 19:35:47 +0000218 <pathelement path="${dir.build.classes.smile}" />
219 <pathelement path="${dir.build.classes.mrbean}" />
cowtowncoder6b87a692009-12-01 03:15:28 +0000220 <pathelement location="${dir.test.classes}" />
221 <path refid="test-libs"/>
222 <path refid="test-libs-ext"/>
223 <fileset dir="${dir.lib}/jaxrs">
224 <include name="*.jar" />
225 </fileset>
226 </classpath>
227 </junit>
228 </target>
229
230</project>