blob: 602cd8ffa161f2723a9cb8911ce00ca7d2d106bd [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:
* tware - initial API and implementation
* egwin - update to adopt calling standards
* 03/30/2016-2.7 Tomas Kraus
* - 490677: Database connection properties made configurable in test.properties
#******************************************************************************/-->
<!-- This ant project includes the following tasks:
- build (default) : cleans, compiles, and packages all tests
- clean : cleans up all generated files and dirs
- compile : compiles all tests
- package : packages test jar
- test : Runs Oracle NoSQL and AQ tests
- test-oracle-nosql: Runs Oracle NoSQL tests
- test-oracle-aq: Runs Oracle AQ tests
It requires some configuration of the build.properties and test.properties to run.
-->
<project name="eclipselink.extension.oracle.nosql.test" default="build" basedir=".">
<available file="../${ant.project.name}" type="dir" property="ora_nosql_test.is.local"/>
<fail message="Not running from '${ant.project.name}' directory" unless="ora_nosql_test.is.local"/>
<dirname property="ora_nosql_test.build.location_temp" file="${ant.file.eclipselink.extension.oracle.nosql.test}"/>
<pathconvert targetos="unix" property="ora_nosql_test.build.location">
<path>
<pathelement location="${ora_nosql_test.build.location_temp}"/>
</path>
</pathconvert>
<echo message="ora_nosql_test.build.location = '${ora_nosql_test.build.location}'"/>
<condition property="ora_nosql_test.2.base.dir" value="../.." else="..">
<contains string="${ora_nosql_test.build.location}" substring="foundation"/>
</condition>
<echo message="ora_nosql_test.2.base.dir = '${ora_nosql_test.2.base.dir}'"/>
<property name="ora_nosql_test.2.common.plugins.dir" value="${ora_nosql_test.2.base.dir}/plugins"/>
<property name="ora_nosql_test.2.core.dir" value="../org.eclipse.persistence.core"/>
<property name="ora_nosql_test.2.core.test.dir" value="../eclipselink.core.test"/>
<property name="ora_nosql_test.2.nosql.dir" value="../org.eclipse.persistence.nosql"/>
<property name="ora_nosql_test.2.jpa.dir" value="${ora_nosql_test.2.base.dir}/jpa/org.eclipse.persistence.jpa"/>
<property name="ora_nosql_test.2.jpa.test.dir" value="${ora_nosql_test.2.base.dir}/jpa/eclipselink.jpa.test"/>
<property name="ora_nosql_test.2.jpa.plugins.dir" value="${ora_nosql_test.2.base.dir}/jpa/plugins"/>
<property name="ora_nosql_test.2.buildsys.dir" value="${ora_nosql_test.2.base.dir}/buildsystem"/>
<property name="ora_nosql_test.plugins.dir" value="../plugins"/>
<!-- Allows a user to overide certain user specific properties. -->
<condition property="custom.bld.properties.message"
value="Loading ${user.home}/build.properties"
else="Skipping ${user.home}/build.properties, file does not exist">
<available file="${user.home}/build.properties"/>
</condition>
<echo message="${custom.bld.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}"/>
<condition property="custom.tst.properties.message"
value="Loading ${user.home}/test.properties"
else="Skipping ${user.home}/test.properties, file does not exist">
<available file="${user.home}/test.properties"/>
</condition>
<echo message="${custom.tst.properties.message}"/>
<property file="${user.home}/test.properties"/>
<property file="${ora_nosql_test.build.location}/antbuild.properties"/>
<property file="${ora_nosql_test.build.location}/${test.properties}"/>
<property file="${ora_nosql_test.build.location}/test.properties"/>
<!-- Local path variables -->
<property name="ora_nosql_test.src.dir" value="${ora_nosql_test.build.location}/${src.dir}"/>
<property name="ora_nosql_test.resource.dir" value="${ora_nosql_test.build.location}/${resource.dir}"/>
<property name="ora_nosql_test.classes.dir" value="${ora_nosql_test.build.location}/${classes.dir}"/>
<property name="ora_nosql_test.report.dir" value="${ora_nosql_test.build.location}/${report.dir}"/>
<property name="ora_nosql_test.run.dir" value="${ora_nosql_test.build.location}/${run.dir}"/>
<!-- Default ant target, compiles and translates resources, does not run tests. -->
<target name="build" depends="clean, compile, package" description="build Oracle extension tests"/>
<!-- Clean all build generated content. -->
<target name="clean" description="Clean the build">
<echo message="Cleaning..."/>
<echo message=" ${ora_nosql_test.classes.dir}"/>
<echo message=" ${ora_nosql_test.report.dir}"/>
<echo message=" ${ora_nosql_test.run.dir}"/>
<echo message=" ${ora_nosql_test.build.location}/${oracle.nosql.test.jar}"/>
<echo message=" ${ora_nosql_test.build.location}/${oracle.nosql.model.jar}"/>
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${ora_nosql_test.classes.dir}"/>
<fileset dir="${ora_nosql_test.report.dir}"/>
<fileset dir="${ora_nosql_test.run.dir}"/>
<fileset dir="${ora_nosql_test.build.location}" includes="${oracle.nosql.test.jar}"/>
<fileset dir="${ora_nosql_test.build.location}" includes="${oracle.nosql.model.jar}"/>
</delete>
</target>
<target name="init">
<property name="custom.tasks.lib" value="${ora_nosql_test.2.buildsys.dir}/ant_customizations.jar"/>
<property name="custom.echo.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.Say"/>
<property name="custom.selectbundle.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.SelectBundle"/>
<taskdef name="say" classname="${custom.echo.task.class}" classpath="${custom.tasks.lib}"/>
<taskdef name="selectbundle" classname="${custom.selectbundle.task.class}" classpath="${custom.tasks.lib}"/>
<!-- Give this a default value if not set in a user.home or test property file -->
<property name="oracle.extensions.depend.dir" value="../${ora_nosql_test.2.base.dir}/extension.oracle.lib.external"/>
<property name="extensions.depend.dir" value="../${ora_nosql_test.2.base.dir}/extension.lib.external"/>
<property name="junit.lib" value="${extensions.depend.dir}/junit.jar"/>
<property name="jacocoagent.lib" value="${extensions.depend.dir}/${jacocoagent.jar}"/>
<echo message="ora_nosql_test.src.dir ='${ora_nosql_test.src.dir}'"/>
<echo message="ora_nosql_test.resource.dir='${ora_nosql_test.resource.dir}'"/>
<echo message="ora_nosql_test.classes.dir ='${ora_nosql_test.classes.dir}'"/>
<echo message="ora_nosql_test.report.dir ='${ora_nosql_test.report.dir}'"/>
<echo message="ora_nosql_test.run.dir ='${ora_nosql_test.run.dir}'"/>
<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}'"/>
<echo message="jacocoagent.lib ='${jacocoagent.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"/>
<!-- Determine appropriate settings for lib variables (overrides of .lib variables won't get reset) -->
<condition property="coretest.framework.lib" value="${ora_nosql_test.2.core.test.dir}/${coretest.framework.jar}">
<available file="${ora_nosql_test.2.core.test.dir}/${coretest.framework.jar}"/>
</condition>
<condition property="coretest.lib" value="${ora_nosql_test.2.core.test.dir}/${coretest.jar}">
<available file="${ora_nosql_test.2.core.test.dir}/${coretest.jar}"/>
</condition>
<condition property="jpatest.framework.lib" value="${ora_nosql_test.2.jpa.test.dir}/${jpatest.framework.jar}">
<available file="${ora_nosql_test.2.jpa.test.dir}/${jpatest.framework.jar}"/>
</condition>
<!-- Determine appropriate settings for Oracle lib variables (overrides of .lib variables won't get reset) -->
<!-- Check first in oracle extensions dir -->
<condition property="oracle.aqapi.lib" value="${oracle.extensions.depend.dir}/${oracle.aqapi.jar}"
else="${extensions.depend.dir}/${oracle.aqapi.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.aqapi.jar}"/>
</condition>
<condition property="oracle.orai18n.lib" value="${oracle.extensions.depend.dir}/${oracle.orai18n.jar}"
else="${extensions.depend.dir}/${oracle.orai18n.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.orai18n.jar}"/>
</condition>
<condition property="oracle.orai18n-mapping.lib" value="${oracle.extensions.depend.dir}/${oracle.orai18n-mapping.jar}"
else="${extensions.depend.dir}/${oracle.orai18n-mapping.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.orai18n-mapping.jar}"/>
</condition>
<condition property="oracle.nosql.lib" value="${oracle.extensions.depend.dir}/${oracle.nosql.jar}"
else="${extensions.depend.dir}/${oracle.nosql.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.nosql.jar}"/>
</condition>
<!-- Create needed directories
<mkdir dir="${ora_nosql_test.classes.dir}"/>
<mkdir dir="${ora_nosql_test.run.dir}"/>
<mkdir dir="${ora_nosql_test.report.dir}"/ -->
<!-- Determine availability of compile dependencies -->
<selectbundle basename="javax.persistence" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.jpa.plugins.dir}" separator="_"
criterion="[2.0.0,3.0.0)" property="persistence.lib" includepath="true"
/>
<selectbundle basename="${antlr}" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,9.0.0)" property="antlr.lib" includepath="true"
/>
<selectbundle basename="${asm}" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,9.0.0)" property="asm.lib" includepath="true"
/>
<selectbundle basename="org.eclipse.persistence.jpa" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,9.0.0)" property="oep.jpa.lib" includepath="true"
/>
<selectbundle basename="org.eclipse.persistence.core" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,9.0.0)" property="oep.core.lib" includepath="true"
/>
<selectbundle basename="org.eclipse.persistence.nosql" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,9.0.0)" property="oep.nosql.lib" includepath="true"
/>
<selectbundle basename="org.eclipse.persistence.oracle.nosql" directory="${ora_nosql_test.build.location}/${ora_nosql_test.2.common.plugins.dir}" separator="_"
criterion="[2.0.0,9.0.0)" property="oep.oracle.nosql.lib" includepath="true"
/>
<available file="${ora_nosql_test.2.jpa.dir}/${classes.dir}" type="dir" property="jpa.classes.exist"/>
<available file="${ora_nosql_test.2.core.dir}/${classes.dir}" type="dir" property="core.classes.exist"/>
<available file="${ora_nosql_test.2.nosql.dir}/${classes.dir}" type="dir" property="nosql.classes.exist"/>
<available file="${ora_nosql_test.2.oracle.nosql.dir}/${classes.dir}" type="dir" property="oracle.nosql.classes.exist"/>
<available file="${ora_nosql_test.2.base.dir}/${eclipselink.jar}" property="eclipselink.jar.exist"/>
<available classname="org.junit.Test" classpath="${junit.lib}" property="junit.lib.exist"/>
<available file="${coretest.framework.lib}" property="test.framework.exist"/>
<available file="${coretest.lib}" property="core.test.exist"/>
<available file="${jpatest.framework.lib}" property="jpatest.framework.exist"/>
<!-- Determine availability of runtime dependencies -->
<available file="${ora_nosql_test.2.jpa.dir}/${resource.dir}" type="dir" property="jpa.resources.exist"/>
<available file="${ora_nosql_test.2.core.dir}/${resource.dir}" type="dir" property="core.resources.exist"/>
<available file="${ora_nosql_test.2.oracle.nosql.dir}/${resource.dir}" type="dir" property="oracle.nosql.resources.exist"/>
<available file="${jdbc.driver.jar}" property="jdbc.jar.exist"/>
<!-- Determine availability and location of Oracle dependencies -->
<available file="${oracle.extensions.depend.dir}" type="dir" property="oracle.depend.dir.exist"/>
<available file="${extensions.depend.dir}" type="dir" property="ext.depend.dir.exist"/>
<!-- Now retest using the regular extensions dir, if already found variables will not be reset -->
<available file="${oracle.aqapi.lib}" property="oracle.aqapi.lib.exist"/>
<available file="${oracle.nosql.lib}" property="oracle.nosql.lib.exist"/>
<available file="${oracle.orai18n.lib}" property="oracle.orai18n.lib.exist"/>
<available file="${oracle.orai18n-mapping.lib}" property="oracle.orai18n-mapping.lib.exist"/>
<say message="persistence.lib: '${persistence.lib}'" if="persistence.lib"/>
<say message="antlr.lib: '${antlr.lib}'" if="antlr.lib"/>
<say message="asm.lib: '${asm.lib}'" if="asm.lib"/>
<say message="core.lib: '${oep.core.lib}'" if="oep.core.lib"/>
<say message="jpa.lib: '${oep.jpa.lib}'" if="oep.jpa.lib"/>
<say message="nosql.lib: '${oep.nosql.lib}'" if="oep.nosql.lib"/>
<say message="oracle.nosql.lib: '${oep.oracle.nosql.lib}'" if="oep.oracle.nosql.lib"/>
<!-- Determine where to get product classes, based upon availability -->
<condition property="use.eclipselink">
<and>
<isset property="eclipselink.jar.exist"/>
<isset property="oep.nosql.lib"/>
<isset property="oep.oracle.nosql.lib"/>
</and>
</condition>
<condition property="use.bundles">
<and>
<isset property="antlr.lib"/>
<isset property="asm.lib"/>
<isset property="oep.core.lib"/>
<isset property="oep.jpa.lib"/>
<isset property="oep.nosql.lib"/>
<isset property="oep.oracle.nosql.lib"/>
<not> <isset property="use.eclipselink"/> </not>
</and>
</condition>
<condition property="use.classes">
<and>
<isset property="core.resources.exist"/>
<isset property="jpa.resources.exist"/>
<isset property="nosql.resources.exist"/>
<isset property="oracle.nosql.resources.exist"/>
<isset property="core.classes.exist"/>
<isset property="jpa.classes.exist"/>
<isset property="nosql.classes.exist"/>
<isset property="oracle.nosql.classes.exist"/>
<not> <isset property="use.eclipselink"/> </not>
<not> <isset property="use.bundles"/> </not>
</and>
</condition>
<condition property="use.failed">
<and>
<not> <isset property="use.eclipselink"/> </not>
<not> <isset property="use.bundles"/> </not>
<not> <isset property="use.classes"/> </not>
</and>
</condition>
<!-- Determine availability of other dependencies -->
<condition property="dependency.ok">
<and>
<isset property="test.framework.exist"/>
<isset property="core.test.exist"/>
<isset property="jpatest.framework.exist"/>
<isset property="junit.lib.exist"/>
<isset property="jdbc.jar.exist"/>
<isset property="oracle.aqapi.lib.exist"/>
<isset property="oracle.nosql.lib.exist"/>
<isset property="oracle.orai18n.lib.exist"/>
<isset property="oracle.orai18n-mapping.lib.exist"/>
</and>
</condition>
<condition property="run.ok">
<and>
<not> <isset property="use.failed"/> </not>
<isset property="jdbc.jar.exist"/>
</and>
</condition>
</target>
<target name="init_eclipselink" if="use.eclipselink">
<echo message="Using EclipseLink.jar and org.eclipse.persistence.*.nosql_*.jar as 'product' in compile dependency."/>
<path id="ora_nosql_test.product.path">
<pathelement path="${ora_nosql_test.2.base.dir}/${eclipselink.jar}"/>
<pathelement path="${oep.nosql.lib}"/>
<pathelement path="${oep.oracle.nosql.lib}"/>
</path>
</target>
<target name="init_bundles" if="use.bundles">
<echo message="Using EclipseLink OSGi bundles as 'product' in compile dependency."/>
<path id="ora_nosql_test.product.path">
<pathelement path="${antlr.lib}"/>
<pathelement path="${asm.lib}"/>
<pathelement path="${oep.core.lib}"/>
<pathelement path="${oep.nosql.lib}"/>
<pathelement path="${oep.oracle.nosql.lib}"/>
</path>
</target>
<target name="init_classes" if="use.classes">
<echo message="Using EclipseLink classes directly as 'product' in compile dependency."/>
<path id="ora_nosql_test.product.path">
<pathelement path="${ora_nosql_test.2.common.plugins.dir}/${antlr}"/>
<pathelement path="${ora_nosql_test.2.common.plugins.dir}/${asm}"/>
<pathelement path="${ora_nosql_test.2.jpa.dir}/${classes.dir}"/>
<pathelement path="${ora_nosql_test.2.jpa.dir}/${resource.dir}"/>
<pathelement path="${ora_nosql_test.2.core.dir}/${classes.dir}"/>
<pathelement path="${ora_nosql_test.2.core.dir}/${resource.dir}"/>
<pathelement path="${ora_nosql_test.2.nosql.dir}/${classes.dir}"/>
<pathelement path="${ora_nosql_test.2.nosql.dir}/${resource.dir}"/>
<pathelement path="${ora_nosql_test.2.oracle.nosql.dir}/${classes.dir}"/>
<pathelement path="${ora_nosql_test.2.oracle.nosql.dir}/${resource.dir}"/>
</path>
</target>
<target name="init_dependency" if="dependency.ok" depends="announce_missing_dependencies">
<path id="ora_nosql_test.oracle.dependency.path">
<pathelement path="${oracle.nosql.lib}"/>
<pathelement path="${oracle.aqapi.lib}"/>
<pathelement path="${oracle.orai18n.lib}"/>
<pathelement path="${oracle.orai18n-mapping.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${jacocoagent.lib}"/>
</path>
<path id="ora_nosql_test.test.infrastructure.path">
<pathelement path="${coretest.framework.lib}"/>
<pathelement path="${coretest.lib}"/>
<pathelement path="${jpatest.framework.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${jacocoagent.lib}"/>
</path>
<path id="ora_nosql_test.public.dependency.path">
<pathelement path="${persistence.lib}"/>
<pathelement path="${ora_nosql_test.2.common.plugins.dir}/${resource.jar}"/>
<pathelement path="${ora_nosql_test.2.common.plugins.dir}/${jms.jar}"/>
<pathelement path="${ora_nosql_test.2.common.plugins.dir}/${transaction.jar}"/>
</path>
</target>
<target name="init_paths" depends="init, init_eclipselink, init_bundles, init_classes, init_dependency">
<fail message="Product classes do not exist anywhere! Compile product or populate jars." if="use.failed"/>
<!-- Define 'Helper' path refids -->
<path id="ora_nosql_test.runtime.only.path">
<pathelement path="${ora_nosql_test.build.location}/${oracle.nosql.test.jar}"/>
<pathelement path="${ora_nosql_test.build.location}/${oracle.nosql.model.jar}"/>
<pathelement path="${ora_nosql_test.run.dir}"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${ora_nosql_test.2.core.test.dir}/resource"/>
</path>
<!-- Classpath used for compiling tests. -->
<path id="ora_nosql_test.compile.path">
<path refid="ora_nosql_test.product.path"/>
<path refid="ora_nosql_test.public.dependency.path"/>
<path refid="ora_nosql_test.oracle.dependency.path"/>
<path refid="ora_nosql_test.test.infrastructure.path"/>
</path>
<!-- Classpath used for running tests. -->
<path id="ora_nosql_test.run.path">
<path refid="ora_nosql_test.compile.path"/>
<path refid="ora_nosql_test.runtime.only.path"/>
</path>
</target>
<target name="announce_missing_dependencies" unless="dependency.ok" description="publicize missing dependencies">
<echo message="Following is a list of dependencies and their status:"/>
<echo message=" Test infrastructure:"/>
<say message=" found. :: '${junit.lib}'" if="junit.lib.exist"/>
<say message=" missing! :: '${junit.lib}'" unless="junit.lib.exist"/>
<say message=" found. :: '${ora_nosql_test.2.jpa.test.dir}/${jpatest.framework.jar}'" if="jpatest.framework.exist"/>
<say message=" missing! :: '${ora_nosql_test.2.jpa.test.dir}/${jpatest.framework.jar}'" unless="jpatest.framework.exist"/>
<say message=" found. :: '${ora_nosql_test.2.core.test.dir}/${coretest.framework.jar}'" if="test.framework.exist"/>
<say message=" missing! :: '${ora_nosql_test.2.core.test.dir}/${coretest.framework.jar}'" unless="test.framework.exist"/>
<say message=" found. :: '${ora_nosql_test.2.core.test.dir}/${coretest.jar}'" if="core.test.exist"/>
<say message=" missing! :: '${ora_nosql_test.2.core.test.dir}/${coretest.jar}'" unless="core.test.exist"/>
<echo message="The test framework jars are currently part of the core.test and jpa.test projects. Be sure they are built."/>
<echo message=" oracle dependency location:"/>
<say message=" found. :: '${oracle.extensions.depend.dir}'" if="oracle.depend.dir.exist"/>
<say message=" missing! :: '${oracle.extensions.depend.dir}'" unless="oracle.depend.dir.exist"/>
<echo message=" dependency location:"/>
<say message=" found. :: '${extensions.depend.dir}'" if="ext.depend.dir.exist"/>
<say message=" missing! :: '${extensions.depend.dir}'" unless="ext.depend.dir.exist"/>
<say message=" found. :: '${oracle.aqapi.lib}'" if="oracle.aqapi.lib.exist"/>
<say message=" missing! :: '${oracle.aqapi.lib}'" unless="oracle.aqapi.lib.exist"/>
<say message=" found. :: '${oracle.orai18n.lib}'" if="oracle.orai18n.lib.exist"/>
<say message=" missing! :: '${oracle.orai18n.lib}'" unless="oracle.orai18n.lib.exist"/>
<say message=" found. :: '${oracle.orai18n-mapping.lib}'" if="oracle.orai18n-mapping.lib.exist"/>
<say message=" missing! :: '${oracle.orai18n-mapping.lib}'" unless="oracle.orai18n-mapping.lib.exist"/>
<say message=" found. :: '${oracle.nosql.lib}'" if="oracle.nosql.lib.exist"/>
<say message=" missing! :: '${oracle.nosql.lib}'" unless="oracle.nosql.lib.exist"/>
<say message="Please put your Oracle dependencies in one of the two 'dependency' locations (default or custom defined)."/>
<fail message="Missing dependencies!" unless="compile.ok"/>
</target>
<!-- Compiles all tests. -->
<target name="compile" depends="init_paths" description="compile EclipseLink Oracle tests">
<echo message="Using the following oracle dependencies:"/>
<echo message=" '${jdbc.driver.jar}'"/>
<echo message=" '${oracle.aqapi.lib}'"/>
<echo message=" '${oracle.orai18n.lib}'"/>
<echo message=" '${oracle.orai18n-mapping.lib}'"/>
<echo message=" '${oracle.nosql.lib}'"/>
<mkdir dir="${ora_nosql_test.classes.dir}"/>
<javac srcdir="${ora_nosql_test.src.dir}"
destdir="${ora_nosql_test.classes.dir}"
includes="org/eclipse/persistence/**, java/sql/**"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
encoding="UTF-8"
optimize="${javac.optimize}"
source="${javac.version}"
target="${javac.version}"
deprecation="${javac.deprecation}"
failonerror="true"
memoryMaximumSize="512m"
fork="true">
<classpath>
<path refid="ora_nosql_test.compile.path"/>
</classpath>
</javac>
</target>
<target name="package">
<!-- Package the NoSQL JPA model jar. -->
<jar jarfile="${oracle.nosql.model.jar}">
<zipfileset dir="resource/nosql" includes="*.xml" prefix="META-INF"/>
<fileset dir="${ora_nosql_test.classes.dir}"
includes="org/eclipse/persistence/testing/models/jpa/nosql/**"/>
</jar>
<!-- Build tests jar. -->
<jar jarfile="${oracle.nosql.test.jar}">
<fileset dir="${ora_nosql_test.classes.dir}"
includes="org/eclipse/persistence/**/*.class"
excludes="org/eclipse/persistence/testing/models/jpa/**"/>
<fileset dir="${ora_nosql_test.resource.dir}"
includes="org/eclipse/persistence/**"/>
</jar>
</target>
<target name="init_run" depends="init_paths">
<mkdir dir="${ora_nosql_test.run.dir}"/>
<mkdir dir="${ora_nosql_test.report.dir}"/>
<copy file="${ora_nosql_test.2.core.test.dir}/${resource.dir}/java.policy.allpermissions" todir="${ora_nosql_test.run.dir}" overwrite="true"/>
</target>
<!-- Runs both Oracle NoSQL and AQ tests.
- Requires Oracle NoSQL and relational with AQ extensions databases. -->
<target name="test" depends="init_run, run-nosql-test, run-aq-test">
<generate_report/>
</target>
<!-- Runs Oracle NoSQL tests. Requires Oracle NoSQL database. -->
<target name="test-oracle-nosql" depends="init_run, run-nosql-test">
<generate_report/>
</target>
<!-- Runs Oracle AQ tests. Requires Oracle relational database with AQ extensions. -->
<target name="test-oracle-aq" depends="init_run, run-aq-test">
<generate_report/>
</target>
<!-- Execute Oracle NoSQL tests with no initialization and reports generation. -->
<target name="run-nosql-test">
<run_nosql_test testclass="org.eclipse.persistence.testing.tests.eis.nosql.NoSQLTestSuite"/>
<run_nosql_test testclass="org.eclipse.persistence.testing.tests.jpa.nosql.NoSQLJPATestSuite"/>
</target>
<!-- Runs Oracle AQ tests with no initialization and reports generation. -->
<target name="run-aq-test">
<run_test testclass="org.eclipse.persistence.testing.tests.eis.aq.AQTestSuite" dburl="${db.url}"/>
</target>
<!-- Prompt runner test target, runs test.class from test.properties (default is OracleTestModel). -->
<target name="test-prompt" depends="init_run">
<run_test_prompt testclass="${test.class}" dburl="${db.url}"/>
</target>
<!-- Launches the testing browser -->
<target name="test-browser">
<echo>Running test browser</echo>
<mkdir dir="${ora_nosql_test.run.dir}"/>
<mkdir dir="${ora_nosql_test.report.dir}"/>
<copy file="${ora_nosql_test.2.core.test.dir}/${resource.dir}/java.policy.allpermissions" todir="${ora_nosql_test.run.dir}" overwrite="true"/>
<!-- Can be set e.g. in test.properties to add VM options for a particular platform/driver -->
<property name="additional.jvmargs" value="-Ddummy2=dummy"/>
<java classname="org.eclipse.persistence.testing.framework.ui.TestingBrowserFrame"
fork="true"
maxmemory="512m"
failonerror="false"
dir="${run.dir}">
<jvmarg value="-Declipselink.logging.level=${logging.level}"/>
<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 value="-Ddb.platform=${db.platform}"/>
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=../java.policy.allpermissions"/>
<jvmarg line="${additional.jvmargs}"/>
<classpath>
<path refid="ora_nosql_test.run.path"/>
</classpath>
</java>
</target>
<!-- Generic target for running NoSQL tests. -->
<macrodef name="run_nosql_test">
<attribute name="testclass"/>
<sequential>
<echo>Running test on ${nosql.url}</echo>
<!-- 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" failureproperty="junit.failed" fork="yes" forkmode="once" showoutput="true" maxmemory="512m" dir="${run.dir}">
<jvmarg value="-Declipselink.logging.level=${logging.level}"/>
<jvmarg value="-Dnosql.url=${nosql.url}"/>
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=./java.policy.allpermissions"/>
<jvmarg line="${additional.jvmargs}"/>
<classpath>
<path refid="ora_nosql_test.run.path"/>
</classpath>
<formatter type="xml"/>
<test name="@{testclass}" haltonfailure="no" outfile="${report.dir}/@{testclass}-test-results">
</test>
</junit>
</sequential>
</macrodef>
<!-- Generic target for running tests. -->
<macrodef name="run_test">
<attribute name="testclass"/>
<attribute name="dburl"/>
<sequential>
<echo>Running test on @{dburl}</echo>
<!-- 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" failureproperty="junit.failed" fork="yes" forkmode="once" showoutput="true" maxmemory="512m" dir="${run.dir}">
<jvmarg value="-Declipselink.logging.level=${logging.level}"/>
<jvmarg value="-Ddb.driver=${db.driver}"/>
<jvmarg value="-Ddb.url=@{dburl}"/>
<jvmarg value="-Ddb.user=${db.user}"/>
<jvmarg value="-Ddb.pwd=${db.pwd}"/>
<jvmarg value="-Ddb.platform=${db.platform}"/>
<jvmarg value="-Djava.library.path=${java.library.path}"/>
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=./java.policy.allpermissions"/>
<jvmarg line="${additional.jvmargs}"/>
<classpath>
<path refid="ora_nosql_test.run.path"/>
</classpath>
<formatter type="xml"/>
<test name="@{testclass}" haltonfailure="no" outfile="${report.dir}/@{testclass}-test-results">
</test>
</junit>
</sequential>
</macrodef>
<macrodef name="generate_report">
<sequential>
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="*test-results.xml"/>
</fileset>
<report format="noframes" todir="${report.dir}"/>
</junitreport>
</sequential>
</macrodef>
<!-- Runs the test using the PromptTestRunner -->
<macrodef name="run_test_prompt">
<attribute name="testclass"/>
<attribute name="dburl"/>
<sequential>
<echo>Running test on @{dburl}</echo>
<!-- Can be set e.g. in test.properties to add VM options for a particular platform/driver -->
<property name="additional.jvmargs" value="-Ddummy2=dummy"/>
<java classname="org.eclipse.persistence.testing.framework.PromptTestRunner"
fork="true"
maxmemory="512m"
failonerror="false"
dir="${ora_nosql_test.run.dir}">
<jvmarg value="-Declipselink.logging.level=${logging.level}"/>
<jvmarg value="-Ddb.driver=${db.driver}"/>
<jvmarg value="-Ddb.url=@{dburl}"/>
<jvmarg value="-Ddb.user=${db.user}"/>
<jvmarg value="-Ddb.pwd=${db.pwd}"/>
<jvmarg value="-Ddb.platform=${db.platform}"/>
<jvmarg value="-Djava.library.path=${java.library.path}"/>
<jvmarg value="${test.security-manager}"/>
<jvmarg value="${test.security-manager.policy}"/>
<jvmarg line="${additional.jvmargs}"/>
<arg value="pfile=../test.properties" />
<arg value="testmodel=@{testclass}" />
<arg value="regressionlog=${report.dir}/@{testclass}-test.log" />
<arg value="saveresults=true" />
<classpath>
<path refid="ora_nosql_test.run.path"/>
</classpath>
</java>
</sequential>
</macrodef>
</project>