blob: b7ab7e55523ff954e0119e99b465f8e824436047 [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 concatinated
* e.g. 'runpathref'
* - multi-word tasks (taskdef) names are concatinated
* 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
* egwin - update to adopt calling standards
#******************************************************************************/-->
<project name="eclipselink.dbws.builder.test" default="build" basedir=".">
<!-- Test to make certain that build is run from component dir -->
<available file="../${ant.project.name}" type="dir" property="dbwsbldrtest.is.local"/>
<fail unless="dbwsbldrtest.is.local" message="Not running from '${ant.project.name}' directory"/>
<condition property="is.java.version.16">
<equals arg1="${ant.java.version}" arg2="1.6"/>
</condition>
<fail unless="is.java.version.16"
message="org.eclipse.persistence.dbws.builder requires Java version 1.6 or higher. You are currently using Java version ${ant.java.version}."
/>
<dirname property="dbwsbldrtest.build.location_temp" file="${ant.file.eclipselink.dbws.builder.test}"/>
<pathconvert targetos="unix" property="dbwsbldrtest.build.location">
<path>
<pathelement location="${dbwsbldrtest.build.location_temp}"/>
</path>
</pathconvert>
<echo message="dbwsbldrtest.build.location = '${dbwsbldrtest.build.location}'"/>
<condition property="dbwsbldrtest.2.base.dir" value="../.." else="..">
<contains string="${dbwsbldrtest.build.location}" substring="utils/${ant.project.name}"/>
</condition>
<echo message="dbwsbldrtest.2.base.dir = '${dbwsbldrtest.2.base.dir}'"/>
<property name="dbwsbldrtest.2.common.plugins.dir" value="${dbwsbldrtest.2.base.dir}/plugins"/>
<property name="dbwsbldrtest.2.dbwsbldr.dir" value="../org.eclipse.persistence.dbws.builder"/>
<property name="custom.tasks.lib" value="${dbwsbldrtest.build.location}/${dbwsbldrtest.2.base.dir}/buildsystem/ant_customizations.jar"/>
<property name="custom.tolower.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.ToLower"/>
<available file="${custom.tasks.lib}" property="ant_customizations.exist"/>
<fail unless="ant_customizations.exist" message="Cannot find custom tasks library: '${custom.tasks.lib}'"/>
<taskdef name="toLower" classname="${custom.tolower.task.class}" classpath="${custom.tasks.lib}"/>
<!-- OS environment variables have 'env' as a prefix -->
<property environment="env"/>
<!-- local property overrides -->
<property file="${user.home}/build.properties"/>
<!-- properties checked into SVN -->
<property file="./build.properties"/>
<!-- local testing properties overrides -->
<property file="${user.home}/test.properties"/>
<!-- testing properties checked into SVN -->
<property file="./test.properties"/>
<!-- 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.string" value="${release.version}.qualifier"/>
<property name="release.designation" value="EclipseLink DeveloperBuild"/>
<!-- Set Compile Path-->
<path id="dbwsbldrtest.compile.path">
<pathelement path="${junit.lib}"/>
<pathelement path="${dbwsbldrtest.2.base.dir}/${eclipselink.jar}"/>
<pathelement path="${dbwsbldrtest.2.common.plugins.dir}/${asm}"/>
<pathelement path="${dbwsbldrtest.2.common.plugins.dir}/org.eclipse.persistence.dbws.builder_${version.string}.jar"/>
<fileset
dir="../plugins"
includes="${eclipselink.dbws.builder.depend}"
/>
<fileset
dir="${dbwsbldrtest.2.common.plugins.dir}"
includes="${eclipselink.dbws.core.depend}"
/>
</path>
<echo message="junit.lib='${junit.lib}'"/>
<!-- Set Run Path-->
<path id="dbwsbldrtest.run.path">
<path refid="dbwsbldrtest.compile.path"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="./${dbwsutils.test.jar}"/>
</path>
<!-- Test dependencies -->
<available file="${dbwsbldrtest.2.base.dir}/${eclipselink.jar}" property="eclipselink.jar.exist"/>
<available file="${dbwsbldrtest.2.common.plugins.dir}/org.eclipse.persistence.dbws.builder_${version.string}.jar" property="dbwsbldr.jar.exist"/>
<available file="${dbwsbldrtest.2.common.plugins.dir}/${asm}" type="dir" property="asm.exist"/>
<available file="../plugins/${wsdl.jar}" property="wsdl.exist"/>
<available file="${jdbc.driver.jar}" property="jdbc.jar.exist"/>
<available file="./${dbwsutils.test.jar}" property="dbwsbldrtest.common.jar.exist"/>
<condition property="support.test">
<and>
<isset property="is.java.version.16"/>
<isset property="jdbc.jar.exist"/>
<isset property="db.platform"/>
<matches
pattern="org.eclipse.persistence.platform.database.MySQLPlatform"
string="${db.platform}"
/>
</and>
</condition>
<!-- all -->
<target name="build" depends="clean, compile, package" description="build dbwsbldrtests jar"/>
<!-- test -->
<target name="test" depends="compile-common, run-tests" description="run tests after building"/>
<!-- MACRO and SCRIPT definitions -->
<presetdef name="javac">
<javac
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
optimize="${javac.optimize}"
source="1.6"
target="1.6"
deprecation="${javac.deprecation}"
failonerror="true"
memoryMaximumSize="512m"
/>
</presetdef>
<presetdef
name="DeleteDirQuietly"
>
<delete
dir="_tmp_"
quiet="true"
failonerror="false"
/>
</presetdef>
<presetdef
name="DeleteFileQuietly"
>
<delete
file="_tmp_"
quiet="true"
failonerror="false"
/>
</presetdef>
<macrodef
name="SetupDatabase"
>
<attribute name="testsuite-name"/>
<sequential>
<sql
onerror="continue"
keepformat="true"
driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.pwd}"
classpathref="dbwsbldrtest.run.path"
delimiter="|"
>
<fileset
dir="./${etc.dir}"
>
<include name="dbsetup_@{testsuite-name}.sql"/>
</fileset>
</sql>
</sequential>
</macrodef>
<macrodef
name="CompileTestsuite"
>
<attribute name="testsuite-name"/>
<attribute name="package-name"/>
<sequential>
<mkdir
dir="./${classes.dir}"
/>
<javac
fork="true"
srcdir="./${src.dir}"
destdir="./${classes.dir}"
includes="dbws/testing/@{package-name}/@{testsuite-name}TestSuite.java"
classpathref="dbwsbldrtest.run.path"
/>
</sequential>
</macrodef>
<macrodef
name="RunTestsuite"
>
<attribute name="testsuite-name"/>
<attribute name="package-name"/>
<sequential>
<junit
printsummary="withOutAndErr"
fork="yes"
forkmode="once"
maxmemory="512m"
>
<formatter
type="xml"
/>
<classpath>
<pathelement
path="./jaxb-ri_override.jar"
/>
<path
refid="dbwsbldrtest.run.path"
/>
<pathelement
path="./${classes.dir}"
/>
<pathelement
path="./${dbwsutils.test.jar}"
/>
<pathelement
path="dbws@{package-name}.jar"
/>
</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}"
/>
<test
name="dbws.testing.@{package-name}.@{testsuite-name}TestSuite"
/>
</junit>
<junitreport
todir="./${report.dir}"
>
<fileset
dir="."
>
<include
name="TEST-*TestSuite.xml"
/>
</fileset>
<report
format="noframes"
todir="./${report.dir}"
/>
</junitreport>
</sequential>
</macrodef>
<macrodef
name="TeardownDatabase"
>
<attribute name="testsuite-name"/>
<sequential>
<sql
onerror="continue"
keepformat="true"
driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.pwd}"
classpathref="dbwsbldrtest.run.path"
delimiter="|"
>
<fileset
dir="./${etc.dir}"
>
<include name="dbteardown_@{testsuite-name}.sql"/>
</fileset>
</sql>
</sequential>
</macrodef>
<macrodef
name="SetupCompileRunTeardown"
>
<attribute name="testsuite-name"/>
<sequential>
<toLower
input="@{testsuite-name}"
property="package-name"
/>
<SetupDatabase
testsuite-name="${package-name}"
/>
<CompileTestsuite
testsuite-name="@{testsuite-name}"
package-name="${package-name}"
/>
<RunTestsuite
testsuite-name="@{testsuite-name}"
package-name="${package-name}"
/>
<TeardownDatabase
testsuite-name="${package-name}"
/>
</sequential>
</macrodef>
<!-- clean -->
<target name="clean" description="Clean generated files for common content">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${classes.dir}"/>
<fileset dir="." includes="${dbwsutils.test.jar}"/>
</delete>
</target>
<!-- compile -->
<target name="compile" description="Compile DBWS Util test Common classes">
<fail unless="eclipselink.jar.exist" message="EclipseLink cannot be found. Exiting..."/>
<fail unless="dbwsbldr.jar.exist" message="DBWS Builder cannot be found. Exiting..."/>
<fail unless="asm.exist" message="ASM Bundle cannot be found. Exiting..."/>
<fail unless="wsdl.exist" message="WSDL Library cannot be found. Exiting..."/>
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
includes="dbws/testing/*.java"
fork="true"
classpathref="dbwsbldrtest.compile.path"
/>
</target>
<!-- package -->
<target name="package" description="package DBWS Util Test Common jar">
<jar jarfile="./${dbwsutils.test.jar}">
<fileset dir="${classes.dir}">
<include name="dbws/testing/*.class"/>
</fileset>
</jar>
</target>
<!-- *** Test execution targets *** -->
<target name="compile-common" unless="dbwsbldrtest.common.jar.exist">
<antcall target="build" inheritAll="true" inheritRefs="true"/>
<available file="./${dbwsutils.test.jar}" property="dbwsbldrtest.common.jar.exist"/>
</target>
<target name="run-tests" if="support.test" description="setup, compile, and run dbws util testsuites">
<DeleteDirQuietly dir="./${report.dir}"/>
<mkdir dir="./${report.dir}"/>
<SetupCompileRunTeardown testsuite-name="AttachedBinary"/>
<SetupCompileRunTeardown testsuite-name="CRUD"/>
<SetupCompileRunTeardown testsuite-name="CustomSQL"/>
<SetupCompileRunTeardown testsuite-name="InlineBinary"/>
<SetupCompileRunTeardown testsuite-name="SimpleTable"/>
<SetupCompileRunTeardown testsuite-name="SimpleSP"/>
<SetupCompileRunTeardown testsuite-name="SimpleTableWithNestedSQL"/>
<SetupCompileRunTeardown testsuite-name="UpdateFault"/>
<SetupCompileRunTeardown testsuite-name="RootCause"/>
<SetupCompileRunTeardown testsuite-name="OptLock"/>
<SetupCompileRunTeardown testsuite-name="MTOM"/>
<SetupCompileRunTeardown testsuite-name="SecondarySQL"/>
</target>
</project>