maven-plugins/cactus/plugin.jelly
dion 230698d6ee detab
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113229 13f79535-47bb-0310-9956-ffa450edef68
2003-03-30 16:18:05 +00:00

181 lines
6.7 KiB
XML

<?xml version="1.0"?>
<!--
=============================================================================
Cactus plugin for Maven. It uses the Cactus Ant Integration from the
Cactus project.
=============================================================================
-->
<project xmlns:j="jelly:core" xmlns:doc="doc">
<!-- Global properties -->
<property name="maven.cactus.antintegration.dir"
value="${plugin.resources}/jakarta-cactus-integration-ant"/>
<!--
========================================================================
Default goal.
========================================================================
-->
<goal name="cactus" description="Run all Cactus Test Cases"
prereqs="cactus:test"/>
<!--
========================================================================
Initializations.
========================================================================
-->
<goal name="cactus:init" prereqs="war:war">
<path id="cactus.classpath">
<pathelement location="${maven.build.dest}"/>
<pathelement path="${pom.getDependencyClasspath()}"/>
</path>
<j:set var="warBuildDir"
value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.build.dir')}"/>
<property name="cactus.war"
value="${warBuildDir}/${pom.artifactId}.war"/>
<!-- TODO: Verify here that the war or webapp exists -->
<property name="cactus.antintegration.jar"
value="${plugin.getDependencyPath('cactus:cactus-integration-ant')}"/>
<property name="cactus.framework.jar"
value="${plugin.getDependencyPath('cactus:cactus-framework')}"/>
<property name="cactus.log4j.jar"
value="${plugin.getDependencyPath('log4j')}"/>
<property name="cactus.aspectjrt.jar"
value="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
<property name="cactus.commons.logging.jar"
value="${plugin.getDependencyPath('commons-logging')}"/>
<property name="cactus.junit.jar"
value="${plugin.getDependencyPath('junit')}"/>
<property name="cactus.commons.httpclient.jar"
value="${plugin.getDependencyPath('commons-httpclient')}"/>
<property name="cactus.httpunit.jar"
value="${plugin.getDependencyPath('httpunit')}"/>
<property name="cactus.nekohtml.jar"
value="${plugin.getDependencyPath('nekohtml')}"/>
<property name="cactus.xerces.jar"
value="${plugin.getDependencyPath('xerces:xercesImpl')}"/>
<property name="cactus.xmlapis.jar"
value="${plugin.getDependencyPath('xerces:xmlParserAPIs')}"/>
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
</goal>
<!--
========================================================================
Execute the Cactus tests on all containers which have been defined,
i.e. which have a ${cactus.home.[container name]} property
defined.
========================================================================
-->
<goal name="cactus:test" prereqs="cactus:init"
description="Run all Cactus Test Cases">
<!-- Find all the scripts in ${maven.cactus.antintegration.dir}/scripts
and try to start the tests for all the corresponding containers
which have a home directory set -->
<fileScanner var="scanner">
<fileset dir="${maven.cactus.antintegration.dir}/scripts"
includes="build-tests-*.xml"/>
</fileScanner>
<j:forEach var="script" items="${scanner.iterator()}">
<j:set var="scriptName"
value="${script.name.substring(12, script.name.indexOf('.'))}"/>
<j:set var="containerHomeName" value="cactus.home.${scriptName}"/>
<j:set var="containerHome" value="${context.findVariable(containerHomeName)}"/>
<j:set var="containerHomeX" value="${containerHome}X"/>
<j:if test="${containerHomeX != 'X'}">
<echo message="Running Cactus tests on ${scriptName} ..."/>
<ant dir="${maven.cactus.antintegration.dir}"
target="cactus.run.${scriptName}">
<reference refid="cactus.classpath"/>
<!-- It seems there is a bug when the properties are defined in
plugin.properties and we need to redefine them -->
<property name="cactus.target.dir" value="${cactus.target.dir}"/>
<property name="cactus.src.dir" value="${cactus.src.dir}"/>
<property name="cactus.port" value="${cactus.port}"/>
<property name="cactus.src.includes" value="${cactus.src.includes}"/>
<property name="cactus.src.excludes" value="${cactus.src.excludes}"/>
<property name="cactus.context" value="${cactus.context}"/>
<property name="cactus.jboss3x.config.dir"
value="${cactus.jboss3x.config.dir}"/>
<property name="cactus.jboss3x.config.name"
value="${cactus.jboss3x.config.name}"/>
</ant>
<j:set var="containerFound" value="true"/>
</j:if>
</j:forEach>
<!-- If no container was defined, display a warning message -->
<j:if test="${containerFound != 'true'}">
<echo>WARNING: You need to define at least one container property of the form cactus.home.[container name]. See the plugin documentation.</echo>
</j:if>
</goal>
<!--
========================================================================
Register a Cactus report.
========================================================================
-->
<goal name="maven-cactus-plugin:register">
<doc:registerReport
name="Cactus Unit Tests"
pluginName="cactus"
description="Report on the results of the Cactus unit tests."
link="cactus-report"/>
</goal>
<!--
========================================================================
Deregister a Cactus report.
========================================================================
-->
<goal name="maven-cactus-plugin:deregister">
<doc:deregisterReport name="Cactus Unit Tests"/>
</goal>
<!--
========================================================================
Generate a Cactus report.
========================================================================
-->
<goal name="cactus:report"
description="Generate a report from the test results">
<!-- Consolidate the reports into a single -->
<junitreport todir="${cactus.target.dir}">
<fileset dir="${cactus.reports.dir}">
<include name="TEST-*.xml"/>
</fileset>
</junitreport>
<doc:jsl
input="${cactus.target.dir}/TESTS-TestSuites.xml"
output="cactus-report.xml"
stylesheet="${plugin.resources}/cactus.jsl"
omitXmlDeclaration="true"
outputMode="xml"
prettyPrint="true"
/>
</goal>
</project>