Apply patch (had to manually do some pieces) from Eric Pugh.

Needs testing


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion
2003-01-31 00:28:32 +00:00
parent 3482c527cf
commit 440c0a5698
3 changed files with 135 additions and 55 deletions

View File

@@ -5,19 +5,24 @@
Cactus plugin for Maven.
=============================================================================
-->
<project xmlns:j="jelly:core" xmlns:dvsl="dvsl"
xmlns:cactus="jelly:org.apache.maven.cactus.CactusTagLibrary">
<project xmlns:j="jelly:core"
xmlns:doc="doc"
xmlns:cactus="jelly:org.apache.maven.cactus.CactusTagLibrary" >
<!-- Import all the jelly scripts found in the maven.cactus.conf.dir
<!-- Import all the jelly scripts found in the plugin-resources/scripts
directory. They are jelly scripts to start/stop the different
containers. -->
<fileScanner var="scanner">
<fileset dir="${maven.cactus.scripts.dir}" includes="*.jelly"/>
<fileset dir="${plugin.resources}/scripts/" includes="*.jelly"/>
</fileScanner>
<j:forEach var="script" items="${scanner.iterator()}">
<j:import inherit="true" uri="${script.toURL().toString()}"/>
<j:import inherit="true" file="${script.toString()}"/>
</j:forEach>
<!--
========================================================================
@@ -89,8 +94,10 @@
========================================================================
-->
<goal name="cactus:webapp" description="Create the Cactus webapp">
<available file="${maven.cactus.prewar.dir}/${pom.artifactId}.war"
<attainGoal name="war:init"/> <!-- this seems required to setup the plugin context -->
<j:set var="maven.cactus.prewar.dir" value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.build.dir')}"/>
<available file="${maven.cactus.prewar.dir}/${maven.final.name}.war"
property="maven.cactus.prewar.exists"/>
<j:choose>
@@ -98,7 +105,7 @@
<j:when test="${maven.cactus.prewar.exists}">
<!-- Expand the project war -->
<unwar src="${maven.cactus.prewar.dir}/${pom.artifactId}.war"
<unwar src="${maven.cactus.prewar.dir}/${maven.final.name}.war"
dest="${maven.cactus.build.dir}/${pom.artifactId}"/>
<attainGoal name="cactus:webapp-update"/>
@@ -106,14 +113,14 @@
<j:otherwise>
<available file="${maven.cactus.prewar.dir}/${pom.artifactId}/WEB-INF"
<available file="${maven.cactus.prewar.dir}/${maven.final.name}/WEB-INF"
type="dir" property="maven.cactus.prewebapp.exists"/>
<j:choose>
<j:when test="${maven.cactus.prewebapp.exists}">
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}">
<fileset dir="${maven.cactus.prewar.dir}/${pom.artifactId}"/>
<fileset dir="${maven.cactus.prewar.dir}/${maven.final.name}"/>
</copy>
<attainGoal name="cactus:webapp-update"/>
@@ -137,7 +144,8 @@
and the webapp elements needed by Cactus.
========================================================================
-->
<goal name="cactus:merge-webxml" prereqs="init-dvsl-tag"
<goal name="cactus:merge-webxml"
description="Generate a web.xml which is the merge betweem the user project web.xml and the webapp elements needed by Cactus">
<j:set var="warWebXml"
@@ -155,13 +163,16 @@
</j:otherwise>
</j:choose>
<dvsl:dvsl
basedir="${basedir}"
style="${maven.cactus.webxml.dvsl}"
toolboxFile="${plugin.dir}/toolbox.props"
in="${webxml}"
out="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/web.xml">
</dvsl:dvsl>
<!-- FIXME: The Merge was done in DVSL. I removed it, but haven't been able to duplicate it with JSL.
You need to provide a Cactus'ed web.xml to use.
-->
<j:set var="cactuscheckwebxml" value="${maven.cactus.webxml}X"/>
<j:if test="${cactuscheckwebxml == 'X'}">
<fail message="You must provide in your project.properties a maven.cactus.webxml web.xml file to use."/>
</j:if>
<copy toFile="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/web.xml" overwrite="true"
file="${maven.cactus.webxml}"/>
</goal>
@@ -175,7 +186,7 @@
<!-- Copy Cactus configuration files -->
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}"
file="${maven.cactus.jspRedirector}"/>
file="${plugin.resources}/conf/web/jspRedirector.jsp"/>
<!-- Create the web.xml which is result of merging the project web.xml
and the elements needed by Cactus -->
@@ -318,7 +329,8 @@
to then transform into HTML.
========================================================================
-->
<goal name="cactus:generate" prereqs="init-dvsl-tag"
<goal name="cactus:generate"
description="Generate HTML report">
<mkdir dir="${maven.cactus.test.reportsDirectory}"/>
@@ -329,21 +341,87 @@
<include name="TEST-*.xml"/>
</fileset>
</junitreport>
<!-- Convert single report into an xdoc -->
<dvsl:dvsl
basedir="${basedir}"
style="${plugin.dir}/cactus.dvsl"
toolboxFile="${plugin.dir}/toolbox.props"
in="${maven.cactus.test.reportsDirectory}/TESTS-TestSuites.xml"
out="${maven.gen.docs}/cactus-report.xml">
</dvsl:dvsl>
<!-- copied from junit report plugin -->
<doc:jsl
input="${maven.build.dir}/TESTS-TestSuites.xml"
output="junit-report.xml"
stylesheet="${plugin.resources}/junit.jsl"
omitXmlDeclaration="true"
outputMode="xml"
prettyPrint="true"
/>
</goal>
<!--
========================================================================
Execute a single Cactus test case defined using the 'testcase'
Execute all Cactus tests using the 'maven.cactus.container'
variable.
========================================================================
-->
<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>
</goal>
<!--
========================================================================
Execute a single Cactus test case defined using the 'Dmavencactustestcase'
variable.
NOTE: This assumes that the server was already started and that the
@@ -354,10 +432,10 @@
description="Execute a single test defined using the 'testcase' variable">
<j:choose>
<j:when test="${empty(testcase)}">
<j:when test="${empty(mavencactustestcase)}">
<echo>
You must define the test case to run via -Dtestcase=classname
Example: maven -Dtestcase=MyTest cactus:single
You must define the test case to run via -Dmavencactustestcase=classname
Example: maven -Dmavencactustestcase=MyTest cactus:single
</echo>
</j:when>
<j:otherwise>
@@ -368,7 +446,7 @@
<formatter type="xml"/>
<formatter type="plain" usefile="${maven.cactus.junit.usefile}"/>
<classpath refid="cactus.classpath.clientside"/>
<test name="${testcase}"
<test name="${mavencactustestcase}"
todir="${maven.cactus.test.reportsDirectory}"/>
</junit>

View File

@@ -3,7 +3,7 @@
# -------------------------------------------------------------------
# Location of containers. These properties need to be put in your
# local build.properties as they depend on where you installed
# local project.properties as they depend on where you installed
# your containers on your local machine.
#
# Examples:
@@ -12,26 +12,35 @@
# maven.cactus.resin2x.home = C:/Apps/resin-2.1.4
# maven.cactus.weblogic7x.home = C:/bea
# The default container to run in. You must specifiy which one.
#
# Examples:
#
# maven.cactus.container=tomcat-4x
# maven.cactus.container=resin-2x
# maven.cactus.container=weblogic-7x
# Currently you must provide a web.xml to use.
maven.cactus.webxml=
# DVSL Template to merge user web.xml to entries needed by Cactus
maven.cactus.webxml.dvsl = ${plugin.dir}/conf/web.xml.dvsl
maven.cactus.webxml.dvsl = ${plugin.resources}/conf/web.xml.dvsl
# Empty web.xml to use if the user project does not provide a web.xml file
maven.cactus.emptywebxml = ${plugin.dir}/conf/web.xml
# Location of Cactus JSP Redirector
maven.cactus.jspRedirector = ${plugin.dir}/conf/web/jspRedirector.jsp
maven.cactus.emptywebxml = ${plugin.resources}/conf/web.xml
# Location of cactus.properties Cactus configuration file
maven.cactus.configFile = ${plugin.dir}/conf/cactus.properties
maven.cactus.configFile = ${plugin.resources}/conf/cactus.properties
# Location of Cactus tests in project sources
maven.cactus.src.dir = src/test-cactus
# Location of scripts for the different containers
maven.cactus.scripts.dir = ${plugin.dir}/scripts
maven.cactus.scripts.dir = ${plugin.resources}/scripts
# Location of container configuration files
maven.cactus.conf.containers.dir = ${plugin.dir}/conf/containers
maven.cactus.conf.containers.dir = ${plugin.resources}/conf/containers
# Location where the cactus plugin puts its generateds stuff in
# the project build directory.
@@ -54,23 +63,16 @@ maven.cactus.junit.usefile = true
# Location of generated raw test reports
maven.cactus.test.reportsDirectory = ${maven.cactus.build.dir}/test-reports
# Location where the project war/webapp is located (either as a war or an
# expanded webapp). Cactus will then add its own stuff to the war/webapp.
#
# -- FIXME ---------------------------------------------
# -- This style of property defaulting no longer works +
# ------------------------------------------------------
#
maven.cactus.prewar.dir = ${maven.war.build.dir}
# Define what TestRunner to use. Default is the JUnit text test runner
# (the one used by the <junit> Ant task). Valid values are: text, swing
maven.cactus.testrunner = text
# Location of junit excluded.properties file to use when using the Swing
# Test Runner
maven.cactus.testrunner.swing.excluded = ${plugin.dir}/conf/excluded.properties
maven.cactus.testrunner.swing.excluded = ${plugin.resources}/conf/excluded.properties
# Include/Exclude for Cactus tests
maven.cactus.test.fileset.include=**/*.class
maven.cactus.test.fileset.exclude=

View File

@@ -88,7 +88,7 @@
description="Deploy the test webapp in Tomcat">
<copy todir="${maven.cactus.build.dir}/tomcat4x/webapps/test">
<fileset dir="${maven.cactus.build.dir}/${pom.id}"/>
<fileset dir="${maven.cactus.build.dir}/${pom.artifactId}"/>
</copy>
</goal>
@@ -103,7 +103,7 @@
description="Redeploy the test webapp in Tomcat">
<copy todir="${maven.cactus.build.dir}/tomcat4x/webapps/test">
<fileset dir="${maven.cactus.build.dir}/${pom.id}">
<fileset dir="${maven.cactus.build.dir}/${pom.artifactId}">
<include name="WEB-INF/classes/**"/>
</fileset>
</copy>