Working junit tests for pkix validation, both at the entity and entities level.
[java-idp.git] / build.xml
index 3f0ac0a..d9b7b9c 100755 (executable)
--- a/build.xml
+++ b/build.xml
@@ -1,24 +1,44 @@
 <!-- Main build configutaion for Shibboleth java components - Walter Hoehn 06/04/2002 -->
 
 <!-- Main build configutaion for Shibboleth java components - Walter Hoehn 06/04/2002 -->
 
-<project name="Shibboleth" default="dist-all" basedir=".">
+<project name="Shibboleth" default="dist-IdP" basedir=".">
 
     <!-- Set global properties for this build -->
     <property name="distname" value="shibboleth" />
     <property name="root" value="." />
 
     <!-- Set global properties for this build -->
     <property name="distname" value="shibboleth" />
     <property name="root" value="." />
-    <property name="src" value="${root}/src" />
-    <property name="approot" value="${root}/webApplication" />
-    <property name="configroot" value="${root}/webAppConfig" />
-    <property name="build" value="${approot}/WEB-INF/classes" />
-    <property name="libdir" value="${approot}/WEB-INF/lib" />
-    <property name="buildlibs" value="${root}/lib" />
-    <property name="dist" value="${root}/dist" />
-    <property name="docs" value="${root}/docs" />
-    <property name="javadocs" value="${docs}/api" />
-
-    <property name="year" value="2002"/>
+    <property name="src" value="${root}/src/" />
+    <property name="tests" value="${root}/tests/" />
+    <property name="approot" value="${root}/webApplication/" />
+    <property name="appconfig" value="${src}/conf/" />
+    <property name="configroot" value="${root}/webAppConfig/" />
+    <property name="build" value="${approot}/WEB-INF/classes/" />
+    <property name="libdir" value="${approot}/WEB-INF/lib/" />
+    <property name="buildlibs" value="${root}/lib/" />
+    <property name="endorsed" value="${root}/endorsed/" />
+    <property name="distlibs" value="${root}/lib/" />
+    <property name="dist" value="${root}/dist/" />
+    <property name="docs" value="${root}/doc/" />
+    <property name="javadocs" value="${docs}/api/" />
+
+    <property name="year" value="2002-2005"/>
     <property name="copyright" value="Copyright &#169; ${year} UCAID. All Rights Reserved."/>
 
     <property name="copyright" value="Copyright &#169; ${year} UCAID. All Rights Reserved."/>
 
-
+       <!-- Configure properties to find Tomcat and access the Manager application -->
+       <property name="tomcat.home" value="/usr/local/tomcat"/>
+       <property name="url" value="http://localhost:8080/manager"/>
+       <property name="username" value="manager"/>
+       <property name="password" value="password"/>
+
+       <!-- Uncomment this for Tomcat Tasks
+       <path id="tomcat.classpath">
+       <fileset dir="${tomcat.home}/server/lib" includes="catalina-ant.jar"/>
+       </path>
+
+       <taskdef name="tomcatStart" classname="org.apache.catalina.ant.StartTask" classpathref="tomcat.classpath"/>
+       <taskdef name="tomcatStop" classname="org.apache.catalina.ant.StopTask" classpathref="tomcat.classpath"/>
+       <taskdef name="tomcatDeploy" classname="org.apache.catalina.ant.DeployTask" classpathref="tomcat.classpath"/>
+       <taskdef name="tomcatUndeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="tomcat.classpath"/>
+       -->
+       
     <!-- Construct the CLASSPATH -->
     <path id="build.path">
         <pathelement path="${classpath}" />
     <!-- Construct the CLASSPATH -->
     <path id="build.path">
         <pathelement path="${classpath}" />
 
 
     <!-- This target should be run before checking code into the repository -->
 
 
     <!-- This target should be run before checking code into the repository -->
-    <target name="pre-checkin" depends="compile-all, test-all, clean-all" />
+    <target name="pre-checkin" depends="compile, test-all, clean-all" />
 
 
     <!-- Compile classes and move them to ${build} -->
 
 
     <!-- Compile classes and move them to ${build} -->
-    <target name="compile-all" depends="init">
+    <target name="compile" depends="init"
+       description="Compile source file, combine with schemas and conf directories">
         <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on">
             <classpath refid="build.path" />
         </javac>
         <copy todir="${build}/schemas">
             <fileset dir="${src}/schemas"/>
         </copy>
         <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on">
             <classpath refid="build.path" />
         </javac>
         <copy todir="${build}/schemas">
             <fileset dir="${src}/schemas"/>
         </copy>
+        <copy todir="${build}/conf">
+            <fileset dir="${src}/conf"/>
+        </copy>
+    </target>
+    
+    <target name="compile-tests" depends="compile">
+        <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on">
+            <classpath refid="build.path" />
+        </javac>
     </target>
 
 
     </target>
 
 
        </target>
 
     <!-- Create various product distributions and move them to ${dist} -->
        </target>
 
     <!-- Create various product distributions and move them to ${dist} -->
-    <target name="dist" depends="dist-all" />
-    <target name="dist-all" depends="compile-all, test-all, package-all, clean-build" />
+
+    <target name="dist-all" depends="compile, test-all, package-all, clean-build" />
+       
     <target name="package-all">
         <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
     </target>
 
     <target name="package-all">
         <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
     </target>
 
-    <target name="dist-origin" depends="compile-all, test-origin, package-origin, clean-build" />
-    <target name="package-origin">
-        <war warfile="${dist}/${distname}-origin.war" webxml="${configroot}/origin.xml" basedir="${approot}" update="no" />
+    <target name="dist-IdP" depends="compile, test-IdP, package-IdP, clean-build" />
+    <target name="package-IdP">
+        <war warfile="${dist}/${distname}.war" webxml="${configroot}/origin.xml" basedir="${approot}" update="no" />
     </target>
     </target>
-
-    <!-- Build utilities -->
-    <target name="build-util" depends="compile-all">
-        <jar jarfile="${dist}/shib-util.jar" basedir="${build}" />
+       
+    <target name="dist-IdP-SP" depends="compile, package-IdP-SP, clean-build" 
+       description="Build application from source, create shibboleth.war file for IdP and SP"/>
+    <target name="package-IdP-SP" depends="compile"
+       description="Create shibboleth.war file from build output and IdP-SP deployment descriptor">
+        <war warfile="${dist}/${distname}.war" webxml="${configroot}/IdP-SP.xml" basedir="${approot}" update="no" />
     </target>
 
     </target>
 
-    <target name="dist-wayf" depends="compile-all, test-wayf, package-wayf, clean-build" />
+    <target name="dist-wayf" depends="compile, package-wayf, clean-build" />
     <target name="package-wayf">
         <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
     </target>
 
     <target name="package-wayf">
         <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
     </target>
 
+    <!-- Build utilities -->
+    <target name="build-util" depends="compile">
+        <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
+    </target>
 
 
+    
     <!-- Cleanup after the build, test, and distribution processes -->
     <target name="clean" depends="clean-all" />
     <!-- Cleanup after the build, test, and distribution processes -->
     <target name="clean" depends="clean-all" />
-    <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs" />
+    <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util" />
     <target name="clean-build">
         <delete dir="${build}" />
     </target>
     <target name="clean-build">
         <delete dir="${build}" />
     </target>
        <target name="clean-javadocs">
                <delete dir="${javadocs}" />
        </target>
        <target name="clean-javadocs">
                <delete dir="${javadocs}" />
        </target>
+    <target name="clean-util">
+        <delete>
+            <fileset dir="${buildlibs}">
+                <include name="shib-util.jar" />
+            </fileset>
+        </delete>
+    </target>
 
 
-    
     <!-- Run automated tests on compiled code -->
     <!-- Run automated tests on compiled code -->
-    <target name="test-all" depends="test-origin, test-wayf" />
-    <target name="test-origin" depends="test-common" />
-    <target name="test-wayf" depends="test-common" />
-    <target name="test-common" depends="compile-all">
-        <junit printsummary="no" fork="no" haltonfailure="yes" haltonerror="no">
+    <target name="test-all" depends="test-IdP" />
+    <target name="test-IdP" depends="compile-tests">
+        <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
+                       <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
             <classpath refid="build.path" />
             <formatter type="plain" />
             <classpath refid="build.path" />
             <formatter type="plain" />
-        <!-- <test name="edu.internet2.middleware.shibboleth.common.AQHTest" /> -->
+            <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
+                       <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
         </junit>
     </target>
         </junit>
     </target>
+    
+    <!-- Tomcat Management -->
+    <target name="start" description="Start a deployed webapp using Tomcat manager">
+        <tomcatStop url="${url}" username="${username}" password="${password}" path="/${distname}"/>
+    </target>
+
+    <target name="stop" description="Stop a deployed webapp using Tomcat manager">
+        <tomcatStop url="${url}" username="${username}" password="${password}" path="/${distname}"/>
+    </target>
+
+    <target name="deploy" description="Upload and deploy using Tomcat manager">
+        <tomcatDeploy url="${url}" username="${username}" password="${password}" path="/${distname}"
+               war="file:${basedir}/${dist}/${distname}.war"/>
+    </target>
 
 
+    <target name="undeploy" description="Undeploy using Tomcat manager">
+        <tomcatUndeploy url="${url}" username="${username}" password="${password}" path="/${distname}"/>
+    </target>
+       
+       <target name="distcopy" description="Copy shibboleth.war to {tomcat.home}/webapps (Tomcat must be stopped first)">
+               <!-- Deploy war file by copy and delete. Tomcat must not be
+                    running when this occurs. --> 
+               <copy file="${dist}/${distname}.war" 
+                       tofile="${tomcat.home}/webapps/${distname}.war" 
+               />
+               <delete dir="${tomcat.home}/webapps/${distname}" quiet="yes" />
+       </target>
+       
+    
+    <!-- Automated key generation -->
+       <target name="genSecret" depends="compile">
+       <taskdef name="genSecret" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
+               <genSecret keyStorePath="${appconfig}/handle.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
+       </target>
+
+    <target name="genSalt" depends="compile">
+        <taskdef name="genSalt" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
+        <genSalt keyStorePath="${appconfig}/persistent.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
+    </target>
 </project>
 </project>