blob: ee85c74a49921b44f4f9c5704d1bd363d416158b [file] [log] [blame]
<!--/*******************************************************************************
* 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:
* bdoughan, dtwelves, egwin - initial API and implementation from SDO test project
* tware - modified for jpa rs tests
* Dmitry Kornilov - remoteDebug property added
* Tomas Kraus - JPA RS jUnit tests for Java EE with WebLogic
* Dmitry Kornilov - Jersey 2.0 & dependencies
#******************************************************************************/-->
<!-- This ant project includes the following tasks:
- test (default) : Run JPA RS jUnit tests for Java SE
- test-javaee : Run JPA RS jUnit tests for Java EE
- build : Compile all JPA RS jUnit tests
- build-against-jar : Compile all JPA RS jUnit tests against external eclipselink.jar
- clean : Clean all build generated content
- create-war : Create WAR file to deploy for Java EE jUnit tests
- server-install : Create Java EE server domain for tests
- server-start : Start Java EE server domain for tests
- server-stop : Stop Java EE server domain for tests
- server-setup : Set Java EE server configuration for tests (create JDBC resources)
- server-reset : Reset Java EE server configuration for tests (delete JDBC resources)
- server-deploy : Deploy testing application on Java EE server
- server-undeploy : Undeploy testing application from Java EE server
It requires some configuration of the build.properties and test.properties to run.
-->
<project name="eclipselink.jpars.test" default="test" basedir=".">
<available file="../${ant.project.name}" type="dir" property="jparstest.is.local"/>
<!-- Test to make sure that the calling script doesn't inherit the variable -->
<!-- (should be set locally, and be destroyed upon return) -->
<fail message="Not running from '${ant.project.name}' directory" unless="jparstest.is.local"/>
<dirname property="jparstest.build.location_temp" file="${ant.file.eclipselink.jpars.test}"/>
<pathconvert targetos="unix" property="jparstest.build.location">
<path>
<pathelement location="${jparstest.build.location_temp}"/>
</path>
</pathconvert>
<echo message="jparstest.build.location = '${jparstest.build.location}'"/>
<property name="eclipselink.jpars.test" value="."/>
<echo message="eclipselink.jpars.test = '${eclipselink.jpars.test}'"/>
<condition property="jparstest.2.base.dir" value="../.." else="..">
<contains string="${jparstest.build.location}" substring="/jpa/"/>
</condition>
<echo message="jparstest.2.base.dir = '${jparstest.2.base.dir}'"/>
<property name="jparstest.2.common.plugins.dir" value="${jparstest.2.base.dir}/plugins"/>
<condition property="jparstest.2.jpa.plugins.dir" value="${jparstest.2.base.dir}/jpa/plugins" else="../plugins">
<available file="${jparstest.2.base.dir}/jpa/plugins" type="dir"/>
</condition>
<property name="jparstest.2.buildsys.dir" value="${jparstest.2.base.dir}/buildsystem"/>
<property name="jparstest.basedir" value="${jparstest.build.location}"/>
<condition property="custom.properties.message"
value="Loading ${user.home}/build.properties"
else="Skipping ${user.home}/build.properties', file does not exist">
<and>
<isset property="user.home"/>
<available file="${user.home}/build.properties"/>
</and>
</condition>
<echo message="${custom.properties.message}"/>
<property file="${user.home}/build.properties"/>
<condition property="custom.cmd.properties.message"
value="Loading ${test.properties}"
else="Skipping ${test.properties}, file does not exist">
<and>
<isset property="test.properties"/>
<available file="${test.properties}"/>
</and>
</condition>
<echo message="${custom.cmd.properties.message}"/>
<property file="${test.properties}"/>
<property file="${user.home}/test.properties"/>
<property file="${jparstest.build.location}/${test.properties}"/>
<property file="${jparstest.build.location}/test.properties"/>
<property file="${jparstest.build.location}/antbuild.properties"/>
<!-- JVM used to run tests -->
<property name="test.junit.jvm" value="${env.JAVA_HOME}"/>
<property name="test.junit.jvm.exec" value="${test.junit.jvm}/bin/java"/>
<!-- Clean all build generated content. -->
<target name="clean" description="Clean the build">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${classes.dir}"/>
<fileset dir="${report.dir}"/>
<fileset dir="${run.dir}"/>
<fileset dir="${jparstest.build.location}" includes="${jpars.test.jar}"/>
</delete>
</target>
<target name="init">
<!-- Give this a default value if not set in a user.home or test property file -->
<property name="extensions.depend.dir" value="../${core_test.2.base.dir}/extension.lib.external"/>
<property name="junit.lib" value="${extensions.depend.dir}/junit.jar"/>
<property name="json.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${json.jar}"/>
<property name="jacocoagent.lib" value="${extensions.depend.dir}/${jacocoagent.jar}"/>
<!-- Jersey 2.0 dependencies -->
<property name="javax.ws.rs.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${javax.ws.rs.jar}"/>
<property name="jersey.client.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${jersey.client.jar}"/>
<property name="jersey.common.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${jersey.common.jar}"/>
<property name="hk2.api.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${hk2.api.jar}"/>
<property name="hk2.locator.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${hk2.locator.jar}"/>
<property name="hk2.utils.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${hk2.utils.jar}"/>
<property name="jersey.guava.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${jersey.guava.jar}"/>
<property name="javax.inject.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${javax.inject.jar}"/>
<property name="javax.annotation.lib" value="${jparstest.build.location}/${jparstest.2.common.plugins.dir}/${javax.annotation.jar}"/>
<echo message="user.home ='${user.home}'"/>
<echo message="test.properties ='${test.properties}'"/>
<echo message="extensions.depend.dir ='${extensions.depend.dir}'"/>
<echo message="junit.lib ='${junit.lib}'"/>
<!-- versioning -->
<!-- These variables are set in autobuild.xml. A manual build gets defaults -->
<tstamp>
<format property="build.date" pattern="yyyyMMdd"/>
<format property="build.time" pattern="HHmm"/>
</tstamp>
<property name="build.type" value="SNAPSHOT"/>
<property name="svn.revision" value="NA"/>
<property name="version.qualifier" value="qualifier"/>
<property name="version.string" value="${release.version}.${version.qualifier}"/>
<property name="release.designation" value="EclipseLink ${release.version} Build"/>
<!-- task for Dynamic Dependency checks -->
<property name="custom.tasks.lib" value="${jparstest.2.buildsys.dir}/ant_customizations.jar"/>
<property name="custom.selectbundle.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.SelectBundle"/>
<taskdef name="selectbundle" classname="${custom.selectbundle.task.class}" classpath="${custom.tasks.lib}"/>
<!-- Test for Third-party dependencies -->
<selectbundle basename="javax.xml.bind" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,3.0.0)" property="jaxb-api.lib" includepath="true"/>
<selectbundle basename="javax.persistence" directory="${jparstest.build.location}/${jparstest.2.jpa.plugins.dir}" separator="_"
criterion="[2.0.0,3.0.0)" property="persistence20.lib" includepath="true"/>
<selectbundle basename="javax.ws.rs-api" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,3.0.0)" property="javax.ws.rs.lib" includepath="true"/>
<selectbundle basename="javax.ejb" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[3.0.0,4.0.0)" property="javax.ejb.lib" includepath="true"/>
<selectbundle basename="javax.servlet" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,3.0.0)" property="javax.servlet.lib" includepath="true"/>
<selectbundle basename="javax.validation.api" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[1.0.0,5.0.0)" property="validation.lib" includepath="true"/>
<available file="${jaxb-api.lib}" property="jaxb-api.lib.exist"/>
<available file="${persistence20.lib}" property="persistence20.lib.exist"/>
<available file="${jersey.common.lib}" property="jersey.common.lib.exist"/>
<available file="${hk2.api.lib}" property="hk2.api.lib.exist"/>
<available file="${hk2.locator.lib}" property="hk2.locator.lib.exist"/>
<available file="${hk2.utils.lib}" property="hk2.utils.lib.exist"/>
<available file="${jersey.guava.lib}" property="jersey.guava.lib.exist"/>
<available file="${javax.inject.lib}" property="javax.inject.lib.exist"/>
<available file="${javax.annotation.lib}" property="javax.annotation.lib.exist"/>
<available file="${javax.ws.rs.lib}" property="javax.ws.rs.lib.exist"/>
<available file="${validation.lib}" property="validation.lib.exist"/>
<available file="${json.lib}" property="json.lib.exists"/>
<echo message="jaxb-api.lib ='${jaxb-api.lib}'"/>
<echo message="persistence20.lib ='${persistence20.lib}'"/>
<echo message="jersey.client.lib ='${jersey.client.lib}'"/>
<echo message="jersey.common.lib ='${jersey.common.lib}'"/>
<echo message="hk2.api.lib ='${hk2.api.lib}'"/>
<echo message="hk2.locator.lib ='${hk2.locator.lib}'"/>
<echo message="hk2.utils.lib ='${hk2.utils.lib}'"/>
<echo message="jersey.guava.lib ='${jersey.guava.lib}'"/>
<echo message="javax.inject.lib ='${javax.inject.lib}'"/>
<echo message="javax.annotation.lib ='${javax.annotation.lib}'"/>
<echo message="javax.ws.rs.lib ='${javax.ws.rs.lib}'"/>
<echo message="validation.lib ='${validation.lib}'"/>
<echo message="json.lib ='${json.lib}'"/>
<!-- Test for Eclipselink dependencies -->
<selectbundle basename="org.eclipse.persistence.antlr" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="antlr.lib" includepath="true"/>
<selectbundle basename="org.eclipse.persistence.jpa.jpql" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="hermes.lib" includepath="true"/>
<selectbundle basename="org.eclipse.persistence.core" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="core.lib" includepath="true"/>
<selectbundle basename="org.eclipse.persistence.moxy" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="moxy.lib" includepath="true"/>
<selectbundle basename="org.eclipse.persistence.jpa" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="jpa.lib" includepath="true"/>
<selectbundle basename="org.eclipse.persistence.jpars" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="jpars.lib" includepath="true"/>
<selectbundle basename="org.eclipse.persistence.dbws" directory="${jparstest.build.location}/${jparstest.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,4.0.0)" property="dbws.lib" includepath="true"/>
<available file="${antlr.lib}" property="antlr.bundle.exist"/>
<available file="${hermes.lib}" property="hermes.bundle.exist"/>
<available file="${core.lib}" property="core.bundle.exist"/>
<available file="${moxy.lib}" property="moxy.bundle.exist"/>
<available file="${jpa.lib}" property="jpa.bundle.exist"/>
<available file="${jpars.lib}" property="jpars.bundle.exist"/>
<available file="${jparstest.2.base.dir}/${eclipselink.jar}" property="eclipselink.jar.exist"/>
<echo message="antlr.lib ='${antlr.lib}'"/>
<echo message="hermes.lib ='${hermes.lib}'"/>
<echo message="core.lib ='${core.lib}'"/>
<echo message="moxy.lib ='${moxy.lib}'"/>
<echo message="jpa.lib ='${jpa.lib}'"/>
<echo message="jpars.lib ='${jpars.lib}'"/>
<echo message="javax.ejb.lib ='${javax.ejb.lib}'"/>
<!-- path to OSGi Bundle compile dependencies -->
<path id="jparstest.bundle.compile.path">
<pathelement path="${core.lib}"/>
<pathelement path="${moxy.lib}"/>
<pathelement path="${jpa.lib}"/>
<pathelement path="${jpars.lib}"/>
<pathelement path="${dbws.lib}"/>
</path>
<!-- compile path without product components -->
<path id="jparstest.thirdparty.compile.path">
<pathelement path="${junit.lib}"/>
<pathelement path="${jaxb-api.lib}"/>
<pathelement path="${persistence20.lib}"/>
<pathelement path="${jersey.common.lib}"/>
<pathelement path="${javax.ws.rs.lib}"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${javax.ejb.lib}"/>
<pathelement path="${javax.servlet.lib}"/>
<pathelement path="${validation.lib}"/>
</path>
<!-- Run path without product components -->
<path id="jparstest.thirdparty.run.path">
<pathelement path="${jacocoagent.lib}"/>
<pathelement path="${resource.dir}"/>
<pathelement path="${classes.dir}"/>
<pathelement path="${antlr.lib}"/>
<pathelement path="${hermes.lib}"/>
<pathelement path="${json.lib}"/>
<pathelement path="${hk2.api.lib}"/>
<pathelement path="${javax.ws.rs.lib}"/>
<pathelement path="${hk2.locator.lib}"/>
<pathelement path="${hk2.utils.lib}"/>
<pathelement path="${javax.inject.lib}"/>
<pathelement path="${javax.annotation.lib}"/>
<pathelement path="${jersey.guava.lib}"/>
<pathelement path="${jersey.common.lib}"/>
<pathelement path="${jersey.client.lib}"/>
<fileset dir="${jparstest.2.common.plugins.dir}" includes="${eclipselink.core.depend}"/>
</path>
<!-- Set Compile/Run Paths using product OSGi bundles -->
<path id="jparstest.compile.path">
<path refid="jparstest.bundle.compile.path"/>
<path refid="jparstest.thirdparty.compile.path"/>
</path>
<path id="jparstest.run.path">
<path refid="jparstest.compile.path"/>
<path refid="jparstest.thirdparty.run.path"/>
</path>
<!-- The following compile/run paths reference eclipselink.jar for non-test classes and resources -->
<path id="jparstest.compile.against.jar.path">
<pathelement path="${jparstest.2.base.dir}/${eclipselink.jar}"/>
<pathelement path="${jparstest.2.common.plugins.dir}/org.eclipse.persistence.jpars_${version.string}.jar"/>
<path refid="jparstest.thirdparty.compile.path"/>
</path>
<path id="jparstest.run.against.jar.path">
<path refid="jparstest.compile.against.jar.path"/>
<path refid="jparstest.thirdparty.run.path"/>
</path>
</target>
<!-- Detect OS family and set script suffix property. -->
<target name="detect-os">
<condition property="is.windows" value="true">
<os family="windows"/>
</condition>
<condition property="is.unix" value="true">
<os family="unix"/>
</condition>
<condition property="suffix" value="bat">
<isset property="is.windows"/>
</condition>
<condition property="suffix" value="sh">
<isset property="is.unix"/>
</condition>
</target>
<!-- This checks if the Apllication Server is WebLogic -->
<condition property="is.weblogic">
<contains string="${server.name}" substring="weblogic"/>
</condition>
<!-- Build targets -->
<target name="build" depends="init" description="build jpars test classes">
<fail message="Cannot find CORE: '${jparstest.2.common.plugins.dir}/org.eclipse.persistence.core_${version.string}.jar'." unless="core.bundle.exist"/>
<fail message="Cannot find MOXY: '${jparstest.2.common.plugins.dir}/org.eclipse.persistence.moxy_${version.string}.jar'." unless="moxy.bundle.exist"/>
<fail message="Cannot find JPA: '${jparstest.2.common.plugins.dir}/org.eclipse.persistence.jpa_${version.string}.jar'." unless="jpa.bundle.exist"/>
<compile_jpars_tests compilepathref="jparstest.compile.path"/>
</target>
<target name="build-against-jar" depends="init" description="build jpars test classes against eclipselink.jar">
<fail message="Cannot find EclipseLink: '${jparstest.2.base.dir}/${eclipselink.jar}'." unless="eclipselink.jar.exist"/>
<compile_jpars_tests compilepathref="jparstest.compile.against.jar.path"/>
</target>
<!-- Run targets -->
<!-- Use -DremoteDebug=true to enable remote debugging on 8787 port -->
<target name="test" depends="build" description="run jpars tests">
<property name="SERVER_URL" value="http://localhost:7001"/>
<property name="JPARS_VERSION" value="v1.0"/>
<echo message="Server url is ${SERVER_URL}"/>
<echo message="jpars version is ${JPARS_VERSION}"/>
<run_jpars_tests testclass="${test.class}" runpathref="jparstest.run.path"/>
</target>
<target name="test-javaee" depends="create-war" description="run jpars tests">
<property name="SERVER_URL" value="http://localhost:7001"/>
<property name="JPARS_VERSION" value="v1.0"/>
<echo message="Server url is ${SERVER_URL}"/>
<echo message="jpars version is ${JPARS_VERSION}"/>
<run_jpars_tests testclass="${test.class.javaee}" runpathref="jparstest.run.path"/>
</target>
<target name="test-against-jar" depends="build-against-jar" description="run jpars tests against eclipselink.jar">
<run_jpars_tests testclass="${test.class}" runpathref="jparstest.run.against.jar.path"/>
</target>
<!-- Build war file for JAX-RS -->
<target name="create-war" depends="build">
<mkdir dir="${eclipselink.jpars.test}/stage/META-INF"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/lib"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/auction"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/basket"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/dynamic"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/employee"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/traveler"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/multitenant"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/weaving"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/META-INF"/>
<mkdir dir="${eclipselink.jpars.test}/stage/WEB-INF/classes/META-INF/xmldocs"/>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/dynamic">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/dynamic" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/auction">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/auction" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/basket">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/basket" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/multitenant">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/multitenant" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/employee">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/employee" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/traveler">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/traveler" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/org/eclipse/persistence/jpars/test/model/weaving">
<fileset dir="${eclipselink.jpars.test}/classes/org/eclipse/persistence/jpars/test/model/weaving" includes="*.class"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/classes/META-INF">
<fileset dir="${eclipselink.jpars.test}/src/META-INF" includes="*.xml"/>
</copy>
<copy todir="${eclipselink.jpars.test}/stage/WEB-INF/">
<fileset dir="${eclipselink.jpars.test}/WebContent/WEB-INF" includes="*.xml"/>
</copy>
<copy file="${jpars.lib}" todir="${eclipselink.jpars.test}/stage/WEB-INF/lib"/>
<jar destfile="${eclipselink.jpars.test}/${ant.project.name}.war" basedir="${eclipselink.jpars.test}/stage"/>
<delete dir="stage" includeEmptyDirs="true" failonerror="false"/>
</target>
<!-- Application server handling tasks-->
<target name="server-install">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-install" inheritRefs="true"/>
</target>
<target name="server-start" depends="detect-os">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-start" inheritRefs="true"/>
</target>
<target name="server-stop" depends="detect-os">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-stop" inheritRefs="true"/>
</target>
<target name="server-setup" depends="detect-os">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-setup" inheritRefs="true"/>
</target>
<target name="server-reset">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-reset" inheritRefs="true"/>
</target>
<target name="server-deploy" depends="detect-os, create-war">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-deploy" inheritRefs="true">
<property name="ear.name" value="${eclipselink.jpars.test}/${ant.project.name}.war"/>
<property name="application.name" value="${test.application.name}"/>
</ant>
</target>
<target name="server-undeploy" depends="detect-os">
<ant antfile="${jparstest.basedir}/${server.name}.xml" target="${server.name}-undeploy" inheritRefs="true">
<property name="application.name" value="${test.application.name}"/>
</ant>
</target>
<!-- Test run macros -->
<macrodef name="run_jpars_tests">
<attribute name="testclass"/>
<attribute name="runpathref"/>
<sequential>
<delete dir="${report.dir}" includeEmptyDirs="true" failonerror="false"/>
<mkdir dir="${report.dir}"/>
<mkdir dir="${jparstest.build.location}/${classes.dir}/META-INF"/>
<copy todir="${jparstest.build.location}/${classes.dir}/META-INF">
<fileset dir="${jparstest.build.location}/${src.dir}/META-INF" includes="**"/>
</copy>
<!-- Use -DremoteDebug=true to enable remote debugging on 8787 port -->
<property name="remoteDebug" value="false"/>
<condition property="remoteDebugJvmArgs"
value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8787"
else="-ea">
<istrue value="${remoteDebug}"/>
</condition>
<!-- Fix for 290177 below removed temporarily to avoid out-of-memeory issues with LRG run -->
<!-- junit printsummary="withOutAndErr" fork="yes" forkmode="once" dir="${resource.dir}" maxmemory="512m" showoutput="yes" -->
<echo message="Running @{testclass} suite"/>
<!-- 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 jvm="${test.junit.jvm.exec}" printsummary="withOutAndErr" fork="yes" dir="${classes.dir}" maxmemory="512m" showoutput="yes">
<jvmarg value="-Ddb.driver=${db.driver}"/>
<jvmarg value="-Ddb.url=${db.url}"/>
<jvmarg value="-Ddb.user=${db.user}"/>
<jvmarg value="-Ddb.pwd=${db.pwd}"/>
<jvmarg line="${additional.jvmargs}"/>
<jvmarg value="-javaagent:../${jparstest.2.base.dir}/${eclipselink.jar}"/>
<jvmarg value="${remoteDebugJvmArgs}"/>
<!--jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8787"/-->
<sysproperty key="loggingLevelFinest" value="false"/>
<sysproperty key="tempFileDir" value="${tmp.dir}"/>
<sysproperty key="ignoreCRLF" value="true"/>
<sysproperty key="useLogging" value="false"/>
<sysproperty key="useSAXParsing" value="true"/>
<sysproperty key="useDeploymentXML" value="false"/>
<sysproperty key="test.properties" value="${jparstest.build.location}/test.properties"/>
<sysproperty key="jpars.xmlfile.directory" value="META-INF/xmldocs/"/>
<sysproperty key="server.uri.base" value="${SERVER_URL}"/>
<sysproperty key="jpars.version.string" value="${JPARS_VERSION}"/>
<batchtest todir="${report.dir}">
<fileset dir="${src.dir}">
<include name="@{testclass}"/>
</fileset>
<formatter type="xml"/>
</batchtest>
<classpath refid="@{runpathref}"/>
</junit>
<!-- Create JUnit report -->
<mkdir dir="${report.dir}"/>
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="**/*.xml"/>
</fileset>
<report format="noframes" todir="${report.dir}"/>
</junitreport>
</sequential>
</macrodef>
<!-- Compile macros -->
<macrodef name="compile_jpars_tests">
<attribute name="compilepathref"/>
<sequential>
<fail message="Cannot find JPARS: '${jparstest.2.common.plugins.dir}/org.eclipse.persistence.jpars_${version.string}.jar'." unless="jpars.bundle.exist"/>
<fail message="Cannot find JAXB-API: '${jaxb-api.lib}'." unless="jaxb-api.lib.exist"/>
<fail message="Cannot find javax.persistence: '${persistence20.lib}'." unless="persistence20.lib.exist"/>
<fail message="Cannot find jersey-common: '${jersey.common.lib}'." unless="jersey.common.lib.exist"/>
<fail message="Cannot find javax.ws.rs: '${javax.ws.rs.lib}'." unless="javax.ws.rs.lib.exist"/>
<mkdir dir="${classes.dir}"/>
<javac
srcdir="${src.dir}"
destdir="${classes.dir}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
encoding="UTF-8"
optimize="${javac.optimize}"
source="${javac.version}"
target="${javac.version}"
deprecation="${javac.deprecation}"
failonerror="true"
includes="org/eclipse/persistence/jpars/test/**/*.java">
<classpath>
<path refid="@{compilepathref}"/>
</classpath>
</javac>
<filter token="DB_URL" value="${db.url}"/>
<filter token="DB_USER" value="${db.user}"/>
<filter token="DB_PWD" value="${db.pwd}"/>
<filter token="DB_DRIVER" value="${db.driver}"/>
<copy todir="classes/META-INF" filtering="true" overwrite="true">
<fileset dir="src/META-INF" includes="**/*.xml" excludes=".svn"/>
</copy>
</sequential>
</macrodef>
</project>