? cactus-single.patch
Index: plugin.jelly
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/plugins-build/cactus/plugin.jelly,v
retrieving revision 1.7
diff -u -r1.7 plugin.jelly
--- plugin.jelly	21 Oct 2002 17:50:48 -0000	1.7
+++ plugin.jelly	30 Oct 2002 18:56:17 -0000
@@ -8,8 +8,8 @@
 <project xmlns:j="jelly:core" xmlns:dvsl="dvsl">
 
   <!-- Import all the jelly scripts found in the maven.cactus.conf.dir 
-  	   directory. They are jelly scripts to start/stop the different
-  	   containers. -->
+       directory. They are jelly scripts to start/stop the different
+       containers. -->
   <fileScanner var="scanner">
     <fileset dir="${maven.cactus.scripts.dir}" includes="*.jelly"/>
   </fileScanner>
@@ -87,7 +87,7 @@
         <include name="${plugin.getDependency('junit').getArtifact()}"/>
       </lib>    
 
-	  <!-- Add project dependencies jars -->
+      <!-- Add project dependencies jars -->
       <j:forEach var="lib" items="${pom.dependencies}">
         <j:if test="${lib.getProperty('war.bundle.jar')=='true'}">
           <lib dir="${maven.repo.local}/${lib.getProjectId()}/jars/">
@@ -144,7 +144,7 @@
         <pathelement path="${plugin.getDependencyPath('commons-logging')}"/>
         <pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
         <!-- These 2 jars should not be needed but it won't work without 
-        	 them -->
+             them -->
         <pathelement path="${plugin.getDependencyPath('xml-apis')}"/>
         <pathelement path="${plugin.getDependencyPath('xerces')}"/>
       </classpath>
@@ -189,6 +189,56 @@
       out="${maven.gen.docs}/cactus-report.xml">
     </dvsl:dvsl>
     
+  </goal>
+  
+  <goal name="cactus:single" description="Execute a single test defined using the 'testcase' variable"
+                               prereqs="war:war,cactus:compile">
+    
+      <j:choose>
+        <j:when test="${empty(testcase)}">
+        <echo>
+          You must define the test case to run via -Dtestcase=classname
+          Example: maven -Dtestcase=MyTest cactus:single
+        </echo>
+        </j:when>
+  
+        <j:otherwise>
+          <taskdef name="junit"
+            classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
+  
+          <junit printSummary="yes" fork="true" dir="${basedir}"
+            failureProperty="maven.cactus.test.failure">
+  
+            <formatter type="xml"/>
+            <formatter type="plain" usefile="${maven.cactus.junit.usefile}"/>
+            <classpath>
+              <path refid="maven.dependency.classpath"/>
+              <pathelement location="${maven.build.dest}"/>
+              <pathelement location="${maven.cactus.classes.dir}"/>
+              <pathelement location="${maven.cactus.build.resources.dir}"/>
+              <pathelement path="${plugin.getDependencyPath('junit')}"/>
+              <pathelement path="${plugin.getDependencyPath('cactus:cactus')}"/>
+              <pathelement path="${plugin.getDependencyPath('commons-httpclient')}"/>
+              <pathelement path="${plugin.getDependencyPath('commons-logging')}"/>
+              <pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
+              <!-- These 2 jars should not be needed but it won't work without 
+                   them -->
+              <pathelement path="${plugin.getDependencyPath('xml-apis')}"/>
+              <pathelement path="${plugin.getDependencyPath('xerces')}"/>
+            </classpath>
+            <test name="${testcase}" todir="${maven.cactus.test.reportsDirectory}"/>
+  
+          </junit>
+          
+          <j:if test="${maven.cactus.test.failure}">
+            <j:set var="cactusignore__" value="${maven.cactus.test.failure.ignore}X"/>
+            <j:if test="${cactusignore__ == 'X'}">
+              <fail message="There were test failures."/>
+            </j:if>
+          </j:if>  
+    
+        </j:otherwise>
+      </j:choose>
   </goal>
 
 </project>

