| <!--/******************************************************************************* |
| * 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: |
| * etang - initial API and implementation |
| #******************************************************************************/--> |
| |
| <!-- This ant project includes the following tasks: |
| - all (default) : compiles all Spring tests, packages test jar |
| - compile : compiles all Spring tests |
| - package : jars JPA persistent unit and tests jar |
| - test-jpa-spring: runs all Spring tests |
| - test-jpa-spring-local: runs Spring local tests |
| - test-jpa-spring-container: runs Spring container tests |
| |
| It requires some configuration of the build.properties and test.properties to run. |
| It also requires the following third-party jars available in ../../../extension.lib.external/spring |
| spring.jar(version 2.5.3) |
| spring-agent.jar(version 2.5.3) |
| spring-mock.jar(version 2.5.3, self-built from source code) |
| cglib-nodep-2.2.jar |
| commons-logging-1.1.1.jar |
| --> |
| |
| <project name="Eclipse Persistence Services JPA Spring Testing" default="all" basedir="."> |
| <!-- Allows a user to overide certain user specific properties. --> |
| <property file="${user.home}/build.properties"/> |
| <property file="${user.home}/test.properties"/> |
| <property name="eclipselink.jpa.spring.test" value="."/> |
| <property file="${eclipselink.jpa.spring.test}/antbuild.properties"/> |
| <property file="${eclipselink.jpa.spring.test}/local.build.properties"/> |
| <property file="${eclipselink.jpa.spring.test}/build.properties"/> |
| <property file="${eclipselink.jpa.spring.test}/${test.properties}"/> |
| <property file="${eclipselink.jpa.spring.test}/test.properties"/> |
| |
| <!-- This checks if the trunk was checked out, or just the Eclipse projects. --> |
| <available file="${eclipselink.jpa.spring.test}/${eclipselink.core.trunk}" type="dir" property="is.trunk"/> |
| |
| <!-- Configures paths for trunk checkout. --> |
| <target name="config-trunk" depends="proxy"> |
| <property name="eclipselink.core.dir" value="${eclipselink.jpa.spring.test}/${eclipselink.core.trunk}"/> |
| <property name="eclipselink.core.test.dir" value="${eclipselink.jpa.spring.test}/${eclipselink.core.test.trunk}"/> |
| <property name="eclipselink.core.lib.dir" value="${eclipselink.jpa.spring.test}/${eclipselink.plugins}"/> |
| <property name="eclipselink.extension.oracle.test.dir" value="${eclipselink.jpa.spring.test}/${eclipselink.extension.oracle.test.trunk}"/> |
| <path id="compile.path"> |
| <pathelement path="${eclipselink.core.dir}/${classes.dir}"/> |
| <pathelement path="${eclipselink.jpa}/${classes.dir}"/> |
| <pathelement path="${eclipselink.jpa.test}/${classes.dir}"/> |
| <pathelement path="${eclipselink.core.test.dir}/${classes.dir}"/> |
| <pathelement path="${eclipselink.core.lib.dir}/${persistence.jar}"/> |
| <fileset |
| dir="${eclipselink.core.lib.dir}" |
| includes="${eclipselink.core.depend}"/> |
| <pathelement path="../../${eclipselink.jar}"/> |
| <pathelement path="${junit.lib}"/> |
| <pathelement path="${eclipselink.plugins}/${antlr}"/> |
| <pathelement path="${eclipselink.plugins}/${asm}"/> |
| <fileset dir="${spring.jlib.dir}" includes="${spring.jlib}"/> |
| </path> |
| <get dest="${spring.jlib.dir}"> |
| <url url="http://central.maven.org/maven2/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/> |
| <url url="http://central.maven.org/maven2/cglib/cglib-nodep/3.2.2/cglib-nodep-3.2.2.jar"/> |
| <url url="http://central.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/> |
| <url url="http://central.maven.org/maven2/jotm/jotm/2.0.10/jotm-2.0.10.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-context/4.2.5.RELEASE/spring-context-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-test/4.2.5.RELEASE/spring-test-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-beans/4.2.5.RELEASE/spring-beans-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-jdbc/4.2.5.RELEASE/spring-jdbc-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-aop/4.2.5.RELEASE/spring-aop-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-tx/4.2.5.RELEASE/spring-tx-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-orm/4.2.5.RELEASE/spring-orm-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-expression/4.2.5.RELEASE/spring-expression-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/org/springframework/spring-instrument/4.2.5.RELEASE/spring-instrument-4.2.5.RELEASE.jar"/> |
| <url url="http://central.maven.org/maven2/com/experlog/xapool/1.6-beta/xapool-1.6-beta.jar"/> |
| </get> |
| <!-- Classpath used for running tests. --> |
| <path id="run.classpath"> |
| <pathelement path="${eclipselink.jpa.spring.test}/${jpa.spring}.jar"/> |
| <pathelement path="${jdbc.driver.jar}"/> |
| <path refid="compile.path"/> |
| </path> |
| </target> |
| |
| <!-- Default ant target, compiles and packages test jars, does not run tests. --> |
| <target name="all" depends="clean, init, compile, package" description="build EclipseLink JPA testing jars"/> |
| |
| <target name="clean" description="Clean the build"> |
| <delete includeEmptyDirs="true" failonerror="false"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${classes.dir}"/> |
| <fileset dir="${eclipselink.jpa.spring.test}/${build.dir}"/> |
| <fileset file="${eclipselink.jpa.spring.test}/${jpa.spring}.jar"/> |
| </delete> |
| </target> |
| |
| <!-- Creates required directories for building. --> |
| <target name="init"> |
| <mkdir dir="${eclipselink.jpa.spring.test}/${run.dir}"/> |
| <mkdir dir="${eclipselink.jpa.spring.test}/${classes.dir}"/> |
| <mkdir dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}"/> |
| </target> |
| |
| <!-- Compiles all tests. --> |
| <target name="compile" depends="init, config-trunk" description="compile EclipseLink testing"> |
| <javac srcdir="${eclipselink.jpa.spring.test}/${src.dir}" |
| destdir="${eclipselink.jpa.spring.test}/${classes.dir}" |
| debug="${javac.debug}" |
| debuglevel="${javac.debuglevel}" |
| encoding="UTF-8" |
| optimize="${javac.optimize}" |
| source="${javac.version}" |
| target="${javac.version}" |
| deprecation="${javac.deprecation}" |
| failonerror="true"> |
| <include name="org/eclipse/persistence/testing/**"/> |
| <classpath> |
| <path refid="compile.path"/> |
| </classpath> |
| </javac> |
| </target> |
| |
| <!-- Packages JPA persistent unit test jars. --> |
| <target name="package" depends="compile"> |
| <copy todir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}"> |
| <fileset dir="${eclipselink.jpa.spring.test}/resource/${jpa.spring}" includes="**"/> |
| </copy> |
| <replace dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}" token='@dbURL@' value="${db.url}"> |
| <include name="**"/> |
| </replace> |
| <replace dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}" token='@driverClass@' value="${db.driver}"> |
| <include name="**"/> |
| </replace> |
| <replace dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}" token='@dbUser@' value="${db.user}"> |
| <include name="**"/> |
| </replace> |
| <replace dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}" token='@dbPassword@' value="${db.pwd}"> |
| <include name="**"/> |
| </replace> |
| <replace dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}" token='@dbPlatform@' value="${db.platform}"> |
| <include name="**"/> |
| </replace> |
| <copy todir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${classes.dir}"> |
| <include name="test/org/eclipse/persistence/testing/models/jpa/spring/**"/> |
| <include name="org/eclipse/persistence/testing/tests/jpa/spring/**"/> |
| </fileset> |
| </copy> |
| <jar jarfile="${eclipselink.jpa.spring.test}/${jpa.spring}.jar"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${build.dir}/${jpa.spring}"/> |
| </jar> |
| </target> |
| |
| <!-- Repackages JPA persistent unit test jars. --> |
| <target name="repackage"> |
| <copy todir="${eclipselink.jpa.test}/${resource.dir}/eclipselink-advanced-field-access-model/"> |
| <fileset dir="${eclipselink.jpa.test}/${resource.dir}/eclipselink-advanced-field-access-model/spring" includes="**"/> |
| </copy> |
| <copy todir="${eclipselink.jpa.test}/${resource.dir}/eclipselink-annotation-model/"> |
| <fileset dir="${eclipselink.jpa.test}/${resource.dir}/eclipselink-annotation-model/spring" includes="**"/> |
| <fileset dir="${eclipselink.jpa.test}/${resource.dir}/eclipselink-annotation-model" includes="case-sensitive-advanced-entity-mappings.xml"/> |
| </copy> |
| </target> |
| |
| <target name="clean-run" description="Clean the run"> |
| <delete dir="${eclipselink.jpa.spring.test}/${run.dir}"/> |
| <delete dir="${eclipselink.jpa.spring.test}/${report.dir}"/> |
| <mkdir dir="${eclipselink.jpa.spring.test}/${run.dir}"/> |
| <mkdir dir="${eclipselink.jpa.spring.test}/${report.dir}"/> |
| </target> |
| |
| <target name="test-jpa-spring" depends="test-jpa-spring-local, test-jpa-spring-container"/> |
| |
| <target name="test-jpa-spring-local" depends="clean-run, config-trunk"> |
| <junit printsummary="yes" haltonfailure="no" failureproperty="junit.failed" fork="yes" forkmode="once" showoutput="yes" maxmemory="512m" dir="${eclipselink.jpa.spring.test}/${run.dir}"> |
| <jvmarg value="${test.agent}"/> |
| <jvmarg value="${test.weaving}"/> |
| <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="-Declipselink.logging.level=${logging.level}"/> |
| <jvmarg value="-Dtest.properties=${test.properties.run}"/> |
| <classpath> |
| <path refid="run.classpath"/> |
| </classpath> |
| <batchtest todir="${eclipselink.jpa.spring.test}/${report.dir}"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${src.dir}"> |
| <include name="**/spring/TestLocalEMF.java"/> |
| <include name="**/spring/TestLocalEMFtransactional.java"/> |
| <include name="**/spring/dao/TestLocalEMFwithDao.java"/> |
| </fileset> |
| <formatter type="xml"/> |
| </batchtest> |
| </junit> |
| <junitreport todir="${eclipselink.jpa.spring.test}/${report.dir}"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${report.dir}"> |
| <include name="*.xml"/> |
| </fileset> |
| <report format="noframes" todir="${eclipselink.jpa.spring.test}/${report.dir}"/> |
| </junitreport> |
| </target> |
| |
| <target name="test-jpa-spring-container" depends="clean-run, config-trunk"> |
| <junit printsummary="yes" haltonfailure="no" failureproperty="junit.failed" fork="yes" forkmode="once" showoutput="yes" maxmemory="512m" dir="${eclipselink.jpa.spring.test}/${run.dir}"> |
| <jvmarg value="-javaagent:${spring.jlib.dir}/spring-instrument-4.2.5.RELEASE.jar"/> |
| <jvmarg value="${test.weaving}"/> |
| <jvmarg value="-Declipselink.logging.level=${logging.level}"/> |
| <jvmarg value="-Dtest.properties=${test.properties.run}"/> |
| <classpath> |
| <path refid="run.classpath"/> |
| </classpath> |
| <batchtest todir="${eclipselink.jpa.spring.test}/${report.dir}"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${src.dir}"> |
| <include name="**/spring/TestContainerEMF.java"/> |
| <include name="**/spring/TestContainerEMFtransactional.java"/> |
| <include name="**/spring/dao/TestContainerEMFwithDao.java"/> |
| </fileset> |
| <formatter type="xml"/> |
| </batchtest> |
| </junit> |
| <junitreport todir="${eclipselink.jpa.spring.test}/${report.dir}"> |
| <fileset dir="${eclipselink.jpa.spring.test}/${report.dir}"> |
| <include name="*.xml"/> |
| </fileset> |
| <report format="noframes" todir="${eclipselink.jpa.spring.test}/${report.dir}"/> |
| </junitreport> |
| </target> |
| |
| <target name="proxy" if="http.proxyHost"> |
| <setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}"/> |
| </target> |
| </project> |