blob: 7f960a6071c374024a6aeb9bfbb8c029fea2d5a1 [file] [log] [blame]
<!--
Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0,
or the Eclipse Distribution License v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-->
<!--
Contributors:
tware - initial API and implementation
egwin - update to adopt calling standards
-->
<!-- 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 tests
- test-oracle: Runs Core Oracle-specific tests
It requires some configuration of the build.properties and test.properties to run.
-->
<!--
* 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.
-->
<project name="eclipselink.extension.oracle.spatial.test" default="build" basedir=".">
<echo message="ORCLSPATEST_BEGINS..."/>
<available file="../${ant.project.name}" type="dir" property="oracle_spatial_test.is.local"/>
<fail message="Not running from '${ant.project.name}' directory" unless="oracle_spatial_test.is.local"/>
<!-- Default ant target, compiles and translates resources, does not run tests. -->
<target name="build" depends="compile, package" description="build Oracle extension tests"/>
<!-- Initialization -->
<target name="pre-init">
<!-- Setup relative pathing for build -->
<dirname property="oracle_spatial_test.build.location_temp" file="${ant.file.eclipselink.extension.oracle.test}"/>
<pathconvert targetos="unix" property="oracle_spatial_test.build.location">
<path>
<pathelement location="${oracle_spatial_test.build.location_temp}"/>
</path>
</pathconvert>
<condition property="oracle_spatial_test.2.base.dir" value="../.." else="..">
<contains string="${oracle_spatial_test.build.location}" substring="foundation"/>
</condition>
<!-- Allows tools.jar to be relative to JAVA_HOME. -->
<property environment="env"/>
<!-- Allows a user to overide certain user specific properties. -->
<condition property="custom.bld.properties.message" value="Loading ${user.home}/build.properties..."
else="Notice: custom properties file '${user.home}/build.properties' not found to load.">
<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="Notice: custom properties file '${test.properties}' not found to load.">
<available file="${test.properties}"/>
</condition>
<echo message="${custom.cmd.properties.message}"/>
<property file="${test.properties}"/>
<condition property="custom.tst.properties.message" value="Loading ${user.home}/test.properties..."
else="Notice: custom properties file '${user.home}/test.properties' not found to load.">
<available file="${user.home}/test.properties"/>
</condition>
<echo message="${custom.tst.properties.message}"/>
<property file="${user.home}/test.properties"/>
<condition property="custom.local.properties.message" value="Loading ${basedir}/local.build.properties..."
else="Notice: custom properties file '${basedir}/local.build.properties' not found to load.">
<available file="${basedir}/local.build.properties"/>
</condition>
<echo message="${custom.local.properties.message}"/>
<property file="${basedir}/local.build.properties"/>
<property file="${oracle_spatial_test.build.location}/antbuild.properties"/>
<property file="${oracle_spatial_test.build.location}/${test.properties}"/>
<property file="${oracle_spatial_test.build.location}/test.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"/>
<!-- Handle missing $JAVA_HOME/release file (Travis OpenJDK 8) -->
<condition property="test.junit.jdk.JAVA_VERSION" value='"1.8.0"'>
<not><available file="${test.junit.jvm}/release"/></not>
</condition>
<property prefix="test.junit.jdk" file="${test.junit.jvm}/release"/>
<condition property="use.modules" value="true" else="false">
<not>
<matches pattern='"[1-8]\..*"' string="${test.junit.jdk.JAVA_VERSION}"/>
</not>
</condition>
<!-- versioning -->
<!-- These variables are set in autobuild.xml. A manual build gets defaults -->
<property name="version.qualifier" value="qualifier"/>
<property name="version.string" value="${release.version}.${version.qualifier}"/>
<!-- Local path variables -->
<property name="oracle_spatial_test.src.dir" value="${oracle_spatial_test.build.location}/${src.dir}"/>
<property name="oracle_spatial_test.resource.dir" value="${oracle_spatial_test.build.location}/${resource.dir}"/>
<property name="oracle_spatial_test.classes.dir" value="${oracle_spatial_test.build.location}/${classes.dir}"/>
<property name="oracle_spatial_test.report.dir" value="${oracle_spatial_test.build.location}/${report.dir}"/>
<property name="oracle_spatial_test.run.dir" value="${oracle_spatial_test.build.location}/${run.dir}"/>
<property name="oracle_spatial_test.2.common.plugins.dir" value="${oracle_spatial_test.2.base.dir}/plugins"/>
<property name="oracle_spatial_test.2.core.dir" value="../org.eclipse.persistence.core"/>
<property name="oracle_spatial_test.2.core.test.dir" value="../eclipselink.core.test"/>
<property name="oracle_spatial_test.2.jpa.dir" value="${oracle_spatial_test.2.base.dir}/jpa/org.eclipse.persistence.jpa"/>
<property name="oracle_spatial_test.2.jpa.test.dir" value="${oracle_spatial_test.2.base.dir}/jpa/eclipselink.jpa.test"/>
<property name="oracle_spatial_test.2.jpa.plugins.dir" value="${oracle_spatial_test.2.base.dir}/jpa/plugins"/>
<property name="oracle_spatial.test.2.oracle.test.dir" value="../eclipselink.extension.oracle.test"/>
<property name="oracle_spatial_test.plugins.dir" value="../plugins"/>
<!-- Give this a default value if not set in a user.home or test property file -->
<property name="oracle.extensions.depend.dir" value="../${oracle_spatial_test.2.base.dir}/extension.oracle.lib.external"/>
<property name="extensions.depend.dir" value="../${oracle_spatial_test.2.base.dir}/extension.lib.external"/>
<property name="junit.lib" value="${extensions.depend.dir}/junit.jar"/>
<property name="tools.lib" value="${env.JAVA_HOME}/lib/tools.jar"/>
<property name="jacocoagent.lib" value="${extensions.depend.dir}/${jacocoagent.jar}"/>
<echo message="oracle_spatial_test.build.location ='${oracle_spatial_test.build.location}'"/>
<echo message="oracle_spatial_test.2.base.dir ='${oracle_spatial_test.2.base.dir}'"/>
<echo message="oracle_spatial_test.src.dir ='${oracle_spatial_test.src.dir}'"/>
<echo message="oracle_spatial_test.resource.dir ='${oracle_spatial_test.resource.dir}'"/>
<echo message="oracle_spatial_test.classes.dir ='${oracle_spatial_test.classes.dir}'"/>
<echo message="oracle_spatial_test.report.dir ='${oracle_spatial_test.report.dir}'"/>
<echo message="oracle_spatial_test.run.dir ='${oracle_spatial_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="tools.lib ='${tools.lib}'"/>
<echo message="jdk.version ='${test.junit.jdk.JAVA_VERSION}'"/>
<!-- Determine availability of compile dependencies -->
<available file="${oracle_spatial_test.2.common.plugins.dir}/${antlr.jar}" property="antlr.bundle.exist"/>
<available file="${oracle_spatial_test.2.common.plugins.dir}/${asm.jar}" property="asm.bundle.exist"/>
<available file="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.jpa_${version.string}.jar" property="jpa.bundle.exist"/>
<available file="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.core_${version.string}.jar" property="core.bundle.exist"/>
<available file="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.oracle_${version.string}.jar" property="oracle.bundle.exist"/>
<available file="${oracle_spatial_test.2.base.dir}/${eclipselink.jar}" property="eclipselink.jar.exist"/>
<available file="${oracle_spatial_test.2.jpa.dir}/${classes.dir}" type="dir" property="jpa.classes.exist"/>
<available file="${oracle_spatial_test.2.core.dir}/${classes.dir}" type="dir" property="core.classes.exist"/>
<available file="${oracle_spatial_test.2.oracle.dir}/${classes.dir}" type="dir" property="oracle.classes.exist"/>
<available classname="org.junit.Test" classpath="${junit.lib}" property="junit.lib.exist"/>
<available file="${oracle_spatial_test.2.jpa.plugins.dir}/${persistence22.jar}" property="persistence.bundle.exist"/>
<available file="${oracle_spatial_test.2.core.test.dir}/${coretest.framework.jar}" property="test.framework.exist"/>
<available file="${oracle_spatial_test.2.core.test.dir}/${core.test.jar}" property="core.test.models.exist"/>
<available file="${oracle_spatial_test.2.jpa.test.dir}/${jpatest.framework.jar}" property="jpatest.framework.exist"/>
<!-- Determine availability of runtime dependencies -->
<available file="${oracle_spatial_test.2.jpa.dir}/${resource.dir}" type="dir" property="jpa.resources.exist"/>
<available file="${oracle_spatial_test.2.core.dir}/${resource.dir}" type="dir" property="core.resources.exist"/>
<available file="${oracle_spatial_test.2.oracle.dir}/${resource.dir}" type="dir" property="oracle.resources.exist"/>
<available file="${jdbc.driver.jar}" property="jdbc.jar.exist"/>
<!-- Determine where to get product classes, based upon availability -->
<condition property="use.eclipselink">
<isset property="eclipselink.jar.exist"/>
</condition>
<condition property="use.bundles">
<and>
<isset property="antlr.bundle.exist"/>
<isset property="asm.bundle.exist"/>
<isset property="jpa.bundle.exist"/>
<isset property="core.bundle.exist"/>
<isset property="oracle.bundle.exist"/>
<not><isset property="use.eclipselink"/></not>
</and>
</condition>
<condition property="use.classes">
<and>
<isset property="jpa.resources.exist"/>
<isset property="core.resources.exist"/>
<isset property="oracle.resources.exist"/>
<isset property="jpa.classes.exist"/>
<isset property="core.classes.exist"/>
<isset property="oracle.classes.exist"/>
<not><isset property="use.eclipselink"/></not>
<not><isset property="use.bundles"/></not>
</and>
</condition>
<!-- 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"/>
<!-- Determine appropriate settings for Oracle lib variables (overrides of .lib variables won't get reset) -->
<!-- Check first in oracle extensions dir -->
<condition property="oracle.xdb.lib" value="${oracle.extensions.depend.dir}/${oracle.xdb.jar}"
else="${extensions.depend.dir}/${oracle.xdb.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.xdb.jar}"/>
</condition>
<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.xmlparser.lib" value="${oracle.extensions.depend.dir}/${oracle.xmlparser.jar}"
else="${extensions.depend.dir}/${oracle.xmlparser.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.xmlparser.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.ucp.lib" value="${oracle.extensions.depend.dir}/${oracle.ucp.jar}"
else="${extensions.depend.dir}/${oracle.ucp.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.ucp.jar}"/>
</condition>
<condition property="oracle.sdoapi.lib" value="${oracle.extensions.depend.dir}/${oracle.sdoapi.jar}"
else="${extensions.depend.dir}/${oracle.sdoapi.jar}">
<available file="${oracle.extensions.depend.dir}/${oracle.sdoapi.jar}"/>
</condition>
<!-- Now retest using the regular extensions dir, if already found variables will not be reset -->
<available file="${oracle.xdb.lib}" property="oracle.xdb.lib.exist"/>
<available file="${oracle.aqapi.lib}" property="oracle.aqapi.lib.exist"/>
<available file="${oracle.xmlparser.lib}" property="oracle.xmlparser.lib.exist"/>
<available file="${oracle.ucp.lib}" property="oracle.ucp.lib.exist"/>
<available file="${oracle.sdoapi.lib}" property="oracle.sdoapi.lib.exist"/>
<!-- Determine availability of other dependencies. -->
<condition property="dependency.ok">
<and>
<isset property="test.framework.exist"/>
<isset property="core.test.models.exist"/>
<isset property="jpatest.framework.exist"/>
<isset property="junit.lib.exist"/>
<isset property="oracle.xdb.lib.exist"/>
<isset property="jdbc.jar.exist"/>
<isset property="oracle.aqapi.lib.exist"/>
<isset property="oracle.xmlparser.lib.exist"/>
<isset property="oracle.ucp.lib.exist"/>
<isset property="oracle.sdoapi.lib.exist"/>
</and>
</condition>
<!-- Define system properties for resource processing and testing -->
<property name="eclipselink.logging.level" value="${logging.level}"/>
<propertyset id="test.run.propertyset" dynamic="false">
<propertyref prefix="test.security-manager"/>
<propertyref regex="db\.(?!pwd|url|oci).*"/>
<propertyref name="jdbc.driver.jar"/>
<propertyref name="eclipselink.logging.level"/>
</propertyset>
<condition property="evnarg.key.tmplib" value="LD_LIBRARY_PATH" else="IGN_OCI_LIB">
<os family="unix"/>
</condition>
<condition property="evnarg.key.ldlib" value="DY${evnarg.key.tmplib}" else="${evnarg.key.tmplib}">
<and>
<not><equals arg1="IGN_OCI_LIB" arg2="${evnarg.key.tmplib}"/></not>
<contains string="${os.name}" substring="mac" casesensitive="false"/>
</and>
</condition>
<propertyset id="test.perfrun.propertyset" dynamic="false">
<propertyref regex="eclipselink.perfdb\.(?!pwd).*"/>
</propertyset>
</target>
<target name="announce_missing_dependencies" unless="dependency.ok" description="publicize missing dependencies">
<echo message="Following is a list of dependencies and their status ('found=' anything but 'true' means it wasn't found):"/>
<echo message=" Test infrastructure:"/>
<echo message=" '${junit.lib}' :: found='${junit.lib.exist}'"/>
<echo message=" '${oracle_spatial_test.2.jpa.test.dir}/${jpatest.framework.jar}' :: found='${jpatest.framework.exist}'"/>
<echo message=" '${oracle_spatial_test.2.core.test.dir}/${core.test.jar}' :: found='${core.test.models.exist}'"/>
<echo message=" '${oracle_spatial_test.2.core.test.dir}/${coretest.framework.jar}' :: found='${test.framework.exist}'"/>
<echo message="The test framework is currently part of the core.test and jpa.test projects. Be sure they are built."/>
<echo message=" oracle dependency location: '${oracle.extensions.depend.dir}' :: found='${oracle.depend.dir.exist}'"/>
<echo message=" dependency location: '${extensions.depend.dir}' :: found='${ext.depend.dir.exist}'"/>
<echo message=" '${jdbc.driver.jar}' :: found='${jdbc.jar.exist}'"/>
<echo message=" '${oracle.xdb.lib}' :: found='${oracle.xdb.lib.exist}'"/>
<echo message=" '${oracle.aqapi.lib}' :: found='${oracle.aqapi.lib.exist}'"/>
<echo message=" '${oracle.xmlparser.lib}' :: found='${oracle.xmlparser.lib.exist}'"/>
<echo message=" '${oracle.ucp.lib}' :: found='${oracle.ucp.lib.exist}'"/>
<echo message=" '${oracle.sdoapi.lib}' :: found='${oracle.sdoapi.lib.exist}'"/>
<echo 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>
<target name="init-eclipselink" if="use.eclipselink">
<path id="oracle_spatial_test.product.path">
<pathelement path="${oracle_spatial_test.2.base.dir}/${eclipselink.jar}"/>
</path>
<echo message="Using EclipseLink.jar as 'product' in compile dependency: ${toString:oracle_spatial_test.product.path}."/>
</target>
<target name="init-bundles" if="use.bundles">
<path id="oracle_spatial_test.product.path">
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${antlr.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${asm.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.core_${version.string}.jar"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.jpa_${version.string}.jar"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.oracle_${version.string}.jar"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/org.eclipse.persistence.oracle_*v20*.jar"/>
<echo message="Using EclipseLink OSGi bundles as 'product' in compile dependency ${toString:oracle_spatial_test.product.path}."/>
</path>
</target>
<target name="init-classes" if="use.classes">
<path id="oracle_spatial_test.product.path">
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${antlr.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${asm.jar}"/>
<pathelement path="${oracle_spatial_test.2.jpa.dir}/${classes.dir}"/>
<pathelement path="${oracle_spatial_test.2.jpa.dir}/${resource.dir}"/>
<pathelement path="${oracle_spatial_test.2.core.dir}/${classes.dir}"/>
<pathelement path="${oracle_spatial_test.2.core.dir}/${resource.dir}"/>
<pathelement path="${oracle_spatial_test.2.oracle.dir}/${classes.dir}"/>
<pathelement path="${oracle_spatial_test.2.oracle.dir}/${resource.dir}"/>
</path>
<echo message="Using EclipseLink classes directly as 'product' in compile dependency: ${toString:oracle_spatial_test.product.path}."/>
</target>
<target name="init-classpaths" unless="${use.modules}">
<property name="test.javac.version" value="1.8"/>
<property name="test.javac.args" value=""/>
<property name="test.junit.jvm.modules.prop" value=""/>
<path id="oracle_spatial_test.compile.module.path" cache="true"></path>
<path id="oracle_spatial_test.upgrade.module.path" cache="true"></path>
<path id="oracle_spatial_test.compile.core.path" cache="true">
<path refid="oracle_spatial_test.product.path"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${oracle_spatial_test.2.jpa.plugins.dir}/${persistence22.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${transaction.jar}"/>
<!--<fileset dir="${oracle_spatial_test.2.common.plugins.dir}" includes="${eclipselink.core.depend.without.connector}"/>-->
</path>
</target>
<target name="init-modulepaths" if="${use.modules}">
<property name="test.javac.version" value="9"/>
<property name="test.javac.args" value="--add-modules ${javac.modules}"/>
<property name="test.junit.jvm.modules.prop" value="--add-modules ${test.junit.jvm.modules}"/>
<path id="oracle_spatial_test.compile.module.path" cache="true">
<!--<pathelement path="${oracle_spatial_test.2.jpa.plugins.dir}/${persistence22.jar}"/>-->
</path>
<path id="oracle_spatial_test.upgrade.module.path" cache="true">
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${transaction.jar}"/>
</path>
<path id="oracle_spatial_test.compile.core.path" cache="true">
<path refid="oracle_spatial_test.product.path"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${oracle_spatial_test.2.jpa.plugins.dir}/${persistence22.jar}"/>
</path>
</target>
<target name="init" depends="pre-init, announce_missing_dependencies, init-eclipselink, init-bundles, init-classes, init-classpaths, init-modulepaths"
description="Initialize the build">
<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>
<fail message="Product classes do not exist anywhere! Compile product or populate jars." if="use.failed"/>
<path id="oracle_spatial_test.oracle.dependency.path">
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${oracle.xdb.lib}"/>
<pathelement path="${oracle.aqapi.lib}"/>
<pathelement path="${oracle.xmlparser.lib}"/>
<pathelement path="${oracle.orai18n.lib}"/>
<pathelement path="${oracle.orai18n-mapping.lib}"/>
<pathelement path="${oracle.ucp.lib}"/>
<pathelement path="${oracle.sdoapi.lib}"/>
</path>
<path id="oracle_spatial_test.test.infrastructure.path">
<pathelement path="${oracle_spatial_test.2.core.test.dir}/${coretest.framework.jar}"/>
<pathelement path="${oracle_spatial_test.2.core.test.dir}/${core.test.jar}"/>
<pathelement path="${oracle_spatial_test.2.jpa.test.dir}/${jpatest.framework.jar}"/>
<pathelement path="${oracle_spatial.test.2.oracle.test.dir}/${oracle.test.jar}"/>
</path>
<path id="oracle_spatial_test.public.dependency.path">
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${resource.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${ejb.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${jms.jar}"/>
<pathelement path="${oracle_spatial_test.2.common.plugins.dir}/${mail.jar}"/>
</path>
<!-- Define 'Helper' path refids -->
<!-- Classpath used for compiling tests. -->
<path id="oracle_spatial_test.compile.path">
<path refid="oracle_spatial_test.compile.core.path"/>
<path refid="oracle_spatial_test.public.dependency.path"/>
<path refid="oracle_spatial_test.oracle.dependency.path"/>
<path refid="oracle_spatial_test.test.infrastructure.path"/>
</path>
<path id="oracle_spatial_test.runtime.only.path">
<pathelement path="${oracle_spatial_test.build.location}/${oracle.spatial.test.jar}"/>
<pathelement path="${oracle_spatial_test.build.location}/${oracle.spatial.jpa.test.jar}"/>
<pathelement path="${oracle_spatial_test.build.location}/${eclipselink.struct.converter.model}.jar"/>
<pathelement path="${oracle_spatial_test.run.dir}"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${oracle_spatial_test.2.core.test.dir}/resource"/>
</path>
<!-- Classpath used for running tests. -->
<path id="oracle_spatial_test.run.path">
<path refid="oracle_spatial_test.compile.path"/>
<path refid="oracle_spatial_test.runtime.only.path"/>
</path>
</target>
<target name="init-test-macro" depends="init">
<macrodef name="test">
<attribute name="include" />
<attribute name="classpath" default="oracle_spatial_test.run.path"/>
<attribute name="modulepath" default="oracle_spatial_test.compile.module.path"/>
<attribute name="upgrademodulepath" default="oracle_spatial_test.upgrade.module.path"/>
<attribute name="dburl" default="${db.url}"/>
<sequential>
<local name="junit.failed"/>
<property name="additional.jvmargs" value=""/>
<local name="arg.lib.path"/>
<condition property="arg.lib.path" value="${jdbc.driver.oci.dir}" else="--empty--">
<contains string="@{dburl}" substring="oracle:oci:"/>
</condition>
<local name="single.test"/>
<condition property="single.test" value="true" else="false">
<not>
<contains string="@{include}" substring=".java"/>
</not>
</condition>
<echo message="${line.separator}${line.separator}Running test on @{dburl}${line.separator}${line.separator}" />
<echo message="Environment settings:"/>
<echo message=" ${evnarg.key.ldlib} ='${arg.lib.path}'"/>
<echo message="JUnit settings:"/>
<echo message=" test ='@{include}'"/>
<echo message=" run.dir ='${oracle_spatial_test.run.dir}'"/>
<echo message=" report.dir ='${oracle_spatial_test.report.dir}'"/>
<echo message=" failonerror ='${fail.on.error}'"/>
<echo message="Java settings:"/>
<echo message=" jdk.version ='${test.junit.jdk.JAVA_VERSION}'"/>
<echo message=" additional.jvmargs ='${additional.jvmargs}'"/>
<echo message=" maxmemory ='${max.heap.memory}'"/>
<echo message=" java args ='${test.junit.jvm.modules.prop}'"/>
<echo message=" module-path ='${toString:@{modulepath}}'"/>
<echo message=" upgrade-module-path ='${toString:@{upgrademodulepath}}'"/>
<echo message=" class-path ='${toString:@{classpath}}'"/>
<echo message="System properties: ='db.url=@{dburl}, java.library.path=${arg.lib.path}, ${toString:test.run.propertyset}'"/>
<echo message=" db.pwd ='**********'"/>
<mkdir dir="${oracle_spatial_test.run.dir}"/>
<mkdir dir="${oracle_spatial_test.report.dir}"/>
<junit fork="yes" jvm="${test.junit.jvm.exec}" maxmemory="${max.heap.memory}"
dir="${oracle_spatial_test.run.dir}" showoutput="true" printsummary="yes" failureproperty="junit.failed">
<classpath refid="@{classpath}"/>
<modulepath refid="@{modulepath}"/>
<upgrademodulepath refid="@{upgrademodulepath}"/>
<jvmarg line="${test.junit.jvm.modules.prop}"/>
<jvmarg line="${additional.jvmargs}"/>
<jvmarg line="-Djava.library.path=${arg.lib.path}"/>
<syspropertyset refid="test.run.propertyset"/>
<sysproperty key="db.url" value="@{dburl}"/>
<sysproperty key="db.pwd" value="${db.pwd}"/>
<env key="${evnarg.key.ldlib}" value="${arg.lib.path}"/>
<formatter type="xml"/>
<!--<formatter type="plain"/>-->
<batchtest haltonfailure="no" todir="${oracle_spatial_test.report.dir}">
<fileset dir="${oracle_spatial_test.src.dir}">
<include name="@{include}"/>
</fileset>
</batchtest>
<test name="@{include}" haltonfailure="no" todir="${oracle_spatial_test.report.dir}" if="${single.test}"/>
</junit>
<fail message="TESTS FAILED !">
<condition>
<and>
<isset property="junit.failed"/>
<istrue value="${fail.on.error}"/>
</and>
</condition>
</fail>
</sequential>
</macrodef>
</target>
<target name="init-report-macro" depends="pre-init">
<macrodef name="generate-report">
<attribute name="dir" default="${oracle_spatial_test.report.dir}"/>
<sequential>
<junitreport todir="@{dir}">
<fileset dir="@{dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" todir="@{dir}"/>
</junitreport>
</sequential>
</macrodef>
</target>
<target name="init-java-macro" depends="init">
<macrodef name="run-java">
<attribute name="classname" />
<attribute name="classpath" default="oracle_spatial_test.run.path"/>
<attribute name="modulepath" default="oracle_spatial_test.compile.module.path"/>
<attribute name="upgrademodulepath" default="oracle_spatial_test.upgrade.module.path"/>
<attribute name="dburl" default="${db.url}"/>
<element name="customize" implicit="true" optional="true"/>
<sequential>
<property name="additional.jvmargs" value=""/>
<local name="arg.lib.path"/>
<condition property="arg.lib.path" value="${jdbc.driver.oci.dir}" else="--empty--">
<contains string="@{dburl}" substring="oracle:oci:"/>
</condition>
<condition property="jvmarg.performance.baseline.version"
value="-Dtoplink.loadbuild.baseline-version=${performance.baseline.version}" else="-Ddummy=dummy">
<isset property="performance.baseline.version"/>
</condition>
<echo message="Environment settings:"/>
<echo message=" ${evnarg.key.ldlib} ='${arg.lib.path}'"/>
<echo message="Java settings:"/>
<echo message=" classname ='@{classname}'"/>
<echo message=" run.dir ='${oracle_spatial_test.run.dir}'"/>
<echo message=" report.dir ='${oracle_spatial_test.report.dir}'"/>
<echo message=" failonerror ='${fail.on.error}'"/>
<echo message=" jdk.version ='${test.junit.jdk.JAVA_VERSION}'"/>
<echo message=" additional.jvmargs ='${additional.jvmargs}'"/>
<echo message=" maxmemory ='${max.heap.memory}'"/>
<echo message=" java args ='${test.junit.jvm.modules.prop}'"/>
<echo message=" module-path ='${toString:@{modulepath}}'"/>
<echo message=" upgrade-module-path ='${toString:@{upgrademodulepath}}'"/>
<echo message=" class-path ='${toString:@{classpath}}'"/>
<echo message="System properties: ='db.url=@{dburl}, java.library.path=${arg.lib.path}, ${toString:test.run.propertyset}'"/>
<echo message=" db.pwd ='**********'"/>
<echo message="Perf properties: ='${jvmarg.performance.baseline.version}, ${toString:test.perfrun.propertyset}'"/>
<echo message=" eclipselink.perfdb.pwd ='**********'"/>
<mkdir dir="${oracle_spatial_test.run.dir}"/>
<mkdir dir="${oracle_spatial_test.report.dir}"/>
<java fork="true" jvm="${test.junit.jvm.exec}" maxmemory="${max.heap.memory}"
dir="${oracle_spatial_test.run.dir}" failonerror="${fail.on.error}"
classname="@{classname}">
<classpath refid="@{classpath}"/>
<modulepath refid="@{modulepath}"/>
<upgrademodulepath refid="@{upgrademodulepath}"/>
<jvmarg line="${test.junit.jvm.modules.prop}"/>
<jvmarg line="-Djava.library.path=${arg.lib.path}"/>
<syspropertyset refid="test.run.propertyset"/>
<sysproperty key="db.url" value="@{dburl}"/>
<sysproperty key="db.pwd" value="${db.pwd}"/>
<syspropertyset refid="test.perfrun.propertyset"/>
<sysproperty key="eclipselink.perfdb.pwd" value="${eclipselink.perfdb.pwd}"/>
<env key="${evnarg.key.ldlib}" value="${arg.lib.path}"/>
<jvmarg value="${jvmarg.performance.baseline.version}"/>
<jvmarg value="-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"/>
<jvmarg line="${additional.jvmargs}"/>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="init-test-prompt-macro" depends="init-java-macro">
<macrodef name="test-prompt">
<attribute name="testmodel" />
<attribute name="classpath" default="oracle_spatial_test.run.path"/>
<attribute name="modulepath" default="oracle_spatial_test.compile.module.path"/>
<attribute name="upgrademodulepath" default="oracle_spatial_test.upgrade.module.path"/>
<attribute name="dburl" default="${db.url}"/>
<element name="customize" implicit="true" optional="true"/>
<sequential>
<echo message="${line.separator}${line.separator}Running @{testmodel} on ${db.url}${line.separator}${line.separator}" />
<run-java classname="org.eclipse.persistence.testing.framework.PromptTestRunner"
classpath="@{classpath}" modulepath="@{modulepath}" upgrademodulepath="@{upgrademodulepath}"
dburl="@{dburl}">
<arg value="testmodel=@{testmodel}" />
<arg value="regressionlog=${oracle_spatial_test.report.dir}/test.log" />
<arg value="saveresults=${should.save.results}" />
<customize/>
</run-java>
</sequential>
</macrodef>
</target>
<target name="init-testing" depends="init-test-macro, init-report-macro, init-test-prompt-macro"/>
<!-- Cleaning, Building & Packaging -->
<!-- Clean all build generated content. -->
<target name="clean" depends="pre-init" description="Clean the build">
<echo message="Cleaning..."/>
<echo message=" ${oracle_spatial_test.classes.dir}"/>
<echo message=" ${oracle_spatial_test.report.dir}"/>
<echo message=" ${oracle_spatial_test.run.dir}"/>
<echo message=" ${oracle_spatial_test.build.location}/${oracle.spatial.test.jar}"/>
<echo message=" ${oracle_spatial_test.build.location}/${eclipselink.struct.converter.model}.jar"/>
<echo message=" ${oracle_spatial_test.build.location}/${oracle.spatial.jpa.test.jar}"/>
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${oracle_spatial_test.classes.dir}"/>
<fileset dir="${oracle_spatial_test.report.dir}"/>
<fileset dir="${oracle_spatial_test.run.dir}"/>
<fileset dir="${oracle_spatial_test.build.location}" includes="${oracle.spatial.test.jar}"/>
<fileset dir="${oracle_spatial_test.build.location}" includes="${eclipselink.struct.converter.model}.jar"/>
<fileset dir="${oracle_spatial_test.build.location}" includes="${oracle.spatial.jpa.test.jar}"/>
</delete>
</target>
<!-- Translates the login information in the resources into the run directory. -->
<target name="process-resource" depends="init">
<!-- fail message="Cannot find jdbc driver: '${jdbc.driver.jar}'." unless="jdbc.jar.exist"/ -->
<!-- fail message="Cannot find tools library: '${tools.lib}'." unless="tools.jar.exist"/ -->
<mkdir dir="${oracle_spatial_test.run.dir}"/>
<filter token="dbUser" value="${db.user}"/>
<filter token="dbPassword" value="${db.pwd}"/>
<filter token="driverClass" value="${db.driver}"/>
<filter token="dbURL" value="${db.url}"/>
<filter token="loglevel" value="${logging.level}"/>
<filter token="dbPlatform" value="${db.platform}"/>
<echo message="Setup filtering values:"/>
<echo message="dbUser: '${db.user}'"/>
<echo message="dbPassword: ********"/>
<echo message="driverClass: '${db.driver}'"/>
<echo message="dbURL '${db.url}'"/>
<echo message="loglevel: '${logging.level}'"/>
<echo message="dbPlatform: '${db.platform}'"/>
<echo message=" "/>
<echo message="Filter copying Resources (default encoding):"/>
<echo message=" from '${oracle_spatial_test.resource.dir}'"/>
<echo message=" to '${oracle_spatial_test.classes.dir}'"/>
<copy todir="${oracle_spatial_test.classes.dir}" filtering="true" overwrite="true">
<fileset dir="${oracle_spatial_test.resource.dir}" includes="org/eclipse/persistence/**/*.xml"/>
</copy>
</target>
<!-- Compiles all tests. -->
<target name="compile" depends="init, process-resource" description="compile EclipseLink Oracle tests">
<!-- fail message="Cannot find junit: '${junit.lib}'." unless="junit.jar.exist"/ -->
<echo message="Compiler settings:"/>
<echo message="jdk.version ='${test.junit.jdk.JAVA_VERSION}'"/>
<echo message="srcdir ='${oracle_spatial_test.src.dir}'"/>
<echo message="destdir ='${oracle_spatial_test.classes.dir}'"/>
<echo message="debug/debuglevel ='${javac.debug}'/'${javac.debuglevel}'"/>
<echo message="source/target ='${test.javac.version}'/'${test.javac.version}'"/>
<echo message="deprecation ='${javac.deprecation}'"/>
<echo message="failonerror ='${fail.on.error}'"/>
<echo message="memoryMaximumSize ='${max.heap.memory}'"/>
<echo message="javac args ='${test.javac.args}'"/>
<echo message="module-path ='${toString:oracle_spatial_test.compile.module.path}'"/>
<echo message="upgrade-module-path ='${toString:oracle_spatial_test.upgrade.module.path}'"/>
<echo message="class-path ='${toString:oracle_spatial_test.compile.path}'"/>
<mkdir dir="${oracle_spatial_test.classes.dir}"/>
<javac srcdir="${oracle_spatial_test.src.dir}" destdir="${oracle_spatial_test.classes.dir}"
debug="${javac.debug}" debuglevel="${javac.debuglevel}"
encoding="UTF-8" deprecation="${javac.deprecation}"
source="${test.javac.version}" target="${test.javac.version}"
failonerror="${fail.on.error}"
memoryMaximumSize="${max.heap.memory}"
includes="org/eclipse/persistence/**"
classpathref="oracle_spatial_test.compile.path"
modulepathref="oracle_spatial_test.compile.module.path"
upgrademodulepathref="oracle_spatial_test.upgrade.module.path"
fork="true" >
<compilerarg line="${test.javac.args}"/>
</javac>
</target>
<!-- Packages tests jar. -->
<target name="package" depends="compile">
<!-- Package the structconverter JPA model jar. -->
<jar jarfile="${eclipselink.struct.converter.model}.jar">
<zipfileset dir="resource/structconverter" includes="*.xml" prefix="META-INF"/>
<fileset dir="${oracle_spatial_test.classes.dir}"
includes="org/eclipse/persistence/testing/models/jpa/structconverter/**"/>
</jar>
<!-- Package the JPA oracle specific tests jar. -->
<jar jarfile="${oracle.spatial.jpa.test.jar}">
<fileset dir="${oracle_spatial_test.classes.dir}"
includes="org/eclipse/persistence/testing/tests/jpa/**"/>
</jar>
<!-- Build tests jar. -->
<jar jarfile="${oracle.spatial.test.jar}">
<fileset dir="${oracle_spatial_test.classes.dir}"
includes="org/eclipse/persistence/**/*.class,
org/eclipse/persistence/**/*.xml"
excludes="org/eclipse/persistence/testing/models/jpa/**,
org/eclipse/persistence/testing/tests/jpa/**"/>
</jar>
</target>
<!-- Testing -->
<!-- Test target to initialize a clean database -->
<target name="clear-database" depends="init-testing">
<test include="org.eclipse.persistence.testing.tests.ClearDatabaseSchemaTest"/>
</target>
<!-- Default test target, runs test.class from test.properties (default is OracleSpatialTestModel). -->
<target name="test" depends="init-testing">
<test include="${test.class}"/>
<generate-report/>
</target>
<!-- Runs Core Oracle-specific spatial tests. -->
<target name="test-oracle-spatial" depends="init-testing">
<echo message="Creating MY_GEOMETRY datatype for spatial tests: ${db.url}..."/>
<sql userid="${db.user}" password="${db.pwd}"
driver="${db.driver}"
url="${db.url}"
classpath="${jdbc.driver.jar}"
keepformat="true" delimiter="|"
onerror="continue">
CREATE OR REPLACE TYPE MY_GEOMETRY AS OBJECT (id NUMBER, geom MDSYS.SDO_GEOMETRY);
</sql>
<test include="org.eclipse.persistence.testing.tests.OracleSpatialTestModel"/>
<generate-report/>
</target>
<!-- Prompt runner test target, runs test.class from test.properties (default is OracleSpatialTestModel). -->
<target name="test-prompt" depends="init-testing">
<test-prompt testmodel="${test.class}" dburl="${db.url}"/>
</target>
<target name="generate-report" depends="init-report-macro">
<generate-report/>
</target>
<!-- Launches the testing browser -->
<target name="test-browser" depends="init, init-java-macro">
<echo>Running test browser</echo>
<run-java classname="org.eclipse.persistence.testing.framework.ui.TestingBrowserFrame" />
</target>
</project>