blob: 2e2988da168e702ac121279ec9eb34b356bd1c70 [file] [log] [blame]
<?xml version="1.0"?>
<!--/*******************************************************************************
* 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:
* egwin - initial API and implementation
* minorman - dbws utils oracle-specific test target
* egwin - update to adopt calling standards
* egwin - update to dynamic dependency loading
#******************************************************************************/-->
<!-- 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 test classes
- package : packages tests into eclipselink-dbws-oracle-depend-test.jar
- test: Runs DBWS utils Oracle-specific tests
-->
<project name="eclipselink.dbws.builder.test.oracle" default="build" basedir=".">
<!-- Test to make certain that build is run from component dir -->
<available file="../${ant.project.name}" type="dir" property="dbwsbldrorcltst.is.local"/>
<fail unless="dbwsbldrorcltst.is.local" message="Not running from '${ant.project.name}' directory"/>
<dirname property="dbwsbldrorcltst.build.location_temp" file="${ant.file.eclipselink.dbws.builder.test.oracle}"/>
<pathconvert targetos="unix" property="dbwsbldrorcltst.build.location">
<path>
<pathelement location="${dbwsbldrorcltst.build.location_temp}"/>
</path>
</pathconvert>
<echo message="dbwsbldrorcltst.build.location = '${dbwsbldrorcltst.build.location}'"/>
<condition property="dbwsbldrorcltst.2.base.dir" value="../.." else="..">
<contains string="${dbwsbldrorcltst.build.location}" substring="utils/${ant.project.name}"/>
</condition>
<echo message="dbwsbldrorcltst.2.base.dir = '${dbwsbldrorcltst.2.base.dir}'"/>
<property name="dbwsbldrorcltst.2.common.plugins.dir" value="${dbwsbldrorcltst.build.location}/${dbwsbldrorcltst.2.base.dir}/plugins"/>
<property name="dbwsbldrorcltst.2.plugins.dir" value="${dbwsbldrorcltst.build.location}/../plugins"/>
<property name="dbwsbldrorcltst.2.buildsys.dir" value="${dbwsbldrorcltst.2.base.dir}/buildsystem"/>
<property name="dbwsbldrorcltst.2.dbwsbldr.dir" value="../org.eclipse.persistence.dbws.builder"/>
<!-- OS environment variables have 'env' as a prefix -->
<property environment="env"/>
<condition property="custom.test.properties.message" value="Loading ${user.home}/test.properties..."
else="Custom properties file '${user.home}/test.properties' not found to load.">
<available file="${user.home}/test.properties"/>
</condition>
<echo message="${custom.test.properties.message}"/>
<property file="${user.home}/test.properties"/>
<condition property="custom.properties.message" value="Loading ${user.home}/build.properties..."
else="Custom properties file '${user.home}/build.properties' not found to load.">
<available file="${user.home}/build.properties"/>
</condition>
<echo message="${custom.properties.message}"/>
<property file="${user.home}/build.properties"/>
<property file="${test.properties}"/>
<property file="${dbwsbldrorcltst.build.location}/test.properties"/>
<property file="${dbwsbldrorcltst.build.location}/antbuild.properties"/>
<!-- Sets default oracle.extensions.depend dir location to default based upon discovered dir heirarchy -->
<!-- Must be defined after ${user.home}/build.properties and ${user.home}/test.properties are included to allow redefinition -->
<condition property="oracle.extensions.depend.dir" value="../../../extension.oracle.lib.external" else="../../extension.oracle.lib.external">
<contains string="${dbwsbldrorcltst.build.location}" substring="utils"/>
</condition>
<!-- Primary Targets: "jar" separate for dev use -->
<target name="build" depends="clean, compile, package" description="build dbwsbldrorcltsts jar"/>
<target name="test" depends="build, run-tests" description="run tests after building"/>
<!-- clean -->
<target name="clean" description="Clean all generated content">
<delete dir="${classes.dir}" failonerror="false" />
<delete dir="${run.dir}" failonerror="false" />
<delete file="${dbwsbldrorcltst.jar}" />
</target>
<!-- initialize varables and paths needed for compile -->
<!-- the number of properties needed now is too great for lazy loading without a target -->
<target name="init">
<property name="custom.tasks.lib" value="${dbwsbldrorcltst.2.buildsys.dir}/ant_customizations.jar"/>
<available file="${custom.tasks.lib}" property="ant_customizations.exist"/>
<fail unless="ant_customizations.exist" message="Cannot find custom tasks library: '${custom.tasks.lib}'"/>
<property name="custom.tolower.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.ToLower"/>
<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="toLower" classname="${custom.tolower.task.class}" classpath="${custom.tasks.lib}"/>
<taskdef name="say" classname="${custom.echo.task.class}" classpath="${custom.tasks.lib}"/>
<taskdef name="selectbundle" classname="${custom.selectbundle.task.class}" classpath="${custom.tasks.lib}"/>
<!-- 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}"/>
<!-- dependency properties -->
<selectbundle basename="${asm.prefix}" directory="${dbwsbldrorcltst.2.common.plugins.dir}"
criterion="${asm.criteria}" property="asm.jar"
/>
<selectbundle basename="${dbwsbldr.prefix}" directory="${dbwsbldrorcltst.2.common.plugins.dir}"
criterion="${dbwsbldr.criteria}" property="dbwsbldr.jar"
/>
<selectbundle basename="${servlet.prefix}" directory="${dbwsbldrorcltst.2.common.plugins.dir}"
criterion="${servlet.criteria}" property="servlet.jar"
/>
<selectbundle basename="${ddlparser.prefix}" directory="${dbwsbldrorcltst.2.plugins.dir}"
criterion="${ddlparser.criteria}" property="ddlparser.jar"
/>
<selectbundle basename="${wsdl.prefix}" directory="${dbwsbldrorcltst.2.plugins.dir}"
criterion="${wsdl.criteria}" property="wsdl.jar"
/>
<echo message="junit.lib ='${junit.lib}'"/>
<echo message="asm.jar ='${dbwsbldrorcltst.2.common.plugins.dir}/${asm.jar}'"/>
<echo message="dbwsbldr.jar ='${dbwsbldrorcltst.2.common.plugins.dir}/${dbwsbldr.jar}'"/>
<!-- property name="dbwsbldr.jar" value="${dbwsbldr.prefix}_${version.string}.jar"/>
<echo message="dbwsbldr.jar ='${dbwsbldr.jar}'"/ -->
<echo message="servlet.jar ='${dbwsbldrorcltst.2.common.plugins.dir}/${servlet.jar}'"/>
<echo message="ddlparser.jar='${dbwsbldrorcltst.2.plugins.dir}/${ddlparser.jar}'"/>
<echo message="wsdl.jar ='${dbwsbldrorcltst.2.plugins.dir}/${wsdl.jar}'"/>
<echo message="persistence.jar ='${dbwsbldrorcltst.2.common.plugins.dir}/${persistence.jar}'"/>
<property name="eclipselink.lib" value="${dbwsbldrorcltst.2.base.dir}/${eclipselink.jar}"/>
<property name="asm.lib" value="${dbwsbldrorcltst.2.common.plugins.dir}/${asm.jar}"/>
<property name="servlet.lib" value="${dbwsbldrorcltst.2.common.plugins.dir}/${servlet.jar}"/>
<property name="dbwsbldr.lib" value="${dbwsbldrorcltst.2.common.plugins.dir}/${dbwsbldr.jar}"/>
<property name="ddlparser.lib" value="${dbwsbldrorcltst.2.plugins.dir}/${ddlparser.jar}"/>
<property name="wsdl.lib" value="${dbwsbldrorcltst.2.plugins.dir}/${wsdl.jar}"/>
<property name="persistence.lib" value="${dbwsbldrorcltst.2.common.plugins.dir}/${persistence.jar}"/>
<!-- dependency tests -->
<available classname="org.junit.Test" classpath="${junit.lib}" property="junit.lib.exist"/>
<available file="${eclipselink.lib}" property="eclipselink.exist"/>
<available file="${persistence.lib}" property="persistence.exist"/>
<available file="${asm.lib}" property="asm.bundle.exist"/>
<available file="${servlet.lib}" property="servlet.lib.exist"/>
<available file="${wsdl.lib}" property="wsdl.lib.exist"/>
<available file="${ddlparser.lib}" property="ddlparser.lib.exist"/>
<available file="${dbwsbldr.lib}" property="dbwsbldr.lib.exist"/>
<fail message="Cannot find: '${junit.lib}'" unless="junit.lib.exist"/>
<fail message="Cannot find: '${eclipselink.lib}'" unless="eclipselink.exist"/>
<fail message="Cannot find: '${persistence.lib}'" unless="persistence.exist"/>
<fail message="Cannot find: '${asm.lib}'" unless="asm.bundle.exist"/>
<fail message="Cannot find: '${servlet.lib}'" unless="servlet.lib.exist"/>
<fail message="Cannot find: '${wsdl.lib}'" unless="wsdl.lib.exist"/>
<fail message="Cannot find: '${ddlparser.lib}'" unless="ddlparser.lib.exist"/>
<fail message="Cannot find: '${dbwsbldr.lib}'" unless="dbwsbldr.lib.exist"/>
<!-- Set Compile Path -->
<path id="dbwsbldrorcltst.compile.path">
<pathelement path="${junit.lib}"/>
<pathelement path="${eclipselink.lib}"/>
<pathelement path="${persistence.lib}"/>
<pathelement path="${asm.lib}"/>
<pathelement path="${servlet.lib}"/>
<pathelement path="${dbwsbldr.lib}"/>
<pathelement path="${ddlparser.lib}"/>
<pathelement path="${wsdl.lib}"/>
</path>
</target>
<target name="init-tests" depends="init">
<!-- Test dependencies -->
<selectbundle basename="${validation.prefix}" directory="${dbwsbldrorcltst.2.common.plugins.dir}"
criterion="${validation.criteria}" property="validation.jar"
/>
<selectbundle basename="${mail.prefix}" directory="${dbwsbldrorcltst.2.common.plugins.dir}"
criterion="${mail.criteria}" property="mail.jar"
/>
<echo message="oracle.extensions.depend.dir = '${oracle.extensions.depend.dir}'"/>
<echo message="jdbc.driver.jar ='${jdbc.driver.jar}'"/>
<echo message="dbwsbldrorcltst.jar ='./${dbwsbldrorcltst.jar}'"/>
<echo message="validation.jar ='${dbwsbldrorcltst.2.common.plugins.dir}/${validation.jar}'"/>
<echo message="mail.jar ='${dbwsbldrorcltst.2.common.plugins.dir}/${mail.jar}'"/>
<echo message="xdb.jar ='${oracle.extensions.depend.dir}/${xdb.jar}'"/>
<echo message="xmlparser.jar ='${oracle.extensions.depend.dir}/${xmlparser.jar}'"/>
<property name="validation.lib" value="${dbwsbldrorcltst.2.common.plugins.dir}/${validation.jar}"/>
<property name="mail.lib" value="${dbwsbldrorcltst.2.common.plugins.dir}/${mail.jar}"/>
<available file="${jdbc.driver.jar}" property="jdbc.jar.exist"/>
<available file="./${dbwsbldrorcltst.jar}" property="dbwsbldrorcltst.jar.exist"/>
<available file="${validation.lib}" property="validation.lib.exist"/>
<available file="${mail.lib}" property="mail.lib.exist"/>
<!-- oracle extension dir test -->
<available file="${oracle.extensions.depend.dir}" type="dir" property="oracle.depend.dir.exist"/>
<available file="${oracle.extensions.depend.dir}/${xdb.jar}" property="xdb.jar.exist"/>
<available file="${oracle.extensions.depend.dir}/${xmlparser.jar}" property="xmlparser.jar.exist"/>
<!-- Set Run Path-->
<path id="dbwsbldrorcltst.run.path">
<path refid="dbwsbldrorcltst.compile.path"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="./${dbwsbldrorcltst.jar}"/>
<pathelement path="${validation.lib}"/>
<pathelement path="${mail.lib}"/>
<pathelement path="${oracle.extensions.depend.dir}/${xdb.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${xmlparser.jar}"/>
</path>
<!-- Set Run Condition -->
<condition property="is.oracle.platform">
<matches
pattern="org.eclipse.persistence.platform.database.oracle.Oracle[0-12]{1,2}Platform"
string="${db.platform}"
/>
</condition>
<condition property="support.test">
<and>
<isset property="is.oracle.platform"/>
<isset property="jdbc.jar.exist"/>
<isset property="dbwsbldrorcltst.jar.exist"/>
<isset property="validation.lib.exist"/>
<isset property="mail.lib.exist"/>
<isset property="oracle.depend.dir.exist"/>
<isset property="xdb.jar.exist"/>
<isset property="xmlparser.jar.exist"/>
<isset property="db.platform"/>
<isset property="db.driver"/>
<isset property="db.url"/>
<isset property="db.user"/>
<isset property="db.pwd"/>
<isset property="db.ddl.create"/>
<isset property="db.ddl.drop"/>
</and>
</condition>
<!-- Report unmet Run conditions -->
<say message="Conditions not met to execute tests!" unless="support.test"/>
<say message=" DB platform not set to Oracle!" unless="is.oracle.platform"/>
<say message=" jdbc.jar not found!" unless="jdbc.jar.exist"/>
<say message=" dbwsbldrorcltst.jar not found!" unless="dbwsbldrorcltst.jar.exist"/>
<say message=" validation.lib not found!" unless="validation.lib.exist"/>
<say message=" mail.lib not found!" unless="mail.lib.exist"/>
<say message=" Oracle extension dir not found!" unless="oracle.depend.dir.exist"/>
<say message=" xdb.jar not found!" unless="xdb.jar.exist"/>
<say message=" xmlparser.jar not found!" unless="xmlparser.jar.exist"/>
<say message=" db.platform not set!" unless="db.platform"/>
<say message=" db.driver not set!" unless="db.driver"/>
<say message=" db.url not set!" unless="db.url"/>
<say message=" db.user not set!" unless="db.user"/>
<say message=" db.pwd not set!" unless="db.pwd"/>
<say message=" db.ddl not set!" unless="db.ddl.create"/>
<say message=" db.ddl not set!" unless="db.ddl.drop"/>
</target>
<target name="compile" depends="init" description="Compile DBWS Util test Common classes">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
includes="**/*.java"
fork="true"
classpathref="dbwsbldrorcltst.compile.path"
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" />
<copy todir="${classes.dir}">
<fileset dir="resource" includes="**" />
</copy>
</target>
<target name="package" description="package DBWS Util Oracle Test Common jar">
<jar jarfile="./${dbwsbldrorcltst.jar}">
<fileset dir="${classes.dir}">
<include name="**/*"/>
</fileset>
</jar>
</target>
<target name="run-tests" if="support.test" depends="init-tests" description="setup, compile, and run dbws util testsuites">
<pathconvert property="dbwsbldrorcltst.run.path.msg" refid="dbwsbldrorcltst.run.path"/>
<echo>Running test on ${db.url}</echo>
<echo>ClassPath: ${dbwsbldrorcltst.run.path.msg}</echo>
<delete dir="./${report.dir}" failonerror="false" />
<delete dir="./${run.dir}" failonerror="false" />
<mkdir dir="./${report.dir}"/>
<mkdir dir="./${run.dir}"/>
<!-- Can be set e.g. in test.properties to add VM options for a particular platform/driver -->
<property name="additional.jvmargs" value="-Ddummy2=dummy"/>
<property name="test.class" value="**/*TestSuite*" />
<junit printsummary="withOutAndErr" fork="yes" dir="${run.dir}" tempdir="${run.dir}" maxmemory="512m" showoutput="true">
<formatter type="xml" />
<classpath>
<path refid="dbwsbldrorcltst.run.path"/>
</classpath>
<sysproperty key="eclipselink.logging.level" value="${logging.level}" />
<sysproperty key="db.driver" value="${db.driver}" />
<sysproperty key="db.url" value="${db.url}" />
<sysproperty key="db.user" value="${db.user}" />
<sysproperty key="db.pwd" value="${db.pwd}" />
<sysproperty key="db.platform" value="${db.platform}" />
<sysproperty key="db.ddl.create" value="${db.ddl.create}" />
<sysproperty key="db.ddl.drop" value="${db.ddl.drop}" />
<sysproperty key="db.ddl.debug" value="${db.ddl.debug}" />
<sysproperty key="release.version" value="${release.version}" />
<jvmarg line="${additional.jvmargs}"/>
<batchtest todir="${report.dir}">
<fileset dir="${src.dir}">
<include name="${test.class}" />
<exclude name="**/DBWSTestSuite*" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${report.dir}" >
<fileset dir="${report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" todir="./${report.dir}" />
</junitreport>
</target>
</project>