You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ep...@apache.org on 2003/03/12 17:10:20 UTC

cvs commit: jakarta-turbine-maven/src/plugins-build/cactus plugin.jelly

epugh       2003/03/12 08:10:20

  Modified:    src/plugins-build/cactus plugin.jelly
  Log:
  My First Commit!  Added in the dynamic choosing of server configurations to run, initial targets for report registration.  Other small fixes.  At this point, the plugin should work.
  
  Revision  Changes    Path
  1.5       +84 -80    jakarta-turbine-maven/src/plugins-build/cactus/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/cactus/plugin.jelly,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- plugin.jelly	3 Feb 2003 14:08:02 -0000	1.4
  +++ plugin.jelly	12 Mar 2003 16:10:20 -0000	1.5
  @@ -174,7 +174,7 @@
         <j:when test="${cactuscheckwebxml == 'X'}">
           <echo message="You should provide in your project.properties a maven.cactus.webxml web.xml file to use.  Using default web.xml"/>
           <copy toFile="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/web.xml" overwrite="true"
  -          file="${plugin.resources}/conf/web.cactus.xml"/>        
  +          file="${plugin.resources}/conf/web.xml"/>        
         </j:when>
         <j:otherwise>
           <copy toFile="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/web.xml" overwrite="true"
  @@ -295,6 +295,44 @@
   
     </goal>
   
  + <!--
  +     ========================================================================
  +       Start only one Cactus test using the <junit> Ant task with the JUnit
  +       Text Test Runner.
  +     ========================================================================
  +  -->
  +  <goal name="cactus:test-text-single" prereqs="cactus:test-init,cactus:init"
  +    description="Start the tests using the text runner">
  +
  +    <mkdir dir="${maven.cactus.test.reportsDirectory}"/>
  +    <mkdir dir="${maven.cactus.build.resources.dir}"/>
  +
  +    <copy todir="${maven.cactus.build.resources.dir}"
  +      file="${maven.cactus.configFile}" filtering="on">
  +      <filterset>
  +        <filter token="maven.cactus.port" value="${maven.cactus.port}"/>
  +      </filterset>
  +    </copy>
  +
  +    <junit printSummary="yes" fork="true" dir="${basedir}"
  +      failureProperty="maven.cactus.test.failure">
  +
  +      <formatter type="xml"/>
  +      <formatter type="plain" usefile="${maven.cactus.junit.usefile}"/>
  +      <classpath refid="cactus.classpath.clientside"/>
  +      <test name="${mavencactustestcase}"
  +        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>
  +
  +  </goal>
  +
     <!--
        ========================================================================
          Start the Cactus tests using the <junit> Ant task with the JUnit
  @@ -378,59 +416,24 @@
     <goal name="cactus:test"
       description="Execute all testcases">
   
  -    <j:set var="container" value="${maven.cactus.container}X"/>
  -    <j:choose>
  -      <j:when test="${container != 'X'}">
  -        <echo message="Attempting to run target: cactus:test-${maven.cactus.container}"/>
  -        
  -        <!-- This should be the call, but I get JellyContext errors-->
  -        <!--
  -        <attainGoal name="cactus:test-${maven.cactus.container}"/>
  -        -->
  -        
  -        <!-- 
  -        Therefore, we have this chunk of code lifted from tomcat.4x.jelly that
  -        starts up the Tomcat engine in one thread.  Because the <j:thread> tag seems to
  -        generate errors as well, it blocks the thread.
  -        You must then start another command line, call cactus:test again, and it 
  -        will run the actual tests.  Nothing shuts down the original webserver thread.
  -        If you use something besides Tomcat, you will need to change this section.
  -        -->
  -        
  -        <!-- Is Tomcat 4.x already started? -->
  -         <condition property="tomcat4xstarted">
  -           <socket server="localhost" port="${maven.cactus.port}"/>
  -         </condition>
  -
  -         <j:choose>
  -           <j:when test="${tomcat4xstarted == null}">
  -
  -               <attainGoal name="cactus:start-tomcat-4x"/>
  -
  -           </j:when>
  -           <j:otherwise>
  -              <!-- redeploy seems to fail.  The copy doesn't happen. -->
  -           <!--  <attainGoal name="cactus:redeploy-tomcat-4x"/>-->
  -           </j:otherwise>
  -         </j:choose>
  -         <waitfor checkevery="500">
  -           <http url="http://localhost:${maven.cactus.port}/test/ServletRedirector?Cactus_Service=RUN_TEST"/>
  -         </waitfor>
  -
  -         <attainGoal name="cactus:test-${maven.cactus.testrunner}"/>
  -
  -        
  -      
  -      </j:when>
  -      <j:otherwise>
  -        
  -        <echo>
  -          You must define the maven.cactus.container to run!
  -        </echo>
  -        
  -      </j:otherwise>
  -    </j:choose>
  -
  +    <j:set var="containerHomeX" value="${maven.cactus.tomcat4x.home}X"/>
  +    <j:if test="${containerHomeX != 'X'}">
  +        <echo message="Attempting to run tomcat4x target: cactus:test-tomcat-4x"/>
  +        <attainGoal name="cactus:test-tomcat-4x"/>
  +    </j:if> 
  +    
  +    <j:set var="containerHomeX" value="${maven.cactus.resin2x.home}X"/>
  +    <j:if test="${containerHomeX != 'X'}">
  +        <echo message="Attempting to run resin2x target: cactus:test-resin-2x"/>
  +        <attainGoal name="cactus:test-resin-2x"/>
  +    </j:if>     
  +
  +    <j:set var="containerHomeX" value="${maven.cactus.weblogic7x.home}X"/>
  +    <j:if test="${containerHomeX != 'X'}">
  +        <echo message="Attempting to run weblogic7x target: cactus:test-weblogin-7x"/>
  +        <attainGoal name="cactus:test-weblogic-7x"/>
  +    </j:if>         
  +    
     </goal>
   
   
  @@ -438,45 +441,46 @@
        ========================================================================
          Execute a single Cactus test case defined using the 'Dmavencactustestcase'
          variable.
  -
  -       NOTE: This assumes that the server was already started and that the
  -       Cactus war has already been deployed.
        ========================================================================
     -->
  -  <goal name="cactus:single" prereqs="war:war,cactus:compile,cactus:init"
  -    description="Execute a single test defined using the 'testcase' variable">
  -
  +  <goal name="cactus:single"
  +    description="Execute a single test defined using the 'mavencactustestcase' variable">
  +    <j:set var="testcaseX" value="${mavencactustestcase}X"/>
       <j:choose>
  -      <j:when test="${empty(mavencactustestcase)}">
  +      <j:when test="${testcaseX == 'X'}">
           <echo>
             You must define the test case to run via -Dmavencactustestcase=classname
             Example: maven -Dmavencactustestcase=MyTest cactus:single
           </echo>
         </j:when>
         <j:otherwise>
  +      
  +        <j:set var="maven.cactus.testrunner" value="text-single"/>
   
  -        <junit printSummary="yes" fork="true" dir="${basedir}"
  -          failureProperty="maven.cactus.test.failure">
  -
  -          <formatter type="xml"/>
  -          <formatter type="plain" usefile="${maven.cactus.junit.usefile}"/>
  -          <classpath refid="cactus.classpath.clientside"/>
  -          <test name="${mavencactustestcase}"
  -            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>
  -
  +        <attainGoal name="cactus:test"/>
  +        
         </j:otherwise>
       </j:choose>
   
  +  </goal>
  +  
  +  <!--
  +     ========================================================================
  +       Goals to register the Cactus test reports should to be included in the 
  +       Maven reports and produce the reports.
  +     ========================================================================
  +  -->
  +  
  +  <goal name="maven-cactus-plugin:register">
  +    <doc:registerReport
  +      name="Cactus Test Results"
  +      link=""
  +      description="Report on the Cactus unit tests."/>
  +  </goal>
  +  
  +  <goal name="maven-cactus-plugin:report">
  +    <!-- here will be code to generate the reports.  Not sure what will happen yet. -->
  +  
     </goal>
   
   </project>