Sfoglia il codice sorgente

Correct report summarisation, and add support for testing both WAR versions of Contact sample application.

Ben Alex 21 anni fa
parent
commit
7d1916eb7a
1 ha cambiato i file con 136 aggiunte e 72 eliminazioni
  1. 136 72
      integration-test/build.xml

+ 136 - 72
integration-test/build.xml

@@ -23,6 +23,16 @@
 		</fileset>
 	</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"/>
@@ -47,9 +57,6 @@ 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
-
-BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!
-   *** The script does NOT halt if a test errors or fails ***
 </echo>
 	</target>
 
@@ -69,7 +76,7 @@ BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!
 		</javac>
 	</target>
 
-    <target name="format" description="Formats all project source code">
+	<target name="format" description="Formats all project source code">
         <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
             <classpath refid="jalopy-classpath"/>
         </taskdef>
@@ -85,7 +92,7 @@ BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!
                 <include name="**/*.java"/>
             </fileset>
         </jalopy>
-   </target>
+	</target>
 
 	<target name="tests" depends="clean,unzip,tests-jetty,tests-catalina,tests-jboss"
 		description="Run all integration tests">
@@ -115,60 +122,68 @@ BE SURE TO CHECK REPORTS DIRECTORY FOR RESULTS OF TESTS!
 		<antcall target="-prepare.availablereports.unix"/>
 		<antcall target="-prepare.availablereports.windows"/>
 
-		<condition property="jetty.errored" value="YES !">
+		<condition property="jetty.errored" value="YES!">
 			<isset property="jetty-${jetty.version}.errored"/>
 		</condition>
 
-		<condition property="jboss.errored" value="YES !">
+		<condition property="jboss.errored" value="YES!">
 			<isset property="jboss-${jboss.version}.errored"/>
 		</condition>
 
-		<condition property="jakarta-tomcat-4.1.errored" value="YES !">
+		<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 !">
+		<condition property="jakarta-tomcat-5.errored" value="YES!">
 			<isset property="jakarta-tomcat-${tomcat-5.version}.errored"/>
 		</condition>
 
-		<condition property="jetty.failed" value="YES !">
+		<condition property="jetty.failed" value="YES!">
 			<isset property="jetty-${jetty.version}.failed"/>
 		</condition>
 
-		<condition property="jboss.failed" value="YES !">
+		<condition property="jboss.failed" value="YES!">
 			<isset property="jboss-${jboss.version}.failed"/>
 		</condition>
 
-		<condition property="jakarta-tomcat-4.1.failed" value="YES !">
+		<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 !">
+		<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>
 
-		<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"/>
+		<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;&#9;Errored: ${jetty.errored}&#9;Failed: ${jetty.failed}
-JBoss ${jboss.version}:&#9;Run: ${jboss.run}&#9;&#9;Errored: ${jboss.errored}&#9;Failed: ${jboss.failed}
-Tomcat ${tomcat-4.1.version}:&#9;Run: ${jakarta-tomcat-4.1.run}&#9;&#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;&#9;Errored: ${jakarta-tomcat-5.errored}&#9;Failed: ${jakarta-tomcat-5.failed}
+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 OCCURED DURING TESTING</fail>
-		<fail if="anyfailures">Failures occured during testing</fail>
+		<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">
@@ -187,66 +202,105 @@ Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${ja
 	</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}/aop-alliance/aopalliance.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}/spring/spring.jar" todir="${tmp.dir}/jetty-${jetty.version}/ext" overwrite="true"/>
-		<copy file="${contacts.war}" todir="${tmp.dir}/jetty-${jetty.version}/webapps" 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="240" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
-                    <http url="http://localhost:8080/contacts" />
+                <waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
+                    <http url="${wait.for.url}" />
                 </waitfor>
-				<antcall target="-runtests">
+				<antcallback target="-runtests" return="jetty-${jetty.version}.errored, jetty-${jetty.version}.failed">
 					<param name="product" value="jetty-${jetty.version}"/>
-				</antcall>
+				</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>
-
-		<antcall target="-report">
-			<param name="product" value="jetty-${jetty.version}"/>
-		</antcall>
-		<property name="jetty.run" value="yes"/>
 	</target>
 
 	<target name="tests-catalina" description="Runs Catalina integration tests">
-		<antcall target="-tests-catalina">
+		<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}"/>
-		</antcall>
-		<antcall target="-tests-catalina">
+		</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}"/>
-		</antcall>
+		</antcallback>
     </target>
 
 	<target name="tests-catalina-4.1" description="Runs Catalina 4.1 integration tests">
-		<antcall target="-tests-catalina">
+		<antcallback inheritall="true" target="-tests-catalina" >
 			<param name="tomcat.version" value="${tomcat-4.1.version}"/>
-		</antcall>
+		</antcallback>
     </target>
 
 	<target name="tests-catalina-5" description="Runs Catalina 5 integration tests">
-		<antcall target="-tests-catalina">
+		<antcallback target="-tests-catalina">
 			<param name="tomcat.version" value="${tomcat-5.version}"/>
-		</antcall>
+		</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}/aop-alliance/aopalliance.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="${contacts.war}" todir="${tmp.dir}/jakarta-tomcat-${tomcat.version}/webapps" 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>
 
-		<property name="tomcat.home" value="${tmp.dir}/jakarta-tomcat-${tomcat.version}"/>
+		<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}"/>
@@ -259,12 +313,12 @@ Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${ja
 				</classpath>
 			</java>
 			<sequential>
-                <waitfor maxwait="240" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
-                    <http url="http://localhost:8080/contacts" />
+                <waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
+                    <http url="${wait.for.url}" />
                 </waitfor>
-				<antcall target="-runtests">
+				<antcallback target="-runtests" return="jakarta-tomcat-${tomcat.version}.errored, jakarta-tomcat-${tomcat.version}.failed">
 					<param name="product" value="jakarta-tomcat-${tomcat.version}"/>
-				</antcall>
+				</antcallback>
 				<java fork="true" classname="org.apache.catalina.startup.Bootstrap" dir="${tomcat.home}">
 					<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
 					<arg value="stop"/>
@@ -277,21 +331,37 @@ Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${ja
 				</java>
  	      	</sequential>
 		</parallel>
-
-		<antcall target="-report">
-			<param name="product" value="jakarta-tomcat-${tomcat.version}"/>
-		</antcall>
-		<property name="jakarta-tomcat-${tomcat.version}.run" value="yes"/>
 	</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}/aop-alliance/aopalliance.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="${contacts.war}" todir="${tmp.dir}/jboss-${jboss.version}/server/default/deploy" 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>
@@ -300,12 +370,12 @@ Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${ja
                 </classpath>
             </java>
 			<sequential>
-                <waitfor maxwait="240" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
-                    <http url="http://localhost:8080/contacts" />
+                <waitfor maxwait="60" maxwaitunit="second" checkevery="500" checkeveryunit="millisecond">
+                    <http url="${wait.for.url}" />
                 </waitfor>
-				<antcall target="-runtests">
+				<antcallback target="-runtests"  return="jboss-${jboss.version}.errored, jboss-${jboss.version}.failed">
 					<param name="product" value="jboss-${jboss.version}"/>
-				</antcall>
+				</antcallback>
 		        <java fork="yes" classname="org.jboss.Shutdown" dir="${tmp.dir}/jboss-${jboss.version}">
 					<arg value="--shutdown"/>
 		            <classpath>
@@ -314,11 +384,6 @@ Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${ja
 		        </java>
  	      	</sequential>
 		</parallel>
-
-		<antcall target="-report">
-			<param name="product" value="jboss-${jboss.version}"/>
-		</antcall>
-		<property name="jboss.run" value="yes"/>
 	</target>
 
 	<target name="unzip" depends="unzip-jetty,unzip-catalina,unzip-jboss" description="Unzip all containers"/>
@@ -371,7 +436,6 @@ Tomcat ${tomcat-5.version}:&#9;Run: ${jakarta-tomcat-5.run}&#9;&#9;Errored: ${ja
 	</target>
 
 	<target name="-runtests" description="Runs the unit tests">
-  		<delete dir="${reports.dir}/${product}"/>
   		<mkdir dir="${reports.dir}/${product}"/>
   		<junit printsummary="yes" haltonfailure="no" haltonerror="no"
 			failureproperty="${product}.failed"