Included black-box IdP tests in standared test suite.
[java-idp.git] / build.xml
index b928d6b..8c5e1f9 100755 (executable)
--- a/build.xml
+++ b/build.xml
 
        <!-- Construct the CLASSPATH -->
        <path id="build.path">
-               <pathelement path="${classpath}" />
                <pathelement location="${build}" />
-               <fileset dir="${custom}">
-                       <include name="**/*.jar" />
-               </fileset>
                <fileset dir="${endorsed}">
                        <include name="**/*.jar" />
                </fileset>
@@ -86,8 +82,9 @@
                </copy>
 
                <!-- Build extensions -->
-               <antcall target="build-exts">
+               <antcall target="ext-invoke">
                        <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-build"/>      
                </antcall>
        </target>
 
 
        <!-- 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, clean-util" />
-       <target name="clean-build">
+
+    <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util"/>
+       
+    <target name="clean-build">
                <delete dir="${build}" />
                <delete dir="${custom.libs}"/>
                <delete dir="${custom.webapges}"/>
-           <antcall target="ext-clean">
+           <antcall target="ext-invoke">
                <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-build"/>   
            </antcall>
        </target>
-       <target name="clean-test">
+       
+    <target name="clean-test">
                <delete>
                        <fileset dir="${root}">
                                <include name="**/TEST*.txt" />
                        </fileset>
                </delete>
        </target>
-       <target name="clean-dist">
+       
+    <target name="clean-dist">
                <delete dir="${dist}" />
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-dist"/>   
+        </antcall>   
        </target>
-       <target name="clean-javadocs">
+       
+    <target name="clean-javadocs">
                <delete dir="${javadocs}" />
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-javadocs"/>   
+        </antcall>
        </target>
-       <target name="clean-util">
+       
+    <target name="clean-util">
                <delete>
                        <fileset dir="${buildlibs}">
                                <include name="shib-util.jar" />
                        </fileset>
                </delete>
        </target>
-       <!-- For IDE development, run this target first to delete all
-       directories generated by the install process before
-       recreating and reinstalling everything. -->
-       <target name="clean-install" depends="init" 
-               description="Delete old configuration and Tomcat webapp directories.">
-               <delete dir="${idp.home}" />
-               <delete dir="${sp.home}" />
-               <delete dir="${tomcat.home}/webapps/${idp.webapp.name}" />
-               <delete dir="${tomcat.home}/webapps/${sp.webapp.name}" />
-       </target>
-
 
        <!-- Add to the classpath for unit tests -->
        <path id="test.path">
        <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="test.path" />
+                       <classpath>
+                           <fileset dir="${custom.libs}">
+                               <include name="*.jar"/>
+                           </fileset>
+                           <path refid="test.path"/>
+                       </classpath>
                        <formatter type="plain" />
                        <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
                        <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
                        <test name="edu.internet2.middleware.shibboleth.common.TrustTests" />
                        <test name="edu.internet2.middleware.shibboleth.idp.provider.DNHostNameExtractionTests" />
                        <test name="edu.internet2.middleware.shibboleth.metadata.MetadataTests" />
+                       <test name="edu.internet2.middleware.shibboleth.idp.SSOTest" />      
+                       <test name="edu.internet2.middleware.shibboleth.idp.AATest" />    
                </junit>
        </target>
 
        <target name="test-SP" depends="compile-tests">
                <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
                        <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
-                       <classpath refid="test.path" />
+                   <classpath>
+                               <fileset dir="${custom.libs}">
+                                       <include name="*.jar"/>
+                               </fileset>
+                       <path refid="test.path"/>
+                       </classpath>
                        <formatter type="plain" />
                        <test name="edu.internet2.middleware.shibboleth.aap.AAPTests" />
                </junit>
 
 
        <!-- Tomcat Management -->
-       <target name="setupTomcatTasks">
+       <target name="setupTomcatTasks" depends="init">
                <path id="tomcat.classpath">
                        <fileset dir="${tomcat.home}/server/lib" includes="catalina-ant.jar"/>
                </path>
                <!-- copy values to deployment descriptor -->
                <copy file="${configroot}/${idp.deployment.descriptor}" tofile="${configroot}/idp.xml" overwrite="true" />
                <replace file="${configroot}/idp.xml" token="$IDP_HOME$" value="${idp.home.url}" />
+     
+        <!-- package extensions -->
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-package"/>
+            <param name="ext.filesystem.home" value="${idp.home}"/>
+            <param name="ext.home.token" value="$IDP_HOME$"/>
+        </antcall>
 
                <!-- create the war -->
-               <war warfile="${dist}/${idp.webapp.name}.war" webxml="${configroot}/idp.xml" basedir="${approot}" update="no">
+               <war warfile="${dist}/${idp.webapp.name}.war" webxml="${configroot}/idp.xml" basedir="${approot}" update="no" duplicate="preserve">
                        <!-- Grab any custom extension libraries -->
                        <lib dir="${custom.libs}"/>
 
        </target>
 
        <target name="package-wayf" depends="compile" description="Creates the WAYF war and moves it to ${dist}">
-               <war warfile="${dist}/${distnameWayf}.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
+        <copy file="${appconfig}/schemas.properties" todir="${approot}/WEB-INF/classes/conf"/>
+        <copy file="${appconfig}/wayfconfig.xml" todir="${approot}/WEB-INF/classes/conf"/>
+            
+               <war warfile="${dist}/${distnameWayf}.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no"/>
        </target>
 
        <target name="package-sp" depends="compile, install.url" description="Creates the Java SP war and moves it to ${dist}">
                <copy file="${configroot}/${sp.deployment.descriptor}" tofile="${configroot}/sp.xml" overwrite="true" />
                <replace file="${configroot}/sp.xml" token="$SP_HOME$" value="${sp.home.url}" />
 
+        <!-- package extensions -->
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-package"/>
+            <param name="ext.filesystem.home" value="${sp.home}"/>
+            <param name="ext.home.token" value="$SP_HOME$"/>
+        </antcall>
+        
                <!-- create the war -->
                <war warfile="${dist}/${sp.webapp.name}.war" webxml="${configroot}/sp.xml" basedir="${approot}" update="no">
                        <!-- Grab any custom extension libraries -->
                        </then>
                </if>
        </target>
+       
+       <target name="installx" depends="init, install.init" description="Interactive SP Install">
+               <if>
+                       <xinput type="confirm" defaultvalue="y">Do you want to install the Shibboleth Service Provider?</xinput>
+                       <then>
+                               <input message="What name do you want to use for the Service Provider web application? [default: ${sp.webapp.name}]" 
+                                       addproperty="sp.webapp.name.input" defaultValue="${sp.webapp.name}" />
+                               <var name="sp.webapp.name" value="${sp.webapp.name.input}" />
+
+                               <antcall target="install.sp" />
+                       </then>
+               </if>
+       </target>
 
        <target name="install.idp" depends="init, install.init">
                <xinput message="Deploying the java web application.  Do you want to install it directly onto the filesystem or use the tomcat manager application?" 
 
                <antcall target="install.idp.${idp.install-type}" />
        </target>
+       
+       <target name="install.sp" depends="init, install.init">
+               <xinput message="Deploying the java web application.  Do you want to install it directly onto the filesystem or use the tomcat manager application?" 
+                       addproperty="sp.install-type.input" type="menu" casesensitive="no" defaultValue="${sp.install-type}">
+                       <xoption value="filesystem.prompt">filesystem</xoption>
+                       <xoption>manager</xoption>
+               </xinput>
+               <var name="sp.install-type" value="${sp.install-type.input}" />
+
+               <antcall target="install.sp.${sp.install-type}" />
+       </target>
 
        <!-- Prompt user for filesystem installation options and save them to build.properties -->
        <target name="install.idp.filesystem.prompt" depends="init, install.init">
-               <input message="Select an installation base for the Shibboleth Identity Provider [default: ${idp.home}]"
+               <input message="Select a home directory for the Shibboleth Identity Provider [default: ${idp.home}]"
                        addproperty="idp.home.input" defaultvalue="${idp.home}" />
                <var name="idp.home" value="${idp.home.input}" />
                <input message="Enter tomcat home directory [default: ${tomcat.home}]"
                <if>
                        <available file="${idp.home}/etc" />
                        <then>
-                               <xinput type="confirm" addproperty="copy-idp-conf1">The directory `${idp.home}${file.separator}etc` already exists.  Do you want to overwrite the existing configuration?</xinput>
-                               <if>
-                                       <equals arg1="${copy-idp-conf1}" arg2="y" />
-                                       <then>
-                                               <xinput type="confirm" addproperty="copy-idp-conf">WARNING!!! You are about to delete your Shibboleth IdP configuration.  Are you certain you certain this is what you want?</xinput>
-                                       </then>
-                               </if>
+                               <echo>--------------------------------------------------------------------------------------</echo>
+                               <echo>---</echo>
+                               <echo>---   NOTE:  Existing Identiity Provider configuration at ${idp.home}/etc ${line.separator}---   will not be overwritten.</echo>
+                               <echo>---</echo>
+                               <echo>--------------------------------------------------------------------------------------</echo>
+                               <property name="copy-idp-conf" value="n" />
                        </then>
                        <else>
                                <property name="copy-idp-conf" value="y" />
                <antcall target="install.idp.filesystem" />
                <antcall target="savePropertyFile" />
        </target>
+       
+       <!-- Prompt user for filesystem installation options and save them to build.properties -->
+       <target name="install.sp.filesystem.prompt" depends="init, install.init">
+               <input message="Select a home directory for the Shibboleth Service Provider [default: ${sp.home}]"
+                       addproperty="sp.home.input" defaultvalue="${sp.home}" />
+               <var name="sp.home" value="${sp.home.input}" />
+               <input message="Enter tomcat home directory [default: ${tomcat.home}]"
+                       addproperty="tomcat.home.input" defaultvalue="${tomcat.home}" />
+               <var name="tomcat.home" value="${tomcat.home.input}" />
+
+               <if>
+                       <available file="${sp.home}/etc" />
+                       <then>
+                               <echo>--------------------------------------------------------------------------------------</echo>
+                               <echo>---</echo>
+                               <echo>---   NOTE:  Existing Service Provider configuration at ${sp.home}/etc ${line.separator}---   will not be overwritten.</echo>
+                               <echo>---</echo>
+                               <echo>--------------------------------------------------------------------------------------</echo>
+                               <property name="copy-sp-conf" value="n" />
+                       </then>
+                       <else>
+                               <property name="copy-sp-conf" value="y" />
+                       </else>
+               </if>
+
+               <antcall target="install.sp.filesystem" />
+               <antcall target="savePropertyFile" />
+       </target>
 
        <!-- Install Shibboleth IdP to filesystem using the properties in build.properties -->
        <target name="install.idp.filesystem" depends="init, install.init, build-util, install.url, package-idp" 
                        <fileset dir="lib" includesfile="conf/idp-lib.include" />
                </copy>
 
+               <copy todir="${idp.home}/endorsed">
+                       <fileset dir="endorsed" />
+               </copy>
+
                <copy todir="${idp.home}/bin">
                        <fileset dir="bin"/>
                </copy>
                                <antcall target="install.idp.filesystem.config" />
                        </then>
                </if>
+
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-install-filesystem"/>
+            <param name="ext.filesystem.home" value="${idp.home}"/>
+            <param name="ext.home.token" value="$IDP_HOME$"/>
+        </antcall>   
        </target>
 
        <!-- Install Shibboleth SP to filesystem using the properties in build.properties -->
 
                <!-- Move SP war to Tomcat deployment directory -->
                <copy file="${dist}/${sp.webapp.name}.war" tofile="${tomcat.home}/webapps/${sp.webapp.name}.war" />
+               
+               <!-- Move Shib Filter jar to Tomcat shared directory -->
+               <copy file="${distlibs}/shib-filter.jar" tofile="${tomcat.home}/shared/lib/shib-filter.jar" />
+               
+               <!-- Copy test secure application to Tomcat -->
+               <copy file="${root}/data/secure.war" tofile="${tomcat.home}/webapps/secure.war" />
 
                <!-- copy sp jars and utilities -->
                <copy todir="${sp.home}/lib">
                                <antcall target="install.sp.filesystem.config" />
                        </then>
                </if>
+
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-install-filesystem"/>
+            <param name="ext.filesystem.home" value="${sp.home}"/>
+            <param name="ext.home.token" value="$SP_HOME$"/>
+        </antcall>      
        </target>
 
 
                <copy todir="${sp.home}/etc" overwrite="true">
                        <fileset dir="${src}/conf" includesfile="conf/sp-conf.include"/>
                </copy>
-               <move file="${sp.home}/etc/dist.sp.xml" tofile="${sp.home}/etc/sp.xml" overwrite="true" />
+               <move file="${sp.home}/etc/dist.sp-iqidp.xml" tofile="${sp.home}/etc/sp.xml" overwrite="true" />
                <replace file="${sp.home}/etc/sp.xml" token="$SP_HOME$" value="${sp.home.url}" />
        </target>
 
                <input message="Enter tomcat password [default: ${tomcat.password}]" addproperty="tomcat.password.input" defaultValue="${tomcat.password}" />
                <var name="tomcat.password" value="${tomcat.password.input}" />
 
+        <antcall target="package-idp" />
                <antcall target="tomcat.deploy" />
                <antcall target="savePropertyFile" />
        </target>
                        <entry key="tomcat.password" value="${tomcat.password}" />
                </propertyfile>
        </target>
+       <!-- For IDE development, run this target first to delete all
+       directories generated by the install process before
+       recreating and reinstalling everything. -->
+       <target name="clean-install" depends="init" 
+               description="Delete old configuration and Tomcat webapp directories.">
+               <delete dir="${idp.home}" />
+               <delete dir="${sp.home}" />
+               <delete dir="${tomcat.home}/webapps/${idp.webapp.name}" />
+               <delete dir="${tomcat.home}/webapps/${sp.webapp.name}" />
+       </target>
 </project>