Tests cases now compile and run properly - fixes bug 421
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 22 Aug 2005 13:17:18 +0000 (13:17 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 22 Aug 2005 13:17:18 +0000 (13:17 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1812 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

custom/extension-build.properties
custom/extension-build.xml

index d870e41..bf22ebd 100644 (file)
@@ -5,13 +5,14 @@ ext.etc=${ext.root}/etc
 ext.lib=${ext.root}/lib
 ext.src=${ext.root}/src
 ext.src.conf=${ext.root}/src-conf
-ext.test-src=${ext.root}/tests
+ext.test.src=${ext.root}/tests
 ext.webpages=${ext.root}/web
 ext.dist=${ext.root}/dist
 ext.build=${ext.root}/build
 ext.classes=${ext.build}/classes
+ext.test.classes=${ext.build}/tests
 ext.docs=${ext.root}/doc/api
 
 # Properties controlling build behavior
 gen.ext.docs=true
-test.ext=true
+test.ext=true
\ No newline at end of file
index 94131fd..4bd0f7a 100644 (file)
@@ -9,6 +9,25 @@
 -->
 <project name="Shibboleth-Extensions" default="ext-invoke" basedir=".">
 
+    <path id="ext.path">
+        <!-- Shibboleth Libraries -->
+        <path refid="build.path" />
+
+        <!-- Shibboleth Classes -->
+        <pathelement location="${build}" />
+
+        <!-- Extension libraries -->
+        <fileset dir="${ext.lib}">
+            <include name="**/*.jar" />
+        </fileset>
+
+        <!-- Extension classes -->
+        <pathelement location="${ext.classes}" />
+        
+        <!-- Extension test classes -->
+        <pathelement location="${ext.test.classes}" />
+    </path>
+
     <!-- Loops through all the extension directories and executes a particular operation on them -->
     <target name="ext-invoke" description="Invoke operation extensions">
         <for keepgoing="true" param="module-path">
@@ -31,7 +50,7 @@
 
         <!-- Compile the source -->
         <antcall target="ext-compile" />
-        
+
         <!-- Generate Javadocs -->
         <antcall target="ext-gen-docs" />
 
 
     <!-- Initialize everything we need. -->
     <!-- The properties loaded here are scoped to this particular extension build -->
-    <target name="ext-build-init"  depends="ext-load-properties" description="Sets up everything to prepare for the build">
+    <target name="ext-build-init" depends="ext-load-properties" description="Sets up everything to prepare for the build">
 
         <!-- Create needed directories -->
         <mkdir dir="${ext.dist}" />
         <mkdir dir="${ext.build}" />
         <mkdir dir="${ext.classes}" />
+        <mkdir dir="${ext.test.classes}" />
         <mkdir dir="${ext.docs}" />
     </target>
 
             <available file="${ext.src}" />
             <then>
                 <echo message="Compiling extension source" />
-                <javac srcdir="${ext.src}" destdir="${ext.classes}" includes="**/*.java" debug="on" source="1.4" deprecation="true">
-                    <!-- Shibboleth Libraries -->
-                    <classpath refid="build.path" />
-
-                    <!-- Shibboleth Classes -->
-                    <classpath>
-                        <pathelement location="${build}" />
-                    </classpath>
-
-                    <!-- Extension libraries -->
-                    <classpath>
-                        <fileset dir="${ext.lib}">
-                            <include name="**/*.jar" />
-                        </fileset>
-                    </classpath>
-                </javac>
+                <javac srcdir="${ext.src}"
+                       destdir="${ext.classes}"
+                       classpathref="ext.path"
+                       includes="**/*.java"
+                       debug="on"
+                       source="1.4"
+                       deprecation="true"/>
             </then>
         </if>
     </target>
                 <if>
                     <available file="${ext.test.src}" />
                     <then>
+                        <echo message="Compiling extension test source" />
+                        <javac srcdir="${ext.test.src}"
+                               destdir="${ext.test.classes}"
+                               classpathref="ext.path"
+                               includes="**/*.java"
+                               debug="on"
+                               source="1.4"
+                               deprecation="true"/>
+
                         <echo message="Running tests cases for extension ${ext.name}" />
-                        <junit printsummary="no" fork="yes" haltonerror="true" haltonfailure="true" jvm="${ext.root}">
+                        <junit printsummary="no" fork="yes" haltonerror="true" haltonfailure="true" dir="${ext.root}">
                             <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
+                            <classpath refid="ext.path"/>
                             <formatter type="plain" />
-                            <batchtest>
-                                <fileset dir="${ext.test.src}" />
+                            <batchtest todir="${ext.root}">
+                                <fileset dir="${ext.test.classes}" />
                             </batchtest>
                         </junit>
                     </then>
                 </if>
             </then>
         </if>
-
     </target>
 
     <!-- Generates the Javadocs for the extension -->
             <then>
                 <replace dir="${ext.classes}" token="${ext.home.token}" value="${ext.filesystem.home}" excludes="*.class" />
                 <replace dir="${ext.classes}" token="$EXTENSION_NAME$" value="${ext.name}" excludes="*.class" />
-                <jar jarfile="${ext.dist}/${ext.name}.jar" basedir="${ext.classes}" update="false"/>
+                <jar jarfile="${ext.dist}/${ext.name}.jar" basedir="${ext.classes}" update="false" />
                 <copy file="${ext.dist}/${ext.name}.jar" todir="${exts.dir}/lib" />
-                <delete dir="${ext.classes}"/>
+                <delete dir="${ext.classes}" />
             </then>
         </if>
     </target>