Rev 1866 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<project name="ant-junitee"><description>Example usage:<!--<run-junitee-tests jar="myejb.jar" appxml="${basedir}/src/etc/application.xml" testserver="mytestserver"><junitee-war><classes dir="${basedir}/build/classes/test"><include name="**/*Test.class"/></classes><testcases dir="${basedir}/build/classes/test"><include name="**/*Test.class"/></testcases></junitee-war></run-junitee-tests>--></description><!-- Note: The following are from jakarta-cactus 13.1.7.cots. This section needs tobe kept up to date with the associated version of jakarta-cactus --><taskdef resource="cactus.tasks"><classpath><pathelement location="${using.jakarta-cactus.basedir}/jar/cactus-1.7.jar"/><pathelement location="${using.jakarta-cactus.basedir}/jar/cactus-ant-1.7.jar"/><pathelement location="${using.jakarta-cactus.basedir}/jar/commons-httpclient-2.0.2.jar"/><pathelement location="${using.jakarta-cactus.basedir}/jar/commons-logging-1.0.4.jar"/><pathelement location="${using.jakarta-cactus.basedir}/jar/aspectjrt-1.2.1.jar"/><pathelement location="${using.junit.basedir}/jar/junit.jar"/><pathelement location="${using.ant-junit.basedir}/jar/ant-junit.jar"/></classpath></taskdef><taskdef name="junitee" classname="org.junitee.anttask.JUnitEETask"><classpath><pathelement location="${using.junitee.basedir}/jar/junitee-anttask.jar"/></classpath></taskdef><taskdef name="juniteewar" classname="org.junitee.anttask.JUnitEEWarTask"><classpath><pathelement location="${using.junitee.basedir}/jar/junitee-anttask.jar"/></classpath></taskdef><macrodef name="run-junitee-tests"><attribute name="jar" default="${ant.project.name}.jar"/><attribute name="war" default="unit-test.war"/><attribute name="appxml" default="${basedir}/src/etc/application.xml"/><attribute name="testserver" default="${ant.project.name}"/><element name="junitee-war"/><element name="dependencies" optional="true"/><sequential><mkdir dir="${basedir}/build/jar"/><juniteewar destFile="${basedir}/build/jar/@{war}"><lib dir="${using.junitee.basedir}/jar" includes="junitee.jar"/><lib dir="${using.junit.basedir}/jar" includes="junit.jar"/><junitee-war/></juniteewar><ear destfile="${basedir}/build/jar/${ant.project.name}-junitee.ear" appxml="@{appxml}"><fileset dir="${basedir}/build/pkg/jar"><include name="@{jar}" /></fileset><fileset dir="${basedir}/build/jar"><include name="@{war}" /></fileset><dependencies/></ear><!-- This is the trick bit. If you just use antcall to -runservertests, it will complain that -junitee-deploy does not exist in the project.- If you explicitly import this file from the main build file after using, then it will work, but just relying on the import done in the- using ant-junitee call will not. Go figure?--><ant antfile = "${using.ant-junitee.basedir}/ant-junitee.xml"dir = "${basedir}"target = "-runservertests"inheritAll = "false"inheritRefs = "false"><reference refid = "using.junitee.path"/><reference refid = "using.jakarta-cactus.path"/><property name = "using.junitee.basedir" value="${using.junitee.basedir}"/><property name = "test.project.name" value="${ant.project.name}"/><property name = "test.server" value="@{testserver}"/><property name = "env" environment="env" value="env"/></ant></sequential></macrodef><target name="-runservertests"><runservertests testURL="http://${env.COMPUTERNAME}:8080/unit-test/TestServlet"startTarget = "-junitee-deploy"stopTarget = "-junitee-undeploy"testTarget = "-junitee-run" /></target><!--- Start unit test deployment--><target name="-junitee-deploy"><echo message="DEPLOYING: ${deployment.filename}"/><echo message="DEPLOYING TO: ${deployment.location}"/><copy file="${basedir}/build/jar/${test.project.name}-junitee.ear"todir="${env.JBOSS_HOME}/server/${test.server}/deploy"/><java jar="${env.JBOSS_HOME}/bin/run.jar" fork="true" taskname="jboss"><arg value="-c" /><arg value="${test.server}" /></java></target><!--- Stop unit test deployment--><target name="-junitee-undeploy"><echo message="Undeploying ${env.JBOSS_HOME}/server/${test.server}/deploy/${test.project.name}-junitee.ear"/><delete file="${env.JBOSS_HOME}/server/${test.server}/deploy/${test.project.name}-junitee.ear"/><!-- This doesn't quite work yet...<java jar="${env.JBOSS_HOME}/bin/shutdown.jar" fork="true"><arg value="-s localhost"/><classpath><pathelement location="${env.JBOSS_HOME}/client/jnet.jar"/></classpath></java--></target><!--- Run server-side unit tests--><target name="-junitee-run"><delete dir="${basedir}/build/junit"/><mkdir dir="${basedir}/build/junit"/><echo message="Running Unit tests.... Please wait....."/><junitee url="http://${env.COMPUTERNAME}:8080/unit-test/TestServlet" printsummary="true"><formatter type="xml"/><test runall="true" todir="${basedir}/build/junit"/></junitee></target></project>