spring-security/integration-test/build.xml

467 lines
21 KiB
XML

<?xml version="1.0"?>
<!--
Build file for running container integration tests.
$Id$
-->
<project name="acegi-security-integration-tests" default="usage" basedir=".">
<property file="build.properties"/>
<property file="project.properties"/>
<path id="qa-portalpath">
<fileset dir="${dist.lib.dir}">
<include name="acegi-security-spring.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${httpunit.lib.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset file="${contacts.client.jar}"/>
</path>
<path id="antcontrib-classpath">
<fileset dir="${httpunit.lib.dir}">
<include name="ant-contrib.jar"/>
</fileset>
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath refid="antcontrib-classpath"/>
</taskdef>
<path id="jalopy-classpath">
<fileset dir="${lib.dir}/jalopy">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="usage">
<echo level="info">
${name} build file
------------------------------------------------------
Among the available targets are:
clean --> deletes output directories
unzip --> unzips each container into file system
tests --> unzips each container and runs all tests
tests-all --> runs all tests (does not unzip each container)
tests-jetty --> runs the integration tests with Jetty
tests-jboss --> runs the integration tests with JBoss
tests-catalina --> runs the integration tests with Catalina
(both 4.1 and 5.0)
tests-catalina-4.1--> runs the integration tests with Catalina 4.1
tests-catalina-5 --> runs the integration tests with Catalina 5.0
Each tests-xxxx target assumes the container is unzipped
</echo>
</target>
<target name="clean" description="Clean all output dirs">
<delete dir="${build.dir}"/>
<delete dir="${tmp.dir}"/>
<delete dir="${reports.dir}"/>
</target>
<target name="buildtests" depends="" description="Compile test source tree Java files into class files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" target="1.3" debug="${debug}"
deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="qa-portalpath"/>
</javac>
</target>
<target name="format" description="Formats all project source code">
<taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
<classpath refid="jalopy-classpath"/>
</taskdef>
<jalopy fileformat="unix"
convention="${jalopy.xml}"
history="file"
historymethod="adler32"
loglevel="error"
threads="2"
classpathref="qa-portalpath">
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
</jalopy>
</target>
<target name="tests" depends="clean,unzip,tests-all">
</target>
<target name="tests-all" depends="tests-jetty,tests-catalina,tests-jboss"
description="Run all integration tests">
<condition property="anyerrors" value="true">
<or>
<isset property="jetty-${jetty.version}.errored"/>
<isset property="jboss-${jboss.version}.errored"/>
<isset property="jakarta-tomcat-${tomcat-4.1.version}.errored"/>
<isset property="jakarta-tomcat-${tomcat-5.version}.errored"/>
</or>
</condition>
<condition property="anyfailures" value="true">
<or>
<isset property="jetty-${jetty.version}.failed"/>
<isset property="jboss-${jboss.version}.failed"/>
<isset property="jakarta-tomcat-${tomcat-4.1.version}.failed"/>
<isset property="jakarta-tomcat-${tomcat-5.version}.failed"/>
</or>
</condition>
<fileset id="availablereports" dir="${reports.dir}"
includes="**/html/index.html"/>
<condition property="is.windows">
<os family="windows"/>
</condition>
<antcall target="-prepare.availablereports.unix"/>
<antcall target="-prepare.availablereports.windows"/>
<condition property="jetty.errored" value="YES!">
<isset property="jetty-${jetty.version}.errored"/>
</condition>
<condition property="jboss.errored" value="YES!">
<isset property="jboss-${jboss.version}.errored"/>
</condition>
<condition property="jakarta-tomcat-4.1.errored" value="YES!">
<isset property="jakarta-tomcat-${tomcat-4.1.version}.errored"/>
</condition>
<condition property="jakarta-tomcat-5.errored" value="YES!">
<isset property="jakarta-tomcat-${tomcat-5.version}.errored"/>
</condition>
<condition property="jetty.failed" value="YES!">
<isset property="jetty-${jetty.version}.failed"/>
</condition>
<condition property="jboss.failed" value="YES!">
<isset property="jboss-${jboss.version}.failed"/>
</condition>
<condition property="jakarta-tomcat-4.1.failed" value="YES!">
<isset property="jakarta-tomcat-${tomcat-4.1.version}.failed"/>
</condition>
<condition property="jakarta-tomcat-5.failed" value="YES!">
<isset property="jakarta-tomcat-${tomcat-5.version}.failed"/>
</condition>
<condition property="jakarta-tomcat-4.1.run" value="yes">
<isset property="jakarta-tomcat-${tomcat-4.1.version}.run"/>
</condition>
<condition property="jakarta-tomcat-5.run" value="yes">
<isset property="jakarta-tomcat-${tomcat-5.version}.run"/>
</condition>
<property name="jetty.errored" value="no "/>
<property name="jboss.errored" value="no "/>
<property name="jakarta-tomcat-4.1.errored" value="no "/>
<property name="jakarta-tomcat-5.errored" value="no "/>
<property name="jetty.failed" value="no "/>
<property name="jboss.failed" value="no "/>
<property name="jakarta-tomcat-4.1.failed" value="no "/>
<property name="jakarta-tomcat-5.failed" value="no "/>
<property name="jetty.run" value="no "/>
<property name="jboss.run" value="no "/>
<property name="jakarta-tomcat-4.1.run" value="no "/>
<property name="jakarta-tomcat-5.run" value="no "/>
<echo level="info">
Jetty ${jetty.version}:&#9;Run: ${jetty.run}&#9;Errored: ${jetty.errored}&#9;Failed: ${jetty.failed}
JBoss ${jboss.version}:&#9;Run: ${jboss.run}&#9;Errored: ${jboss.errored}&#9;Failed: ${jboss.failed}
Tomcat ${tomcat-4.1.version}:&#9;Run: ${jakarta-tomcat-4.1.run}&#9;Errored: ${jakarta-tomcat-4.1.errored}&#9;Failed: ${jakarta-tomcat-4.1.failed}
Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;Errored: ${jakarta-tomcat-5.errored}&#9;Failed: ${jakarta-tomcat-5.failed}
</echo>
<fail if="anyerrors">*** ERRORS OCCURRED DURING TESTING ***</fail>
<fail if="anyfailures">*** Failures occurred during testing ***</fail>
</target>
<target name="-prepare.availablereports.windows" if="is.windows">
<pathconvert dirsep="\" pathsep="&#13;&#10;"
property="availablereports.paths"
refid="availablereports"/>
<echo>${availablereports.paths}</echo>
</target>
<target name="-prepare.availablereports.unix" unless="is.windows">
<echo>not is.windows: ${is.windows}</echo>
<pathconvert dirsep="/" pathsep="&#10;"
property="availablereports.paths"
refid="availablereports"/>
<echo>${availablereports.paths}</echo>
</target>
<target name="tests-jetty" depends="buildtests" description="Runs Jetty integration tests">
<delete dir="${reports.dir}/jetty-${jetty.version}"/>
<!-- Execute non-container adapter unit tests in normal environment-->
<copy file="${contacts.filter.war}" todir="${tmp.dir}/Jetty-${jetty.version}/webapps" overwrite="true"/>
<antcallback target="-perform-test-jetty" return="jetty-${jetty.version}.errored, jetty-${jetty.version}.failed">
<param name="test.includes" value="**/FilterContactsTests.class"/>
<param name="wait.for.url" value="http://localhost:8080/contacts"/>
</antcallback>
<!-- Setup container adapter environment and execute unit tests -->
<copy file="${config.dir}/jetty-${jetty.version}/jetty.xml" todir="${tmp.dir}/Jetty-${jetty.version}/etc" overwrite="true"/>
<copy file="${acegisecurity.xml}" todir="${tmp.dir}/Jetty-${jetty.version}/etc" overwrite="true"/>
<copy file="${dist.lib.dir}/acegi-security-jetty-ext.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${lib.dir}/aopalliance/aopalliance-1.0.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${lib.dir}/jakarta-commons/commons-logging.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${lib.dir}/jakarta-commons/commons-codec.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${lib.dir}/caucho/burlap.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${lib.dir}/caucho/hessian.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/Jetty-${jetty.version}/ext" overwrite="true"/>
<copy file="${contacts.ca.war}" todir="${tmp.dir}/Jetty-${jetty.version}/webapps" overwrite="true"/>
<antcallback target="-perform-test-jetty" return="jetty-${jetty.version}.errored, jetty-${jetty.version}.failed">
<param name="test.includes" value="**/ContainerAdapterContactsTests.class"/>
<param name="wait.for.url" value="http://localhost:8080/contacts-container-adapter"/>
</antcallback>
<antcall target="-report">
<param name="product" value="jetty-${jetty.version}"/>
</antcall>
<property name="jetty.run" value="yes"/>
</target>
<target name="-perform-test-jetty">
<parallel>
<java fork="true" dir="${tmp.dir}/Jetty-${jetty.version}/" classpath="${tmp.dir}/Jetty-${jetty.version}/start.jar" classname="org.mortbay.start.Main">
</java>
<sequential>
<waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
<http url="${wait.for.url}" />
</waitfor>
<antcallback target="-runtests" return="jetty-${jetty.version}.errored, jetty-${jetty.version}.failed">
<param name="product" value="jetty-${jetty.version}"/>
</antcallback>
<java fork="true" dir="${tmp.dir}/Jetty-${jetty.version}/" classpath="${tmp.dir}/Jetty-${jetty.version}/stop.jar" classname="org.mortbay.stop.Main"/>
</sequential>
</parallel>
</target>
<target name="tests-catalina" description="Runs Catalina integration tests">
<antcallback target="-tests-catalina" return="jakarta-tomcat-${tomcat-4.1.version}.run, jakarta-tomcat-${tomcat-4.1.version}.errored, jakarta-tomcat-${tomcat-4.1.version}.failed">
<param name="tomcat.version" value="${tomcat-4.1.version}"/>
</antcallback>
<antcallback target="-tests-catalina" return="jakarta-tomcat-${tomcat-5.version}.run, jakarta-tomcat-${tomcat-5.version}.errored, jakarta-tomcat-${tomcat-5.version}.failed">
<param name="tomcat.version" value="${tomcat-5.version}"/>
</antcallback>
</target>
<target name="tests-catalina-4.1" description="Runs Catalina 4.1 integration tests">
<antcallback inheritall="true" target="-tests-catalina" >
<param name="tomcat.version" value="${tomcat-4.1.version}"/>
</antcallback>
</target>
<target name="tests-catalina-5" description="Runs Catalina 5 integration tests">
<antcallback target="-tests-catalina">
<param name="tomcat.version" value="${tomcat-5.version}"/>
</antcallback>
</target>
<target name="-tests-catalina" depends="buildtests" description="Runs Catalina integration tests">
<property name="tomcat.home" value="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
<delete dir="${reports.dir}/jakarta-tomcat-${tomcat.version}"/>
<!-- Execute non-container adapter unit tests in normal environment-->
<delete dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps/contacts"/>
<copy file="${contacts.filter.war}" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps" overwrite="true"/>
<antcallback target="-perform-test-catalina" return="jakarta-tomcat-${tomcat.version}.errored, jakarta-tomcat-${tomcat.version}.failed">
<param name="test.includes" value="**/FilterContactsTests.class"/>
<param name="wait.for.url" value="http://localhost:8080/contacts"/>
</antcallback>
<!-- Setup container adapter environment and execute unit tests -->
<copy file="${config.dir}/catalina-${tomcat.version}/server.xml" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/conf" overwrite="true"/>
<copy file="${acegisecurity.xml}" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/conf" overwrite="true"/>
<copy file="${dist.lib.dir}/acegi-security-catalina-server.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/server/lib" overwrite="true"/>
<copy file="${dist.lib.dir}/acegi-security-catalina-common.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
<copy file="${lib.dir}/aopalliance/aopalliance-1.0.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
<copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
<copy file="${lib.dir}/jakarta-commons/commons-codec.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
<copy file="${lib.dir}/caucho/burlap.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
<copy file="${lib.dir}/caucho/hessian.jar" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/common/lib" overwrite="true"/>
<copy file="${contacts.ca.war}" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps" overwrite="true"/>
<delete dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps/contacts-container-adapter"/>
<antcallback target="-perform-test-catalina" return="jakarta-tomcat-${tomcat.version}.errored, jakarta-tomcat-${tomcat.version}.failed">
<param name="test.includes" value="**/ContainerAdapterContactsTests.class"/>
<param name="wait.for.url" value="http://localhost:8080/contacts-container-adapter"/>
</antcallback>
<antcall target="-report">
<param name="product" value="jakarta-tomcat-${tomcat.version}"/>
</antcall>
<property name="jakarta-tomcat-${tomcat.version}.run" value="yes"/>
</target>
<target name="-perform-test-catalina">
<parallel>
<java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
<arg value="start"/>
<classpath>
<pathelement path="${java.home}/../lib/tools.jar"/>
<fileset dir="${tomcat.home}">
<include name="bin/bootstrap.jar"/>
</fileset>
</classpath>
</java>
<sequential>
<waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
<http url="${wait.for.url}" />
</waitfor>
<antcallback target="-runtests" return="jakarta-tomcat-${tomcat.version}.errored, jakarta-tomcat-${tomcat.version}.failed">
<param name="product" value="jakarta-tomcat-${tomcat.version}"/>
</antcallback>
<java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
<arg value="stop"/>
<classpath>
<pathelement path="${java.home}/../lib/tools.jar"/>
<fileset dir="${tomcat.home}">
<include name="bin/bootstrap.jar"/>
</fileset>
</classpath>
</java>
</sequential>
</parallel>
</target>
<target name="tests-jboss" depends="buildtests" description="Runs JBoss integration tests">
<delete dir="${reports.dir}/jboss-${jboss.version}"/>
<!-- Execute non-container adapter unit tests in normal environment-->
<copy file="${contacts.filter.war}" todir="${tmp.dir}/jboss-${jboss.version}/server/default/deploy" overwrite="true"/>
<antcallback target="-perform-test-jboss" return="jboss-${jboss.version}.errored, jboss-${jboss.version}.failed">
<param name="test.includes" value="**/FilterContactsTests.class"/>
<param name="wait.for.url" value="http://localhost:8080/contacts"/>
</antcallback>
<!-- Setup container adapter environment and execute unit tests -->
<copy file="${config.dir}/jboss-${jboss.version}/login-config.xml" todir="${tmp.dir}/jboss-${jboss.version}/server/default/conf" overwrite="true"/>
<copy file="${acegisecurity.xml}" todir="${tmp.dir}/jboss-${jboss.version}/server/default/conf" overwrite="true"/>
<copy file="${dist.lib.dir}/acegi-security-jboss-lib.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
<copy file="${lib.dir}/aopalliance/aopalliance-1.0.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
<copy file="${lib.dir}/spring/spring.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
<copy file="${lib.dir}/jakarta-commons/commons-codec.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
<copy file="${lib.dir}/caucho/burlap.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
<copy file="${lib.dir}/caucho/hessian.jar" todir="${tmp.dir}/jboss-${jboss.version}/server/default/lib" overwrite="true"/>
<copy file="${contacts.ca.war}" todir="${tmp.dir}/jboss-${jboss.version}/server/default/deploy" overwrite="true"/>
<antcallback target="-perform-test-jboss" return="jboss-${jboss.version}.errored, jboss-${jboss.version}.failed">
<param name="test.includes" value="**/ContainerAdapterContactsTests.class"/>
<param name="wait.for.url" value="http://localhost:8080/contacts-container-adapter"/>
</antcallback>
<antcall target="-report">
<param name="product" value="jboss-${jboss.version}"/>
</antcall>
<property name="jboss.run" value="yes"/>
</target>
<target name="-perform-test-jboss">
<parallel>
<java fork="yes" classname="org.jboss.Main" dir="${tmp.dir}/jboss-${jboss.version}">
<classpath>
<pathelement path="${java.home}/../lib/tools.jar"/>
<pathelement path="${tmp.dir}/jboss-${jboss.version}/bin/run.jar"/>
</classpath>
</java>
<sequential>
<waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
<http url="${wait.for.url}" />
</waitfor>
<antcallback target="-runtests" return="jboss-${jboss.version}.errored, jboss-${jboss.version}.failed">
<param name="product" value="jboss-${jboss.version}"/>
</antcallback>
<java fork="yes" classname="org.jboss.Shutdown" dir="${tmp.dir}/jboss-${jboss.version}">
<arg value="--shutdown"/>
<classpath>
<pathelement path="${tmp.dir}/jboss-${jboss.version}/bin/shutdown.jar"/>
</classpath>
</java>
</sequential>
</parallel>
</target>
<target name="unzip" depends="unzip-jetty,unzip-catalina,unzip-jboss" description="Unzip all containers"/>
<target name="unzip-jetty" depends="" description="Unzip Jetty container">
<delete dir="${tmp.dir}/Jetty-${jetty.version}"/>
<mkdir dir="${tmp.dir}/Jetty-${jetty.version}"/>
<unzip src="${containers.dir}/Jetty-${jetty.version}-all.zip" dest="${tmp.dir}"/>
</target>
<target name="unzip-catalina" depends="" description="Unzip Catalina container">
<antcall target="-unzip-catalina">
<param name="tomcat.version" value="${tomcat-4.1.version}"/>
</antcall>
<antcall target="-unzip-catalina">
<param name="tomcat.version" value="${tomcat-5.version}"/>
</antcall>
</target>
<target name="unzip-catalina-4.1" depends="" description="Unzip Catalina 4.1 container">
<antcall target="-unzip-catalina">
<param name="tomcat.version" value="${tomcat-4.1.version}"/>
</antcall>
</target>
<target name="unzip-catalina-5" depends="" description="Unzip Catalina 5 container">
<antcall target="-unzip-catalina">
<param name="tomcat.version" value="${tomcat-4.1.version}"/>
</antcall>
</target>
<target name="-unzip-catalina" depends="" description="Unzip Catalina container">
<delete dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
<mkdir dir="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
<unzip src="${containers.dir}/jakarta-tomcat-${tomcat.version}.zip" dest="${tmp.dir}"/>
</target>
<target name="unzip-jboss" depends="" description="Unzip JBoss container">
<delete dir="${tmp.dir}/jboss-${jboss.version}"/>
<mkdir dir="${tmp.dir}/jboss-${jboss.version}"/>
<unzip src="${containers.dir}/jboss-${jboss.version}.zip" dest="${tmp.dir}"/>
</target>
<target name="-report" description="Generates a browsable HTML report of the test run">
<mkdir dir="${reports.dir}/${product}/html"/>
<junitreport todir="${reports.dir}/${product}">
<fileset dir="${reports.dir}/${product}" includes="**/TEST-*.xml"/>
<report format="frames" todir="${reports.dir}/${product}/html"/>
</junitreport>
</target>
<target name="-runtests" description="Runs the unit tests">
<mkdir dir="${reports.dir}/${product}"/>
<junit printsummary="yes" haltonfailure="no" haltonerror="no"
failureproperty="${product}.failed"
errorproperty="${product}.errored">
<classpath location="${build.dir}"/>
<classpath refid="qa-portalpath"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${reports.dir}/${product}">
<fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
</batchtest>
</junit>
</target>
</project>