gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Existence of a database?
Date Mon, 24 May 2004 07:33:20 GMT
On Wed, 19 May 2004, Ceki Gülc <> wrote:

> I wonder if it possible to group tasks and invoke them as a function
> or a method call.

Rather "as a macro".  Let me see whether I can find a macrodef
solution for you.

The target running the test would be easy:

<macrodef name="rundbtest">
  <attribute name="dbtype"/>
    <delete file="./input/db/"/>
    <echo message="@{dbtype} available"/>
    <copy file="./input/db/@{dbtype}.properties" 

    <junit printsummary="yes" fork="no" haltonfailure="yes">
      <sysproperty key="runLen" value="100"/>
      <classpath refid="tests.classpath"/>
      <formatter type="plain" usefile="false"/>
      <test name="org.apache.log4j.db.FullCycleDBTest" />


<target name="mysql" depends="mysqlCheck, build" if="mysql-present">
  <rundbtest dbtype="mysql"/>
<target name="postgresql" depends="postgresqlCheck, build" 
  <rundbtest dbtype="postgresql"/>

The checking part may be more difficult than the tests you've shown,
you could also <macrodef> them if they really are that similar for all

The whole check-then-test logic could be streamlined into a single
macro with Ant-Contrib's <if> if you feel that inclined.   A pure Ant
solution would probably look like:

* write a build file that contains check and test targets much like
  your old build file did and use properties for all DB specific things
  (JDBC driver, property file).  No macros, plain old targets.

* for each database you intend to support write a tiny little build
  file that <import>s the build file above and sets the properties.
  If you ever encounter a database that needs more complicated checks
  than the ones you have so far, you can override the check target
  (<import> supports "target inheritance").

* In you master build file, <subant> over your database specific build

But we are really getting off Gump-topic here 8-)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message