maven-plugins/cactus/plugin.jelly
2003-03-23 09:30:31 +00:00

116 lines
4.4 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.httpunit.jar"
value="${plugin.getDependencyPath('httpunit')}"/>
<property name="cactus.commons.httpclient.jar"
value="${plugin.getDependencyPath('commons-httpclient')}"/>
<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}"/>
</ant>
</j:if>
</j:forEach>
</goal>
</project>