buildTest.xml (249 lines of code) (raw):

<?xml version="1.0"?> <!DOCTYPE project [ <!ENTITY properties SYSTEM "xmls/properties.xml"> <!ENTITY paths SYSTEM "xmls/path_refs.xml"> <!ENTITY taskdefs SYSTEM "xmls/taskdefs.xml"> <!ENTITY taskdefs_post_compile SYSTEM "xmls/taskdefs_post_compile.xml"> <!ENTITY targets SYSTEM "xmls/targets.xml"> ]> <project default="printEnv" basedir="."> <!-- =================================================================== --> <description> Test Files Build file for Axis Notes: This is a build file for use with the Jakarta Ant build tool. Prerequisites: jakarta-ant from http://jakarta.apache.org Optional components: SOAP Attachment support enablement: activation.jar from http://java.sun.com/products/javabeans/glasgow/jaf.html mailapi.jar from http://java.sun.com/products/javamail/ Security support enablement: xmlsec.jar from fresh build of CVS from http://xml.apache.org/security/ Other support jars from http://cvs.apache.org/viewcvs.cgi/xml-security/libs/ Build Instructions: To build, run ant "target" on the directory where this file is located with the target you want. Most useful targets: - compile : compiles the tests and WSDL files Author: Matt Seibert mseibert@us.ibm.com Copyright: Copyright (c) 2002-2003 Apache Software Foundation. </description> <!-- ==================================================================== --> &properties; &paths; &taskdefs; &taskdefs_post_compile; &targets; <!-- Give user a chance to override without editing this file (and without typing -D each time it compiles it) --> <property file="test.properties"/> <property file="${user.home}/test.properties"/> <!-- =========================================================================== --> <target name="compile" depends="printEnv,copy"> <!-- Compile the code --> <antcall target="compileJunit"/> <antcall target="compileFunctional"/> </target> <target name="compileJunit" depends="printEnv,copy"> <!-- Compile the code --> <foreach target="component-compile" fork="${foreach.fork}" inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}"> <param name="file"> <fileset dir="${axis.home}" > <patternset> <include name="test/**/build.xml"/> <exclude name="test/wsdl/**/build.xml" /> <exclude name="test/functional/build.xml"/> <!-- TODO: these tests are not working because they rely on a 3rd party service that is no longer available --> <exclude name="test/client/build.xml"/> </patternset> </fileset> </param> </foreach> </target> <target name="compileFunctional" depends="printEnv,copy"> <!-- Compile the code --> <foreach target="component-compile" fork="${foreach.fork}" inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}"> <param name="file"> <fileset dir="${axis.home}" > <patternset> <include name="test/wsdl/**/build.xml" /> <include name="test/rpc/**/build.xml" /> <include name="test/functional/build.xml"/> <exclude name="test/wsdl/attachments/**/build.xml" unless="attachments.present"/> <exclude name="test/wsdl/interop3/**/build.xml" /> <exclude name="test/wsdl/adaptive/**/build.xml" /> <!-- TODO: AXIS-2865 --> <exclude name="test/wsdl/liberty/build.xml"/> </patternset> </fileset> </param> </foreach> </target> <!-- =================================================================== --> <!-- Compiles the JUnit testcases --> <!-- =================================================================== --> <!-- =================================================================== --> <!-- Runs the JUnit package testcases --> <!-- =================================================================== --> <target name="junit" if="junit.present"> <available file="${axis.home}/junit-exclude-tests.txt" property="junit-exclude-tests.present"/> <junit printsummary="yes" haltonfailure="${test.functional.fail}" fork="yes"> <jvmarg value="-Xbootclasspath:${sun.boot.class.path}"/> <classpath refid="classpath" /> <formatter type="xml" /> <batchtest todir="${test.functional.reportdir}"> <fileset dir="${build.dir}/classes"> <!-- Convention: each package that's being tested has its own test class collecting all the tests --> <include name="**/PackageTests.class" /> <excludesfile name="${axis.home}/junit-exclude-tests.txt" if="junit-exclude-tests.present"/> <!-- <include name="**/test/*TestSuite.class"/> --> </fileset> </batchtest> </junit> </target> <!-- =================================================================== --> <!-- Functional tests, no server (for testing under debugger) --> <!-- =================================================================== --> <target name="functional-tests-noserver"> <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${axis.home}/test" antfile="build_functional_tests.xml" target="junit-functional-noserver"> <property name="test.functional.usefile" value="${test.functional.usefile}"/> </ant> </target> <!-- =================================================================== --> <!-- Cleans everything --> <!-- =================================================================== --> <target name="clean"> <delete dir="${build.dir}/test"/> </target> <target name="copy"/> <!-- =================================================================== --> <!-- Prepares the JUnit functional test --> <!-- =================================================================== --> <target name="junit-functional-prepare" if="junit.present"> <path id="deploy.xml.files"> <fileset dir="${build.dir}/work"> <include name="**/deploy.wsdd"/> <exclude name="mssoapinterop/interop*/deploy.wsdd"/> </fileset> </path> <path id="undeploy.xml.files"> <fileset dir="${build.dir}/work"> <include name="**/undeploy.wsdd"/> <exclude name="mssoapinterop/interop*/undeploy.wsdd"/> </fileset> </path> <property name="deploy.xml.property" refid="deploy.xml.files"/> <property name="undeploy.xml.property" refid="undeploy.xml.files"/> </target> <!-- =================================================================== --> <!-- Runs the JUnit functional test --> <!-- =================================================================== --> <target name="junit-functional" if="junit.present" depends="junit-functional-prepare"> <mkdir dir="${test.functional.reportdir}" /> <java classname="org.apache.axis.client.AdminClient" fork="yes"> <classpath refid="classpath" /> <arg line="${deploy.xml.property}"/> </java> <available file="${axis.home}/junit-exclude-tests.txt" property="junit-exclude-tests.present"/> <!-- now, run the actual test --> <junit dir="${axis.home}" printsummary="yes" haltonfailure="${test.functional.fail}" fork="yes"> <!-- See if this helps with Gump test failures --> <sysproperty key="build.clonevm" value="true"/> <!-- Pass the parser settings --> <jvmarg value="-Djavax.xml.parsers.DocumentBuilderFactory=${javax.xml.parsers.DocumentBuilderFactory}"/> <jvmarg value="-Djavax.xml.parsers.SAXParserFactory=${javax.xml.parsers.SAXParserFactory}"/> <jvmarg value="-Xbootclasspath:${sun.boot.class.path}"/> <jvmarg value="-Djikes.class.path=${jikes.class.path}"/> <!-- Pass through the proxy parameters --> <jvmarg value="-Dhttp.proxyHost=${http.proxyHost}"/> <jvmarg value="-Dhttp.proxyPort=${http.proxyPort}"/> <jvmarg value="-Dhttp.nonProxyHosts=${http.nonProxyHosts}"/> <jvmarg value="-Dhttp.proxyUser=${http.proxyUser}"/> <jvmarg value="-Dhttp.proxyPassword=${http.proxyPassword}"/> <!-- Pass the port for SimpleAxisServer --> <jvmarg value="-Dtest.functional.SimpleAxisPort=${test.functional.SimpleAxisPort}"/> <jvmarg value="-Dtest.functional.ServicePort=${test.functional.ServicePort}"/> <classpath refid="classpath" /> <formatter type="xml" usefile="${test.functional.usefile}"/> <batchtest todir="${test.functional.reportdir}"> <fileset dir="${build.dest}"> <!-- Convention: each package that's being tested has its own test class collecting all the tests --> <include name="**/FunctionalTests.class" /> <include name="**/*TestCase.class" /> <exclude name="**/Interop3TestCase.class"/> <exclude name="**/DataServiceTestCase.class"/> <exclude name="**/WhiteMesaSoap12TestSvcTestCase.class"/> <exclude name="**/test/wsdl/attachments/**/*.class" unless="attachments.present" /> <exclude name="**/test/wsdl/adaptive/**/*.class"/> <excludesfile name="${axis.home}/junit-exclude-tests.txt" if="junit-exclude-tests.present"/> </fileset> </batchtest> </junit> <java classname="org.apache.axis.client.AdminClient" fork="yes"> <classpath refid="classpath" /> <arg line="${undeploy.xml.property}"/> </java> </target> <target name="junit-functional-secure" if="junit.present" depends="junit-functional-prepare,start-signature-signing-and-verification"> <available file="${axis.home}/junit-exclude-tests.txt" property="junit-exclude-tests.present"/> <!-- now, run the actual test --> <junit dir="${axis.home}" printsummary="yes" haltonfailure="${test.functional.fail}" fork="yes"> <classpath refid="classpath" /> <formatter type="xml" usefile="${test.functional.usefile}"/> <batchtest todir="${test.functional.reportdir}"> <fileset dir="${build.dest}"> <!-- Convention: each package that's being tested has its own test class collecting all the tests --> <include name="**/TestBidBuySample.class" /> <exclude name="**/Interop3TestCase.class"/> <excludesfile name="${axis.home}/junit-exclude-tests.txt" if="junit-exclude-tests.present"/> </fileset> </batchtest> </junit> </target> <!-- =================================================================== --> <!-- Run functional tests --> <!-- =================================================================== --> <target name="functional-tests" depends="printEnv,transport-layer" if="junit.present" > <!-- This uses a custom Ant task. See test/functional/ant/RunAxisFunctionalTests.java --> <!-- This pattern taken from Cactus, http://jakarta.apache.org/commons/cactus --> <runaxisfunctionaltests url="http://localhost:8088" tcpServerTarget="start-functional-test-tcp-server" httpServerTarget="start-functional-test-http-server" testTarget="junit-functional" httpStopTarget="stop-functional-test-http-server" /> <!-- now run security test --> <antcall target="functional-tests-secure"/> </target> <!-- =================================================================== --> <!-- Run secure functional tests ONLY --> <!-- =================================================================== --> <target name="functional-tests-secure" if="security.present"> <runaxisfunctionaltests url="http://localhost:8088" tcpServerTarget="start-functional-test-tcp-server" httpServerTarget="start-functional-test-http-server-secure" testTarget="junit-functional-secure" httpStopTarget="stop-functional-test-http-server-secure" /> </target> <!-- =================================================================== --> <!-- Run simple tests --> <!-- =================================================================== --> <target name="simple-tests" depends="setenv" if="junit.present" > <runaxisfunctionaltests url="http://localhost:8088" tcpServerTarget="start-functional-test-tcp-server" httpServerTarget="start-functional-test-http-server" testTarget="printEnv" httpStopTarget="stop-functional-test-http-server" /> </target> <!-- =================================================================== --> <!-- This simply echos the component files, for sanity checks --> <!-- =================================================================== --> <target name="echoTest" > <foreach target="echo-file" fork="${foreach.fork}" inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}"> <param name="file"> <fileset dir="${axis.home}" > <patternset> <include name="test/**/build.xml"/> <exclude name="test/wsdl/interop3/**/build.xml" /> </patternset> </fileset> </param> </foreach> </target> <!-- =================================================================== --> <!-- This runs each test component, instantiating the server each time --> <!-- =================================================================== --> <target name="componentTest" > <foreach target="batch-component-run" fork="${foreach.fork}" inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}"> <param name="file"> <fileset dir="${axis.home}" > <patternset> <include name="test/**/build.xml"/> <exclude name="test/wsdl/interop3/**/build.xml" /> </patternset> </fileset> </param> </foreach> </target> <!-- =================================================================== --> <!-- This runs all the tests, but only execs the server ONCE --> <!-- =================================================================== --> <target name="batchTest" depends="transport-layer"> <runaxisfunctionaltests url="http://localhost:${test.functional.TCPListenerPort}" tcpServerTarget="start-functional-test-tcp-server" httpServerTarget="start-functional-test-http-server" testTarget="batch-junit-functional" httpStopTarget="stop-functional-test-http-server" /> <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${axis.home}/test/functional" antfile="build.xml" target="run"/> </target> <target name="batch-junit-functional" depends="start-signature-signing-and-verification"> <foreach target="batch-component-test" fork="${foreach.fork}" inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}"> <param name="file"> <fileset dir="${axis.home}" > <patternset> <include name="test/**/build.xml"/> <exclude name="test/wsdl/interop/build.xml" /> <exclude name="test/wsdl/interop3/**/build.xml" /> </patternset> </fileset> </param> </foreach> </target> <!-- generate a report from all the tests. requires Xalan or other XSLT engine in ant\lib--> <target name="create-test-report" description="create the test report" > <mkdir dir="${test.reports.dir}"/> <junitreport todir="${test.functional.reportdir}"> <fileset dir="${test.functional.reportdir}"> <include name="TEST-*.xml"/> </fileset> <report format="frames" todir="${test.reports.dir}" styledir="xmls"/> </junitreport> </target> </project>