You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by gm...@apache.org on 2008/01/09 16:32:31 UTC
svn commit: r610417 - /db/torque/test/trunk/test-project/maven.xml
Author: gmonroe
Date: Wed Jan 9 07:31:05 2008
New Revision: 610417
URL: http://svn.apache.org/viewvc?rev=610417&view=rev
Log:
- Refactored goals to make testing Derby Embedded Server easier.
- Added in goals to handle attempting to shutdown a DB if the torque.database.shutdownUrl property is set. (Only partially successful)
- Added support for a torque.test.haltonfailure project property which can be used to force all junit tests to run.
Modified:
db/torque/test/trunk/test-project/maven.xml
Modified: db/torque/test/trunk/test-project/maven.xml
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/maven.xml?rev=610417&r1=610416&r2=610417&view=diff
==============================================================================
--- db/torque/test/trunk/test-project/maven.xml (original)
+++ db/torque/test/trunk/test-project/maven.xml Wed Jan 9 07:31:05 2008
@@ -30,11 +30,14 @@
<project
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
+ xmlns:ant="jelly:ant"
default="torque-test:run">
<goal name="torque-test:run" description="builds and runs the test project">
+ <attainGoal name="torque-test:pre-test"/>
<attainGoal name="torque-test:test"/>
- <attainGoal name="torque-test:post-test"/>
+ <attainGoal name="torque-test:post-test1"/>
+ <attainGoal name="torque-test:post-test2"/>
</goal>
@@ -43,7 +46,7 @@
<property file="../profile/${torque.test.profile}/build.properties" />
<property file="../profile/${torque.test.profile}/project.properties" />
-
+
<delete dir="target/sql" />
<copy todir="${torque.schema.dir}">
<fileset dir="src/schema">
@@ -51,7 +54,7 @@
</fileset>
<filterset>
<filter token="DATABASE_DEFAULT" value="${torque.project}"/>
- <filter token="DATABASE_ID_METHOD" value="${torque.test.base.idMethod}"/>
+ <filter token="DATABASE_ID_METHOD" value="${torque.test.base.idMethod}"/>
</filterset>
</copy>
<copy todir="${torque.test.sql2xml.dir}">
@@ -65,9 +68,11 @@
description="creates the docs, fills the database and creates om classes">
<attainGoal name="torque:doc"/>
<attainGoal name="torque:create-db"/>
+ <attainGoal name="torque-test:shutdown-db-skip-exception"/>
<attainGoal name="torque:sql"/>
<attainGoal name="torque:id-table-init-sql"/>
<attainGoal name="torque:insert-sql"/>
+ <attainGoal name="torque-test:shutdown-db-skip-exception"/>
<attainGoal name="torque:om"/>
<mkdir dir="${torque.test.compile.dir}" />
@@ -95,8 +100,8 @@
<pathelement location="${torque.test.compile.dir}"/>
<path refid="maven.dependency.classpath"/>
</classpath>
- <src path="${torque.java.base.dir}" />
- <src path="${torque.java.dir}" />
+ <src path="${torque.java.base.dir}" />
+ <src path="${torque.java.dir}" />
</javac>
</j:if>
<j:if test="${javaDir == javaBaseDir}">
@@ -160,15 +165,15 @@
<include name="*"/>
</fileset>
</copy>
- </postGoal>
+ </postGoal>
<goal name="torque-test:test"
- prereqs="torque-test:pre-test"
description="run the tests for the om classes">
+
<taskdef
name="junit"
- classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
-
+ classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
+
<mkdir dir="${torque.test.log.dir}" />
<mkdir dir="${torque.test.junit.report.dir}" />
@@ -177,9 +182,14 @@
<echo>ComplexObjectModel is ${torque.complexObjectModel}</echo>
<echo>ObjectIsCaching is ${torque.objectIsCaching}</echo>
- <junit printsummary="no" haltonfailure="yes" fork="true">
- <sysproperty
- key="torque.configuration.file"
+ <j:set var="haltonfailure" value="${torque.test.haltonfailure}" />
+ <j:if test="${empty(haltonfailure)}" >
+ <j:set var="haltonfailure" value="yes" />
+ </j:if>
+
+ <junit printsummary="no" haltonfailure="${haltonfailure}" fork="true">
+ <sysproperty
+ key="torque.configuration.file"
value="../profile/${torque.test.profile}/Torque.properties" />
<classpath>
<pathelement location="${torque.test.compile.dir}"/>
@@ -212,26 +222,31 @@
</batchtest>
</junit>
</goal>
-
-
- <goal name="torque-test:post-test"
- description="tests tasks needing a filled database">
+
+
+ <goal name="torque-test:post-test1"
+ description="tests tasks needing a filled database - part 1">
<attainGoal name="torque:datadtd"/>
<attainGoal name="torque:datadump"/>
-
+ <attainGoal name="torque-test:shutdown-db-skip-exception"/>
+
<!-- copy files generated by torque:datadump and torque:datadtd
to directory where it can be read by torque:datasql -->
<copy file="${torque.output.dir}/bookstore-bookstore-all-data.xml"
toFile="${torque.schema.dir}/bookstore-data.xml" />
<copy file="${torque.output.dir}/bookstore-data.dtd"
toDir="${torque.schema.dir}" />
-
+ </goal>
+
+ <goal name="torque-test:post-test2"
+ description="tests tasks needing a filled database - part 2">
<attainGoal name="torque:datasql"/>
<attainGoal name="torque:jdbc"/>
+ <attainGoal name="torque-test:shutdown-db-skip-exception"/>
</goal>
-
+
<goal
- name="torque-test:install"
+ name="torque-test:install"
description="Builds and installs all Torque subprojects to the local repository">
<maven:reactor
basedir="../.."
@@ -246,17 +261,17 @@
excludes=""
goals="plugin:install-now"
ignoreFailures="false"
- />
+ />
</goal>
- <goal name="torque-test:install-run"
+ <goal name="torque-test:install-run"
description="Builds and installs all Torque components and run the test project"
prereqs="torque-test:install">
<attainGoal name="torque-test:run" />
</goal>
- <goal
- name="torque-test:clean"
+ <goal
+ name="torque-test:clean"
description="clean all subproject affected by the test">
<maven:reactor
basedir="../.."
@@ -264,14 +279,48 @@
excludes=""
goals="clean"
ignoreFailures="false"
- />
+ />
<attainGoal name="clean" />
</goal>
- <goal name="torque-test:clean-install-run"
+ <goal name="torque-test:clean-install-run"
description="Cleans, Builds and installs all Torque components and run the test project"
prereqs="torque-test:clean">
<attainGoal name="torque-test:install-run" />
+ </goal>
+
+ <goal name="torque-test:shutdown-db-skip-exception"
+ description="Shuts down embedded DBs if the torque.database.shutdownUrl has been set" >
+ <j:set var="shutdownURL" value="${torque.database.shutdownUrl}"/>
+ <j:if test="${! empty(shutdownURL)}" >
+ <maven:reactor
+ basedir="."
+ includes="project.xml"
+ excludes=""
+ goals="torque-test:shutdown-db"
+ ignoreFailures="true"
+ />
+ </j:if>
+ </goal>
+
+ <goal name="torque-test:shutdown-db"
+ description="Shut down an embedded DB. Should be called from shutdown-db-skip-exceptions" >
+
+ <echo>Shutting down DB instance.</echo>
+ <echo>Shutdown URL = ${torque.database.shutdownUrl}</echo>
+ <ant:sql
+ autocommit="true"
+ driver="${torque.database.driver}"
+ onerror="continue"
+ password="${torque.database.password}"
+ url="${torque.database.shutdownUrl}"
+ userid="${torque.database.user}">
+ <classpath>
+ <pathelement path="${pom.getDependencyClasspath()}"/>
+ <path refid="maven.dependency.classpath"/>
+ </classpath>
+-- Do nothing script;
+ </ant:sql>
</goal>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org