blob: 78736922448b6e2f9c14afd78108ffcc16fff5d2 [file] [log] [blame]
<?xml version="1.0" standalone='yes'?>
<!-- This Ant build file fragment contains targets needed
to run unit tests
-->
<project name="Jackson Unit tests" basedir=".">
<!-- Source directories -->
<property name="dir.src.test" location="${dir.src}/test" />
<!-- some support for perf testing -->
<property name="dir.build.classes.perf" location="${dir.build}/classes/perf" />
<!-- Unit Tests -->
<property name="dir.test" location="${basedir}/test" />
<property name="dir.test.classes" location="${dir.test}/classes" />
<property name="dir.test.results" location="${dir.test}/results" />
<property name="dir.test.xmlresults" location="${dir.test.results}/xml" />
<path id="test-libs">
<fileset dir="${dir.lib}">
<!-- for actual unit testing, junit -->
<include name="junit/*.jar" />
</fileset>
</path>
<!-- Libs only needed for tests that check optional interoperability
extensions
-->
<path id="test-libs-ext">
<fileset dir="${dir.lib}">
<!-- For 1.5, need JAXB API jar too (and related) -->
<include name="jaxb/*.jar" />
<!-- and some other misc libs for interoperability tests -->
<include name="ext/**/*.jar" />
</fileset>
</path>
<target name="test.prepare">
<!-- make test output directories -->
<mkdir dir="${dir.test}" />
<mkdir dir="${dir.test.classes}" />
<mkdir dir="${dir.test.results}" />
<mkdir dir="${dir.test.xmlresults}" />
</target>
<!--*********************************************************************-->
<!-- Tasks from here down are in support of junit tests. -->
<!--*********************************************************************-->
<target name="all-tests" depends="test" />
<!-- Compiling and running test cases
-->
<target name="test.compile" depends="test.prepare, compile.mapper,
compile.xc, compile.jaxrs, compile.smile, compile.mrbean">
<javac srcdir="${dir.src.test}" destdir="${dir.test.classes}"
source="1.5" target="1.5"
debug="true" includeantruntime="false"
>
<exclude name="org/codehaus/jackson/map/ext/*.java" />
<exclude name="org/codehaus/jackson/map/interop/*.java" />
<include name="**/*.java" />
<classpath>
<pathelement path="${dir.build.classes.core}"/>
<pathelement path="${dir.build.classes.mapper}"/>
<pathelement path="${dir.build.classes.jaxrs}"/>
<pathelement path="${dir.build.classes.xc}"/>
<pathelement path="${dir.build.classes.smile}"/>
<pathelement path="${dir.build.classes.mrbean}"/>
<path refid="test-libs"/>
<fileset dir="${dir.lib}/jaxrs">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
<javac srcdir="${dir.src.test}" destdir="${dir.test.classes}"
source="1.5" target="1.5"
debug="true" includeantruntime="false"
>
<include name="org/codehaus/jackson/map/ext/*.java" />
<include name="org/codehaus/jackson/map/interop/*.java" />
<classpath>
<pathelement path="${dir.build.classes.core}"/>
<pathelement path="${dir.build.classes.mapper}"/>
<path refid="test-libs"/>
<path refid="test-libs-ext"/>
</classpath>
</javac>
</target>
<target name="test" depends="test.run">
<junitreport todir="${dir.test.results}">
<fileset dir="${dir.test.xmlresults}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${dir.test.results}" />
</junitreport>
</target>
<target name="test.run" depends="test.run.main,
test.run.interop, test.run.jaxrs, test.run.failing, test.run.versions"
/>
<target name="test.run.main" depends="test.compile">
<!-- showoutput 'yes' to allow outputting debug msgs... -->
<junit fork="no" printsummary="yes" haltonfailure="no" showoutput="yes">
<batchtest fork="no" todir="${dir.test.xmlresults}">
<fileset dir="${dir.test.classes}">
<!-- Need to exclude inner classes... -->
<exclude name="**/*$*.class"/>
<!-- and also interop tests, run later on -->
<exclude name="org/codehaus/jackson/jaxrs/*.class"/>
<exclude name="org/codehaus/jackson/failing/*.class"/>
<exclude name="org/codehaus/jackson/map/ext/Test*.class"/>
<exclude name="org/codehaus/jackson/map/interop/Test*.class"/>
<exclude name="org/codehaus/jackson/version/*.class"/>
<include name="**/Test*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath>
<pathelement path="${dir.build.classes.core}" />
<pathelement path="${dir.build.classes.mapper}" />
<pathelement path="${dir.build.classes.xc}" />
<pathelement path="${dir.build.classes.smile}" />
<pathelement path="${dir.build.classes.mrbean}" />
<pathelement location="${dir.test.classes}" />
<path refid="test-libs"/>
</classpath>
</junit>
</target>
<target name="test.run.interop" depends="test.compile">
<!-- for interop tests, yes, we need to fork (classloading issues) -->
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
<batchtest fork="no" todir="${dir.test.xmlresults}">
<fileset dir="${dir.test.classes}">
<exclude name="**/*$*.class"/>
<!-- 25-Nov-2009, tatu: Argh. Looks like classloading
is problematic for this test; works when run
separately as single test... but not in sequence
-->
<exclude name="org/codehaus/jackson/map/interop/TestHibernate.class"/>
<include name="org/codehaus/jackson/map/interop/Test*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath>
<pathelement path="${dir.build.classes.core}" />
<pathelement path="${dir.build.classes.mapper}" />
<pathelement location="${dir.test.classes}" />
<path refid="test-libs"/>
<path refid="test-libs-ext"/>
</classpath>
</junit>
</target>
<target name="test.run.jaxrs" depends="test.compile">
<!-- And finally, minimal testing for jax-rs too -->
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
<batchtest fork="no" todir="${dir.test.xmlresults}">
<fileset dir="${dir.test.classes}">
<exclude name="**/*$*.class"/>
<include name="org/codehaus/jackson/jaxrs/*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath>
<pathelement path="${dir.build.classes.core}" />
<pathelement path="${dir.build.classes.mapper}" />
<pathelement path="${dir.build.classes.jaxrs}" />
<pathelement path="${dir.build.classes.xc}" />
<pathelement location="${dir.test.classes}" />
<path refid="test-libs"/>
<fileset dir="${dir.lib}/jaxrs">
<include name="*.jar" />
</fileset>
</classpath>
</junit>
</target>
<!-- failing tests run during dev, disabled for maintenance versions -->
<target name="test.run.failing" depends="test.compile">
<!--
<junit fork="no" printsummary="yes" haltonfailure="no" showoutput="yes">
<batchtest fork="no" todir="${dir.test.xmlresults}">
<fileset dir="${dir.test.classes}">
<exclude name="**/*$*.class"/>
<include name="org/codehaus/jackson/failing/Test*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath>
<pathelement path="${dir.build.classes.core}" />
<pathelement path="${dir.build.classes.mapper}" />
<pathelement path="${dir.build.classes.mrbean}" />
<pathelement path="${dir.build.classes.jaxrs}" />
<pathelement path="${dir.build.classes.xc}" />
<pathelement location="${dir.test.classes}" />
<path refid="test-libs"/>
<path refid="test-libs-ext"/>
<fileset dir="${dir.lib}/jaxrs">
<include name="*.jar" />
</fileset>
</classpath>
</junit>
-->
</target>
<target name="test.run.versions" depends="test.compile">
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="FROM_ANT" value="true"/>
<batchtest fork="no" todir="${dir.test.xmlresults}">
<fileset dir="${dir.test.classes}">
<include name="org/codehaus/jackson/version/*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath>
<pathelement path="${dir.build.classes.core}" />
<pathelement path="${dir.build.classes.mapper}" />
<pathelement path="${dir.build.classes.jaxrs}" />
<pathelement path="${dir.build.classes.xc}" />
<pathelement path="${dir.build.classes.mrbean}" />
<pathelement path="${dir.build.classes.smile}" />
<pathelement location="${dir.test.classes}" />
<path refid="test-libs"/>
<fileset dir="${dir.lib}/jaxrs">
<include name="*.jar" />
</fileset>
</classpath>
</junit>
</target>
<!-- Running a single Unit Test -->
<target name="test.single" depends="test.compile">
<fail unless="test" message="Must define -Dtest" />
<!-- showoutput 'yes' to allow outputting debug msgs... -->
<!-- 09-Apr-2010, tatu: Looks like we must fork, otherwise there may be
issues with junit version?
-->
<junit fork="yes" maxmemory="128M" showoutput="yes" printsummary="yes">
<sysproperty key="FROM_ANT" value="true"/>
<formatter type="plain" usefile="no" />
<test name="${test}" />
<classpath>
<pathelement path="${dir.build.classes.core}" />
<pathelement path="${dir.build.classes.mapper}" />
<pathelement path="${dir.build.classes.xc}" />
<pathelement path="${dir.build.classes.jaxrs}" />
<pathelement path="${dir.build.classes.smile}" />
<pathelement path="${dir.build.classes.mrbean}" />
<pathelement location="${dir.test.classes}" />
<path refid="test-libs"/>
<path refid="test-libs-ext"/>
<fileset dir="${dir.lib}/jaxrs">
<include name="*.jar" />
</fileset>
</classpath>
</junit>
</target>
</project>