<!--/******************************************************************************* | |
* This program and the accompanying materials are made available under the | |
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 | |
* which accompanies this distribution. | |
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | |
* and the Eclipse Distribution License is available at | |
* http://www.eclipse.org/org/documents/edl-v10.php. | |
* | |
* Ant naming conventions: | |
* - regardless of the actual OS platform,'/' is the directory separator | |
* (Ant will convert as appropriate). | |
* - multi-word properties use periods '.' | |
* - properties ending in .jar define jarfile names only (no path) | |
* - properties ending in .lib are fully qualified jars (path and filename) | |
* - properties ending in .dir are directory paths | |
* - properties ending in .path are path refid names (classpath fragments) | |
* - multi-word targets use hyphens '-' | |
* - targets beginning with test- are reserved for high level test targets, | |
* and are used in test results parsing | |
* - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip) | |
* - multi-word macros use underscores '_' | |
* - multi-word macro attributes are concatenated | |
* e.g. 'runpathref' | |
* - multi-word tasks (taskdef) names are concatenated | |
* e.g. 'validateconnection' | |
* - OS environment variables are in ALLCAPS and have 'env' as a prefix | |
* e.g. ${env.XXX}. | |
* - Ant properties are lower case. | |
* | |
* Contributors: | |
* pfilion - initial API and implementation | |
#******************************************************************************/--> | |
<!-- This ant project includes the following tasks: | |
- test (default) : runs AllMappingTests | |
It requires some configuration of the build.properties and test.properties to run. | |
--> | |
<project name="eclipselink.mapping.test" default="test" basedir="."> | |
<available file="../${ant.project.name}" type="dir" property="mapping.test.is.local"/> | |
<dirname property="mapping.test.build.location_temp" file="${ant.file.eclipselink.mapping.test}"/> | |
<pathconvert targetos="unix" property="mapping.test.build.location"> | |
<path> | |
<pathelement location="${mapping.test.build.location_temp}"/> | |
</path> | |
</pathconvert> | |
<property name="env" environment="env" value="env"/> | |
<!-- Allows a user to overide certain user specific properties. --> | |
<!-- local property overrides --> | |
<condition property="custom.bld.properties.message" value="Loading user-defined overrides from '${user.home}/build.properties'..." | |
else="No user-defined overrides found to load ('${user.home}/build.properties' non-existant)."> | |
<available file="${user.home}/build.properties"/> | |
</condition> | |
<echo message="${custom.bld.properties.message}"/> | |
<property file="${user.home}/build.properties"/> | |
<condition property="custom.tst.properties.message" value="Loading user-defined test overrides from '${user.home}/test.properties'..." | |
else="No user-defined test overrides found to load ('${user.home}/test.properties' non-existant)."> | |
<available file="${user.home}/test.properties"/> | |
</condition> | |
<echo message="${custom.tst.properties.message}"/> | |
<property file="${user.home}/test.properties"/> | |
<!-- Allows overriding defaults where access to user.home isn't allowed --> | |
<condition property="custom.local.properties.message" value="Loading local overrides from '${basedir}/local.build.properties'..." | |
else="No Local overrides found to load. ('${basedir}/local.build.properties' non-existant)."> | |
<available file="${basedir}/local.build.properties"/> | |
</condition> | |
<echo message="${custom.local.properties.message}"/> | |
<property file="${basedir}/local.build.properties"/> | |
<!-- Allows override of the build location or "basedir" for specific configurations (can specifically define mapping.test.basedir) --> | |
<property name="mapping.test.basedir" value="${mapping.test.build.location}"/> | |
<property file="${mapping.test.basedir}/antbuild.properties"/> | |
<!-- Allows specific suites/configurations to override defaults and add custom test (runtime) properties --> | |
<property file="${mapping.test.basedir}/${test.properties}"/> | |
<property file="${mapping.test.basedir}/test.properties"/> | |
<property name="mapping.test.common.plugins.dir" value="${tools.root}/target"/> | |
<property name="version.qualifier" value="qualifier"/> | |
<property name="version.string" value="${release.version}.${version.qualifier}"/> | |
<echo message="ant.project.name = '${ant.project.name}'"/> | |
<echo message="mapping.test.build.location = '${mapping.test.build.location}'"/> | |
<echo message="mapping.test.base.dir = '${mapping.test.base.dir}'"/> | |
<echo message="mapping.test.common.plugins.dir = '${mapping.test.common.plugins.dir}'"/> | |
<target name="config-classpath"> | |
<config-run-path/> | |
</target> | |
<macrodef name="config-run-path"> | |
<sequential> | |
<echo message="Configuring compile.path to:"/> | |
<echo message=" '${junit.lib}'"/> | |
<echo message=" '${hamcrest.lib}'"/> | |
<echo message=" '${persistence.lib}'"/> | |
<echo message=" '${eclipselink.lib}'"/> | |
<echo message=" '${mapping.test.common.plugins.dir}/org.eclipse.persistence.tools.utility_*.jar'"/> | |
<echo message=" '${mapping.test.common.plugins.dir}/org.eclipse.persistence.tools.mapping_*.jar'"/> | |
<echo message=" '${mapping.test.common.plugins.dir}/org.eclipse.persistence.tools.mapping.tests_*.jar'"/> | |
<echo message=" "/> | |
<path id="run.classpath"> | |
<pathelement path="${junit.lib}"/> | |
<pathelement path="${hamcrest.lib}"/> | |
<pathelement path="${persistence.lib}"/> | |
<pathelement path="${eclipselink.lib}"/> | |
<fileset dir="${mapping.test.common.plugins.dir}" includes="org.eclipse.persistence.tools.utility_*.jar"/> | |
<fileset dir="${mapping.test.common.plugins.dir}" includes="org.eclipse.persistence.tools.mapping_*.jar"/> | |
<fileset dir="${mapping.test.common.plugins.dir}" includes="org.eclipse.persistence.tools.mapping.tests_*.jar"/> | |
</path> | |
</sequential> | |
</macrodef> | |
<!-- Clean all build generated content. --> | |
<target name="clean-test" description="Clean the test"> | |
<delete dir="${mapping.test.basedir}/${report.dir}"/> | |
<delete dir="${mapping.test.basedir}/${run.dir}"/> | |
<mkdir dir="${mapping.test.basedir}/${report.dir}"/> | |
<mkdir dir="${mapping.test.basedir}/${run.dir}"/> | |
</target> | |
<!-- Default test target, run the AllMappingTests --> | |
<target name="test" depends="clean-test, config-classpath"> | |
<antcall target="run-test" inheritRefs="true"> | |
<param name="TEST_CLASS" value="${test.class}"/> | |
<param name="RUN_PATH" value="run.classpath"/> | |
</antcall> | |
<antcall target="generate-report" inheritRefs="true"/> | |
</target> | |
<!-- Generic target for running tests --> | |
<target name="run-test" depends="config-classpath"> | |
<!-- Can be set e.g. in test.properties to add VM options for a particular platform/driver --> | |
<property name="additional.jvmargs" value="-Ddummy2=dummy"/> | |
<junit printsummary="yes" haltonfailure="yes" fork="yes" forkmode="once" showoutput="true" maxmemory="${max.heap.memory}" dir="${run.dir}"> | |
<jvmarg value="-Declipselink.logging.level=${logging.level}"/> | |
<jvmarg line="${additional.jvmargs}"/> | |
<classpath> | |
<path refid="${RUN_PATH}"/> | |
</classpath> | |
<formatter type="xml"/> | |
<test name="${TEST_CLASS}" haltonfailure="no" outfile="${report.dir}/${TEST_CLASS}-test-results"> | |
</test> | |
</junit> | |
</target> | |
<!-- Generate the EclipseLink Tools Mapping tests report --> | |
<target name="generate-report"> | |
<junitreport todir="${mapping.test.basedir}/${report.dir}"> | |
<fileset dir="${mapping.test.basedir}/${report.dir}"> | |
<include name="*test-results.xml"/> | |
</fileset> | |
<report format="noframes" todir="${mapping.test.basedir}/${report.dir}"/> | |
</junitreport> | |
</target> | |
</project> |