<?xml version="1.0" encoding="UTF-8"?>
<project name="org.springframework.test" xmlns:ivy="antlib:org.apache.ivy.ant">

	<property file="${basedir}/../build.properties"/>
	<property file="${basedir}/../build.versions"/>

	<import file="${basedir}/../build-spring-framework/package-bundle.xml"/>
	<import file="${basedir}/../spring-build/standard/default.xml"/>

<!-- Macros -->
	<macrodef name="test-run">
		<attribute name="classpath.id"/>
		<sequential>

			<condition property="test.halt" value="false" else="true">
				<istrue value="${ci.build}"/>
			</condition>
			<mkdir dir="${test-results.output.dir}/xml"/>
			<junit forkmode="perBatch" dir="${basedir}" haltonerror="${test.halt}" haltonfailure="${test.halt}">
				<jvmarg line="${test.vm.args}"/>
				<syspropertyset>
					<propertyref builtin="commandline"/>
				</syspropertyset>
				<classpath refid="@{classpath.id}"/>
				<test fork="yes" todir="${test-results.output.dir}/xml" name="${testcase}" if="testcase"/>
				<batchtest fork="yes" todir="${test-results.output.dir}/xml" unless="testcase">
					<fileset dir="${test.output.dir}" includes="**/*Test.class,**/*Tests.class"
						excludes="**/Abstract*.class,**/*TestNG*.class"/>
				</batchtest>
				<formatter type="brief" usefile="false"/>
				<formatter type="xml"/>
			</junit>

			<ivy:cachepath resolveId="testng.classpath" pathid="testng.classpath" organisation="org.testng"
					module="com.springsource.org.testng" revision="${org.testng.version}"
					conf="runtime" type="jar" inline="true" log="download-only"/>
			<taskdef name="testng" classpathref="testng.classpath" classname="org.testng.TestNGAntTask" />
			<mkdir dir="${test-results.output.dir}/testng"/>
			<testng outputdir="${test-results.output.dir}/testng" haltonfailure="true" haltonskipped="true" verbose="2">
				<jvmarg line="-Djava.awt.headless=true -Xmx256m -XX:MaxPermSize=128m"/>
				<classpath refid="@{classpath.id}"/>
				<classfileset dir="${test.output.dir}" includes="**/testng/**/*Tests.class" excludes="**/Abstract*" />
			</testng>

		</sequential>
	</macrodef>

</project>
