mpoeschl 2002/08/09 02:16:01
Modified: . maven.xml project-b5.xml
profile mysql.profile
Added: src/rttest build-test.xml
Log:
make testbed work with maven-b5
maven buils a complete dist in /target/test/rttest
and uses src/rttest/build-test.xml to run the tests
the legacy build should do the same and the old build-test.xml should be removed
there is one problem left to solve:
test.datasql and test-jdbc don't work when called from maven
if you run the testbed using ant from /target/test/rttest it works
Revision Changes Path
1.5 +125 -4 jakarta-turbine-torque/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/maven.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- maven.xml 6 Aug 2002 14:33:36 -0000 1.4
+++ maven.xml 9 Aug 2002 09:16:01 -0000 1.5
@@ -2,30 +2,50 @@
default="java:jar"
xmlns:deploy="deploy">
+ <!-- Allow any user specific values to override the defaults -->
+ <property file="${user.home}/build.properties" />
+ <!-- Allow user defaults for this project -->
+ <property file="build.properties" />
+ <!-- Set values in test profile -->
+ <property file="${torque.testProfile}"/>
+ <!-- Set default values for the build -->
+ <property file="default.properties" />
+
+ <!-- ================================================================== -->
+ <!-- C O M P I L E P O S T G O A L -->
+ <!-- ================================================================== -->
+ <!-- copies the templates, dtd, .. to the ${maven.build.dest} to -->
+ <!-- include them in the jar file -->
+ <!-- ================================================================== -->
+
<postGoal name="java:compile">
<!-- copy database.dtd to the right place -->
-
<copy
file="${maven.src.dir}/dtd/database.dtd"
todir="${maven.build.dest}/org/apache/torque/engine/database/transform"
/>
<!-- copy default.properties to the right place -->
-
<copy
file="${maven.src.dir}/conf/default.properties"
todir="${maven.build.dest}/org/apache/torque"
/>
<!-- copy templates to the right place -->
-
<copy todir="${maven.build.dest}">
<fileset dir="${maven.src.dir}/templates" />
</copy>
</postGoal>
+ <!-- ================================================================== -->
+ <!-- D I S T : B U I L D _ B I N P R E G O A L -->
+ <!-- ================================================================== -->
+ <!-- copies jars, templates, ... to the ${maven.dist.bin.assembly.dir} -->
+ <!-- to include them in the binary dists -->
+ <!-- ================================================================== -->
+
<preGoal name="dist:build-bin">
<!-- copy templates to the right place -->
@@ -53,10 +73,111 @@
<!-- move torque.jar to /lib -->
<move
- file="${maven.dist.bin.assembly.dir}/${maven.final.name}.jar"
+ file="${maven.build.dir}/${maven.final.name}.jar"
todir="${maven.dist.bin.assembly.dir}/lib"
/>
</preGoal>
+
+ <!-- ================================================================== -->
+ <!-- R U N T I M E T E S T -->
+ <!-- ================================================================== -->
+ <goal
+ name="runtime:test"
+ prereqs="runtime:prepare"
+ description="runtime tests (set torque.testProfile in your build.properties)">
+
+ <ant antfile="build-test.xml"
+ dir="${torque.distDir}"
+ inheritAll="false"/>
+ </goal>
+
+ <goal
+ name="runtime:test-classpath"
+ prereqs="runtime:prepare"
+ description="runtime tests using useClasspath property (set torque.testProfile
in your build.properties)">
+
+ <ant antfile="build-test.xml"
+ dir="${torque.distDir}"
+ target="test-classpath"
+ inheritAll="false"/>
+ </goal>
+
+ <goal
+ name="runtime:prepare"
+ prereqs="java:jar">
+
+ <!-- Use the profile as the build.properties file
+ in the dist directory so that it is customizable
+ by each tester. -->
+ <echo message="Copying profile into distribution directory:
${torque.testProfile}"/>
+
+ <filter token="DATABASE_DEFAULT" value="${torque.defaultDatabase}"/>
+ <filter token="DATABASE_URL" value="${databaseUrl}"/>
+ <filter token="DATABASE_USER" value="${databaseUser}"/>
+ <filter token="DATABASE_DRIVER" value="${databaseDriver}"/>
+ <filter token="DATABASE_PASSWORD" value="${databasePassword}"/>
+ <filter token="DATABASE_ID_METHOD" value="${torque.idMethod}"/>
+ <filter token="DATABASE_ADAPTER" value="${database}"/>
+
+ <copy
+ tofile="${torque.distDir}/build.properties"
+ file="${torque.testProfile}"
+ overwrite="yes"
+ />
+
+ <!-- copy test schemas -->
+ <copy
+ todir="${torque.distDir}/schema"
+ filtering="yes"
+ overwrite="yes">
+ <fileset dir="${rttest.dir}">
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+
+ <!-- copy test sources -->
+ <copy todir="${torque.distDir}/src/java">
+ <fileset dir="${rttest.dir}"/>
+ </copy>
+
+ <!-- copy ant build files -->
+ <copy
+ tofile="${build.test}/rttest/build-test.xml"
+ file="${src.dir}/rttest/build-test.xml"
+ overwrite="yes"
+ />
+ <copy
+ tofile="${build.test}/rttest/build-torque.xml"
+ file="${src.dir}/conf/build-torque.xml"
+ overwrite="yes"
+ />
+ <copy
+ tofile="${build.test}/rttest/default.properties"
+ file="${src.dir}/conf/default.properties"
+ overwrite="yes"
+ />
+
+ <!-- copy libs -->
+ <deploy:copy-deps todir="${build.test}/rttest/lib"/>
+ <copy file="${maven.build.dir}/${maven.final.name}.jar"
+ todir="${build.test}/rttest/lib"/>
+ <copy file="${torque.testDatabaseJar}"
+ todir="${build.test}/rttest/lib"/>
+
+ <!-- copy templates -->
+ <copy todir="${build.test}/rttest/templates">
+ <fileset dir="${src.dir}/templates"/>
+ </copy>
+
+ <!-- copy Torque.properties -->
+ <copy
+ todir="${build.test}/rttest"
+ file="src/rttest/Torque.properties"
+ filtering="yes"
+ />
+
+ </goal>
+
</project>
1.14 +1 -1 jakarta-turbine-torque/project-b5.xml
Index: project-b5.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/project-b5.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- project-b5.xml 7 Aug 2002 08:07:01 -0000 1.13
+++ project-b5.xml 9 Aug 2002 09:16:01 -0000 1.14
@@ -167,7 +167,7 @@
</dependency>
<dependency>
<id>log4j</id>
- <version>1.2.6</version>
+ <version>1.2.4</version>
<url>http://jakarta.apache.org/log4j/</url>
</dependency>
<dependency>
1.15 +4 -4 jakarta-turbine-torque/profile/mysql.profile
Index: mysql.profile
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/profile/mysql.profile,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- mysql.profile 17 Jul 2002 11:11:12 -0000 1.14
+++ mysql.profile 9 Aug 2002 09:16:01 -0000 1.15
@@ -9,7 +9,7 @@
torque.sqlTest.defaultDatabase = sqltest
torque.sqlTest.databaseUrl = jdbc:mysql://localhost:3306/sqltest
-lib.dir = ../lib
+lib.dir = lib
# -------------------------------------------------------------------
#
@@ -17,7 +17,7 @@
#
# -------------------------------------------------------------------
-project = bookstore
+torque.project = bookstore
# -------------------------------------------------------------------
#
@@ -105,7 +105,7 @@
#
# -------------------------------------------------------------------
-templatePath = ../templates
+templatePath = templates
# -------------------------------------------------------------------
#
@@ -135,4 +135,4 @@
#
# -------------------------------------------------------------------
-schemaDirectory=schema
+torque.schema.dir=schema
1.1 jakarta-turbine-torque/src/rttest/build-test.xml
Index: build-test.xml
===================================================================
<?xml version="1.0"?>
<project name="Torque-rttest" default="test" basedir=".">
<!-- Allow any user specific values to override the defaults -->
<property file="${user.home}/build.properties" />
<!-- Allow user defaults for this project -->
<property file="build.properties" />
<!-- Set default values for the build -->
<property file="default.properties" />
<property name="torque.buildFile" value="build-torque.xml"/>
<!-- ============================================================== -->
<!-- T O R Q U E T E S T S -->
<!-- ============================================================== -->
<!-- This is the build file for torques runtime test -->
<!-- ============================================================== -->
<target
name="test"
description="run the testbed">
<antcall target="test-pre-runtime"/>
<antcall target="test-runtime"/>
<antcall target="test-post-runtime"/>
</target>
<target
name="test-classpath"
description="run the testbed using the useClasspath property">
<property name="useClasspath" value="true"/>
<property name="templatePath" value="no_templatePath"/>
<antcall target="test"/>
</target>
<!-- ============================================================== -->
<!-- P R E R U N T I M E T E S T S -->
<!-- ============================================================== -->
<!-- These are the tests for the torque tests which are -->
<!-- primarily generative in nature. -->
<!-- -->
<!-- The tests will be run from the distribution that is -->
<!-- produced by the build process. This is a test of Torque's -->
<!-- generative abilities. -->
<!-- -->
<!-- These are the tasks that we will be testing: -->
<!-- -->
<!-- sql -->
<!-- om -->
<!-- -->
<!-- The sql is also another complete set of tests: -->
<!-- we need to run the task for each of the supported databases -->
<!-- to make sure that generated SQL remains coherent across -->
<!-- changes to the templates. -->
<!-- ============================================================== -->
<target
name="test-pre-runtime">
<antcall target="test-doc"/>
<antcall target="test-create-db"/>
<antcall target="test-sql"/>
<antcall target="test-id-table-init-sql"/>
<antcall target="test-insert-sql"/>
<antcall target="test-om"/>
</target>
<!-- ============================================================== -->
<!-- P O S T R U N T I M E T E S T S -->
<!-- ============================================================== -->
<target
name="test-post-runtime">
<antcall target="test-datadtd"/>
<antcall target="test-datadump"/>
<antcall target="test-datasql"/>
<antcall target="test-jdbc"/>
</target>
<target
name="test-sql">
<ant
antfile="${torque.buildFile}"
target="sql">
</ant>
</target>
<target
name="test-id-table-init-sql">
<ant
antfile="${torque.buildFile}"
target="id-table-init-sql">
</ant>
</target>
<target
name="test-doc">
<ant
antfile="${torque.buildFile}"
target="doc">
</ant>
</target>
<target
name="test-create-db">
<ant
antfile="${torque.buildFile}"
target="create-db">
</ant>
</target>
<target
name="test-insert-sql">
<ant
antfile="${torque.buildFile}"
target="insert-sql">
</ant>
</target>
<target
name="test-om">
<ant
antfile="${torque.buildFile}"
target="om">
</ant>
<!-- Compile the classes -->
<ant
antfile="${torque.buildFile}"
target="compile"
inheritAll="false">
</ant>
</target>
<!-- Still uses ${project} references. BAD!!! -->
<target
name="test-datadtd">
<ant
antfile="${torque.buildFile}"
target="datadtd"
inheritAll="false">
</ant>
</target>
<!-- Still uses ${project} references. BAD!!! -->
<target
name="test-datadump">
<ant
antfile="${torque.buildFile}"
target="datadump"
inheritAll="false">
</ant>
</target>
<!-- Still uses ${project} references. BAD!!! -->
<target
name="test-datasql">
<copy
todir="schema/"
file="src/bookstore-data.dtd"/>
<copy
tofile="schema/bookstore-data.xml"
file="src/bookstore-bookstore-all-data.xml"/>
<ant
antfile="${torque.buildFile}"
target="datasql"
inheritAll="false">
</ant>
</target>
<target
name="test-jdbc">
<ant
antfile="${torque.buildFile}"
target="jdbc">
<!--
<property name="torque.home" value="${torque.distDir}"/>
-->
</ant>
</target>
<!-- ============================================================== -->
<!-- R U N T I M E T E S T S -->
<!-- ============================================================== -->
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${build.dest}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="test-runtime">
<echo>
${build.dest}
${torque.testDatabaseJar}
</echo>
<java
classname="org.apache.torque.test.TorqueRunner">
<arg value="${basedir}/Torque.properties"/>
<classpath refid="classpath"/>
</java>
</target>
<!-- ============================================================== -->
<!-- S Q L T E S T S -->
<!-- ============================================================== -->
<target name="sql-test">
<filter token="DATABASE_DEFAULT" value="${torque.sqlTest.defaultDatabase}"/>
<filter token="DATABASE_URL" value="${torqe.sqlTest.databaseUrl}"/>
<filter token="DATABASE_USER" value="${databaseUser}"/>
<filter token="DATABASE_DRIVER" value="${databaseDriver}"/>
<filter token="DATABASE_PASSWORD" value="${databasePassword}"/>
<filter token="DATABASE_ID_METHOD" value="${torque.idMethod}"/>
<filter token="DATABASE_ADAPTER" value="${torque.databaseAdapter}"/>
<mkdir dir="${build.test}/sqltest"/>
<copy
tofile="${build.test}/sqltest/build.properties"
file="${torque.testProfile}"
overwrite="yes"
/>
<copy
tofile="${build.test}/sqltest/build-torque.xml"
file="${src.dir}/conf/build-torque.xml"
overwrite="yes"
/>
<copy
todir="${build.test}/sqltest/schema"
file="${src.dir}/sqltest/type-test-schema.xml"
filtering="yes"
overwrite="yes"
/>
<ant
antfile="${torque.buildFile}"
target="create-db">
</ant>
<ant
antfile="${torque.buildFile}"
target="sql">
</ant>
<ant
antfile="${torque.buildFile}"
target="insert-sql">
</ant>
</target>
</project>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>