svn commit: r912614 - /ofbiz/trunk/common.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r912614 - /ofbiz/trunk/common.xml

doogie-3
Author: doogie
Date: Mon Feb 22 15:35:37 2010
New Revision: 912614

URL: http://svn.apache.org/viewvc?rev=912614&view=rev
Log:
Make tests and tests-cobertura use a macro for junit.

Modified:
    ofbiz/trunk/common.xml

Modified: ofbiz/trunk/common.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/common.xml?rev=912614&r1=912613&r2=912614&view=diff
==============================================================================
--- ofbiz/trunk/common.xml (original)
+++ ofbiz/trunk/common.xml Mon Feb 22 15:35:37 2010
@@ -105,19 +105,27 @@
         </default-javadoc>
     </target>
 
+    <macrodef name="run-junit">
+        <attribute name="build.jar" default="${build.dir}/lib/${name}.jar"/>
+        <sequential>
+            <mkdir dir="${build.dir}/test-results"/>
+            <junit fork="on" haltonfailure="on" forkmode="once" showoutput="on" printsummary="withOutAndErr">
+                <classpath>
+                    <path refid="junit.class.path"/>
+                    <path refid="test.class.path"/>
+                    <pathelement location="@{build.jar}"/>
+                </classpath>
+                <sysproperty key="net.sourceforge.cobertura.datafile" file="${build.dir}/test-results/cobertura.dat" />
+                <sysproperty key="ofbiz.home" value="${ofbiz.home.dir}"/>
+                <batchtest>
+                    <filelist refid="test.classes"/>
+                </batchtest>
+            </junit>
+        </sequential>
+    </macrodef>
+
     <target name="tests" depends="jar">
-        <mkdir dir="${build.dir}/test-results"/>
-        <junit fork="on" haltonfailure="on" forkmode="once" showoutput="on" printsummary="withOutAndErr">
-            <classpath>
-                <path refid="junit.class.path"/>
-                <path refid="test.class.path"/>
-                <pathelement location="${build.dir}/lib/${name}.jar"/>
-            </classpath>
-            <sysproperty key="ofbiz.home" value="${ofbiz.home.dir}"/>
-            <batchtest>
-                <filelist refid="test.classes"/>
-            </batchtest>
-        </junit>
+        <run-junit/>
     </target>
 
     <target name="tests-cobertura" depends="jar">
@@ -141,19 +149,7 @@
                 <include name="*.jar"/>
             </fileset>
         </cobertura-instrument>
-        <mkdir dir="${build.dir}/test-results"/>
-        <junit fork="on" haltonfailure="on" forkmode="once" showoutput="on" printsummary="withOutAndErr">
-            <classpath>
-                <path refid="junit.class.path"/>
-                <path refid="test.class.path"/>
-                <pathelement location="${build.dir}/cobertura-lib/${name}.jar"/>
-            </classpath>
-            <sysproperty key="net.sourceforge.cobertura.datafile" file="${build.dir}/test-results/cobertura.dat" />
-            <sysproperty key="ofbiz.home" value="${ofbiz.home.dir}"/>
-            <batchtest>
-                <filelist refid="test.classes"/>
-            </batchtest>
-        </junit>
+        <run-junit build.jar="${build.dir}/cobertura-lib/${name}.jar"/>
         <delete dir="${build.dir}/test-results/cobertura-report"/>
         <mkdir dir="${build.dir}/test-results/cobertura-report"/>
         <cobertura-report datafile="${build.dir}/test-results/cobertura.dat" destdir="${build.dir}/test-results/cobertura-report">