db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb build-xdoclet-module.xml
Date Wed, 17 Dec 2003 22:44:29 GMT
tomdz       2003/12/17 14:44:29

  Modified:    .        build-xdoclet-module.xml
  Log:
  Unit tests for the xdoclet ojb module can now be run from the build script
  
  Revision  Changes    Path
  1.2       +61 -14    db-ojb/build-xdoclet-module.xml
  
  Index: build-xdoclet-module.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/build-xdoclet-module.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build-xdoclet-module.xml	15 Dec 2003 20:09:13 -0000	1.1
  +++ build-xdoclet-module.xml	17 Dec 2003 22:44:29 -0000	1.2
  @@ -4,21 +4,39 @@
        initial author: Thomas Dudziak
   -->
   
  -<project name="XDoclet OJB module" default="all" basedir=".">
  +<project name="XDoclet OJB module" default="build" basedir=".">
   
       <!-- Allow any user specific values to override the defaults -->
       <property file="${user.home}/build.properties" />
       <!-- Allow to specify settings to be specified in the OJB build settings file -->
       <property file="build.properties"/>
   
  -    <!-- If not defined in the build.properties then we define it here: -->
  +    <!-- If not defined in the build.properties then we define them here: -->
  +    <!-- The directories containing the source of the XDoclet OJB module (java src and
unit tests) -->
       <property name="src.xdoclet" value="${src.dir}/xdoclet"/>
  +    <property name="src.xdoclet.java" value="${src.xdoclet}/java"/>
  +    <property name="src.xdoclet.test" value="${src.xdoclet}/test"/>
  +    <!-- The directories for building and running the unit tests -->
  +    <property name="build.xdoclettest" value="${build.dir}/xdoclettest"/>
  +    <property name="build.xdoclettest.src" value="${build.xdoclettest}/src"/>
  +    <property name="build.xdoclettest.dest" value="${build.xdoclettest}/classes"/>
  +    <property name="build.xdoclettest.report" value="${build.xdoclettest}/report"/>
   
       <!-- Specifies where the XDoclet source distribution is located
           (this is the directory that contains the subdirectories xdoclet, xdoclet-gui, xjavadoc).
           Per default it is assumed that a CVS checkout of xdoclet-all resides besides OJB
-->
       <property name="xdoclet.src.dir" value="../xdoclet-all"/>
   
  +    <!-- Classpath for compiling/running the unit tests (the module is compiled with
a different ant script) -->
  +    <path id="test-classpath">
  +        <fileset dir="${lib}">
  +            <include name="**/*.jar"/>
  +            <include name="**/*.zip"/>
  +        </fileset>
  +        <pathelement path="${build.xdoclettest.dest}"/>
  +    </path>
  +
  +
       <!-- Checks whether xdoclet is present -->
       <target name="check-xdoclet">
           <available property="xdoclet.sources.present"
  @@ -30,7 +48,7 @@
       <target name="copy-to-xdoclet" depends="check-xdoclet" if="xdoclet.sources.present">
           <mkdir dir="${xdoclet.src.dir}/xdoclet/modules/ojb"/>
           <copy todir="${xdoclet.src.dir}/xdoclet/modules/ojb">
  -            <fileset dir="${src.xdoclet}/java"/>
  +            <fileset dir="${src.xdoclet.java}"/>
           </copy>
       </target>
   
  @@ -62,6 +80,7 @@
           </ant>
       </target>
   
  +    <!-- Copies the generated jars (xjavadoc, xdoclet, ojb module) into the OJB lib
folder -->
       <target name="copy-xdoclet-jars" depends="build-xdoclet">
           <!-- XJavaDoc core jar -->
           <copy todir="${lib}">
  @@ -84,30 +103,58 @@
           </copy>
       </target>
   
  -    <target name="all" depends="copy-xdoclet-jars"/>
  +    <!-- Main creation target -->
  +    <target name="build" depends="copy-xdoclet-jars"/>
  +
   
  +    <!-- Prepares the folder for the XDoclet OJB module tests -->
       <target name="prepare-test">
  -        <!-- TODO: prepare test directories, compile test classes -->
  +        <mkdir dir="${build.dir}"/>
  +        <mkdir dir="${build.xdoclettest}"/>
  +        <mkdir dir="${build.xdoclettest.src}"/>
  +        <mkdir dir="${build.xdoclettest.dest}"/>
  +        <copy todir="${build.xdoclettest.src}">
  +            <fileset dir="${src.xdoclet.test}" excludes="**/CVS/*"/>
  +        </copy>
       </target>
   
  -    <target name="junit" depends="prepare-test">
  -    <!--
  -        <junit printsummary="yes" fork="yes" dir="${build.test}/xdoclet">
  -            <classpath refid="runtime-classpath"/>
  -            <formatter type="plain" />
  +    <!-- Compiles the test cases -->
  +    <target name="compile-test" depends="prepare-test,build">
  +        <javac srcdir="${build.xdoclettest.src}"
  +               destdir="${build.xdoclettest.dest}"
  +               debug="on"
  +               deprecation="${deprecation}">
  +            <classpath refid="test-classpath"/>
  +        </javac>
  +    </target>
  +
  +    <!-- Runs the tests without preparing or compiling them -->
  +    <target name="junit-no-compile">
  +        <!-- Run the tests -->
  +        <junit printsummary="yes" fork="yes" dir="${build.xdoclettest}">
  +            <classpath refid="test-classpath"/>
               <formatter type="xml" />
   
               <!-- Running all tests from a single vm will lead to an out-of-memory error,
so we rather perform a batch test -->
  -            <batchtest fork="yes" todir=".">
  -                <fileset dir="src">
  +            <batchtest fork="yes" todir="${build.xdoclettest}">
  +                <fileset dir="${build.xdoclettest.src}">
                       <include name="xdoclet/**/*Tests.java"/>
  +                    <!-- We don't use the runner class as this would lead to the situation
explained above -->
                       <exclude name="xdoclet/**/Run*Tests.java"/>
                   </fileset>
               </batchtest>
  -
           </junit>
  -    -->
  +        <!-- Generate the report -->
  +        <junitreport todir="${build.xdoclettest}">
  +            <fileset dir="${build.xdoclettest}">
  +                <include name="TEST-*.xml"/>
  +            </fileset>
  +            <report format="frames" todir="${build.xdoclettest.report}"/>
  +        </junitreport>
       </target>
  +
  +    <!-- Main test target -->
  +    <target name="junit" depends="junit-no-compile"/>
   
       <!-- ================================================================== -->
       <!-- End of targets                                                     -->
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message