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.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113110 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh
2003-03-12 16:10:20 +00:00
parent 2746f76e18
commit 049758cb1b

View File

@@ -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>