| <!--/******************************************************************************* | |
| * 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 CommonUtilityTests | |
| It requires some configuration of the build.properties and test.properties to run. | |
| --> | |
| <project name="eclipselink.utility.test" default="test" basedir="."> | |
| <available file="../${ant.project.name}" type="dir" property="utility.test.is.local"/> | |
| <dirname property="utility.test.build.location_temp" file="${ant.file.eclipselink.utility.test}"/> | |
| <pathconvert targetos="unix" property="utility.test.build.location"> | |
| <path> | |
| <pathelement location="${utility.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 utility.test.basedir) --> | |
| <property name="utility.test.basedir" value="${utility.test.build.location}"/> | |
| <property file="${utility.test.basedir}/antbuild.properties"/> | |
| <!-- Allows specific suites/configurations to override defaults and add custom test (runtime) properties --> | |
| <property file="${utility.test.basedir}/${test.properties}"/> | |
| <property file="${utility.test.basedir}/test.properties"/> | |
| <property name="utility.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="utility.test.build.location = '${utility.test.build.location}'"/> | |
| <echo message="utility.test.base.dir = '${utility.test.base.dir}'"/> | |
| <echo message="utility.test.common.plugins.dir = '${utility.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=" '${utility.test.common.plugins.dir}/org.eclipse.persistence.tools.utility_*.jar'"/> | |
| <echo message=" '${utility.test.common.plugins.dir}/org.eclipse.persistence.tools.utility.tests_*.jar'"/> | |
| <echo message=" "/> | |
| <path id="run.classpath"> | |
| <pathelement path="${junit.lib}"/> | |
| <pathelement path="${hamcrest.lib}"/> | |
| <fileset dir="${utility.test.common.plugins.dir}" includes="org.eclipse.persistence.tools.utility_*.jar"/> | |
| <fileset dir="${utility.test.common.plugins.dir}" includes="org.eclipse.persistence.tools.utility.tests_*.jar"/> | |
| </path> | |
| </sequential> | |
| </macrodef> | |
| <!-- Clean all build generated content. --> | |
| <target name="clean-test" description="Clean the test"> | |
| <delete dir="${utility.test.basedir}/${report.dir}"/> | |
| <delete dir="${utility.test.basedir}/${run.dir}"/> | |
| <mkdir dir="${utility.test.basedir}/${report.dir}"/> | |
| <mkdir dir="${utility.test.basedir}/${run.dir}"/> | |
| </target> | |
| <!-- Default test target, run the CommonUtilityTests --> | |
| <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 Utility tests report --> | |
| <target name="generate-report"> | |
| <junitreport todir="${utility.test.basedir}/${report.dir}"> | |
| <fileset dir="${utility.test.basedir}/${report.dir}"> | |
| <include name="*test-results.xml"/> | |
| </fileset> | |
| <report format="noframes" todir="${utility.test.basedir}/${report.dir}"/> | |
| </junitreport> | |
| </target> | |
| </project> |