Initial revision
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112724 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
66e44f2734
commit
530c640d4f
3
.cvsignore
Normal file
3
.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
3
ant/.cvsignore
Normal file
3
ant/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
368
ant/plugin.jelly
Normal file
368
ant/plugin.jelly
Normal file
@ -0,0 +1,368 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:u="jelly:util">
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- A N T B U I L D G E N E R A T O R -->
|
||||
<!-- ================================================================== -->
|
||||
<!-- This plugin generates a stand alone ant build.xml file that can be -->
|
||||
<!-- used without having Maven installed. The dependencies are -->
|
||||
<!-- retrieved using the ant <get> task and then the standard <javac> -->
|
||||
<!-- and <jar> tasks are used to produce a JAR. This is primarily for -->
|
||||
<!-- people who want to build from sources but don't want to use Maven. -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<goal name="ant"
|
||||
description="Generate an Ant build file"
|
||||
prereqs="ant:generate-build"/>
|
||||
|
||||
<goal
|
||||
name="ant:generate-build"
|
||||
description="Generate an Ant build file">
|
||||
|
||||
<j:file name="${maven.ant.generatebuild.file}" prettyPrint="true">
|
||||
<j:whitespace xmlns="dummy">
|
||||
<project name="${pom.artifactId}" default="jar" basedir=".">
|
||||
|
||||
<property name="defaulttargetdir" value="target"/>
|
||||
<property name="libdir" value="target/lib" />
|
||||
<property name="classesdir" value="target/classes"/>
|
||||
<property name="testclassesdir" value="target/test-classes"/>
|
||||
<property name="testreportdir" value="target/test-reports"/>
|
||||
|
||||
<property name="distdir" value="dist"/>
|
||||
<property name="javadocdir" value="dist/docs/api"/>
|
||||
<property name="final.name" value="${maven.final.name}"/>
|
||||
|
||||
<target
|
||||
name="init"
|
||||
description="o Initializes some properties">
|
||||
<mkdir dir="$${libdir}"/>
|
||||
<condition property="noget">
|
||||
<equals arg1="$${build.sysclasspath}" arg2="only"/>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="compile"
|
||||
depends="get-deps"
|
||||
description="o Compile the code">
|
||||
|
||||
<mkdir dir="$${classesdir}"/>
|
||||
|
||||
<javac
|
||||
destdir="$${classesdir}"
|
||||
excludes="**/package.html"
|
||||
debug="true"
|
||||
deprecation="true"
|
||||
optimize="false">
|
||||
<src>
|
||||
<pathelement location="${pom.build.sourceDirectory}"/>
|
||||
</src>
|
||||
<classpath>
|
||||
<fileset dir="$${libdir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy any resources that must be present in the deployed
|
||||
JAR file.
|
||||
-->
|
||||
<j:forEach var="resource" items="${pom.build.resources}">
|
||||
|
||||
<copy todir="$${classesdir}">
|
||||
|
||||
<j:set var="dir" value="${resource.directory}"/>
|
||||
<j:if test="${empty dir}">
|
||||
<j:set var="dir" value="."/>
|
||||
</j:if>
|
||||
|
||||
<fileset dir="${dir}">
|
||||
|
||||
<j:forEach var="res" items="${resource.includes}">
|
||||
<include name="${res}"/>
|
||||
</j:forEach>
|
||||
<j:forEach var="res" items="${resource.excludes}">
|
||||
<exclude name="${res}"/>
|
||||
</j:forEach>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</j:forEach>
|
||||
|
||||
<!-- Copy any resources required for unit testing -->
|
||||
<j:forEach var="resource" items="${pom.build.unitTest.resources}">
|
||||
|
||||
<copy todir="$${testclassesdir}">
|
||||
|
||||
<j:set var="dir" value="${resource.directory}"/>
|
||||
<j:if test="${empty dir}">
|
||||
<j:set var="dir" value="."/>
|
||||
</j:if>
|
||||
|
||||
<fileset dir="${dir}">
|
||||
|
||||
<j:forEach var="pattern" items="${resource.includes}">
|
||||
<include name="${pattern}"/>
|
||||
</j:forEach>
|
||||
<j:forEach var="pattern" items="${resource.excludes}">
|
||||
<exclude name="${pattern}"/>
|
||||
</j:forEach>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</j:forEach>
|
||||
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="jar"
|
||||
depends="compile,test"
|
||||
description="o Create the jar">
|
||||
|
||||
<jar
|
||||
jarfile="target/$${final.name}.jar"
|
||||
basedir="$${classesdir}"
|
||||
excludes="**/package.html"
|
||||
/>
|
||||
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="clean"
|
||||
description="o Clean up the generated directories">
|
||||
<delete dir="$${defaulttargetdir}"/>
|
||||
<delete dir="$${distdir}"/>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="dist"
|
||||
depends="jar, javadoc"
|
||||
description="o Create a distribution">
|
||||
<mkdir dir="dist"/>
|
||||
<copy todir="dist">
|
||||
<fileset dir="$${defaulttargetdir}" includes="*.jar"/>
|
||||
<fileset dir="$${basedir}" includes="LICENSE*, README*"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="test"
|
||||
depends="internal-test"
|
||||
if="test.failure"
|
||||
description="o Run the test cases">
|
||||
<fail message="There were test failures."/>
|
||||
</target>
|
||||
<target
|
||||
name="internal-test"
|
||||
depends="compile-tests">
|
||||
<j:if test="${unitTestSourcesPresent}">
|
||||
<mkdir dir="$${testreportdir}"/>
|
||||
<junit printSummary="yes"
|
||||
haltonerror="true"
|
||||
failureproperty="test.failure"
|
||||
fork="true"
|
||||
dir="./">
|
||||
<!--
|
||||
I think the following is wrong
|
||||
<sysproperty key="basedir" value="${pom.build.unitTestSourceDirectory}"/>
|
||||
<sysproperty key="basedir" value="${basedir}"/> // this gives a full path
|
||||
including the C:\ on windows
|
||||
-->
|
||||
<sysproperty key="basedir" value="."/>
|
||||
<formatter type="xml"/>
|
||||
<formatter type="plain" usefile="false"/>
|
||||
<classpath>
|
||||
<fileset dir="$${libdir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<pathelement path="$${testclassesdir}"/>
|
||||
<pathelement path="$${classesdir}"/>
|
||||
</classpath>
|
||||
<batchtest todir="$${testreportdir}">
|
||||
<fileset dir="${pom.build.unitTestSourceDirectory}">
|
||||
<j:forEach var="pat" items="${pom.build.unitTest.includes}">
|
||||
<include name="${pat}"/>
|
||||
</j:forEach>
|
||||
<j:forEach var="pat" items="${pom.build.unitTest.excludes}">
|
||||
<exclude name="${pat}"/>
|
||||
</j:forEach>
|
||||
|
||||
<!-- add extra excludes if the property is set -->
|
||||
<j:if test="${context.getVariable('maven.ant.excludeTests') != null}">
|
||||
<u:tokenize var="patterns" delim=",">${maven.ant.excludeTests}</u:tokenize>
|
||||
<j:forEach var="pattern" items="${patterns}">
|
||||
<exclude name="${pattern}" />
|
||||
</j:forEach>
|
||||
</j:if>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</j:if>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="compile-tests"
|
||||
depends="compile">
|
||||
<j:if test="${unitTestSourcesPresent}">
|
||||
<mkdir dir="$${testclassesdir}"/>
|
||||
<javac
|
||||
destdir="$${testclassesdir}"
|
||||
excludes="**/package.html"
|
||||
debug="true"
|
||||
deprecation="true"
|
||||
optimize="false">
|
||||
<src>
|
||||
<pathelement location="${pom.build.unitTestSourceDirectory}"/>
|
||||
</src>
|
||||
<classpath>
|
||||
<fileset dir="$${libdir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<pathelement path="$${classesdir}"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<j:choose trim="true">
|
||||
<j:when test="${!pom.build.unitTest.resources.includes.isEmpty()}">
|
||||
<j:set var="maven.has.test.resource.patterns" value="true"/>
|
||||
</j:when>
|
||||
<j:when test="${!pom.build.unitTest.resources.excludes.isEmpty()}">
|
||||
<j:set var="maven.has.test.resource.patterns" value="true"/>
|
||||
</j:when>
|
||||
</j:choose>
|
||||
|
||||
<j:if test="${maven.has.test.resource.patterns}">
|
||||
|
||||
<copy todir="$${testclassesdir}">
|
||||
<fileset dir="${pom.build.unitTestSourceDirectory}">
|
||||
<j:forEach var="res" items="${pom.build.unitTest.resources.includes}">
|
||||
<include name="${res}"/>
|
||||
</j:forEach>
|
||||
<j:forEach var="res" items="${pom.build.unitTest.resources.excludes}">
|
||||
<exclude name="${res}"/>
|
||||
</j:forEach>
|
||||
</fileset>
|
||||
</copy>
|
||||
</j:if>
|
||||
</j:if>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="javadoc"
|
||||
depends="jar"
|
||||
description="o Generate javadoc">
|
||||
|
||||
|
||||
<mkdir dir="$${javadocdir}"/>
|
||||
|
||||
<!-- Get the year to display in the Javadocs -->
|
||||
<tstamp>
|
||||
<format property="year" pattern="${pom.inceptionYear}-yyyy"/>
|
||||
</tstamp>
|
||||
|
||||
<property
|
||||
name="copyright"
|
||||
value="Copyright &copy; ${year} ${pom.organization.name}. All Rights Reserved."
|
||||
/>
|
||||
|
||||
<property
|
||||
name="title"
|
||||
value="${pom.name} ${pom.currentVersion} API"
|
||||
/>
|
||||
|
||||
<javadoc
|
||||
sourcepath="${pom.build.sourceDirectory}"
|
||||
packagenames="${pom.package}.*"
|
||||
destdir="$${javadocdir}"
|
||||
author="true"
|
||||
private="true"
|
||||
version="true"
|
||||
use="true"
|
||||
windowtitle="${title}"
|
||||
doctitle="${title}"
|
||||
bottom="${copyright}">
|
||||
<classpath>
|
||||
<fileset dir="$${libdir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<pathelement location="target/$${final.name}.jar"/>
|
||||
</classpath>
|
||||
</javadoc>
|
||||
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="get-deps"
|
||||
depends="init"
|
||||
unless="noget">
|
||||
|
||||
<j:forEach var="dep" items="${pom.dependencies}">
|
||||
<get
|
||||
src="${maven.repo.remote}/${dep.artifactDirectory}/jars/${dep.artifact}"
|
||||
dest="$${libdir}/${dep.artifact}"
|
||||
usetimestamp="true"
|
||||
ignoreerrors="true"
|
||||
/></j:forEach>
|
||||
<!-- force junit for tests -->
|
||||
<get
|
||||
src="${maven.repo.remote}/junit/jars/junit-3.8.1.jar"
|
||||
dest="$${libdir}/junit-3.8.1.jar"
|
||||
usetimestamp="true"
|
||||
ignoreerrors="true"/>
|
||||
<get
|
||||
src="${maven.repo.remote}/ant/jars/ant-1.5.jar"
|
||||
dest="$${libdir}/ant-1.5.jar"
|
||||
usetimestamp="true"
|
||||
ignoreerrors="true"/>
|
||||
<get
|
||||
src="${maven.repo.remote}/ant/jars/ant-optional-1.5.jar"
|
||||
dest="$${libdir}/ant-optional-1.5.jar"
|
||||
usetimestamp="true"
|
||||
ignoreerrors="true"/>
|
||||
</target>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- A N T A U T O I N S T A L L E R -->
|
||||
<!-- ================================================================== -->
|
||||
<!-- For users that have Ant installed Maven can be automatically -->
|
||||
<!-- installed by answering a few simple questions. We only need to -->
|
||||
<!-- know what the user wants for ${maven.home} and ${maven.repo.local} -->
|
||||
<!-- and we're set. -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<target
|
||||
name="install-maven">
|
||||
|
||||
<!--
|
||||
|
||||
Ask the user what they would like to use for
|
||||
|
||||
${maven.home}
|
||||
${maven.repo.local}
|
||||
|
||||
-->
|
||||
|
||||
<get
|
||||
src="$${maven.repo.remote}/maven/maven-install-latest.jar"
|
||||
dest="$${user.home}/maven-install-latest.jar"
|
||||
usetimestamp="true"
|
||||
/>
|
||||
|
||||
<unjar
|
||||
src="$${user.home}/maven-install-latest.jar"
|
||||
dest="$${maven.home}"
|
||||
/>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
||||
</j:whitespace>
|
||||
</j:file>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
8
ant/plugin.properties
Normal file
8
ant/plugin.properties
Normal file
@ -0,0 +1,8 @@
|
||||
# -------------------------------------------------------------------
|
||||
# Default Maven properties for the ant Plugin
|
||||
# -------------------------------------------------------------------
|
||||
# These are the properties that we believe are immutable so we
|
||||
# keep them apart from the project specific properties.
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
maven.ant.generatebuild.file = build.xml
|
||||
7
ant/project.properties
Normal file
7
ant/project.properties
Normal file
@ -0,0 +1,7 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
#maven.jarResources.basedir = src
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
46
ant/project.xml
Normal file
46
ant/project.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-ant-plugin</id>
|
||||
<name>Maven Ant Plug-in</name>
|
||||
<currentVersion>1.2-SNAPSHOT</currentVersion>
|
||||
|
||||
<description>
|
||||
Generates ant build files from a maven project, so that plain
|
||||
ant users can build your project
|
||||
</description>
|
||||
|
||||
<shortDescription>Java Project Management Tools</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/ant/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/ant/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@multitask.com.au</email>
|
||||
<organization>Multitask Consulting</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Jason van Zyl</name>
|
||||
<id>jvanzyl</id>
|
||||
<email>jason@zenplex.com</email>
|
||||
<organization>Zenplex</organization>
|
||||
<roles>
|
||||
<role>Architect</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
</project>
|
||||
|
||||
1
ant/xdocs/.cvsignore
Normal file
1
ant/xdocs/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
stylesheets
|
||||
53
ant/xdocs/changes.xml
Normal file
53
ant/xdocs/changes.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<release version="1.2" date="in CVS">
|
||||
<action dev="dion" type="add">
|
||||
Added the new maven.ant.excludedTests property
|
||||
</action>
|
||||
<action dev="dion" type="fix">
|
||||
If a project has no test source, the test targets are empty.
|
||||
</action>
|
||||
<action dev="jcej" type="fix">
|
||||
<p>
|
||||
Fixing a chicken-and-egg problem. The "test" and "compile-tests"
|
||||
tasks were putting target/${final.name}.jar into the classpath.
|
||||
</p>
|
||||
<p>
|
||||
But... the "jar" target that creates that jarfile is dependent
|
||||
upon those two targets.
|
||||
</p>
|
||||
<p>
|
||||
So, there was no way for the first two to succeed since the
|
||||
jarfile couldn't be created. Now, the first two include target/classes
|
||||
in the classpath and all is well.
|
||||
</p>
|
||||
</action>
|
||||
<action dev="jcej" type="add">
|
||||
Added the maven.ant.generatebuild.file property and docs
|
||||
</action>
|
||||
<action dev="dion" type="add">
|
||||
Added more documentation on properties and supported SCM systems
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.1" date="2002-09-15">
|
||||
<action dev="dion" type="update">
|
||||
Fix documentation
|
||||
</action>
|
||||
<action dev="dion" type="fix">
|
||||
Fix for bug Maven-52: generated ant build should execute the unit tests before generating a jar.
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.0" date="2002-08-04">
|
||||
<action dev="jvanzyl" type="add">
|
||||
Original release for Maven 1.0-beta6
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
36
ant/xdocs/goals.xml
Normal file
36
ant/xdocs/goals.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Ant Plug-in Goals</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<goals>
|
||||
<goal>
|
||||
<name>ant</name>
|
||||
<description>
|
||||
This is the default goal of the plugin and simply attains
|
||||
the <code>ant:generate-build</code> goal.
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>ant:generate-build</name>
|
||||
<description>
|
||||
Generates an <a href="http://jakarta.apache.org/ant/">ant</a>
|
||||
<code>build.xml</code> in the current directory which has targets to
|
||||
<ul>
|
||||
<li>Compile the java source code</li>
|
||||
<li>Create a jar from the compiled java code</li>
|
||||
<li>Create a distribution</li>
|
||||
<li>Run unit tests</li>
|
||||
<li>Generate JavaDoc</li>
|
||||
<li>Download all required jar files</li>
|
||||
<li>Download and install Maven</li>
|
||||
</ul>
|
||||
</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
27
ant/xdocs/index.xml
Normal file
27
ant/xdocs/index.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Ant Plug-in</title>
|
||||
<author email="jason@zenplex.com">Jason van Zyl</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Ant Plug-in">
|
||||
<p>
|
||||
This plugin generates a vanilla ant build.xml file that so that user's
|
||||
that haven't installed Maven can still build. Though it is always
|
||||
highly recommended that you install Maven :-)
|
||||
</p>
|
||||
<p>
|
||||
For more information on the functionality provided by this plugin,
|
||||
please see the <a href="goals.html">Goals</a> document.
|
||||
</p>
|
||||
<p>
|
||||
For more information on how to customise the functionality provided
|
||||
by this plugin, please see the <a href="properties.html">properties</a>
|
||||
document.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
ant/xdocs/navigation.xml
Normal file
16
ant/xdocs/navigation.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven Ant Plugin">
|
||||
|
||||
<title>Maven Ant Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="Ant" href="http://jakarta.apache.org/ant/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
44
ant/xdocs/properties.xml
Normal file
44
ant/xdocs/properties.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Ant Plugin Properties</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Ant Plugin Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.ant.excludeTests</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Holds a comma separated list of source file patterns that
|
||||
will be excluded in the generated Ant build, e.g.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<source>
|
||||
maven.ant.excludeTests=**/*Test.java,**/*Suite.java
|
||||
</source>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.ant.generatebuild.file</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Sets the name of the ant buildfile to create.
|
||||
Defaults to "build.xml". This is used by the "ant:generate-build"
|
||||
goal.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
3
antlr/.cvsignore
Normal file
3
antlr/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
46
antlr/plugin.jelly
Normal file
46
antlr/plugin.jelly
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project xmlns:j="jelly:core"
|
||||
xmlns:antlr="jelly:antlr"
|
||||
xmlns:util="jelly:util"
|
||||
xmlns:maven="jelly:maven">
|
||||
|
||||
<j:set var="antlrSrcDir" value="${maven.antlr.src.dir}"/>
|
||||
|
||||
<goal name="antlr:prepare-filesystem"
|
||||
description="Make any necessary directories for antlr processing">
|
||||
<j:if test="${!antlrSrcDir.equals('MAVEN_ANTLR_SRC_DIR_NOT_SET')}">
|
||||
<mkdir dir="${maven.build.dir}/antlr"/>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
<goal name="antlr:generate"
|
||||
description="Generate source from antlr grammars"
|
||||
prereqs="antlr:prepare-filesystem">
|
||||
<j:if test="${!antlrSrcDir.equals('MAVEN_ANTLR_SRC_DIR_NOT_SET')}">
|
||||
|
||||
<path id="maven.antlr.compile.src.set"
|
||||
location="${maven.build.dir}/antlr"/>
|
||||
|
||||
<maven:addPath id="maven.compile.src.set"
|
||||
refid="maven.antlr.compile.src.set"/>
|
||||
|
||||
<util:tokenize var="grammars" delim=" ">
|
||||
${maven.antlr.grammars}
|
||||
</util:tokenize>
|
||||
|
||||
<antlr:antlr outputDir="${maven.build.dir}/antlr">
|
||||
<j:forEach var="grammar" items="${grammars.iterator()}">
|
||||
<antlr:grammar>${grammar}</antlr:grammar>
|
||||
</j:forEach>
|
||||
</antlr:antlr>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
<preGoal name="java:compile">
|
||||
<j:if test="${!antlrSrcDir.equals('MAVEN_ANTLR_SRC_DIR_NOT_SET')}">
|
||||
<attainGoal name="antlr:generate"/>
|
||||
</j:if>
|
||||
</preGoal>
|
||||
|
||||
</project>
|
||||
1
antlr/plugin.properties
Normal file
1
antlr/plugin.properties
Normal file
@ -0,0 +1 @@
|
||||
maven.antlr.src.dir=MAVEN_ANTLR_SRC_DIR_NOT_SET
|
||||
5
antlr/project.properties
Normal file
5
antlr/project.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
89
antlr/project.xml
Normal file
89
antlr/project.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-antlr-plugin</id>
|
||||
<name>Maven Antlr Plugin</name>
|
||||
<currentVersion>1.1-SNAPSHOT</currentVersion>
|
||||
|
||||
<description>
|
||||
</description>
|
||||
|
||||
<shortDescription>Java Project Management Tools</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/antlr/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/antlr/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@multitask.com.au</email>
|
||||
<organization>Multitask Consulting</organization>
|
||||
<roles>
|
||||
<role>Documentation</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Stéphane Mor</name>
|
||||
<id>smor</id>
|
||||
<email>stephanemor@yahoo.fr</email>
|
||||
<organization>Hasgard Systèmes et Réseaux</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Jason van Zyl</name>
|
||||
<id>jvanzyl</id>
|
||||
<email>jason@zenplex.com</email>
|
||||
<organization>Zenplex</organization>
|
||||
<roles>
|
||||
<role>Architect</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<id>ant</id>
|
||||
<version>1.5.1</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-jelly+tags-antlr</id>
|
||||
<version>SNAPSHOT</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-lang</id>
|
||||
<version>1.0-b1.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>antlr</id>
|
||||
<version>2.7.1</version>
|
||||
<jar>antlrall-2.7.1.jar</jar>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
1
antlr/xdocs/.cvsignore
Normal file
1
antlr/xdocs/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
stylesheets
|
||||
22
antlr/xdocs/changes.xml
Normal file
22
antlr/xdocs/changes.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<release version="1.1" date="in CVS">
|
||||
<action dev="dion" type="add">
|
||||
Added documentation for navigation, changes, properties and goals
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.0" date="2002-07-16">
|
||||
<action dev="jvanzyl" type="add">
|
||||
Original release for Maven 1.0-beta6
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
49
antlr/xdocs/goals.xml
Normal file
49
antlr/xdocs/goals.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Ant Plug-in Goals</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Goals">
|
||||
<p>
|
||||
<strong>Note:</strong> The goals in this plugin are only executed
|
||||
when the <a href="properties.html">maven.antlr.src.dir</a> property
|
||||
is set
|
||||
</p>
|
||||
<table>
|
||||
<tr><th>Goal</th><th>Description</th></tr>
|
||||
<tr>
|
||||
<td>antlr:generate</td>
|
||||
<td>
|
||||
<p>
|
||||
Generates code for all grammars defined in the
|
||||
<a href="properties.html">${maven.antlr.grammars}</a>
|
||||
property.
|
||||
</p>
|
||||
<p>
|
||||
This goal is called before the <code>java:compile</code>
|
||||
goal so that code is generated before compilation.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>antlr:prepare-filesystem</td>
|
||||
<td>
|
||||
<p>
|
||||
Creates the <code>${maven.build.dir}/antlr</code>
|
||||
directory which holds antlr generated code.
|
||||
</p>
|
||||
<p>
|
||||
This directory is added to the code to be compiled by
|
||||
Maven, as specified by the <code>maven.compile.src.set</code>
|
||||
property.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
30
antlr/xdocs/index.xml
Normal file
30
antlr/xdocs/index.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Antlr Plug-in</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Antlr Plug-in">
|
||||
<p>
|
||||
This plugin generates code based on user-supplied Antlr grammars.
|
||||
</p>
|
||||
<p>
|
||||
The code is automatically generated before the <code>java:compile</code>
|
||||
goal, so that the generated code is automatically processed as if
|
||||
it was part of the normal application source code.
|
||||
</p>
|
||||
<p>
|
||||
For more information on the functionality provided by this plugin,
|
||||
please see the <a href="goals.html">Goals</a> document.
|
||||
</p>
|
||||
<p>
|
||||
For more information on how to customise the functionality provided
|
||||
by this plugin, please see the <a href="properties.html">properties</a>
|
||||
document.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
antlr/xdocs/navigation.xml
Normal file
16
antlr/xdocs/navigation.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven Activity Plugin">
|
||||
|
||||
<title>Maven Antlr Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="Antlr" href="http://www.antlr.org/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
62
antlr/xdocs/properties.xml
Normal file
62
antlr/xdocs/properties.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Antlr Plugin Properties</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Antlr Plugin Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.antlr.grammars</td>
|
||||
<td>No</td>
|
||||
<td>
|
||||
Sets the grammars to generate code for.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.antlr.src.dir</td>
|
||||
<td>No</td>
|
||||
<td>
|
||||
Must be set to allow antlr processing to happen.
|
||||
<strong>FIXME: It appears this property isn't used?</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section name="Other properties used">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.build.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
This is the directory that output files are generated to. The
|
||||
antlr generated code is placed in the <code>antlr</code>
|
||||
directory below this
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.compile.src.set</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
The source directories maven uses to compile java code.
|
||||
The antlr plugin adds the directory it generates code to
|
||||
this path, so that generated code is compiled seamlessly
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
125
aspectj/plugin.jelly
Normal file
125
aspectj/plugin.jelly
Normal file
@ -0,0 +1,125 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project xmlns:j="jelly:core" xmlns:util="jelly:util">
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- Compile all source code, weaving the Aspects -->
|
||||
<!--==================================================================-->
|
||||
<goal name="aspectj"
|
||||
description="Compile code with AspectJ"
|
||||
prereqs="aspectj:compile"/>
|
||||
|
||||
<goal name="aspectj:compile"
|
||||
description="Compile code with AspectJ">
|
||||
|
||||
<j:if test="${sourcesPresent == 'true'}">
|
||||
|
||||
<taskdef name="ajc" classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
|
||||
|
||||
<available property="aspectSourcesPresent"
|
||||
file="${pom.build.aspectSourceDirectory}"/>
|
||||
|
||||
<uptodate property="aspectj.compile.notRequired"
|
||||
targetfile="${maven.build.dir}/${maven.final.name}.jar">
|
||||
<srcfiles dir="${pom.build.sourceDirectory}"/>
|
||||
<j:if test="${aspectSourcesPresent == 'true'}">
|
||||
<srcfiles dir="${pom.build.aspectSourceDirectory}"/>
|
||||
</j:if>
|
||||
</uptodate>
|
||||
|
||||
<j:set var="aspectjCompileNotRequired" value="${aspectj.compile.notRequired}"/>
|
||||
<j:if test="${aspectjCompileNotRequired == null}">
|
||||
|
||||
<ajc
|
||||
destdir="${maven.build.dest}"
|
||||
excludes="**/package.html"
|
||||
debug="${maven.compile.debug}"
|
||||
deprecation="${maven.compile.deprecation}"
|
||||
optimize="${maven.compile.optimize}">
|
||||
|
||||
<src>
|
||||
<path refid="maven.compile.src.set"/>
|
||||
<j:if test="${aspectSourcesPresent == 'true'}">
|
||||
<pathelement location="${pom.build.aspectSourceDirectory}"/>
|
||||
</j:if>
|
||||
</src>
|
||||
|
||||
<j:forEach var="sm" items="${pom.build.sourceModifications}">
|
||||
<available property="classPresent" classname="${sm.className}"/>
|
||||
<j:if test="${classPresent != 'true'}">
|
||||
<j:forEach var="exclude" items="${sm.excludes}">
|
||||
<exclude name="${exclude}"/>
|
||||
</j:forEach>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<classpath>
|
||||
<path refid="maven.dependency.classpath"/>
|
||||
<pathelement path="${maven.build.dest}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
|
||||
</classpath>
|
||||
</ajc>
|
||||
|
||||
</j:if>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="aspectj:ajdoc" description="Javadoc source using ajdoc">
|
||||
|
||||
<j:if test="${sourcesPresent == 'true'}">
|
||||
|
||||
<taskdef name="ajdoc" classname="org.aspectj.tools.ant.taskdefs.Ajdoc" />
|
||||
|
||||
<available property="aspectSourcesPresent"
|
||||
file="${pom.build.aspectSourceDirectory}"/>
|
||||
|
||||
<!-- retrieve various javadoc plugin vars -->
|
||||
<util:tokenize var="javadocVarList" delim=",">
|
||||
maven.javadoc.author,maven.javadoc.destdir,
|
||||
maven.javadoc.links,maven.javadoc.maxmemory,
|
||||
maven.javadoc.private,maven.javadoc.stylesheet,
|
||||
maven.javadoc.use,maven.javadoc.version
|
||||
</util:tokenize>
|
||||
|
||||
<j:forEach var="javadocVar" items="${javadocVarList}">
|
||||
<j:set var="javadocVar" value="${javadocVar.trim()}" />
|
||||
<j:set var="${javadocVar}"
|
||||
value="${pom.getPluginContext('maven-javadoc-plugin').getVariable(javadocVar)}"/>
|
||||
</j:forEach>
|
||||
|
||||
<ajdoc packagenames="${pom.package}.*"
|
||||
destdir="${maven.javadoc.destdir}"
|
||||
author="${maven.javadoc.author}"
|
||||
private="${maven.javadoc.private}"
|
||||
version="${maven.javadoc.version}"
|
||||
use="${maven.javadoc.use}"
|
||||
windowtitle="${title}"
|
||||
doctitle="${title}"
|
||||
bottom="${copyright}"
|
||||
stylesheetfile="${maven.javadoc.stylesheet}">
|
||||
|
||||
<j:forEach var="link" items="${links}">
|
||||
<link href="${link.trim()}"/>
|
||||
</j:forEach>
|
||||
<classpath>
|
||||
<path refid="maven.dependency.classpath"/>
|
||||
<path location="${maven.build.dest}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
|
||||
</classpath>
|
||||
|
||||
<sourcepath>
|
||||
<path refid="maven.compile.src.set"/>
|
||||
<j:if test="${aspectSourcesPresent == 'true'}">
|
||||
<pathelement location="${pom.build.aspectSourceDirectory}"/>
|
||||
</j:if>
|
||||
</sourcepath>
|
||||
|
||||
</ajdoc>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
5
aspectj/project.properties
Normal file
5
aspectj/project.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
90
aspectj/project.xml
Normal file
90
aspectj/project.xml
Normal file
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-aspectj-plugin</id>
|
||||
<name>Maven AspectJ Plug-in</name>
|
||||
<currentVersion>1.1-SNAPSHOT</currentVersion>
|
||||
|
||||
<description>
|
||||
</description>
|
||||
|
||||
<shortDescription>Eclipse Plugin for AspectJ</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/aspectj/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/aspectj/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@multitask.com.au</email>
|
||||
<organization>Multitask Consulting</organization>
|
||||
<roles>
|
||||
<role>Documentation</role>
|
||||
</roles>
|
||||
</developer>
|
||||
|
||||
<developer>
|
||||
<name>Vincent Massol</name>
|
||||
<id>vmassol</id>
|
||||
<email>vmassol@octo.com</email>
|
||||
<organization>Octo Technology</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<id>aspectj:aspectjrt</id>
|
||||
<version>1.0.6</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>aspectj:aspectj-ant</id>
|
||||
<version>1.0.6</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>aspectj:aspectj-tools</id>
|
||||
<version>1.0.6</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}</directory>
|
||||
<excludes>
|
||||
<exclude>target/**</exclude>
|
||||
<exclude>src/**</exclude>
|
||||
<exclude>xdocs/**</exclude>
|
||||
<exclude>maven.xml</exclude>
|
||||
<exclude>maven.log</exclude>
|
||||
<exclude>velocity.log</exclude>
|
||||
<exclude>.cvsignore</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
1
aspectj/xdocs/.cvsignore
Normal file
1
aspectj/xdocs/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
stylesheets
|
||||
22
aspectj/xdocs/changes.xml
Normal file
22
aspectj/xdocs/changes.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<release version="1.1" date="in CVS">
|
||||
<action dev="dion" type="add">
|
||||
Added documentation for navigation, changes, properties and goals
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.0" date="2002-07-16">
|
||||
<action dev="jvanzyl" type="add">
|
||||
Original release for Maven 1.0-beta6
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
42
aspectj/xdocs/goals.xml
Normal file
42
aspectj/xdocs/goals.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven AspectJ Plug-in Goals</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Goals">
|
||||
<table>
|
||||
<tr><th>Goal</th><th>Description</th></tr>
|
||||
<tr>
|
||||
<td>aspectj</td>
|
||||
<td>
|
||||
This is the default goal of the plugin and simply attains
|
||||
the <code>aspectj:compile</code> goal.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>aspectj:compile</td>
|
||||
<td>
|
||||
Compiles source code as found in the
|
||||
<source><![CDATA[
|
||||
<build>
|
||||
<aspectSourceDirectory>...</aspectSourceDirectory>
|
||||
</build>
|
||||
]]>
|
||||
</source>
|
||||
element from your
|
||||
<a href="http://jakarta.apache.org/turbine/maven/reference/project-descriptor.html">
|
||||
project descriptor</a>
|
||||
<p>
|
||||
Code is only recompiled if any of the source is newer than
|
||||
the jar file
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
26
aspectj/xdocs/index.xml
Normal file
26
aspectj/xdocs/index.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven AspectJ Plug-in</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven AspectJ Plug-in">
|
||||
<p>
|
||||
This plugin provides the basic facilities for compiling
|
||||
code using AspectJ.
|
||||
</p>
|
||||
<p>
|
||||
For more information on the functionality provided by this plugin,
|
||||
please see the <a href="goals.html">Goals</a> document.
|
||||
</p>
|
||||
<p>
|
||||
For more information on how to customise the functionality provided
|
||||
by this plugin, please see the <a href="properties.html">properties</a>
|
||||
document.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
aspectj/xdocs/navigation.xml
Normal file
16
aspectj/xdocs/navigation.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven AspectJ Plugin">
|
||||
|
||||
<title>Maven AspectJ Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="AspectJ" href="http://www.aspectj.org/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
112
aspectj/xdocs/properties.xml
Normal file
112
aspectj/xdocs/properties.xml
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven AspectJ Plugin Properties</title>
|
||||
<author email="dion@multitask.com.au">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven AspectJ Plugin Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.compile.debug</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies wether to include debugging information in the compiled
|
||||
class files; the default value is <code>on</code>.
|
||||
Used by the "java:compile" goal.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.compile.deprecation</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies wether source should be compiled with deprecation
|
||||
information; the default value is <code>off</code>.
|
||||
Used by the "java:compile" goal.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.compile.optimize</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies whether source should be compiled with optimization; the
|
||||
default value is <code>off</code>.
|
||||
Used by the "java:compile" goal.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.compile.src.set</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
The source directories maven uses to compile java code.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pom.build.sourceModifications</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
This property is the list of the
|
||||
<source><![CDATA[
|
||||
<build>
|
||||
<sourceModification>
|
||||
<sourceModification>
|
||||
<className></className>
|
||||
<excludes>
|
||||
<exclude></exclude>
|
||||
</excludes>
|
||||
</sourceModification>
|
||||
</sourceModification>
|
||||
</build>
|
||||
]]></source>
|
||||
source modifications in your
|
||||
<a href="http://jakarta.apache.org/turbine/maven/reference/project-descriptor.html">
|
||||
project descriptor</a>. This property is used during compilation to exclude or
|
||||
include classes from compilation depending on whether a named class is available
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section name="Other properties used">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sourcesPresent</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
This property is set by Maven to indicate the presence of
|
||||
Java source code for compilation. The plugin only attempts
|
||||
to compile AspectJ code if there is java source present.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.build.dest</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
The destination directory for compiled code
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.dependency.classpath</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
This property holds the Ant <code>path</code> of all the dependent jar
|
||||
files listed in the <code>dependencies</code> block of your
|
||||
<a href="http://jakarta.apache.org/turbine/maven/reference/project-descriptor.html">
|
||||
project descriptor</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
6
cactus/.cvsignore
Normal file
6
cactus/.cvsignore
Normal file
@ -0,0 +1,6 @@
|
||||
target
|
||||
maven.log
|
||||
velocity.log
|
||||
build.properties
|
||||
.classpath
|
||||
.project
|
||||
57
cactus/LICENSE.txt
Normal file
57
cactus/LICENSE.txt
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
29
cactus/announcements/1.0.ann
Normal file
29
cactus/announcements/1.0.ann
Normal file
@ -0,0 +1,29 @@
|
||||
The Maven team is pleased to announce the Cactus plugin 1.0 release!
|
||||
|
||||
http://jakarta.apache.org/turbine/maven/reference/plugins/cactus
|
||||
|
||||
The Maven Cactus plugin is a plugin for Cactus
|
||||
(http://jakarta.apache.org/cactus) that allows to automatically start
|
||||
containers, run Cactus tests and stop the containers.
|
||||
|
||||
Features in this version includes:
|
||||
|
||||
o Support for Tomcat 4.x
|
||||
|
||||
o Support for Resin 2.x
|
||||
|
||||
o HTML report generation (integrated with Maven reports)
|
||||
|
||||
o Support for keeping the server running between redeployments
|
||||
|
||||
Limitations:
|
||||
|
||||
o Bug when overriding the cactus web.xml in one's project
|
||||
|
||||
o Supports only the Servlet API 2.3
|
||||
|
||||
You can download the Cactus Maven plugin here:
|
||||
http://www.ibiblio.org/maven/maven/jars/maven-cactus-plugin-1.0.jar
|
||||
|
||||
Have fun!
|
||||
-Vincent
|
||||
34
cactus/announcements/1.1.ann
Normal file
34
cactus/announcements/1.1.ann
Normal file
@ -0,0 +1,34 @@
|
||||
The Maven team is pleased to announce the Cactus plugin 1.1 release!
|
||||
|
||||
http://jakarta.apache.org/turbine/maven/reference/plugins/cactus
|
||||
|
||||
The Maven Cactus plugin is a plugin for Cactus
|
||||
(http://jakarta.apache.org/cactus) that allows to automatically start
|
||||
containers, run Cactus tests and stop the containers.
|
||||
|
||||
Changes in this version:
|
||||
|
||||
o Added support for HttpUnit integration out of the box (i.e. the
|
||||
HttpUnit jars are automatically added by the Cactus plugin).
|
||||
o Ability to exclude Cactus tests (for long running tests for example,
|
||||
in debug period).
|
||||
o The web.xml elements required for Cactus are now automatically added to the
|
||||
user project web.xml.
|
||||
o Added support for running the tests using the JUnit Swing Test Runner.
|
||||
Simply create the following Maven property
|
||||
"maven.cactus.testrunner = swing" to use the Swing Test Runner.
|
||||
o Added automatic discovery of Cactus Test Cases and ignore test support
|
||||
classes.
|
||||
o Creation of the project war/webapp is now left to the Maven War plugin.
|
||||
Cactus repackages it by adding the Cactus tests, the Cactus
|
||||
configuration files and the Cactus external jars. Thus, the Cactus
|
||||
plugin now supports the "war:webapp" goal.
|
||||
o Improved documentation: "news" section on front page and improved
|
||||
"Quick Start" page.
|
||||
o Support for WebLogic 7.x.
|
||||
|
||||
You can download the Cactus Maven plugin here:
|
||||
http://www.ibiblio.org/maven/maven/jars/maven-cactus-plugin-1.1.jar
|
||||
|
||||
Have fun!
|
||||
-Vincent
|
||||
237
cactus/cactus.dvsl
Normal file
237
cactus/cactus.dvsl
Normal file
@ -0,0 +1,237 @@
|
||||
#######################################################################
|
||||
## J U N I T D V S L S T Y L E S H E E T ##
|
||||
#######################################################################
|
||||
|
||||
## This stylesheet is used to transform the output of JUnit's xml
|
||||
## generator. The XML is transformed into a standard xdoc that can
|
||||
## then be transformed (yet again) using whatever stylesheet is used
|
||||
## to format one's site.
|
||||
##
|
||||
## Based on the XSL stylesheet junit-noframes.xsl from Ant.
|
||||
##
|
||||
## Version: $Id: cactus.dvsl,v 1.1 2003/01/24 03:44:37 jvanzyl Exp $
|
||||
|
||||
#######################################################################
|
||||
## G L O B A L V A R I A B L E S ##
|
||||
#######################################################################
|
||||
|
||||
## Used to facilitate quoting in the template.
|
||||
##
|
||||
#set ($quote = '"')
|
||||
|
||||
#######################################################################
|
||||
## V E L O C I T Y M A C R O S ##
|
||||
#######################################################################
|
||||
|
||||
## Convert a string that represents a number using the specified
|
||||
## pattern.
|
||||
##
|
||||
#macro (formatAsNumber $string $pattern)
|
||||
#set ($value = $context.toolbox.numbers.parse($string))
|
||||
$context.toolbox.formatter.formatNumber($value, $pattern)
|
||||
#end
|
||||
|
||||
## Prints a standard navbar for navigation.
|
||||
##
|
||||
#macro (navbar)
|
||||
<p>
|
||||
[<a href="#Summary">summary</a>]
|
||||
[<a href="#Package List">package list</a>]
|
||||
[<a href="#Test Cases">test cases</a>]
|
||||
</p>
|
||||
#end
|
||||
|
||||
## Prints a standard header for a test suite.
|
||||
##
|
||||
#macro (testSuiteHeader)
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Tests</th>
|
||||
<th>Errors</th>
|
||||
<th>Failures</th>
|
||||
<th>Time(s)</th>
|
||||
</tr>
|
||||
#end
|
||||
|
||||
## Prints a standard header for a test case.
|
||||
##
|
||||
#macro (testCaseHeader)
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Type</th>
|
||||
<th>Time(s)</th>
|
||||
</tr>
|
||||
#end
|
||||
|
||||
## Prints the message from a failure.
|
||||
##
|
||||
#macro (displayFailure $current)
|
||||
#if ($current.attribute("message"))
|
||||
$context.toolbox.htmlescape.getText($current.attribute("message"))
|
||||
#else
|
||||
N/A
|
||||
#end
|
||||
<p/>
|
||||
<code>
|
||||
$context.toolbox.htmlescape.getText($current.value())
|
||||
</code>
|
||||
#end
|
||||
|
||||
## Generates the report if unit tests were present.
|
||||
##
|
||||
#macro (generateReport)
|
||||
#navbar ()
|
||||
<p>
|
||||
The following document contains the results of the <a
|
||||
href="http://jakarta.apache.org/cactus">Cactus</a> tests.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
###################################################################
|
||||
<section name="Summary">
|
||||
#navbar ()
|
||||
#set ($testCount = $node.valueOf("sum(testsuite/@tests)"))
|
||||
#set ($errorCount = $node.valueOf("sum(testsuite/@errors)"))
|
||||
#set ($failureCount = $node.valueOf("sum(testsuite/@failures)"))
|
||||
#set ($timeCount = $node.valueOf("sum(testsuite/@time)"))
|
||||
#set ($successRate = $node.valueOf("($testCount - ($failureCount + $errorCount)) div $testCount"))
|
||||
<table>
|
||||
<tr>
|
||||
<th>Tests</th>
|
||||
<th>Errors</th>
|
||||
<th>Failures</th>
|
||||
<th>Success rate</th>
|
||||
<th>Time(s)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#formatAsNumber ($testCount "0")</td>
|
||||
<td>#formatAsNumber ($errorCount "0")</td>
|
||||
<td>#formatAsNumber ($failureCount "0")</td>
|
||||
<td>#formatAsNumber ($successRate "0.00%")</td>
|
||||
<td>#formatAsNumber ($timeCount "0.000")</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
Note: <i>failures</i> are anticipated and checked for with
|
||||
assertions while <i>errors</i> are unanticipated.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
###################################################################
|
||||
<section name="Package List">
|
||||
#navbar ()
|
||||
<table>
|
||||
#testSuiteHeader ()
|
||||
#foreach ($testsuite in $node.selectNodes("./testsuite[not(./@package = preceding-sibling::testsuite/@package)]"))
|
||||
#set ($package = $testsuite.attribute('package'))
|
||||
#set ($quotedPackage = "$quote$package$quote")
|
||||
#set ($testCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@tests)"))
|
||||
#set ($errorCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@errors)"))
|
||||
#set ($failureCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@failures)"))
|
||||
#set ($timeCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@time)"))
|
||||
<tr>
|
||||
<td><a href="#$package">$package</a></td>
|
||||
<td>#formatAsNumber ($testCount "0")</td>
|
||||
<td>#formatAsNumber ($failureCount "0")</td>
|
||||
<td>#formatAsNumber ($errorCount "0")</td>
|
||||
<td>#formatAsNumber ($timeCount "0.000")</td>
|
||||
</tr>
|
||||
#end
|
||||
</table>
|
||||
<p>
|
||||
Note: package statistics are not computed recursively, they only
|
||||
sum up all of its testsuites numbers.
|
||||
</p>
|
||||
|
||||
#foreach ($testsuite in $node.selectNodes("./testsuite[not(./@package = preceding-sibling::testsuite/@package)]"))
|
||||
#set ($package = "$testsuite.attribute('package')")
|
||||
#set ($quotedPackage = "$quote$package$quote")
|
||||
<subsection name="$package">
|
||||
<table>
|
||||
#testSuiteHeader ()
|
||||
#foreach ($test in $node.selectNodes("/testsuites/testsuite[./@package = $quotedPackage]"))
|
||||
<tr>
|
||||
<td><a href="#$test.attribute('name')">$test.attribute('name')</a></td>
|
||||
<td>#formatAsNumber ($test.attribute('tests') "0")</td>
|
||||
<td>#formatAsNumber ($test.attribute('errors') "0")</td>
|
||||
<td>#formatAsNumber ($test.attribute('failures') "0")</td>
|
||||
<td>#formatAsNumber ($test.attribute('time') "0.000")</td>
|
||||
</tr>
|
||||
#end
|
||||
</table>
|
||||
</subsection>
|
||||
#end
|
||||
</section>
|
||||
|
||||
###################################################################
|
||||
<section name="Test Cases">
|
||||
#navbar ()
|
||||
#foreach ($testsuite in $node.selectNodes("./testsuite"))
|
||||
<subsection name="$testsuite.attribute('name')">
|
||||
<table>
|
||||
#testCaseHeader ()
|
||||
|
||||
## test can even not be started at all (failure to load the class)
|
||||
## so report the error directly
|
||||
##
|
||||
#foreach ($error in $testsuite.selectNodes("./error"))
|
||||
<tr> <td colspan="4"> #displayFailure ($error) </td> </tr>
|
||||
#end
|
||||
|
||||
#foreach ($testcase in $testsuite.selectNodes("./testcase"))
|
||||
<tr>
|
||||
<td>$testcase.attribute("name")</td>
|
||||
#if ($testcase.get("failure"))
|
||||
<td>Failure</td>
|
||||
<td> #displayFailure ($testcase.selectSingleNode("failure")) </td>
|
||||
#elseif ($testcase.get("error"))
|
||||
<td>Error</td>
|
||||
<td> #displayFailure ($testcase.selectSingleNode("error")) </td>
|
||||
#else
|
||||
<td>Success</td>
|
||||
<td></td>
|
||||
#end
|
||||
#if ($testcase.attribute("time"))
|
||||
<td>#formatAsNumber ($testcase.attribute("time") "0.000")</td>
|
||||
#else
|
||||
<td></td>
|
||||
#end
|
||||
</tr>
|
||||
#end
|
||||
</table>
|
||||
</subsection>
|
||||
#end
|
||||
</section>
|
||||
#end
|
||||
|
||||
#######################################################################
|
||||
## T E M P L A T E D E F I N I T I O N S ##
|
||||
#######################################################################
|
||||
|
||||
## Matches the root element of the JUnit XML report.
|
||||
##
|
||||
#match ("testsuites")
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Cactus Test Results</title>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Cactus Test Results">
|
||||
|
||||
#if (! $node.get("testsuite"))
|
||||
<p>
|
||||
This project does not contain any unit tests.
|
||||
</p>
|
||||
</section>
|
||||
#else
|
||||
#generateReport()
|
||||
#end
|
||||
|
||||
</body>
|
||||
</document>
|
||||
#end
|
||||
|
||||
386
cactus/plugin.jelly
Normal file
386
cactus/plugin.jelly
Normal file
@ -0,0 +1,386 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
=============================================================================
|
||||
Cactus plugin for Maven.
|
||||
=============================================================================
|
||||
-->
|
||||
<project xmlns:j="jelly:core" xmlns:dvsl="dvsl"
|
||||
xmlns:cactus="jelly:org.apache.maven.cactus.CactusTagLibrary">
|
||||
|
||||
<!-- Import all the jelly scripts found in the maven.cactus.conf.dir
|
||||
directory. They are jelly scripts to start/stop the different
|
||||
containers. -->
|
||||
<fileScanner var="scanner">
|
||||
<fileset dir="${maven.cactus.scripts.dir}" includes="*.jelly"/>
|
||||
</fileScanner>
|
||||
|
||||
<j:forEach var="script" items="${scanner.iterator()}">
|
||||
<j:import inherit="true" uri="${script.toURL().toString()}"/>
|
||||
</j:forEach>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Initialization. Creates objects useful for several goals.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:init" description="Creates objects useful for several goals">
|
||||
|
||||
<taskdef name="junit"
|
||||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
|
||||
|
||||
<!-- Classpath containing all Cactus jars that are needed on Cactus
|
||||
client side -->
|
||||
<path id="cactus.classpath.clientside">
|
||||
<path refid="maven.dependency.classpath"/>
|
||||
<pathelement location="${maven.build.dest}"/>
|
||||
<pathelement location="${maven.cactus.classes.dir}"/>
|
||||
<pathelement location="${maven.cactus.build.resources.dir}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('junit')}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('cactus:cactus')}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('commons-httpclient')}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('commons-logging')}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
|
||||
<pathElement path="${plugin.getDependencyPath('httpunit')}"/>
|
||||
<pathElement path="${plugin.getDependencyPath('nekohtml')}"/>
|
||||
<!-- These 2 jars should not be needed but it won't work without
|
||||
them -->
|
||||
<pathelement path="${plugin.getDependencyPath('xml-apis')}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('xerces')}"/>
|
||||
</path>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Compile Cactus tests.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:compile" prereqs="java:compile"
|
||||
description="Compile Cactus tests">
|
||||
|
||||
<mkdir dir="${maven.cactus.build.dir}"/>
|
||||
<mkdir dir="${maven.cactus.classes.dir}"/>
|
||||
|
||||
<javac
|
||||
destdir="${maven.cactus.classes.dir}"
|
||||
excludes="**/package.html"
|
||||
debug="${maven.compile.debug}"
|
||||
deprecation="${maven.compile.deprecation}"
|
||||
optimize="${maven.compile.optimize}">
|
||||
<classpath>
|
||||
<pathelement path="${maven.build.dest}"/>
|
||||
<path refid="maven.dependency.classpath"/>
|
||||
<pathelement path="${plugin.getDependencyPath('cactus:cactus')}"/>
|
||||
<pathelement path="${plugin.getDependencyPath('junit')}"/>
|
||||
<pathElement path="${plugin.getDependencyPath('httpunit')}"/>
|
||||
</classpath>
|
||||
<src>
|
||||
<path location="${maven.cactus.src.dir}"/>
|
||||
</src>
|
||||
</javac>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Create the Cactus webapp (i.e. add Cactus related jars/config/test
|
||||
classes to either the project war or the project webapp).
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:webapp" description="Create the Cactus webapp">
|
||||
|
||||
<available file="${maven.cactus.prewar.dir}/${pom.artifactId}.war"
|
||||
property="maven.cactus.prewar.exists"/>
|
||||
|
||||
<j:choose>
|
||||
|
||||
<j:when test="${maven.cactus.prewar.exists}">
|
||||
|
||||
<!-- Expand the project war -->
|
||||
<unwar src="${maven.cactus.prewar.dir}/${pom.artifactId}.war"
|
||||
dest="${maven.cactus.build.dir}/${pom.artifactId}"/>
|
||||
<attainGoal name="cactus:webapp-update"/>
|
||||
|
||||
</j:when>
|
||||
|
||||
<j:otherwise>
|
||||
|
||||
<available file="${maven.cactus.prewar.dir}/${pom.artifactId}/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}"/>
|
||||
</copy>
|
||||
<attainGoal name="cactus:webapp-update"/>
|
||||
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>
|
||||
Either a war or a webapp must exist. Please call the War plugin
|
||||
first.
|
||||
</echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Generate a web.xml which is the merge betweem the user project web.xml
|
||||
and the webapp elements needed by Cactus.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:merge-webxml" prereqs="init-dvsl-tag"
|
||||
description="Generate a web.xml which is the merge betweem the user project web.xml and the webapp elements needed by Cactus">
|
||||
|
||||
<available file="${maven.war.webxml}"
|
||||
property="maven.cactus.webxml.exists"/>
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${maven.cactus.webxml.exists}">
|
||||
<j:set var="webxml" value="${maven.war.webxml}"/>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<j:set var="webxml" value="${maven.cactus.emptywebxml}"/>
|
||||
</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>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Generate an expanded Cactus webapp from a project expanded webapp.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:webapp-update" prereqs="cactus:compile"
|
||||
description="Generate an expanded Cactus webapp from a project expanded webapp">
|
||||
|
||||
<!-- Copy Cactus configuration files -->
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}"
|
||||
file="${maven.cactus.jspRedirector}"/>
|
||||
|
||||
<!-- Create the web.xml which is result of merging the project web.xml
|
||||
and the elements needed by Cactus -->
|
||||
<attainGoal name="cactus:merge-webxml"/>
|
||||
|
||||
<!-- Copy Cactus jars -->
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/lib"
|
||||
file="${plugin.getDependencyPath('cactus:cactus')}"/>
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/lib"
|
||||
file="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/lib"
|
||||
file="${plugin.getDependencyPath('commons-logging')}"/>
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/lib"
|
||||
file="${plugin.getDependencyPath('junit')}"/>
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/lib"
|
||||
file="${plugin.getDependencyPath('httpunit')}"/>
|
||||
|
||||
<!-- Copy Cactus tests -->
|
||||
<copy todir="${maven.cactus.build.dir}/${pom.artifactId}/WEB-INF/classes">
|
||||
<fileset dir="${maven.cactus.classes.dir}"/>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Test initialization.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:test-init" description="Test initialization">
|
||||
|
||||
<path id="cactus.scanner.classpath">
|
||||
<path refid="maven.dependency.classpath"/>
|
||||
<pathElement location="${maven.build.dest}"/>
|
||||
<pathElement location="${maven.cactus.classes.dir}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('cactus:cactus')}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('commons-logging')}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('junit')}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('commons-httpclient')}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('httpunit')}"/>
|
||||
<pathElement location="${plugin.getDependencyPath('nekohtml')}"/>
|
||||
<j:forEach var="lib" items="${pom.dependencies}">
|
||||
<pathElement location="${maven.repo.local}/${lib.artifactDirectory}/jars/${lib.artifact}"/>
|
||||
</j:forEach>
|
||||
</path>
|
||||
|
||||
<cactus:scanner var="cactusScanner" classpathref="cactus.scanner.classpath">
|
||||
<fileset dir="${maven.cactus.classes.dir}">
|
||||
<include name="${maven.cactus.test.fileset.include}"/>
|
||||
<exclude name="${maven.cactus.test.fileset.exclude}"/>
|
||||
</fileset>
|
||||
</cactus:scanner>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Start the Cactus tests using the <junit> Ant task with the JUnit
|
||||
Text Test Runner.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:test-text" 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"/>
|
||||
|
||||
<j:forEach var="test" items="${cactusScanner.iterator()}">
|
||||
<test name="${test}" todir="${maven.cactus.test.reportsDirectory}"/>
|
||||
</j:forEach>
|
||||
|
||||
</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
|
||||
Swing Test Runner.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:test-swing" prereqs="cactus:test-init,cactus:init"
|
||||
description="Start the tests using the swing runner">
|
||||
|
||||
<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>
|
||||
|
||||
<!-- Copy the JUnit excluded.properties - This is needed because the
|
||||
the Commons logging package need to be excluded from being loaded
|
||||
by the special JUnit classloader. Otherwise, it fails. -->
|
||||
<copy todir="${maven.cactus.build.resources.dir}/junit/runner"
|
||||
file="${maven.cactus.testrunner.swing.excluded}"/>
|
||||
|
||||
<java classname="junit.swingui.TestRunner" fork="true" dir="${basedir}">
|
||||
|
||||
<j:forEach var="test" items="${cactusScanner.iterator()}">
|
||||
<jvmarg value="-Dmaven.cactus.test.${test}"/>
|
||||
</j:forEach>
|
||||
<arg line="org.apache.maven.cactus.DynamicTestAll"/>
|
||||
|
||||
<classpath>
|
||||
<path refid="cactus.classpath.clientside"/>
|
||||
<pathelement location="${plugin.dir}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Generate Cactus test report (xdoc format). Run maven xdoc:transform
|
||||
to then transform into HTML.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:generate" prereqs="init-dvsl-tag"
|
||||
description="Generate HTML report">
|
||||
|
||||
<mkdir dir="${maven.cactus.test.reportsDirectory}"/>
|
||||
|
||||
<!-- Consolidate the reports into a single -->
|
||||
<junitreport todir="${maven.cactus.test.reportsDirectory}">
|
||||
<fileset dir="${maven.cactus.test.reportsDirectory}">
|
||||
<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>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Execute a single Cactus test case defined using the 'testcase'
|
||||
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">
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${empty(testcase)}">
|
||||
<echo>
|
||||
You must define the test case to run via -Dtestcase=classname
|
||||
Example: maven -Dtestcase=MyTest cactus:single
|
||||
</echo>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
|
||||
<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="${testcase}"
|
||||
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>
|
||||
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
71
cactus/plugin.properties
Normal file
71
cactus/plugin.properties
Normal file
@ -0,0 +1,71 @@
|
||||
# -------------------------------------------------------------------
|
||||
# Default properties for the Cactus Plugin
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
# Location of containers. These properties need to be put in your
|
||||
# local build.properties as they depend on where you installed
|
||||
# your containers on your local machine.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# maven.cactus.tomcat4x.home = c:/apps/tomcat-4.1.10
|
||||
# maven.cactus.resin2x.home = C:/Apps/resin-2.1.4
|
||||
# maven.cactus.weblogic7x.home = C:/bea
|
||||
|
||||
# DVSL Template to merge user web.xml to entries needed by Cactus
|
||||
maven.cactus.webxml.dvsl = ${plugin.dir}/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
|
||||
|
||||
# Location of cactus.properties Cactus configuration file
|
||||
maven.cactus.configFile = ${plugin.dir}/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
|
||||
|
||||
# Location of container configuration files
|
||||
maven.cactus.conf.containers.dir = ${plugin.dir}/conf/containers
|
||||
|
||||
# Location where the cactus plugin puts its generateds stuff in
|
||||
# the project build directory.
|
||||
maven.cactus.build.dir = ${maven.build.dir}/cactus
|
||||
|
||||
# Location where the cactus plugin puts the compiled cactus test classes
|
||||
maven.cactus.classes.dir = ${maven.cactus.build.dir}/classes
|
||||
|
||||
# Location where the cactus plugin puts resources that need to be in the
|
||||
# Cactus client side classpath.
|
||||
maven.cactus.build.resources.dir = ${maven.cactus.build.dir}/resources
|
||||
|
||||
# Port under which the container will be started
|
||||
maven.cactus.port = 8080
|
||||
|
||||
# If true, the junit task used to run the Cactus tests will output the
|
||||
# test result to a file
|
||||
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.
|
||||
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
|
||||
|
||||
# Include/Exclude for Cactus tests
|
||||
maven.cactus.test.fileset.include=**/*.class
|
||||
maven.cactus.test.fileset.exclude=
|
||||
6
cactus/project.properties
Normal file
6
cactus/project.properties
Normal file
@ -0,0 +1,6 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
maven.checkstyle.format = turbine
|
||||
184
cactus/project.xml
Normal file
184
cactus/project.xml
Normal file
@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-cactus-plugin</id>
|
||||
<name>Maven Cactus Plug-in</name>
|
||||
<currentVersion>1.2-SNAPSHOT</currentVersion>
|
||||
|
||||
<description>
|
||||
Plugin for Cactus (http://jakarta.apache.org/cactus) that
|
||||
allows to automatically start containers, run Cactus tests and stop
|
||||
the containers.
|
||||
</description>
|
||||
|
||||
<shortDescription>Cactus plugin</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/cactus/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/cactus/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<versions>
|
||||
<version>
|
||||
<id>1.0</id>
|
||||
<name>1.0</name>
|
||||
<tag>MAVEN_CACTUS_1_0</tag>
|
||||
</version>
|
||||
<version>
|
||||
<id>1.1</id>
|
||||
<name>1.1</name>
|
||||
<tag>MAVEN_CACTUS_1_1</tag>
|
||||
</version>
|
||||
<version>
|
||||
<id>1.2</id>
|
||||
<name>1.2</name>
|
||||
<tag>HEAD</tag>
|
||||
</version>
|
||||
</versions>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Vincent Massol</name>
|
||||
<id>vmassol</id>
|
||||
<email>vmassol@octo.com</email>
|
||||
<organization>OCTO Technology</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
<role>Architect</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<contributors>
|
||||
<contributor>
|
||||
<name>Eric Pugh</name>
|
||||
<email>EPugh@upstate.com</email>
|
||||
</contributor>
|
||||
</contributors>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<id>cactus:cactus</id>
|
||||
<version>13-1.4.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>cactus:cactus-ant</id>
|
||||
<version>1.4.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-httpclient</id>
|
||||
<version>2.0alpha1-20020829</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-logging</id>
|
||||
<version>1.0.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>aspectj:aspectjrt</id>
|
||||
<version>1.0.6</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>httpunit</id>
|
||||
<version>1.5</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>nekohtml</id>
|
||||
<version>0.6.5</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>junit</id>
|
||||
<version>3.8.1</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>ant:ant</id>
|
||||
<version>1.5.1</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-jelly</id>
|
||||
<version>SNAPSHOT</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-jelly+tags-ant</id>
|
||||
<version>SNAPSHOT</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-beanutils</id>
|
||||
<version>1.4.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<!-- Should not be needed but it seems there is a bug with Maven when junit
|
||||
dependency is added -->
|
||||
<dependency>
|
||||
<id>xml-apis</id>
|
||||
<version>1.0.b2</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<!-- Should not be needed but it seems there is a bug with Maven when junit
|
||||
dependency is added -->
|
||||
<dependency>
|
||||
<id>xerces</id>
|
||||
<version>2.0.2</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
270
cactus/src/main/org/apache/maven/cactus/CactusScanner.java
Normal file
270
cactus/src/main/org/apache/maven/cactus/CactusScanner.java
Normal file
@ -0,0 +1,270 @@
|
||||
package org.apache.maven.cactus;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
import org.apache.tools.ant.DirectoryScanner;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
import org.apache.cactus.AbstractTestCase;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URL;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Process {@link FileSet} and extracts classes that are Cactus tests. A
|
||||
* class is considered to be a Cactus Test Case if:
|
||||
* <ul>
|
||||
* <li>It extends {@link AbstractTestCase}</li>
|
||||
* <li>It is not abstract</li>
|
||||
* <li>It has at least one method that starts with "test", returns void and
|
||||
* takes no parameters</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
* @version $Id: CactusScanner.java,v 1.1 2003/01/24 03:44:39 jvanzyl Exp $
|
||||
*/
|
||||
public class CactusScanner
|
||||
{
|
||||
private Log log = LogFactory.getLog(CactusScanner.class);
|
||||
|
||||
/**
|
||||
* The Ant project
|
||||
*/
|
||||
private Project project;
|
||||
|
||||
/**
|
||||
* Lists of Cactus class names that were found in the {@link FileSet}
|
||||
*/
|
||||
private List cactusTests = new ArrayList();
|
||||
|
||||
public void setProject(Project project)
|
||||
{
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
this.cactusTests.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of valid Cactus test cases
|
||||
*/
|
||||
public Iterator iterator() {
|
||||
return this.cactusTests.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Cactus test cases from a list of files.
|
||||
*
|
||||
* @param fs the list of files in which to look for Cactus tests
|
||||
* @param classpath the classpaths needed to load the test classes
|
||||
*/
|
||||
public void processFileSet(FileSet fs, Path classpath)
|
||||
{
|
||||
DirectoryScanner ds = fs.getDirectoryScanner(this.project);
|
||||
ds.scan();
|
||||
String[] files = ds.getIncludedFiles();
|
||||
|
||||
for (int i = 0; i < files.length; i++)
|
||||
{
|
||||
// The path is supposed to be a relative path that matches the
|
||||
// package directory structure. Thus we only need to replace
|
||||
// the directory separator char by a "." and remove the file
|
||||
// extension to get the FQN java class name.
|
||||
|
||||
// Is it a java class file?
|
||||
if (files[i].endsWith(".class"))
|
||||
{
|
||||
String fqn = files[i]
|
||||
.substring(0, files[i].length() - ".class".length())
|
||||
.replace(File.separatorChar, '.');
|
||||
|
||||
log.debug("Found candidate class: [" + fqn + "]");
|
||||
|
||||
// Is it a Cactus test case?
|
||||
if (isCactusTestCase(fqn, classpath))
|
||||
{
|
||||
log.debug("Found Cactus test case: [" + fqn + "]");
|
||||
this.cactusTests.add(fqn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param className the fully qualified name of the class to check
|
||||
* @param classpath the classpaths needed to load the test classes
|
||||
* @return true if the class is a Cactus test case
|
||||
*/
|
||||
private boolean isCactusTestCase(String className, Path classpath)
|
||||
{
|
||||
Class clazz = loadClass(className, classpath);
|
||||
if (clazz == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Class abstractTestCaseClass = null;
|
||||
try
|
||||
{
|
||||
abstractTestCaseClass = clazz.getClassLoader().loadClass(
|
||||
AbstractTestCase.class.getName());
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
log.debug("Cannot load class", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!abstractTestCaseClass.isAssignableFrom(clazz))
|
||||
{
|
||||
log.debug("Not a Cactus test as class [" + className + "] does "
|
||||
+ "not inherit from [" + AbstractTestCase.class.getName()
|
||||
+ "]");
|
||||
return false;
|
||||
}
|
||||
|
||||
// the class must not be abstract
|
||||
if (Modifier.isAbstract(clazz.getModifiers()))
|
||||
{
|
||||
log.debug("Not a Cactus test as class [" + className + "] is "
|
||||
+ "abstract");
|
||||
return false;
|
||||
}
|
||||
|
||||
// the class must have at least one test, i.e. a public method
|
||||
// starting with "test" and that takes no parameters
|
||||
boolean hasTestMethod = false;
|
||||
Method[] methods = clazz.getMethods();
|
||||
for (int i = 0; i < methods.length; i++)
|
||||
{
|
||||
if (methods[i].getName().startsWith("test")
|
||||
&& (methods[i].getReturnType() == Void.TYPE)
|
||||
&& (methods[i].getParameterTypes().length == 0))
|
||||
{
|
||||
hasTestMethod = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasTestMethod)
|
||||
{
|
||||
log.debug("Not a Cactus test as class [" + className + "] has "
|
||||
+ "no method that start with \"test\", returns void and has "
|
||||
+ "no parameters");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param className the fully qualified name of the class to check
|
||||
* @param classpath the classpaths needed to load the test classes
|
||||
* @return the class object loaded by reflection from its string name
|
||||
*/
|
||||
private Class loadClass(String className, Path classpath)
|
||||
{
|
||||
Class clazz = null;
|
||||
try
|
||||
{
|
||||
clazz = createClassLoader(classpath).loadClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
log.error("Failed to load class [" + className + "]", e);
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param classpath the classpaths needed to load the test classes
|
||||
* @return a ClassLoader that has all the needed classpaths for loading
|
||||
* the Cactus tests classes
|
||||
*/
|
||||
private ClassLoader createClassLoader(Path classpath)
|
||||
{
|
||||
URL[] urls = new URL[classpath.size()];
|
||||
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < classpath.size(); i++)
|
||||
{
|
||||
log.debug("Adding ["
|
||||
+ new File(classpath.list()[i]).toURL() + "] "
|
||||
+ "to class loader classpath");
|
||||
urls[i] = new File(classpath.list()[i]).toURL();
|
||||
}
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
log.debug("Invalid URL", e);
|
||||
}
|
||||
|
||||
return new URLClassLoader(urls);
|
||||
}
|
||||
}
|
||||
241
cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java
Normal file
241
cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java
Normal file
@ -0,0 +1,241 @@
|
||||
package org.apache.maven.cactus;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
import org.apache.commons.jelly.TagSupport;
|
||||
import org.apache.commons.jelly.XMLOutput;
|
||||
import org.apache.commons.jelly.MissingAttributeException;
|
||||
import org.apache.commons.jelly.tags.ant.TaskSource;
|
||||
import org.apache.commons.jelly.tags.ant.AntTagLibrary;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
import org.apache.tools.ant.types.Reference;
|
||||
|
||||
/**
|
||||
* Cactus Jelly Tag that scans Ant FileSets and return a list of
|
||||
* qualified class name that are Cactus TestCases (i.e.
|
||||
* ServletTestCase, JspTestCase or FilterTestCase) or subclasses
|
||||
* of Cactus TestCases.
|
||||
*
|
||||
* Note: This is useful when used with the <junit> Ant
|
||||
* task for example, in order to find out the list of tests to
|
||||
* execute.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
* @version $Id: CactusScannerTag.java,v 1.1 2003/01/24 03:44:39 jvanzyl Exp $
|
||||
*/
|
||||
public class CactusScannerTag extends TagSupport implements TaskSource
|
||||
{
|
||||
private Log log = LogFactory.getLog(CactusScannerTag.class);
|
||||
|
||||
/**
|
||||
* The {@link CactusScanner} object that is exposed by this tag
|
||||
* to the Jelly script.
|
||||
*/
|
||||
private CactusScanner cactusScanner;
|
||||
|
||||
/**
|
||||
* We need to save the fileset as its XML attributes are set after the
|
||||
* fileset object is created and thus we need to wait until it is
|
||||
* completely initialized before being able to process it using
|
||||
* {@link CactusScanner#processFileSet}.
|
||||
*/
|
||||
private FileSet fileset;
|
||||
|
||||
/**
|
||||
* Nested <classpath> tag values. This is the classpath that will
|
||||
* be used to dynamically load the test classes to decide whether they
|
||||
* are Cactus tests or not.
|
||||
*
|
||||
* Note: There is a bug in Jelly and it does not work yet. ATM you should
|
||||
* use the classpathref attribute instead.
|
||||
*/
|
||||
private Path classpath;
|
||||
|
||||
/**
|
||||
* Reference to an Ant {@link Path} object containing the classpath.
|
||||
* @see #classpath
|
||||
*/
|
||||
private String classpathref;
|
||||
|
||||
/**
|
||||
* The Jelly variable (exposed to the Jelly script) that will
|
||||
* contain a reference to the {@link CactusScanner} object.
|
||||
*/
|
||||
private String var;
|
||||
|
||||
public CactusScannerTag()
|
||||
{
|
||||
this.cactusScanner = new CactusScanner();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TagSupport#doTag(XMLOutput)
|
||||
*/
|
||||
public void doTag(XMLOutput xmlOutput) throws Exception
|
||||
{
|
||||
this.cactusScanner.setProject(AntTagLibrary.getProject(context));
|
||||
this.cactusScanner.clear();
|
||||
|
||||
// run the body first to configure the task via nested tags
|
||||
invokeBody(xmlOutput);
|
||||
|
||||
// Process the fileset to extract Cactus test cases. We need to pass
|
||||
// the project dependency classpath as the CactusScanner will need
|
||||
// to load the cactus test classes to decide whether they are Cactus
|
||||
// test case or not and that needs the dependent jars to be in the
|
||||
// classpath.
|
||||
Path cp = this.classpath;
|
||||
if (this.classpathref != null)
|
||||
{
|
||||
cp = (Path) AntTagLibrary.getProject(
|
||||
context).getReference(this.classpathref);
|
||||
}
|
||||
|
||||
this.cactusScanner.processFileSet(this.fileset, cp);
|
||||
|
||||
// output the cactusScanner
|
||||
if ( var == null )
|
||||
{
|
||||
throw new MissingAttributeException( "var" );
|
||||
}
|
||||
context.setVariable(var, cactusScanner);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called internally by Jelly to know on which object to
|
||||
* call the {@link TaskSource#setTaskProperty} method.
|
||||
*
|
||||
* @see TaskSource#getTaskObject()
|
||||
*/
|
||||
public Object getTaskObject()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TaskSource#setTaskProperty(String, Object)
|
||||
*/
|
||||
public void setTaskProperty(String name, Object value) throws Exception
|
||||
{
|
||||
BeanUtils.setProperty(this, name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a set of files (nested fileset attribute). This method is called
|
||||
* dynamically by {@link #setTaskProperty}.
|
||||
*/
|
||||
public void addFileset(FileSet set)
|
||||
{
|
||||
log.debug("Adding fileset [" + set + "]");
|
||||
this.fileset = set;
|
||||
}
|
||||
|
||||
public Path createClasspath()
|
||||
{
|
||||
log.debug("Creating classpath");
|
||||
if (this.classpath == null)
|
||||
{
|
||||
this.classpath = new Path(AntTagLibrary.getProject(context));
|
||||
}
|
||||
return this.classpath.createPath();
|
||||
}
|
||||
|
||||
public Path getClasspath()
|
||||
{
|
||||
return this.classpath;
|
||||
}
|
||||
|
||||
public void setClasspath(Path classpath)
|
||||
{
|
||||
log.debug("Setting classpath [" + classpath + "]");
|
||||
if (this.classpath == null)
|
||||
{
|
||||
this.classpath = classpath;
|
||||
} else {
|
||||
this.classpath.append(classpath);
|
||||
}
|
||||
}
|
||||
|
||||
public void setClasspathRef(Reference r)
|
||||
{
|
||||
createClasspath().setRefid(r);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Cactus scanner object
|
||||
*/
|
||||
public CactusScanner getCactusScanner()
|
||||
{
|
||||
return this.cactusScanner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the variable exported by this tag
|
||||
*/
|
||||
public void setVar(String var)
|
||||
{
|
||||
this.var = var;
|
||||
}
|
||||
|
||||
public void setClasspathref(String classpathref)
|
||||
{
|
||||
this.classpathref = classpathref;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package org.apache.maven.cactus;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
import org.apache.commons.jelly.TagLibrary;
|
||||
|
||||
/**
|
||||
* Maven tag library for use in Jelly scripts.
|
||||
*
|
||||
* @author <a href="vmassol@apache.org">Vincent Massol</a>
|
||||
* @version $Id: CactusTagLibrary.java,v 1.1 2003/01/24 03:44:39 jvanzyl Exp $
|
||||
*/
|
||||
public class CactusTagLibrary extends TagLibrary
|
||||
{
|
||||
public CactusTagLibrary()
|
||||
{
|
||||
registerTag("scanner", CactusScannerTag.class);
|
||||
}
|
||||
}
|
||||
130
cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java
Normal file
130
cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java
Normal file
@ -0,0 +1,130 @@
|
||||
package org.apache.maven.cactus;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* JUnit tests suite that runs all the tests found in System Properties
|
||||
* whose name start with {@link #PREFIX}.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
* @version $Id: DynamicTestAll.java,v 1.1 2003/01/24 03:44:41 jvanzyl Exp $
|
||||
*/
|
||||
public class DynamicTestAll extends TestCase
|
||||
{
|
||||
/**
|
||||
* Prefix for test classnames specified as System Properties.
|
||||
*/
|
||||
private static final String PREFIX = "maven.cactus.test";
|
||||
|
||||
/**
|
||||
* Defines the testcase name for JUnit.
|
||||
*
|
||||
* @param theName the test name.
|
||||
*/
|
||||
public DynamicTestAll(String theName)
|
||||
{
|
||||
super(theName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a test suite that includes all tests defined as System
|
||||
* Properties whose name starts with {@link #PREFIX}.
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite("All Cactus tests");
|
||||
|
||||
Properties properties = System.getProperties();
|
||||
Enumeration keys = properties.keys();
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String) keys.nextElement();
|
||||
if (key.startsWith(PREFIX))
|
||||
{
|
||||
suite.addTestSuite(loadClass(
|
||||
key.substring(PREFIX.length() + 1)));
|
||||
}
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param classname name of class to load dynamically
|
||||
* @return the loaded class
|
||||
*/
|
||||
private static Class loadClass(String classname)
|
||||
{
|
||||
Class clazz = null;
|
||||
try
|
||||
{
|
||||
clazz = DynamicTestAll.class.getClassLoader().loadClass(classname);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
// Ignore the class
|
||||
}
|
||||
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
21
cactus/src/plugin-resources/conf/cactus.properties
Normal file
21
cactus/src/plugin-resources/conf/cactus.properties
Normal file
@ -0,0 +1,21 @@
|
||||
# Configuration file for Cactus.
|
||||
|
||||
# Each project using Cactus need to have such a file put in the client side
|
||||
# CLASSPATH (Meaning the directory containgin this file should be in the client
|
||||
# side CLASSPATH, not the file itself of course ... :) )
|
||||
|
||||
# Defines the URLs that will be used by Cactus to call it's redirectors.
|
||||
# You need to specify in these URLs the webapp context that you use for your
|
||||
# application. In the example below, the context is "test".
|
||||
|
||||
# Web app Context under which our application to test runs
|
||||
cactus.contextURL = http://localhost:@maven.cactus.port@/test
|
||||
|
||||
# Default Servlet Redirector Name. Used by ServletTestCase test cases.
|
||||
cactus.servletRedirectorName = ServletRedirector
|
||||
|
||||
# Default JSP Redirector Name. Used by JspTestCase test cases.
|
||||
cactus.jspRedirectorName = JspRedirector
|
||||
|
||||
# Default Filter Redirector Name. Used by FilterTestCase test cases.
|
||||
cactus.filterRedirectorName = FilterRedirector
|
||||
@ -0,0 +1,21 @@
|
||||
<caucho.com>
|
||||
|
||||
<http-server>
|
||||
|
||||
<app-dir>.</app-dir>
|
||||
|
||||
<http port='@maven.cactus.port@'/>
|
||||
|
||||
<host id=''>
|
||||
|
||||
<authenticator class-name='com.caucho.http.security.XmlAuthenticator'>
|
||||
<init-param user='testuser:testpassword:test'/>
|
||||
</authenticator>
|
||||
|
||||
<war-dir id='.'/>
|
||||
|
||||
</host>
|
||||
|
||||
</http-server>
|
||||
|
||||
</caucho.com>
|
||||
@ -0,0 +1,29 @@
|
||||
<Server port="8005" shutdown="SHUTDOWN" debug="0">
|
||||
|
||||
<Service name="Tomcat-Standalone">
|
||||
|
||||
<Connector className="org.apache.catalina.connector.http.HttpConnector"
|
||||
port="@maven.cactus.port@" minProcessors="5" maxProcessors="75"
|
||||
acceptCount="10" debug="0"/>
|
||||
|
||||
<Engine name="Standalone" defaultHost="localhost" debug="0">
|
||||
|
||||
<Realm className="org.apache.catalina.realm.MemoryRealm" />
|
||||
|
||||
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
|
||||
autoDeploy="true">
|
||||
|
||||
<Context path="/test" docBase="test" debug="0" reloadable="true"
|
||||
crossContext="true">
|
||||
|
||||
<Loader checkInterval="1"/>
|
||||
|
||||
</Context>
|
||||
|
||||
</Host>
|
||||
|
||||
</Engine>
|
||||
|
||||
</Service>
|
||||
|
||||
</Server>
|
||||
@ -0,0 +1,3 @@
|
||||
<tomcat-users>
|
||||
<user name="testuser" password="testpassword" roles="test"/>
|
||||
</tomcat-users>
|
||||
@ -0,0 +1,65 @@
|
||||
dn: dc=@domain@
|
||||
dc: @domain@
|
||||
objectclass: top
|
||||
objectclass: domain
|
||||
|
||||
dn: ou=@realm@, dc=@domain@
|
||||
ou: @realm@
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
|
||||
dn: ou=groups,ou=@realm@, dc=@domain@
|
||||
ou: groups
|
||||
objectclass: organizationalUnit
|
||||
objectclass: top
|
||||
|
||||
dn: cn=Administrators,ou=groups,ou=@realm@, dc=@domain@
|
||||
memberURL: ldap:///ou=groups,ou=@realm@,dc=@domain@??sub?(&(objectclass=person)(wlsMemberOf=cn=Administrators,ou=groups,ou=@realm@,dc=@domain@))
|
||||
description: Administrators group
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
objectclass: groupOfURLs
|
||||
cn: Administrators
|
||||
|
||||
dn: cn=Deployers,ou=groups,ou=@realm@, dc=@domain@
|
||||
memberURL: ldap:///ou=groups,ou=@realm@,dc=@domain@??sub?(&(objectclass=person)(wlsMemberOf=cn=Deployers,ou=groups,ou=@realm@,dc=@domain@))
|
||||
description: Deployers group
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
objectclass: groupOfURLs
|
||||
cn: Deployers
|
||||
|
||||
dn: cn=Operators,ou=groups,ou=@realm@, dc=@domain@
|
||||
memberURL: ldap:///ou=groups,ou=@realm@,dc=@domain@??sub?(&(objectclass=person)(wlsMemberOf=cn=Operators,ou=groups,ou=@realm@,dc=@domain@))
|
||||
description: Operators group
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
objectclass: groupOfURLs
|
||||
cn: Operators
|
||||
|
||||
dn: cn=Monitors,ou=groups,ou=@realm@, dc=@domain@
|
||||
memberURL: ldap:///ou=groups,ou=@realm@,dc=@domain@??sub?(&(objectclass=person)(wlsMemberOf=cn=Monitors,ou=groups,ou=@realm@,dc=@domain@))
|
||||
description: Monitors group
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
objectclass: groupOfURLs
|
||||
cn: Monitors
|
||||
|
||||
dn: ou=people,ou=@realm@, dc=@domain@
|
||||
ou: people
|
||||
objectclass: organizationalUnit
|
||||
objectclass: top
|
||||
|
||||
dn: uid=system,ou=people,ou=@realm@, dc=@domain@
|
||||
description: system
|
||||
objectclass: inetOrgPerson
|
||||
objectclass: organizationalPerson
|
||||
objectclass: person
|
||||
objectclass: top
|
||||
cn: system
|
||||
sn: system
|
||||
userpassword: {ssha}XYqqB9c/6OXoNVCOil7ZRdbb/GSIXVcE
|
||||
uid: system
|
||||
objectclass: wlsUser
|
||||
wlsMemberOf: cn=Administrators,ou=groups,ou=@realm@,dc=@domain@
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
yф
|
||||
tfИ2щs©®ы"И4ДЗ-jjЃ{<7B>©ѓD6bт(
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<Domain Name="testdomain">
|
||||
<Server Name="testserver" NativeIOEnabled="true" ListenPort="@maven.cactus.port@"/>
|
||||
</Domain>
|
||||
@ -0,0 +1,9 @@
|
||||
#Wed Jun 19 22:19:44 BST 2002
|
||||
acl.modify.weblogic.admin.acl=Administrators
|
||||
acl.unlockServer.weblogic.admin=Administrators
|
||||
user.system=0xa7dc9690ce40f88dac3bdd23cb32588ff5546bb6
|
||||
acl.lockServer.weblogic.admin=Administrators
|
||||
acl.unlockuser.weblogic.passwordpolicy=Administrators
|
||||
acl.shutdown.weblogic.admin=Administrators
|
||||
acl.boot.weblogic.server=Administrators,everyone
|
||||
group.Administrators=system
|
||||
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 6.0//EN" "http://www.bea.com/servers/wls610/dtd/ weblogic-web-jar.dtd">
|
||||
|
||||
<weblogic-web-app>
|
||||
|
||||
<security-role-assignment>
|
||||
<role-name>test</role-name>
|
||||
<principal-name>testuser</principal-name>
|
||||
</security-role-assignment>
|
||||
|
||||
</weblogic-web-app>
|
||||
16
cactus/src/plugin-resources/conf/excluded.properties
Normal file
16
cactus/src/plugin-resources/conf/excluded.properties
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# The list of excluded package paths for the TestCaseClassLoader
|
||||
#
|
||||
excluded.0=sun.*
|
||||
excluded.1=com.sun.*
|
||||
excluded.2=org.omg.*
|
||||
excluded.3=javax.*
|
||||
excluded.4=sunw.*
|
||||
excluded.5=java.*
|
||||
excluded.6=org.w3c.dom.*
|
||||
excluded.7=org.xml.sax.*
|
||||
excluded.8=net.jini.*
|
||||
excluded.9=org.apache.common.logging.*
|
||||
excluded.10=org.apache.cactus.*
|
||||
excluded.11=com.meterware.httpunit.*
|
||||
|
||||
9
cactus/src/plugin-resources/conf/web.xml
Normal file
9
cactus/src/plugin-resources/conf/web.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Empty web.xml to use when the user project does not provide a web.xml.
|
||||
We need a web.xml in order to perform the merge with our web.xml
|
||||
DVSL template. See plugin.jelly. -->
|
||||
|
||||
</web-app>
|
||||
118
cactus/src/plugin-resources/conf/web.xml.dvsl
Normal file
118
cactus/src/plugin-resources/conf/web.xml.dvsl
Normal file
@ -0,0 +1,118 @@
|
||||
## -----------------------------------------------------
|
||||
## X M L R O O T
|
||||
## -----------------------------------------------------
|
||||
#match ("web-app")
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
$context.applyTemplates("icon")
|
||||
$context.applyTemplates("display-name")
|
||||
$context.applyTemplates("description")
|
||||
$context.applyTemplates("distributable")
|
||||
$context.applyTemplates("context-param")
|
||||
|
||||
<filter>
|
||||
<filter-name>FilterRedirector</filter-name>
|
||||
<filter-class>org.apache.cactus.server.FilterTestRedirector</filter-class>
|
||||
</filter>
|
||||
|
||||
$context.applyTemplates("filter")
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>FilterRedirector</filter-name>
|
||||
<url-pattern>/FilterRedirector</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
$context.applyTemplates("filter-mapping")
|
||||
$context.applyTemplates("listener")
|
||||
|
||||
<servlet>
|
||||
<servlet-name>ServletRedirector</servlet-name>
|
||||
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>ServletRedirectorSecure</servlet-name>
|
||||
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>JspRedirector</servlet-name>
|
||||
<jsp-file>/jspRedirector.jsp</jsp-file>
|
||||
</servlet>
|
||||
|
||||
$context.applyTemplates("servlet")
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>ServletRedirector</servlet-name>
|
||||
<url-pattern>/ServletRedirector</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>ServletRedirectorSecure</servlet-name>
|
||||
<url-pattern>/ServletRedirectorSecure</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>JspRedirector</servlet-name>
|
||||
<url-pattern>/JspRedirector</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
$context.applyTemplates("servlet-mapping")
|
||||
$context.applyTemplates("session-config")
|
||||
$context.applyTemplates("mime-mapping")
|
||||
$context.applyTemplates("welcome-file-list")
|
||||
$context.applyTemplates("error-page")
|
||||
$context.applyTemplates("taglib")
|
||||
$context.applyTemplates("resource-env-ref")
|
||||
$context.applyTemplates("resource-ref")
|
||||
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>SecurityRestriction</web-resource-name>
|
||||
<description>Protect the Cactus redirector servlet.</description>
|
||||
<url-pattern>/ServletRedirectorSecure</url-pattern>
|
||||
<http-method>GET</http-method>
|
||||
<http-method>POST</http-method>
|
||||
</web-resource-collection>
|
||||
<auth-constraint>
|
||||
<description>Authorized Users Group</description>
|
||||
<role-name>test</role-name>
|
||||
</auth-constraint>
|
||||
<user-data-constraint>
|
||||
<transport-guarantee>NONE</transport-guarantee>
|
||||
</user-data-constraint>
|
||||
</security-constraint>
|
||||
|
||||
<login-config>
|
||||
<auth-method>BASIC</auth-method>
|
||||
</login-config>
|
||||
|
||||
<security-role>
|
||||
<description>Test role</description>
|
||||
<role-name>test</role-name>
|
||||
</security-role>
|
||||
|
||||
$context.applyTemplates("env-entry")
|
||||
$context.applyTemplates("ejb-ref")
|
||||
$context.applyTemplates("ejb-local-ref")
|
||||
|
||||
</web-app>
|
||||
#end
|
||||
|
||||
## -----------------------------------------------------
|
||||
## D E F A U L T C O P Y
|
||||
## -----------------------------------------------------
|
||||
|
||||
#match( "text()" )$node.value()#end
|
||||
#match( "@*" ) $node.name()="$node.value()"#end
|
||||
#match("*")
|
||||
#if ($node.name() == "source")
|
||||
$context.applyTemplates("source");
|
||||
#else<$node.name()$context.applyTemplates("@*")>#foreach($n in $node.children())$context.applyTemplates($n)#end</$node.name()>
|
||||
#end
|
||||
#end
|
||||
28
cactus/src/plugin-resources/conf/web/jspRedirector.jsp
Normal file
28
cactus/src/plugin-resources/conf/web/jspRedirector.jsp
Normal file
@ -0,0 +1,28 @@
|
||||
<%@page import="org.apache.cactus.server.*" session="true" %><%
|
||||
|
||||
/**
|
||||
* Note:
|
||||
* It is very important not to put any character between the end
|
||||
* of the page tag and the beginning of the java code expression, otherwise,
|
||||
* the generated servlet containss a 'out.println("\r\n");' and this breaks
|
||||
* our mechanism !
|
||||
*/
|
||||
|
||||
/**
|
||||
* This JSP is used as a proxy to call your server-side unit tests. We use
|
||||
* a JSP rather than a servlet because for testing custom JSP tags for
|
||||
* example we need access to JSP implicit objects (PageContext and
|
||||
* JspWriter).
|
||||
*/
|
||||
|
||||
JspImplicitObjects objects = new JspImplicitObjects();
|
||||
objects.setHttpServletRequest(request);
|
||||
objects.setHttpServletResponse(response);
|
||||
objects.setServletConfig(config);
|
||||
objects.setServletContext(application);
|
||||
objects.setJspWriter(out);
|
||||
objects.setPageContext(pageContext);
|
||||
|
||||
JspTestRedirector redirector = new JspTestRedirector();
|
||||
redirector.doGet(objects);
|
||||
%>
|
||||
4
cactus/src/plugin-resources/sample/project.properties
Normal file
4
cactus/src/plugin-resources/sample/project.properties
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
#maven.cactus.tomcat4x.home = C:/Apps/jakarta-tomcat-4.1.10
|
||||
#maven.cactus.resin2x.home = C:/Apps/resin-2.1.4
|
||||
|
||||
74
cactus/src/plugin-resources/sample/project.xml
Normal file
74
cactus/src/plugin-resources/sample/project.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<!-- the version of maven's project object model -->
|
||||
<pomVersion>3</pomVersion>
|
||||
|
||||
<!-- a unique name for this project -->
|
||||
<id>maven-cactus-sample</id>
|
||||
|
||||
<!-- a short but descriptive name for the project -->
|
||||
<name>Cactus Sample</name>
|
||||
|
||||
<!-- The version of the project under development, e.g.
|
||||
1.1, 1.2, 2.0-dev -->
|
||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
||||
|
||||
<!-- details about the organization that 'owns' the project -->
|
||||
<organization>
|
||||
<name>Apache Software Foundation</name>
|
||||
<url>http://jakarta.apache.org/</url>
|
||||
</organization>
|
||||
|
||||
<!-- the year the project started -->
|
||||
<inceptionYear>2002</inceptionYear>
|
||||
|
||||
<!-- the top level of java packages that this project defines
|
||||
e.g. if your project contains the packages
|
||||
com.mycompany.accounts.reports, com.mycompany.accounts.reports
|
||||
and com.mycompany.accounts.utils, the package would be
|
||||
'com.mycompany.accounts' -->
|
||||
<package>org.apache.maven.cactus.sample</package>
|
||||
|
||||
<!-- a short description of what the project does -->
|
||||
<shortDescription>A sample project using the Cactus plugin for Maven</shortDescription>
|
||||
|
||||
<!-- the project home page -->
|
||||
<url>http://jakarta.apache.org/turbine/maven/</url>
|
||||
|
||||
<!-- the version control repository and http url for online access
|
||||
the connection element has the form:
|
||||
scm:<system>:<system specific connection string> -->
|
||||
<repository>
|
||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven</connection>
|
||||
<url>http://cvs.apache.org/viewcvs/jakarta-turbine-maven/</url>
|
||||
</repository>
|
||||
|
||||
<!-- any mailing lists for the project -->
|
||||
<mailingLists/>
|
||||
|
||||
<!-- who the developers are for the project -->
|
||||
<developers />
|
||||
|
||||
<!-- jar files the project is dependent on -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<id>servletapi</id>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- build information for the project -->
|
||||
<build>
|
||||
<sourceDirectory>src/java</sourceDirectory>
|
||||
|
||||
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
|
||||
<unitTest>
|
||||
<includes>
|
||||
<include>**/Test*.java</include>
|
||||
</includes>
|
||||
</unitTest>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,150 @@
|
||||
package org.apache.maven.cactus.sample;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.BodyTagSupport;
|
||||
|
||||
/**
|
||||
* Sample tag that interacts with its body. The tag acts as a filter for its
|
||||
* body. "Target" and "Replacement" Strings are defined by the tag's attributes
|
||||
* and each "occurrence" of the target is replaced by the "replacement".
|
||||
*
|
||||
* @author <a href="mailto:nick@eblox.com">Nicholas Lesiecki</a>
|
||||
*
|
||||
* @version $Id: SampleBodyTag.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
|
||||
*/
|
||||
public class SampleBodyTag extends BodyTagSupport
|
||||
{
|
||||
/**
|
||||
* The substring to be replaced in the body.
|
||||
*/
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* The substring that will replace the target in the body.
|
||||
*/
|
||||
private String replacement;
|
||||
|
||||
/**
|
||||
* Sets the substring to be replaced in the body.
|
||||
*
|
||||
* @param theTarget the substring to be replaced in the body
|
||||
*/
|
||||
public void setTarget(String theTarget)
|
||||
{
|
||||
this.target = theTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the substring that will replace the target in the body.
|
||||
*
|
||||
* @param theReplacement the replacement string
|
||||
*/
|
||||
public void setReplacement(String theReplacement)
|
||||
{
|
||||
this.replacement = theReplacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BodyTagSupport#doAfterBody()
|
||||
*/
|
||||
public int doAfterBody() throws JspTagException
|
||||
{
|
||||
String contentString = this.bodyContent.getString();
|
||||
StringBuffer contentBuffer = new StringBuffer(contentString);
|
||||
|
||||
int beginIndex = -1;
|
||||
int targetLength = this.target.length();
|
||||
|
||||
// while instances of target still exist
|
||||
while ((beginIndex = contentString.indexOf(this.target)) > -1)
|
||||
{
|
||||
int endIndex = beginIndex + targetLength;
|
||||
|
||||
contentBuffer.replace(beginIndex, endIndex, this.replacement);
|
||||
|
||||
contentString = contentBuffer.toString();
|
||||
}
|
||||
|
||||
// write out the changed body
|
||||
JspWriter pageWriter = this.bodyContent.getEnclosingWriter();
|
||||
|
||||
try
|
||||
{
|
||||
pageWriter.write(contentString);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new JspTagException(e.getMessage());
|
||||
}
|
||||
|
||||
return SKIP_BODY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BodyTagSupport#release()
|
||||
*/
|
||||
public void release()
|
||||
{
|
||||
this.target = null;
|
||||
this.replacement = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,181 @@
|
||||
package org.apache.maven.cactus.sample;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.maven.cactus.sample.util.GenericResponseWrapper;
|
||||
|
||||
/**
|
||||
* Sample filter that implements some very simple business logic. The goal is
|
||||
* to provide some functional tests for Cactus and examples for Cactus users.
|
||||
* This filter simply adds a header and a footer to the returned HTML.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: SampleFilter.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
|
||||
*/
|
||||
public class SampleFilter implements Filter
|
||||
{
|
||||
/**
|
||||
* We need to save the filter config as the Fitler API does not offer
|
||||
* a means to get the filter config ... except in the <code>init()</code>
|
||||
*/
|
||||
private FilterConfig config;
|
||||
|
||||
/**
|
||||
* Filter initialisation. Called by the servlet engine during the life
|
||||
* cycle of the filter.
|
||||
*
|
||||
* @param theConfig the filter config
|
||||
*
|
||||
* @exception ServletException on failure
|
||||
*/
|
||||
public void init(FilterConfig theConfig) throws ServletException
|
||||
{
|
||||
this.config = theConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the filter function. Called by the container upon a request
|
||||
* matching the filter pattern defined in <code>web.xml</code>.
|
||||
*
|
||||
* @param theRequest the incmoing HTTP request
|
||||
* @param theResponse the returned HTTP response
|
||||
* @param theChain the chain of filters extracted from the definition
|
||||
* given in <code>web.xml</code> by the container.
|
||||
*
|
||||
* @exception ServletException on failure
|
||||
* @exception IOException on failure
|
||||
*/
|
||||
public void doFilter(ServletRequest theRequest,
|
||||
ServletResponse theResponse, FilterChain theChain) throws IOException,
|
||||
ServletException
|
||||
{
|
||||
OutputStream out = theResponse.getOutputStream();
|
||||
|
||||
addHeader(out);
|
||||
|
||||
// Create a wrapper of the response so that we can later write to
|
||||
// the response (add the footer). If we did not do this, we would
|
||||
// get an error saying that the response has already been
|
||||
// committed.
|
||||
GenericResponseWrapper wrapper =
|
||||
new GenericResponseWrapper((HttpServletResponse) theResponse);
|
||||
|
||||
theChain.doFilter(theRequest, wrapper);
|
||||
|
||||
out.write(wrapper.getData());
|
||||
addFooter(out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the header to the output stream. The header text is extracted
|
||||
* from a filter initialisation parameter (defined in
|
||||
* <code>web.xml</code>). Don't write anything if no parameter is defined.
|
||||
*
|
||||
* @param theOutputStream the output stream
|
||||
*
|
||||
* @exception IOException on failure
|
||||
*/
|
||||
protected void addHeader(OutputStream theOutputStream) throws IOException
|
||||
{
|
||||
String header = this.config.getInitParameter("header");
|
||||
|
||||
if (header != null)
|
||||
{
|
||||
theOutputStream.write(header.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the footer to the output stream. The footer text is extracted
|
||||
* from a filter initialisation parameter (defined in
|
||||
* <code>web.xml</code>). Don't write anything if no parameter is defined.
|
||||
*
|
||||
* @param theOutputStream the output stream
|
||||
*
|
||||
* @exception IOException on failure
|
||||
*/
|
||||
protected void addFooter(OutputStream theOutputStream) throws IOException
|
||||
{
|
||||
String footer = this.config.getInitParameter("footer");
|
||||
|
||||
if (footer != null)
|
||||
{
|
||||
theOutputStream.write(footer.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter un-initialisation. Called by the servlet engine during the life
|
||||
* cycle of the filter.
|
||||
*/
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package org.apache.maven.cactus.sample;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class SampleServlet extends HttpServlet
|
||||
{
|
||||
public boolean isAuthenticated(HttpServletRequest request)
|
||||
{
|
||||
HttpSession session = request.getSession(false);
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String authenticationAttribute =
|
||||
(String) session.getAttribute("authenticated");
|
||||
|
||||
return new Boolean(authenticationAttribute).booleanValue();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
package org.apache.maven.cactus.sample.util;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
|
||||
/**
|
||||
* Helper class to help write filters that manipulates the output stream. This
|
||||
* is because normally, the <code>ServletOutputStream</code> cannot be
|
||||
* modified after a resource has committed it.
|
||||
*
|
||||
* Note: This code was adapted from the Filter tutorial found
|
||||
* {@link <a href="http://www.orionserver.com/tutorials/filters/lesson3/">
|
||||
* here</a>}
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: FilterServletOutputStream.java,v 1.1 2003/01/24 03:44:47 jvanzyl Exp $
|
||||
*
|
||||
* @see GenericResponseWrapper
|
||||
*/
|
||||
public class FilterServletOutputStream extends ServletOutputStream
|
||||
{
|
||||
/**
|
||||
* The stream where all the data will get written to
|
||||
*/
|
||||
private DataOutputStream stream;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param theOutput the output stream that we wrap in a
|
||||
* <code>DataOutputStream</code> in order to hold the data
|
||||
*/
|
||||
public FilterServletOutputStream(OutputStream theOutput)
|
||||
{
|
||||
stream = new DataOutputStream(theOutput);
|
||||
}
|
||||
|
||||
// Overriden methods from ServletOutputStream ----------------------------
|
||||
|
||||
/**
|
||||
* @see ServletOutputStream#write(int)
|
||||
*/
|
||||
public void write(int b) throws IOException
|
||||
{
|
||||
stream.write(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ServletOutputStream#write(byte[])
|
||||
*/
|
||||
public void write(byte[] b) throws IOException
|
||||
{
|
||||
stream.write(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ServletOutputStream#write(byte[], int, int)
|
||||
*/
|
||||
public void write(byte[] b, int off, int len) throws IOException
|
||||
{
|
||||
stream.write(b, off, len);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,179 @@
|
||||
package org.apache.maven.cactus.sample.util;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
|
||||
/**
|
||||
* Wrapper around a <code>HttpServletResponse</code> that we use to easily
|
||||
* write filters that manipulate the output stream. Indeed, we cannot pass
|
||||
* the output stream of our filter direectly to the next filter in the chain
|
||||
* because then we won't be able to write to it (the response will have been
|
||||
* committed). Instead, we pass this wrapper class and then copy its data
|
||||
* to our filter output stream.
|
||||
*
|
||||
* Note: This code was adapted from the Filter tutorial found
|
||||
* {@link <a href="http://www.orionserver.com/tutorials/filters/lesson3/">
|
||||
* here</a>}
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: GenericResponseWrapper.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
|
||||
*
|
||||
* @see FilterServletOutputStream
|
||||
*/
|
||||
public class GenericResponseWrapper extends HttpServletResponseWrapper
|
||||
{
|
||||
/**
|
||||
* Holder for the output data
|
||||
*/
|
||||
private ByteArrayOutputStream output;
|
||||
|
||||
/**
|
||||
* Save the content length so that we can query it at a later time
|
||||
* (otherwise it would not be possible as
|
||||
* <code>HttpServletResponseWrapper</code> does not have a method to get
|
||||
* the content length).
|
||||
*/
|
||||
private int contentLength;
|
||||
|
||||
/**
|
||||
* Save the content type so that we can query it at a later time
|
||||
* (otherwise it would not be possible as
|
||||
* <code>HttpServletResponseWrapper</code> does not have a method to get
|
||||
* the content type).
|
||||
*/
|
||||
private String contentType;
|
||||
|
||||
// Constructors ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @param theResponse the wrapped response object
|
||||
*/
|
||||
public GenericResponseWrapper(HttpServletResponse theResponse)
|
||||
{
|
||||
super(theResponse);
|
||||
this.output = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
// New methods -----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @return the data sent to the output stream
|
||||
*/
|
||||
public byte[] getData()
|
||||
{
|
||||
return output.toByteArray();
|
||||
}
|
||||
|
||||
// Overridden methods ----------------------------------------------------
|
||||
|
||||
/**
|
||||
* @see HttpServletResponseWrapper#getOutputStream()
|
||||
*/
|
||||
public ServletOutputStream getOutputStream()
|
||||
{
|
||||
return new FilterServletOutputStream(this.output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see HttpServletResponseWrapper#setContentLength(int)
|
||||
*/
|
||||
public void setContentLength(int theLength)
|
||||
{
|
||||
this.contentLength = theLength;
|
||||
super.setContentLength(theLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see HttpServletResponseWrapper#getContentLength()
|
||||
*/
|
||||
public int getContentLength()
|
||||
{
|
||||
return this.contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see HttpServletResponseWrapper#setContentType(String)
|
||||
*/
|
||||
public void setContentType(String theType)
|
||||
{
|
||||
this.contentType = theType;
|
||||
super.setContentType(theType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see HttpServletResponseWrapper#getContentType()
|
||||
*/
|
||||
public String getContentType()
|
||||
{
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see HttpServletResponseWrapper#getWriter()
|
||||
*/
|
||||
public PrintWriter getWriter()
|
||||
{
|
||||
return new PrintWriter(getOutputStream(), true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,170 @@
|
||||
package org.apache.maven.cactus.sample;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import javax.servlet.jsp.tagext.BodyContent;
|
||||
import javax.servlet.jsp.tagext.BodyTag;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.cactus.JspTestCase;
|
||||
import org.apache.cactus.WebResponse;
|
||||
|
||||
/**
|
||||
* Tests of the <code>SampleBodyTag</code> class.
|
||||
*
|
||||
* @author <a href="mailto:nick@eblox.com">Nciholas Lesiecki</a>
|
||||
*
|
||||
* @version $Id: TestSampleBodyTag.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
|
||||
*/
|
||||
public class TestSampleBodyTag extends JspTestCase
|
||||
{
|
||||
private SampleBodyTag tag;
|
||||
private BodyContent tagContent;
|
||||
|
||||
/**
|
||||
* Defines the testcase name for JUnit.
|
||||
*
|
||||
* @param theName the testcase's name.
|
||||
*/
|
||||
public TestSampleBodyTag(String theName)
|
||||
{
|
||||
super(theName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the tests.
|
||||
*
|
||||
* @param theArgs the arguments. Not used
|
||||
*/
|
||||
public static void main(String[] theArgs)
|
||||
{
|
||||
junit.swingui.TestRunner.main(
|
||||
new String[] { TestSampleBodyTag.class.getName() });
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a test suite (<code>TestSuite</code>) that includes all methods
|
||||
* starting with "test"
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
// All methods starting with "test" will be executed in the test suite.
|
||||
return new TestSuite(TestSampleBodyTag.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* In addition to creating the tag instance and adding the pageContext to
|
||||
* it, this method creates a BodyContent object and passes it to the tag.
|
||||
*/
|
||||
public void setUp()
|
||||
{
|
||||
this.tag = new SampleBodyTag();
|
||||
this.tag.setPageContext(this.pageContext);
|
||||
|
||||
//create the BodyContent object and call the setter on the tag instance
|
||||
this.tagContent = this.pageContext.pushBody();
|
||||
this.tag.setBodyContent(this.tagContent);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sets the replacement target and replacement String on the tag, then calls
|
||||
* doAfterBody(). Most of the assertion work is done in endReplacement().
|
||||
*/
|
||||
public void testReplacement() throws Exception
|
||||
{
|
||||
//set the target and the String to replace it with
|
||||
this.tag.setTarget("@target@");
|
||||
this.tag.setReplacement("replacement");
|
||||
|
||||
//add the tag's body by writing to the BodyContent object created in
|
||||
//setUp()
|
||||
this.tagContent.println("@target@ is now @target@");
|
||||
this.tagContent.println("@target@_@target@");
|
||||
|
||||
//none of the other life cycle methods need to be implemented, so they
|
||||
//do not need to be called.
|
||||
int result = this.tag.doAfterBody();
|
||||
|
||||
assertEquals(BodyTag.SKIP_BODY, result);
|
||||
}
|
||||
|
||||
public void tearDown()
|
||||
{
|
||||
//necessary for tag to output anything on most servlet engines.
|
||||
this.pageContext.popBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the target String has indeed been replaced in the tag's
|
||||
* body.
|
||||
*/
|
||||
public void endReplacement(WebResponse theResponse)
|
||||
{
|
||||
String content = theResponse.getText();
|
||||
|
||||
assertTrue("Response should have contained the ["
|
||||
+ "replacement is now replacement] string",
|
||||
content.indexOf("replacement is now replacement") > -1);
|
||||
assertTrue("Response should have contained the ["
|
||||
+ "replacement_replacement] string",
|
||||
content.indexOf("replacement") > -1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,259 @@
|
||||
package org.apache.maven.cactus.sample;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.cactus.FilterTestCase;
|
||||
import org.apache.cactus.WebResponse;
|
||||
|
||||
/**
|
||||
* Tests of the <code>SampleFilter</code> filter class.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: TestSampleFilter.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
|
||||
*/
|
||||
public class TestSampleFilter extends FilterTestCase
|
||||
{
|
||||
/**
|
||||
* Defines the testcase name for JUnit.
|
||||
*
|
||||
* @param theName the testcase's name.
|
||||
*/
|
||||
public TestSampleFilter(String theName)
|
||||
{
|
||||
super(theName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the tests.
|
||||
*
|
||||
* @param theArgs the arguments. Not used
|
||||
*/
|
||||
public static void main(String[] theArgs)
|
||||
{
|
||||
junit.swingui.TestRunner.main(
|
||||
new String[] { TestSampleFilter.class.getName() });
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a test suite (<code>TestSuite</code>) that includes all methods
|
||||
* starting with "test"
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
// All methods starting with "test" will be executed in the test suite.
|
||||
return new TestSuite(TestSampleFilter.class);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Test that adding a header to the output stream is working fine when
|
||||
* a header parameter is defined.
|
||||
*
|
||||
* @exception ServletException on test failure
|
||||
* @exception IOException on test failure
|
||||
*/
|
||||
public void testAddHeaderParamOK() throws ServletException, IOException
|
||||
{
|
||||
SampleFilter filter = new SampleFilter();
|
||||
|
||||
config.setInitParameter("header", "<h1>header</h1>");
|
||||
filter.init(config);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
filter.addHeader(baos);
|
||||
|
||||
assertEquals("<h1>header</h1>", baos.toString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Test that adding a header to the output stream is working fine
|
||||
* (i.e. nothing gets written) when no header parameter is defined.
|
||||
*
|
||||
* @exception ServletException on test failure
|
||||
* @exception IOException on test failure
|
||||
*/
|
||||
public void testAddHeaderParamNotDefined() throws ServletException,
|
||||
IOException
|
||||
{
|
||||
SampleFilter filter = new SampleFilter();
|
||||
|
||||
filter.init(config);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
filter.addHeader(baos);
|
||||
|
||||
assertEquals("", baos.toString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Test that adding a footer to the output stream is working fine when
|
||||
* a footer parameter is defined.
|
||||
*
|
||||
* @exception ServletException on test failure
|
||||
* @exception IOException on test failure
|
||||
*/
|
||||
public void testAddFooterParamOK() throws ServletException, IOException
|
||||
{
|
||||
SampleFilter filter = new SampleFilter();
|
||||
|
||||
config.setInitParameter("footer", "<h1>footer</h1>");
|
||||
filter.init(config);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
filter.addFooter(baos);
|
||||
|
||||
assertEquals("<h1>footer</h1>", baos.toString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Test that adding a footer to the output stream is working fine
|
||||
* (i.e. nothing gets written) when no footer parameter is defined.
|
||||
*
|
||||
* @exception ServletException on test failure
|
||||
* @exception IOException on test failure
|
||||
*/
|
||||
public void testAddFooterParamNotDefined() throws ServletException,
|
||||
IOException
|
||||
{
|
||||
SampleFilter filter = new SampleFilter();
|
||||
|
||||
filter.init(config);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
filter.addFooter(baos);
|
||||
|
||||
assertEquals("", baos.toString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Test that the filter does correctly add a header and footer to
|
||||
* any requets it is serving.
|
||||
*
|
||||
* @exception ServletException on test failure
|
||||
* @exception IOException on test failure
|
||||
*/
|
||||
public void testDoFilterOK() throws ServletException, IOException
|
||||
{
|
||||
SampleFilter filter = new SampleFilter();
|
||||
|
||||
config.setInitParameter("header", "<h1>header</h1>");
|
||||
config.setInitParameter("footer", "<h1>footer</h1>");
|
||||
filter.init(config);
|
||||
|
||||
FilterChain mockFilterChain = new FilterChain()
|
||||
{
|
||||
public void doFilter(ServletRequest theRequest,
|
||||
ServletResponse theResponse) throws IOException,
|
||||
ServletException
|
||||
{
|
||||
PrintWriter writer = theResponse.getWriter();
|
||||
|
||||
writer.print("<p>some content</p>");
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public void init(FilterConfig theConfig)
|
||||
{
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
filter.doFilter(request, response, mockFilterChain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the filter does correctly add a header and footer to
|
||||
* any requets it is serving.
|
||||
*
|
||||
* @param theResponse the response from the server side.
|
||||
*/
|
||||
public void endDoFilterOK(WebResponse theResponse)
|
||||
{
|
||||
assertEquals("<h1>header</h1><p>some content</p><h1>footer</h1>",
|
||||
theResponse.getText());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package org.apache.maven.cactus.sample;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import org.apache.cactus.ServletTestCase;
|
||||
import org.apache.cactus.WebRequest;
|
||||
|
||||
public class TestSampleServlet extends ServletTestCase
|
||||
{
|
||||
public TestSampleServlet(String testName)
|
||||
{
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public void testIsAuthenticatedAuthenticated()
|
||||
{
|
||||
SampleServlet servlet = new SampleServlet();
|
||||
|
||||
session.setAttribute("authenticated", "true");
|
||||
|
||||
assertTrue(servlet.isAuthenticated(request));
|
||||
}
|
||||
|
||||
public void testIsAuthenticatedNotAuthenticated()
|
||||
{
|
||||
SampleServlet servlet = new SampleServlet();
|
||||
|
||||
assertTrue(!servlet.isAuthenticated(request));
|
||||
}
|
||||
|
||||
public void beginIsAuthenticatedNoSession(WebRequest request)
|
||||
{
|
||||
request.setAutomaticSession(false);
|
||||
}
|
||||
|
||||
public void testIsAuthenticatedNoSession()
|
||||
{
|
||||
SampleServlet servlet = new SampleServlet();
|
||||
|
||||
assertTrue(!servlet.isAuthenticated(request));
|
||||
}
|
||||
|
||||
}
|
||||
185
cactus/src/plugin-resources/scripts/resin.2x.jelly
Normal file
185
cactus/src/plugin-resources/scripts/resin.2x.jelly
Normal file
@ -0,0 +1,185 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
=============================================================================
|
||||
Script for running Cactus tests in Resin 2.x
|
||||
=============================================================================
|
||||
-->
|
||||
<project xmlns:j="jelly:core">
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Run the Cactus tests in Resin 2.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:test-resin-2x"
|
||||
description="Run the Cactus tests in Resin 2.x">
|
||||
|
||||
<j:set var="home" value="${maven.cactus.resin2x.home}X"/>
|
||||
|
||||
<!-- Verify Resin home is defined -->
|
||||
<j:choose>
|
||||
<j:when test="${home != 'X'}">
|
||||
|
||||
<echo message="maven.cactus.resin2x.home = ${maven.cactus.resin2x.home}"/>
|
||||
|
||||
<attainGoal name="cactus:resin-2x-run"/>
|
||||
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>Property maven.cactus.resin2x.home is not defined</echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Run Resin
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:resin-2x-run" prereqs="cactus:setup-resin-2x"
|
||||
description="Start Resin, run the tests, stop Resin">
|
||||
|
||||
<!-- Start the servlet engine, wait for it to be started, run the
|
||||
unit tests, stop the servlet engine, wait for it to be stopped.
|
||||
The servlet engine is stopped if the tests fail for any reason -->
|
||||
|
||||
<!-- Is Resin 2.x already started? -->
|
||||
<condition property="resin2xstarted">
|
||||
<socket server="localhost" port="${maven.cactus.port}"/>
|
||||
</condition>
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${resin2xstarted == null}">
|
||||
<j:thread>
|
||||
<attainGoal name="cactus:start-resin-2x"/>
|
||||
</j:thread>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<attainGoal name="cactus:redeploy-resin-2x"/>
|
||||
</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}"/>
|
||||
|
||||
<!-- Only stop if the container was not already started -->
|
||||
<j:if test="${resin2xstarted == null}">
|
||||
<attainGoal name="cactus:stop-resin-2x"/>
|
||||
<waitfor checkevery="500">
|
||||
<not>
|
||||
<http url="http://localhost:${maven.cactus.port}/test/ServletRedirector?Cactus_Service=RUN_TEST"/>
|
||||
</not>
|
||||
</waitfor>
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Deploy the test webapp in Resin
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:deploy-resin-2x" prereqs="cactus:webapp"
|
||||
description="Deploy the test webapp in Resin">
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/resin2x/test">
|
||||
<fileset dir="${maven.cactus.build.dir}/${pom.id}"/>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Redeploy the test webapp in Resin by only deploying the files in
|
||||
WEB-INF/classes (it is faster)
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:redeploy-resin-2x" prereqs="cactus:webapp"
|
||||
description="Redeploy the test webapp in Resin">
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/resin2x/test">
|
||||
<fileset dir="${maven.cactus.build.dir}/${pom.id}">
|
||||
<include name="WEB-INF/classes/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Prepare directories and variables for running the tests
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:setup-resin-2x"
|
||||
description="Prepare directories and variables for running the tests">
|
||||
|
||||
<mkdir dir="${maven.cactus.build.dir}/resin2x"/>
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/resin2x" filtering="on">
|
||||
<fileset dir="${maven.cactus.conf.containers.dir}/resin2x"/>
|
||||
<filterset>
|
||||
<filter token="maven.cactus.port" value="${maven.cactus.port}"/>
|
||||
</filterset>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Start Resin 2.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:start-resin-2x"
|
||||
prereqs="cactus:setup-resin-2x,cactus:deploy-resin-2x"
|
||||
description="Starts Resin 2.x">
|
||||
|
||||
<java classname="org.apache.cactus.ant.ResinRun" fork="yes">
|
||||
|
||||
<arg value="-start"/>
|
||||
<arg value="-conf"/>
|
||||
<arg value="resin.conf"/>
|
||||
|
||||
<!-- Needed so that Resin use the resin home variable as it's
|
||||
root directory for resolving file paths -->
|
||||
<jvmarg value="-Dresin.home=${maven.cactus.build.dir}/resin2x"/>
|
||||
|
||||
<classpath>
|
||||
<pathelement location="${plugin.getDependencyPath('cactus:cactus-ant')}"/>
|
||||
<fileset dir="${maven.cactus.resin2x.home}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Stop Resin 2.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:stop-resin-2x"
|
||||
description="Stops a running Resin 2.x">
|
||||
|
||||
<java classname="org.apache.cactus.ant.ResinRun" fork="yes">
|
||||
|
||||
<arg value="-stop"/>
|
||||
|
||||
<classpath>
|
||||
<pathelement location="${plugin.getDependencyPath('cactus:cactus-ant')}"/>
|
||||
<fileset dir="${maven.cactus.resin2x.home}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
198
cactus/src/plugin-resources/scripts/tomcat.4x.jelly
Normal file
198
cactus/src/plugin-resources/scripts/tomcat.4x.jelly
Normal file
@ -0,0 +1,198 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
=============================================================================
|
||||
Script for running Cactus tests in Tomcat 4.x
|
||||
=============================================================================
|
||||
-->
|
||||
<project xmlns:j="jelly:core">
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Run the Cactus tests in Tomcat 4.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:test-tomcat-4x"
|
||||
description="Run the Cactus tests in Tomcat 4.x">
|
||||
|
||||
<j:set var="home" value="${maven.cactus.tomcat4x.home}X"/>
|
||||
|
||||
<!-- Verify Tomcat home is defined -->
|
||||
<j:choose>
|
||||
<j:when test="${home != 'X'}">
|
||||
|
||||
<echo message="maven.cactus.tomcat4x.home = ${maven.cactus.tomcat4x.home}"/>
|
||||
|
||||
<attainGoal name="cactus:tomcat-4x-run"/>
|
||||
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>Property maven.cactus.tomcat4x.home is not defined</echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Run the tests
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:tomcat-4x-run"
|
||||
description="Start Tomcat, run the tests, stop Tomcat">
|
||||
|
||||
<!-- Start the servlet engine, wait for it to be started, run the
|
||||
unit tests, stop the servlet engine, wait for it to be stopped.
|
||||
The servlet engine is stopped if the tests fail for any reason -->
|
||||
|
||||
<!-- Is Tomcat 4.x already started? -->
|
||||
<condition property="tomcat4xstarted">
|
||||
<socket server="localhost" port="${maven.cactus.port}"/>
|
||||
</condition>
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${tomcat4xstarted == null}">
|
||||
<j:thread>
|
||||
<attainGoal name="cactus:start-tomcat-4x"/>
|
||||
</j:thread>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<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}"/>
|
||||
|
||||
<!-- Only stop if the container was not already started -->
|
||||
<j:if test="${tomcat4xstarted == null}">
|
||||
<attainGoal name="cactus:stop-tomcat-4x"/>
|
||||
<waitfor checkevery="500">
|
||||
<not>
|
||||
<http url="http://localhost:${maven.cactus.port}/test/ServletRedirector?Cactus_Service=RUN_TEST"/>
|
||||
</not>
|
||||
</waitfor>
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Deploy the test webapp in Tomcat
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:deploy-tomcat-4x" prereqs="cactus:webapp"
|
||||
description="Deploy the test webapp in Tomcat">
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/tomcat4x/webapps/test">
|
||||
<fileset dir="${maven.cactus.build.dir}/${pom.id}"/>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Redeploy the test webapp in Tomcat by only deploying the files in
|
||||
WEB-INF/classes (it is faster)
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:redeploy-tomcat-4x" prereqs="cactus:webapp"
|
||||
description="Redeploy the test webapp in Tomcat">
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/tomcat4x/webapps/test">
|
||||
<fileset dir="${maven.cactus.build.dir}/${pom.id}">
|
||||
<include name="WEB-INF/classes/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- Ideally we would need to wait until Tomcat has finished reloading
|
||||
the changes. But apart from using the new Manager in Tomcat 4.1.x
|
||||
I don't know how to do that ... Thus ATM there is a risk that
|
||||
Tomcat will not have picked up the changes when the tests
|
||||
run... -->
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Set up a Tomcat directory structure
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:setup-tomcat-4x"
|
||||
description="Set up a Tomcat directory structure">
|
||||
|
||||
<!-- Create work and conf directories and copy configuration files -->
|
||||
<mkdir dir="${maven.cactus.build.dir}/tomcat4x/conf"/>
|
||||
<mkdir dir="${maven.cactus.build.dir}/tomcat4x/webapps"/>
|
||||
|
||||
<!-- Copy Tomcat configuration files, replacing filter tokens -->
|
||||
<copy todir="${maven.cactus.build.dir}/tomcat4x/conf" filtering="on">
|
||||
<fileset dir="${maven.cactus.conf.containers.dir}/tomcat4x"/>
|
||||
<filterset>
|
||||
<filter token="maven.cactus.port" value="${maven.cactus.port}"/>
|
||||
<filter token="maven.cactus.tomcat4x.home"
|
||||
value="${maven.cactus.tomcat4x.home}"/>
|
||||
</filterset>
|
||||
</copy>
|
||||
|
||||
<!-- Copy the Tomcat web.xml - We need to copy this file as it has
|
||||
changed between Tomcat 4.x versions and one version of it doesn't
|
||||
work with another version of Tomcat 4 -->
|
||||
<copy file="${maven.cactus.tomcat4x.home}/conf/web.xml"
|
||||
todir="${maven.cactus.build.dir}/tomcat4x/conf"/>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Start Tomcat 4.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:start-tomcat-4x"
|
||||
prereqs="cactus:setup-tomcat-4x,cactus:deploy-tomcat-4x"
|
||||
description="Starts Tomcat 4.x">
|
||||
|
||||
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
|
||||
|
||||
<jvmarg value="-Dcatalina.home=${maven.cactus.tomcat4x.home}"/>
|
||||
<jvmarg value="-Dcatalina.base=${maven.cactus.build.dir}/tomcat4x"/>
|
||||
|
||||
<arg value="start"/>
|
||||
<classpath>
|
||||
<pathelement path="${java.home}/../lib/tools.jar"/>
|
||||
<fileset dir="${maven.cactus.tomcat4x.home}">
|
||||
<include name="bin/bootstrap.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Stop Tomcat 4.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:stop-tomcat-4x"
|
||||
description="Stops a running Tomcat 4.x">
|
||||
|
||||
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
|
||||
|
||||
<jvmarg value="-Dcatalina.home=${maven.cactus.tomcat4x.home}"/>
|
||||
<jvmarg value="-Dcatalina.base=${maven.cactus.build.dir}/tomcat4x"/>
|
||||
|
||||
<arg value="stop"/>
|
||||
|
||||
<classpath>
|
||||
<fileset dir="${maven.cactus.tomcat4x.home}">
|
||||
<include name="bin/bootstrap.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
207
cactus/src/plugin-resources/scripts/weblogic.7x.jelly
Normal file
207
cactus/src/plugin-resources/scripts/weblogic.7x.jelly
Normal file
@ -0,0 +1,207 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
=============================================================================
|
||||
Script for running Cactus tests in WebLogic 7.x
|
||||
=============================================================================
|
||||
-->
|
||||
<project xmlns:j="jelly:core">
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Run the Cactus tests in WebLogic 7.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:test-weblogic-7x"
|
||||
description="Run the Cactus tests in WebLogic 7.x">
|
||||
|
||||
<j:set var="home" value="${maven.cactus.weblogic7x.home}X"/>
|
||||
|
||||
<!-- Verify Tomcat home is defined -->
|
||||
<j:choose>
|
||||
<j:when test="${home != 'X'}">
|
||||
|
||||
<echo message="maven.cactus.weblogic7x.home = ${maven.cactus.weblogic7x.home}"/>
|
||||
|
||||
<attainGoal name="cactus:weblogic-7x-run"/>
|
||||
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>Property maven.cactus.weblogic7x.home is not defined</echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Run the tests
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:weblogic-7x-run"
|
||||
description="Start WebLogic, run the tests, stop WebLogic">
|
||||
|
||||
<!-- Start the servlet engine, wait for it to be started, run the
|
||||
unit tests, stop the servlet engine, wait for it to be stopped.
|
||||
The servlet engine is stopped if the tests fail for any reason -->
|
||||
|
||||
<!-- Is WebLogic 7.x already started? -->
|
||||
<condition property="weblogic7xstarted">
|
||||
<socket server="localhost" port="${maven.cactus.port}"/>
|
||||
</condition>
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${weblogic7xstarted == null}">
|
||||
<j:thread>
|
||||
<attainGoal name="cactus:start-weblogic-7x"/>
|
||||
</j:thread>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<attainGoal name="cactus:redeploy-weblogic-7x"/>
|
||||
</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}"/>
|
||||
|
||||
<!-- Only stop if the container was not already started -->
|
||||
<j:if test="${weblogic7xstarted == null}">
|
||||
<attainGoal name="cactus:stop-weblogic-7x"/>
|
||||
<waitfor checkevery="500">
|
||||
<not>
|
||||
<http url="http://localhost:${maven.cactus.port}/test/ServletRedirector?Cactus_Service=RUN_TEST"/>
|
||||
</not>
|
||||
</waitfor>
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Deploy the test webapp in WebLogic
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:deploy-weblogic-7x" prereqs="cactus:webapp"
|
||||
description="Deploy the test webapp in WebLogic">
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/weblogic7x/testdomain/applications/test">
|
||||
<fileset dir="${maven.cactus.build.dir}/${pom.id}"/>
|
||||
<!-- Update the war to include the proprietary weblogic.xml config
|
||||
file. -->
|
||||
<fileset dir="${maven.cactus.conf.containers.dir}/weblogic7x">
|
||||
<include name="weblogic.xml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Redeploy the test webapp in WebLogic
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:redeploy-weblogic-7x" prereqs="cactus:webapp"
|
||||
description="Redeploy the test webapp in WebLogic">
|
||||
|
||||
<copy todir="${maven.cactus.build.dir}/tomcat4x/webapps/test">
|
||||
<fileset dir="${maven.cactus.build.dir}/${pom.id}">
|
||||
<include name="WEB-INF/classes/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Set up a WebLogic directory structure
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:setup-weblogic-7x"
|
||||
description="Set up a WebLogic directory structure">
|
||||
|
||||
<mkdir dir="${maven.cactus.build.dir}/weblogic7x/testdomain/applications"/>
|
||||
<mkdir dir="${maven.cactus.build.dir}/weblogic7x/testdomain/testserver"/>
|
||||
|
||||
<!-- Copy WL configuration files -->
|
||||
<copy todir="${maven.cactus.build.dir}/weblogic7x/testdomain"
|
||||
filtering="on">
|
||||
<fileset dir="${maven.cactus.conf.containers.dir}/weblogic7x">
|
||||
<exclude name="SerializedSystemIni.dat"/>
|
||||
<exclude name="DefaultAuthenticatorInit.ldift"/>
|
||||
<exclude name="weblogic.xml"/>
|
||||
</fileset>
|
||||
<filterset>
|
||||
<filter token="maven.cactus.port" value="${maven.cactus.port}"/>
|
||||
<filter token="maven.cactus.weblogic7x.home"
|
||||
value="${maven.cactus.weblogic7x.home}"/>
|
||||
</filterset>
|
||||
</copy>
|
||||
<copy todir="${maven.cactus.build.dir}/weblogic7x/testdomain"
|
||||
filtering="off">
|
||||
<fileset dir="${maven.cactus.conf.containers.dir}/weblogic7x">
|
||||
<include name="SerializedSystemIni.dat"/>
|
||||
<include name="DefaultAuthenticatorInit.ldift"/>
|
||||
<exclude name="weblogic.xml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Start WebLogic 7.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:start-weblogic-7x"
|
||||
prereqs="cactus:setup-weblogic-7x,cactus:deploy-weblogic-7x"
|
||||
description="Starts WebLogic 7.x">
|
||||
|
||||
<java classname="weblogic.Server" fork="yes"
|
||||
dir="${maven.cactus.build.dir}/weblogic7x/testdomain">
|
||||
|
||||
<classpath>
|
||||
<pathelement location="${maven.cactus.weblogic7x.home}/weblogic700/server/lib/weblogic_sp.jar"/>
|
||||
<pathelement location="${maven.cactus.weblogic7x.home}/weblogic700/server/lib/weblogic.jar"/>
|
||||
</classpath>
|
||||
|
||||
<jvmarg value="-hotspot"/>
|
||||
<jvmarg value="-ms64m"/>
|
||||
<jvmarg value="-mx64m"/>
|
||||
<jvmarg value="-Djava.library.path=${java.library.path};${maven.cactus.weblogic7x.home}/weblogic700/server/bin"/>
|
||||
<jvmarg value="-Dweblogic.Name=testserver"/>
|
||||
<jvmarg value="-Dbea.home=${maven.cactus.weblogic7x.home}"/>
|
||||
<jvmarg value="-Dweblogic.management.username=system"/>
|
||||
<jvmarg value="-Dweblogic.management.password=password"/>
|
||||
<jvmarg value="-Djava.security.policy==./server/lib/weblogic.policy"/>
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Stop WebLogic 7.x
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="cactus:stop-weblogic-7x"
|
||||
description="Stops a running WebLogic 7.x">
|
||||
|
||||
<java classname="weblogic.Admin" fork="yes">
|
||||
|
||||
<classpath>
|
||||
<pathelement location="${maven.cactus.weblogic7x.home}/weblogic700/server/lib/weblogic_sp.jar"/>
|
||||
<pathelement location="${maven.cactus.weblogic7x.home}/weblogic700/server/lib/weblogic.jar"/>
|
||||
</classpath>
|
||||
|
||||
<arg line="-url t3://localhost:${maven.cactus.port}"/>
|
||||
<arg line="-username system"/>
|
||||
<arg line="-password password"/>
|
||||
<arg value="SHUTDOWN"/>
|
||||
|
||||
</java>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
1
cactus/xdocs/.cvsignore
Normal file
1
cactus/xdocs/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
stylesheets
|
||||
84
cactus/xdocs/changes.xml
Normal file
84
cactus/xdocs/changes.xml
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="vmassol@octo.com">Vincent Massol</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
|
||||
<release version="1.2" date="in CVS">
|
||||
<action dev="vmassol" type="add">
|
||||
Added Checkstyle report to Cactus plugin web site.
|
||||
</action>
|
||||
<action dev="vmassol" type="fix">
|
||||
The plugin now works even if not connected to the internet.
|
||||
</action>
|
||||
<action dev="vmassol" type="fix" due-to="Eric Pugh" due-to-email="EPugh@upstate.com">
|
||||
Fixed problem when the <code>web.xml</code> of the application to
|
||||
test was defining security configuration. The Cactus was adding its
|
||||
own but the web.xml DTD only supports one. The new implementation
|
||||
discards the application security information which is replaced by
|
||||
the Cactus definition.
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.1" date="2002-11-16">
|
||||
<action dev="vmassol" type="add">
|
||||
Added support for HttpUnit integration out of the box (i.e. the
|
||||
HttpUnit jars are automatically added by the Cactus plugin).
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Ability to exclude Cactus tests (for long running tests for example,
|
||||
in debug period).
|
||||
</action>
|
||||
<action dev="vmassol" type="update">
|
||||
The <code>web.xml</code> elements required for Cactus are now
|
||||
automatically added to the user project <code>web.xml</code>.
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Added support for running the tests using the JUnit Swing Test Runner.
|
||||
Simply create the following Maven property
|
||||
<code>maven.cactus.testrunner = swing</code> to use the Swing Test
|
||||
Runner.
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Added automatic discovery of Cactus Test Cases and ignore test support
|
||||
classes.
|
||||
</action>
|
||||
<action dev="vmassol" type="update">
|
||||
Creation of the project war/webapp is now left to the Maven War plugin.
|
||||
Cactus repackages it by adding the Cactus tests, the Cactus
|
||||
configuration files and the Cactus external jars. Thus, the Cactus
|
||||
plugin now supports the "war:webapp" goal.
|
||||
</action>
|
||||
<action dev="vmassol" type="update">
|
||||
Improved documentation: "news" section on front page and improved
|
||||
"Quick Start" page.
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Support for WebLogic 7.x.
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.0" date="2002-11-06">
|
||||
<action dev="vmassol" type="add">
|
||||
Sample project showing how to use the Cactus plugin.
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Generates HTML reports
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Support for Resin 2.x.
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Support for Tomcat 4.x (supports hot redeploy).
|
||||
</action>
|
||||
<action dev="vmassol" type="add">
|
||||
Creation of the Cactus plugin
|
||||
</action>
|
||||
</release>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
|
||||
51
cactus/xdocs/features.xml
Normal file
51
cactus/xdocs/features.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Features of the Cactus plugin</title>
|
||||
<author email="vmassol@octo.com">Vincent Massol</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Cactus Plug-in Features">
|
||||
<ul>
|
||||
<li>
|
||||
Support for the following containers:
|
||||
<ul>
|
||||
<li>
|
||||
Support for Tomcat 4.x
|
||||
</li>
|
||||
<li>
|
||||
Support for Resin 2.x
|
||||
</li>
|
||||
<li>
|
||||
Support for WebLogic 7.x
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
HTML report generation (integrated with Maven reports).
|
||||
</li>
|
||||
<li>
|
||||
Support for keeping the server running between redeployments.
|
||||
</li>
|
||||
<li>
|
||||
Automatic discovery of Cactus Test Cases and ignore test support
|
||||
classes.
|
||||
</li>
|
||||
<li>
|
||||
Ability to use either the Text or Swing Test Runner for running the
|
||||
Cactus tests.
|
||||
</li>
|
||||
<li>
|
||||
Automatically merge the <code>web.xml</code> elements needed by
|
||||
Cactus to the user project <code>web.xml</code> file.
|
||||
</li>
|
||||
<li>
|
||||
Ability to exclude Cactus tests (for long running tests for example,
|
||||
in debug period).
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
52
cactus/xdocs/goals.xml
Normal file
52
cactus/xdocs/goals.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Maven cactus Plug-in Goals</title>
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
<body>
|
||||
<goals>
|
||||
<goal>
|
||||
<name>cactus:compile</name>
|
||||
<description>Compile Cactus tests</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:generate</name>
|
||||
<description>Generate HTML report</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:init</name>
|
||||
<description>Creates objects useful for several goals</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:merge-webxml</name>
|
||||
<description>Generate a web.xml which is the merge betweem the user project web.xml and the webapp elements needed by Cactus</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:single</name>
|
||||
<description>Execute a single test defined using the 'testcase' variable</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:test-init</name>
|
||||
<description>Test initialization</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:test-swing</name>
|
||||
<description>Start the tests using the swing runner</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:test-text</name>
|
||||
<description>Start the tests using the text runner</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:webapp</name>
|
||||
<description>Create the Cactus webapp</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>cactus:webapp-update</name>
|
||||
<description>Generate an expanded Cactus webapp from a project expanded webapp</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
62
cactus/xdocs/index.xml
Normal file
62
cactus/xdocs/index.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Cactus Plug-in</title>
|
||||
<author email="vmassol@octo.com">Vincent Massol</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Cactus Plug-in">
|
||||
<p>
|
||||
This is a plugin for
|
||||
<a href="http://jakarta.apache.org/cactus">Cactus</a> that
|
||||
allows to automatically start containers, run Cactus tests and stop
|
||||
the containers.
|
||||
</p>
|
||||
<p>
|
||||
Currently, this plugin only supports the Servlet API 2.3.
|
||||
</p>
|
||||
</section>
|
||||
<section name="News">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16 Nov 2002</td>
|
||||
<td>
|
||||
Release of version 1.1.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>06 Nov 2002</td>
|
||||
<td>
|
||||
Release of version 1.0. Read the announcement
|
||||
<a href="http://www.mail-archive.com/turbine-maven-user%40jakarta.apache.org/msg01876.html">here</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section name="Documentation roadmap">
|
||||
<p>
|
||||
Check the <a href="features.html">features</a> page for all features
|
||||
of this plugin.
|
||||
</p>
|
||||
<p>
|
||||
Then, you should read the <a href="using.html">Quick Start</a> page
|
||||
which provides details about how to use the plugin.
|
||||
</p>
|
||||
<p>
|
||||
A sample application using Cactus is packaged within the Cactus plugin.
|
||||
Go to where you installed Maven and look into the
|
||||
<code>plugins/maven-cactus-plugin-*/sample</code> directory.
|
||||
</p>
|
||||
<p>
|
||||
The latest changes are available <a href="changes.html">here</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
22
cactus/xdocs/navigation.xml
Normal file
22
cactus/xdocs/navigation.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven Cactus Plugin">
|
||||
|
||||
<title>Maven Cactus Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="Cactus" href="http://jakarta.apache.org/cactus/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Features" href="/features.html"/>
|
||||
<item name="Quick Start" href="/using.html"/>
|
||||
<item name="Goals" href="/goals.html"/>
|
||||
<item name="Properties" href="/properties.html"/>
|
||||
</menu>
|
||||
<menu name="Downloads">
|
||||
<item name="Cactus Plugin 1.0" href="http://www.ibiblio.org/maven/maven/jars/maven-cactus-plugin-1.0.jar"/>
|
||||
<item name="Cactus Plugin 1.1" href="http://www.ibiblio.org/maven/maven/jars/maven-cactus-plugin-1.1.jar"/>
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
164
cactus/xdocs/properties.xml
Normal file
164
cactus/xdocs/properties.xml
Normal file
@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>cactus Properties</title>
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="cactus Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.test.fileset.exclude</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>
|
||||
</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.testrunner.swing.excluded</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/conf/excluded.properties</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.build.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.build.dir}/cactus</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.src.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>src/test-cactus</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.classes.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.cactus.build.dir}/classes</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.scripts.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/scripts</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.webxml.dvsl</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/conf/web.xml.dvsl</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.test.reportsDirectory</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.cactus.build.dir}/test-reports</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.build.resources.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.cactus.build.dir}/resources</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.jspRedirector</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/conf/web/jspRedirector.jsp</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.configFile</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/conf/cactus.properties</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.junit.usefile</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>true</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.test.fileset.include</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>**/*.class</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.prewar.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.war.build.dir}</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.emptywebxml</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/conf/web.xml</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.port</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>8080</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.conf.containers.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${plugin.dir}/conf/containers</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.cactus.testrunner</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>text</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
52
cactus/xdocs/tasks.xml
Normal file
52
cactus/xdocs/tasks.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Tasks</title>
|
||||
<author email="vmassol@octo.com">Vincent Massol</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Tasks">
|
||||
<p>
|
||||
Lists of todos and ideas for future versions.
|
||||
</p>
|
||||
|
||||
<subsection name="Unassigned">
|
||||
<p>
|
||||
<ul>
|
||||
<li>
|
||||
Describe plugin properties in the Maven plugin documentation.
|
||||
</li>
|
||||
<li>
|
||||
Fix the "single" goal as it will not really work because it
|
||||
expects that the cactus war has been deployed and it won't
|
||||
redeploy it when the code changes.
|
||||
</li>
|
||||
<li>
|
||||
Transform cactus Ant scripts to Jelly scripts for :
|
||||
Tomcat 3.x, Orion 1.5, Orion 1.6, WebLogic 6.x,
|
||||
Enhydra 5.x
|
||||
</li>
|
||||
<li>
|
||||
Add more scripts for JBoss/Jonas/Jetty.
|
||||
</li>
|
||||
<li>
|
||||
Add a <code>test-all</code> goal that runs the tests on all
|
||||
defined containers.
|
||||
</li>
|
||||
<li>
|
||||
Support packaging as an EAR for EJB unit testing. Requires the
|
||||
EAR plugin first.
|
||||
</li>
|
||||
<li>
|
||||
Add the rhino jar for HttpUnit javascript support.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
68
cactus/xdocs/using.xml
Normal file
68
cactus/xdocs/using.xml
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Using the Maven Cactus Plug-in</title>
|
||||
<author email="vmassol@octo.com">Vincent Massol</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Using the Maven Cactus Plug-in">
|
||||
<ol>
|
||||
<li>
|
||||
Create a <code>src/test-cactus</code> directory in your project and
|
||||
put your Cactus test classes in it (with the normal package directory
|
||||
structure). Note that the location of the Cactus test sources can be
|
||||
configured through the <code>maven.cactus.src.dir</code> property.
|
||||
</li>
|
||||
<li>
|
||||
Create a <code>build.properties</code> file in your project root
|
||||
directory (where <code>project.xml</code> is located) and define in
|
||||
it the location of the container you wish to use for the tests. For
|
||||
example, if you wish to run the Cactus tests on Tomcat 4.1.10 and on
|
||||
Resin 2.4, you will write:
|
||||
</li>
|
||||
|
||||
<source><![CDATA[
|
||||
maven.cactus.tomcat4x.home = C:/Apps/jakarta-tomcat-4.1.10
|
||||
maven.cactus.resin2x.home = C:/Apps/resin-2.1.4
|
||||
]]></source>
|
||||
|
||||
<li>
|
||||
Call the
|
||||
<a href="http://jakarta.apache.org/turbine/maven/reference/plugins/war/index.html">War</a>
|
||||
plugin's goals to generate a war for your webapp. For example:
|
||||
<code>maven war</code>. Note that in the future you would also be
|
||||
able to call the Ear plugin if your application is an EAR.
|
||||
</li>
|
||||
<li>
|
||||
Then, simply run the Cactus goal for your container. For example,
|
||||
type <code>maven cactus:test-tomcat-4x</code> to run the tests with
|
||||
Tomcat 4.x. You can type <code>maven -g</code> for a full list of the
|
||||
available goals.
|
||||
</li>
|
||||
<li>
|
||||
If you wish to generate Cactus HTML test reports, type
|
||||
<code>maven cactus:generate site</code>.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
The plugin will automatically add what is needed for the Cactus tests
|
||||
to your application WAR/webapp by repackaging it. In detail, it will
|
||||
add the Cactus test classes, Cactus configuration files and Cactus jars
|
||||
to your WAR/webapp. It will then deploy it, configure the container you
|
||||
have chosen, start it, run the Cactus tests and stop the container.
|
||||
</p>
|
||||
<p>
|
||||
It is possible (and recommended for performance reasons) to run all the
|
||||
goals in one Maven invocation. For example:
|
||||
<code>maven war cactus:test-tomcat-4x cactus:generate site</code>. You
|
||||
can also put that sequence in your project's <code>maven.xml</code>
|
||||
file.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
3
castor/.cvsignore
Normal file
3
castor/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
26
castor/plugin.jelly
Normal file
26
castor/plugin.jelly
Normal file
@ -0,0 +1,26 @@
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:define="jelly:define"
|
||||
xmlns:castor="castor">
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- C A S T O R -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<define:taglib uri="castor">
|
||||
<define:tag name="srcgen">
|
||||
<java
|
||||
className="org.exolab.castor.builder.SourceGenerator"
|
||||
failonerror="true">
|
||||
|
||||
<arg value="-i${schema}"/>
|
||||
<arg value="-f"/>
|
||||
<arg value="-package${package}"/>
|
||||
<arg value="-types${types}"/>
|
||||
<arg value="-nomarshall"/>
|
||||
<arg value="-dest${generationDirectory}"/>
|
||||
</java>
|
||||
</define:tag>
|
||||
</define:taglib>
|
||||
|
||||
</project>
|
||||
10
castor/plugin.properties
Normal file
10
castor/plugin.properties
Normal file
@ -0,0 +1,10 @@
|
||||
# -------------------------------------------------------------------
|
||||
# Default Maven properties for the VDoclet plugin.
|
||||
# -------------------------------------------------------------------
|
||||
# These are the properties that we believe are immutable so we
|
||||
# keep them apart from the project specific properties.
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
maven.vdoclet.srcDir = NOT_SET
|
||||
maven.vdoclet.destDir = NOT_SET
|
||||
maven.vdoclet.template = NOT_SET
|
||||
3
castor/project.properties
Normal file
3
castor/project.properties
Normal file
@ -0,0 +1,3 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
46
castor/project.xml
Normal file
46
castor/project.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-castor-plugin</id>
|
||||
<name>Maven Castor Plug-in</name>
|
||||
<currentVersion>1.0</currentVersion>
|
||||
|
||||
<description>
|
||||
Various goals for making development with Plexus easy.
|
||||
</description>
|
||||
|
||||
<shortDescription>Plexus Tools</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/castor/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/castor/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Jason van Zyl</name>
|
||||
<id>jvanzyl</id>
|
||||
<email>jason@zenplex.com</email>
|
||||
<organization>Zenplex</organization>
|
||||
<roles>
|
||||
<role>Architect</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<id>castor</id>
|
||||
<version>0.9.4</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
1
castor/xdocs/.cvsignore
Normal file
1
castor/xdocs/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
stylesheets
|
||||
16
castor/xdocs/changes.xml
Normal file
16
castor/xdocs/changes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="jason@zenplex.com">Jason van Zyl</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<release version="1.0" date="2002-08-04">
|
||||
<action dev="jvanzyl" type="add">
|
||||
Original release for Maven 1.0-beta8
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
20
castor/xdocs/goals.xml
Normal file
20
castor/xdocs/goals.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Castor Plug-in Goals</title>
|
||||
<author email="jason@zenplex.com">Jason van Zyl</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<goals>
|
||||
<goal>
|
||||
<name>castor:srcgen</name>
|
||||
<description>
|
||||
For a given project generate a plexus runtime using the required
|
||||
components.
|
||||
</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
16
castor/xdocs/index.xml
Normal file
16
castor/xdocs/index.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Castor Plug-in</title>
|
||||
<author email="jason@zenplex.com">Jason van Zyl</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Castor Plug-in">
|
||||
<p>
|
||||
A plugin that currently just sets up castor for use in Jelly
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
castor/xdocs/navigation.xml
Normal file
16
castor/xdocs/navigation.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven Castor Plugin">
|
||||
|
||||
<title>Maven Castor Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="Castor" href="http://castor.exolab.org/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
25
castor/xdocs/properties.xml
Normal file
25
castor/xdocs/properties.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Castor Plugin Properties</title>
|
||||
<author email="jason@zenplex.com">Jason van Zyl</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Castor Plugin Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
3
changelog/.cvsignore
Normal file
3
changelog/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
63
changelog/plugin.jelly
Normal file
63
changelog/plugin.jelly
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:define="jelly:define"
|
||||
xmlns:changelog="changelog"
|
||||
xmlns:doc="doc">
|
||||
|
||||
<define:taglib uri="changelog">
|
||||
<define:jellybean
|
||||
name="changelog"
|
||||
className="org.apache.maven.changelog.ChangeLog"
|
||||
method="doExecute"
|
||||
/>
|
||||
</define:taglib>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- C H A N G E L O G R E P O R T -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<goal
|
||||
name="maven-changelog-plugin:report"
|
||||
description="Generate a changelog report">
|
||||
|
||||
<j:if test="${context.getVariable('maven.mode.online') == null}">
|
||||
<j:set var="maven.mode.online" value="true"/>
|
||||
</j:if>
|
||||
<j:choose>
|
||||
<j:when test="${maven.mode.online}">
|
||||
<j:set var="_connection">${pom.repository.connection}</j:set>
|
||||
<j:if test="${!empty(_connection)}">
|
||||
<echo>Generating the changelog report</echo>
|
||||
<mkdir dir="${maven.gen.docs}"/>
|
||||
|
||||
<changelog:changelog
|
||||
basedir="${basedir}"
|
||||
developers="${pom.developers}"
|
||||
factory="${maven.changelog.factory}"
|
||||
output="${maven.build.dir}/changelog.xml"
|
||||
outputEncoding="${maven.docs.outputencoding}"
|
||||
range="${maven.changelog.range}"
|
||||
repositoryConnection="${pom.repository.connection}"
|
||||
/>
|
||||
|
||||
<doc:jsl
|
||||
input="${maven.build.dir}/changelog.xml"
|
||||
output="changelog-report.xml"
|
||||
stylesheet="${plugin.resources}/changelog.jsl"
|
||||
encoding="${maven.docs.outputencoding}"
|
||||
omitXmlDeclaration="false"
|
||||
outputMode="xml"
|
||||
prettyPrint="true"
|
||||
/>
|
||||
|
||||
</j:if>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>The Changelog is available in the online mode only.</echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
</project>
|
||||
13
changelog/plugin.properties
Normal file
13
changelog/plugin.properties
Normal file
@ -0,0 +1,13 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P L U G I N P R O P E R I E S
|
||||
# -------------------------------------------------------------------
|
||||
# CVS change log plugin.
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
# These three don't belong here.
|
||||
maven.build.dir = ${basedir}/target
|
||||
maven.gen.docs = ${maven.build.dir}/generated-xdocs
|
||||
maven.docs.outputencoding = ISO-8859-1
|
||||
|
||||
maven.changelog.range = 30
|
||||
maven.changelog.factory = org.apache.maven.cvslib.CvsChangeLogFactory
|
||||
5
changelog/project.properties
Normal file
5
changelog/project.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
120
changelog/project.xml
Normal file
120
changelog/project.xml
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-changelog-plugin</id>
|
||||
<name>Maven Changelog Plug-in</name>
|
||||
<currentVersion>1.2-SNAPSHOT</currentVersion>
|
||||
|
||||
<description>
|
||||
</description>
|
||||
|
||||
<shortDescription>Java Project Management Tools</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/changelog/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/changelog/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@multitask.com.au</email>
|
||||
<organization>Multitask Consulting</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
<role>Documentation</role>
|
||||
</roles>
|
||||
</developer>
|
||||
|
||||
<developer>
|
||||
<name>Pete Kazmier</name>
|
||||
<id>kaz</id>
|
||||
<email>pete-apache-dev@kazmier.com</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Documentation</role>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
|
||||
<developer>
|
||||
<name>Emmanuel Venisse</name>
|
||||
<id>evenisse</id>
|
||||
<email>evenisse@ifrance.com</email>
|
||||
<organization>Fi System</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
|
||||
<developer>
|
||||
<name>Jason van Zyl</name>
|
||||
<id>jvanzyl</id>
|
||||
<email>jason@zenplex.com</email>
|
||||
<organization>Zenplex</organization>
|
||||
<roles>
|
||||
<role>Architect</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<id>ant</id>
|
||||
<version>1.5.1</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-jelly+tags-jsl</id>
|
||||
<version>SNAPSHOT</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-xml</artifactId>
|
||||
<version>SNAPSHOT</version>
|
||||
<url>http://jakarta.apache.org/commons/sandbox/jelly/tags/xml/</url>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-logging</id>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>junit</id>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>regexp</id>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Required because of the Developer class -->
|
||||
<dependency>
|
||||
<id>maven</id>
|
||||
<version>b5</version>
|
||||
<jar>maven.jar</jar>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -0,0 +1,341 @@
|
||||
package org.apache.maven.changelog;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
// maven imports
|
||||
import org.apache.maven.util.AsyncStreamReader;
|
||||
// commons imports
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
// ant imports
|
||||
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
|
||||
import org.apache.tools.ant.taskdefs.Execute;
|
||||
import org.apache.tools.ant.types.Commandline;
|
||||
|
||||
/**
|
||||
* An abstract implementation of the {@link org.apache.maven.changelog.ChangeLog}
|
||||
* interface.
|
||||
*
|
||||
* @author Glenn McAllister
|
||||
* @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a>
|
||||
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
|
||||
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
|
||||
* @author <a href="mailto:bodewig@apache.org">Stefan Bodewig</a>
|
||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
|
||||
* @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
|
||||
* @version
|
||||
* $Id: AbstractChangeLogGenerator.java,v 1.1 2003/01/24 03:44:50 jvanzyl Exp $
|
||||
*/
|
||||
public abstract class AbstractChangeLogGenerator
|
||||
implements ChangeLogGenerator, ExecuteStreamHandler
|
||||
{
|
||||
/**
|
||||
* The working directory.
|
||||
*/
|
||||
protected File base;
|
||||
|
||||
/**
|
||||
* Reference to the enclosing ChangeLog instance - used to obtain
|
||||
* any necessary configuration information.
|
||||
*/
|
||||
protected ChangeLog changeLogExecutor;
|
||||
|
||||
/**
|
||||
* The parser that takes the log output and transforms it into a
|
||||
* collection of ChangeLogEntry's.
|
||||
*/
|
||||
protected ChangeLogParser clParser;
|
||||
|
||||
/** The connection string from the project */
|
||||
private String connection;
|
||||
|
||||
/**
|
||||
* The date range.
|
||||
*/
|
||||
protected String dateRange;
|
||||
|
||||
/**
|
||||
* The collection of ChangeLogEntry's returned from clParser.
|
||||
*/
|
||||
protected Collection entries;
|
||||
|
||||
/**
|
||||
* Stderr stream eater.
|
||||
*/
|
||||
protected AsyncStreamReader errorReader;
|
||||
|
||||
/**
|
||||
* The scm process input stream.
|
||||
*/
|
||||
protected InputStream in;
|
||||
|
||||
/** Log */
|
||||
private static final Log LOG = LogFactory.getLog(
|
||||
AbstractChangeLogGenerator.class);
|
||||
|
||||
/**
|
||||
* Initialize the generator from the changelog controller.
|
||||
*
|
||||
* @param changeLog The invoking controller (useful for logging)
|
||||
* @see ChangeLogGenerator#init(ChangeLog)
|
||||
*/
|
||||
public void init(ChangeLog changeLog)
|
||||
{
|
||||
changeLogExecutor = changeLog;
|
||||
|
||||
base = changeLogExecutor.getBasedir();
|
||||
|
||||
// This lets the user 'not' set a limit on the log command. We
|
||||
// need this cuz Subversion doesn't currently support date
|
||||
// commands on web-based repositories, so it would be nice to
|
||||
// let the user still use the changelog plugin.
|
||||
if (changeLogExecutor.getRange() != null &&
|
||||
changeLogExecutor.getRange().length() != 0)
|
||||
{
|
||||
setDateRange(changeLogExecutor.getRange());
|
||||
}
|
||||
|
||||
setConnection(changeLogExecutor.getRepositoryConnection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dateRange member based on the number of days obtained
|
||||
* from the ChangeLog.
|
||||
*
|
||||
* @param numDaysString The number of days of log output to
|
||||
* generate.
|
||||
*/
|
||||
protected void setDateRange(String numDaysString)
|
||||
{
|
||||
int days = Integer.parseInt(numDaysString);
|
||||
|
||||
Date before = new Date(
|
||||
System.currentTimeMillis() - (long) days * 24 * 60 * 60 * 1000);
|
||||
Date to = new Date(
|
||||
System.currentTimeMillis() + (long) 1 * 24 * 60 * 60 * 1000);
|
||||
|
||||
dateRange = getScmDateArgument(before, to);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute scm client driving the given parser.
|
||||
*
|
||||
* @param parser A {@link ChangeLogParser parser} to process the scm
|
||||
* output.
|
||||
* @return A collection of {@link ChangeLogEntry entries} parsed from
|
||||
* the scm output.
|
||||
* @throws IOException When there are issues executing scm.
|
||||
* @see ChangeLogGenerator#getEntries(ChangeLogParser)
|
||||
*/
|
||||
public Collection getEntries(ChangeLogParser parser) throws IOException
|
||||
{
|
||||
if (parser == null)
|
||||
{
|
||||
throw new NullPointerException("parser cannot be null");
|
||||
}
|
||||
|
||||
if (base == null)
|
||||
{
|
||||
throw new NullPointerException("basedir must be set");
|
||||
}
|
||||
|
||||
if (!base.exists())
|
||||
{
|
||||
throw new FileNotFoundException(
|
||||
"Cannot find base dir " + base.getAbsolutePath());
|
||||
}
|
||||
|
||||
clParser = parser;
|
||||
try
|
||||
{
|
||||
Execute exe = new Execute(this);
|
||||
exe.setCommandline(getScmLogCommand().getCommandline());
|
||||
exe.setWorkingDirectory(base);
|
||||
exe.execute();
|
||||
|
||||
// log messages from stderr
|
||||
String errors = errorReader.toString().trim();
|
||||
if (errors.length() > 0)
|
||||
{
|
||||
LOG.error(errors);
|
||||
}
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
handleParserException(ioe);
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle ChangeLogParser IOExceptions. The default implementation
|
||||
* just throws the exception again.
|
||||
*
|
||||
* @param ioe The IOException thrown.
|
||||
* @throws IOException If the handler doesn't wish to handle the
|
||||
* exception (the default behavior).
|
||||
*/
|
||||
protected void handleParserException(IOException ioe)
|
||||
throws IOException
|
||||
{
|
||||
throw ioe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up any generated resources for this run.
|
||||
*
|
||||
* @see ChangeLogGenerator#cleanup()
|
||||
*/
|
||||
public void cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the appropriate command line to execute the scm's
|
||||
* log command. This method must be implemented by subclasses.
|
||||
*
|
||||
* @return The command line to be executed.
|
||||
*/
|
||||
protected abstract Commandline getScmLogCommand();
|
||||
|
||||
/**
|
||||
* Construct the command-line argument that is passed to the scm
|
||||
* client to specify the appropriate date range.
|
||||
*
|
||||
* @param before The starting point.
|
||||
* @param to The ending point.
|
||||
* @return A string that can be used to specify a date to a scm
|
||||
* system.
|
||||
*/
|
||||
protected abstract String getScmDateArgument(Date before, Date to);
|
||||
|
||||
/**
|
||||
* Stop the process - currently unimplemented
|
||||
*/
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input stream for the scm process.
|
||||
* @param os An {@link java.io.OutputStream}
|
||||
*/
|
||||
public void setProcessInputStream(OutputStream os)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error stream for reading from scm log. This stream will
|
||||
* be read on a separate thread.
|
||||
*
|
||||
* @param is An {@link java.io.InputStream}
|
||||
*/
|
||||
public void setProcessErrorStream(InputStream is)
|
||||
{
|
||||
errorReader = new AsyncStreamReader(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input stream used to read from scm log.
|
||||
*
|
||||
* @param is A stream of scm log output to be read from
|
||||
*/
|
||||
public void setProcessOutputStream(InputStream is)
|
||||
{
|
||||
in = is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start read from the scm log.
|
||||
*
|
||||
* @throws IOException When there are errors reading from the
|
||||
* streams previously provided
|
||||
*/
|
||||
public void start() throws IOException
|
||||
{
|
||||
errorReader.start();
|
||||
entries = clParser.parse(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the connection.
|
||||
* @return String
|
||||
*/
|
||||
public String getConnection()
|
||||
{
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the connection.
|
||||
* @param connection The connection to set
|
||||
*/
|
||||
public void setConnection(String connection)
|
||||
{
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
}
|
||||
424
changelog/src/main/org/apache/maven/changelog/ChangeLog.java
Normal file
424
changelog/src/main/org/apache/maven/changelog/ChangeLog.java
Normal file
@ -0,0 +1,424 @@
|
||||
package org.apache.maven.changelog;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
// java imports
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
// commons imports
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
// maven imports
|
||||
import org.apache.maven.project.Developer;
|
||||
|
||||
/**
|
||||
* Change log task. It uses a ChangeLogGenerator and ChangeLogParser to create
|
||||
* a Collection of ChangeLogEntry objects, which are used to produce an XML
|
||||
* output that represents the list of changes.
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:glenn@somanetworks.com">Glenn McAllister</a>
|
||||
* @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a>
|
||||
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
|
||||
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
|
||||
* @author <a href="mailto:bodewig@apache.org">Stefan Bodewig</a>
|
||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
|
||||
* @version $Id: ChangeLog.java,v 1.1 2003/01/24 03:44:52 jvanzyl Exp $
|
||||
*/
|
||||
public class ChangeLog
|
||||
{
|
||||
/**
|
||||
* Used to specify the range of log entries to retrieve.
|
||||
*/
|
||||
private String range;
|
||||
|
||||
/**
|
||||
* Input dir. Working directory for running CVS executable
|
||||
*/
|
||||
private File base;
|
||||
|
||||
/**
|
||||
* The classname of our ChangeLogFactory, defaulting to Maven's built in
|
||||
* CVS factory.
|
||||
*/
|
||||
private String clFactoryClass =
|
||||
"org.apache.maven.cvslib.CvsChangeLogFactory";
|
||||
|
||||
/** the connection string used to access the SCM */
|
||||
private String connection;
|
||||
|
||||
/** the list of developers on the project */
|
||||
private List developers;
|
||||
|
||||
/** change log entries parsed */
|
||||
private Collection entries;
|
||||
|
||||
/** Log */
|
||||
private static final Log LOG = LogFactory.getLog(ChangeLog.class);
|
||||
|
||||
/**
|
||||
* Output file for xml document
|
||||
*/
|
||||
private File output;
|
||||
|
||||
/** output encoding for the xml document */
|
||||
private String outputEncoding;
|
||||
|
||||
/**
|
||||
* Set the ChangeLogFactory class name. If this isn't set, the factory
|
||||
* defaults to Maven's build in CVS factory.
|
||||
*
|
||||
* @param factoryClassName the fully qualified factory class name
|
||||
*/
|
||||
public void setFactory(String factoryClassName)
|
||||
{
|
||||
clFactoryClass = factoryClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the range of log entries to process; the interpretation of this
|
||||
* parameter depends on the generator.
|
||||
*
|
||||
* @param range the range of log entries.
|
||||
*/
|
||||
public void setRange(String range)
|
||||
{
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the range of log entries to process; the interpretation of the range
|
||||
* depends on the generator implementation.
|
||||
*
|
||||
* @return the range of log entries.
|
||||
*/
|
||||
public String getRange()
|
||||
{
|
||||
return range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base directory for the change log generator.
|
||||
* @param base the base directory
|
||||
*/
|
||||
public void setBasedir(File base)
|
||||
{
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base directory for the change log generator.
|
||||
*
|
||||
* @return the base directory
|
||||
*/
|
||||
public File getBasedir()
|
||||
{
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output file for the log.
|
||||
* @param output the output file
|
||||
*/
|
||||
public void setOutput(File output)
|
||||
{
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return connection string declared in project.xml
|
||||
* @return connection string
|
||||
*/
|
||||
public String getRepositoryConnection()
|
||||
{
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change SCM connection string
|
||||
* @param aString a string containing the project's repository
|
||||
* connection
|
||||
*/
|
||||
public void setRepositoryConnection(String aString)
|
||||
{
|
||||
connection = aString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute task.
|
||||
* @throws FileNotFoundException if {@link ChangeLog#base} doesn't exist
|
||||
* @throws IOException if there are problems running CVS
|
||||
* @throws UnsupportedEncodingException if the underlying platform doesn't
|
||||
* support ISO-8859-1 encoding
|
||||
*/
|
||||
public void doExecute() throws FileNotFoundException, IOException,
|
||||
UnsupportedEncodingException
|
||||
{
|
||||
if (output == null)
|
||||
{
|
||||
throw new NullPointerException("output must be set");
|
||||
}
|
||||
|
||||
generateEntries();
|
||||
replaceAuthorIdWithName();
|
||||
createDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the change log entries.
|
||||
* @throws IOException if there is a problem creating the change log
|
||||
* entries.
|
||||
*/
|
||||
private void generateEntries() throws IOException
|
||||
{
|
||||
ChangeLogFactory factory = createFactory();
|
||||
ChangeLogGenerator generator = factory.createGenerator();
|
||||
ChangeLogParser parser = factory.createParser();
|
||||
|
||||
generator.init(this);
|
||||
parser.init(this);
|
||||
|
||||
try
|
||||
{
|
||||
setEntries(generator.getEntries(parser));
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("ChangeLog found: " + getEntries().size()
|
||||
+ " entries");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
parser.cleanup();
|
||||
generator.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the ChangeLogFactory specified by the
|
||||
* <code>clFactory</code> member.
|
||||
*
|
||||
* @return the new ChangeLogFactory instance
|
||||
* @throws IOException if there is a problem creating the instance.
|
||||
*/
|
||||
private ChangeLogFactory createFactory() throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
Class clazz = Class.forName(clFactoryClass);
|
||||
return (ChangeLogFactory) clazz.newInstance();
|
||||
}
|
||||
catch (ClassNotFoundException cnfe)
|
||||
{
|
||||
throw new IOException("Cannot find class " + clFactoryClass
|
||||
+ " " + cnfe.toString());
|
||||
}
|
||||
catch (IllegalAccessException iae)
|
||||
{
|
||||
throw new IOException("Cannot access class " + clFactoryClass
|
||||
+ " " + iae.toString());
|
||||
}
|
||||
catch (InstantiationException ie)
|
||||
{
|
||||
throw new IOException("Cannot instantiate class " + clFactoryClass
|
||||
+ " " + ie.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up list of developers mapping id to name.
|
||||
* @task This should be a facility on the maven project itself
|
||||
* @return a list of developers ids and names
|
||||
*/
|
||||
private Properties getUserList()
|
||||
{
|
||||
Properties userList = new Properties();
|
||||
|
||||
Developer developer = null;
|
||||
for (Iterator i = getDevelopers().iterator(); i.hasNext();)
|
||||
{
|
||||
developer = (Developer) i.next();
|
||||
userList.put(developer.getId(), developer.getName());
|
||||
}
|
||||
|
||||
return userList;
|
||||
}
|
||||
|
||||
/**
|
||||
* replace all known author's id's with their maven specified names
|
||||
*/
|
||||
private void replaceAuthorIdWithName()
|
||||
{
|
||||
Properties userList = getUserList();
|
||||
ChangeLogEntry entry = null;
|
||||
for (Iterator i = getEntries().iterator(); i.hasNext();)
|
||||
{
|
||||
entry = (ChangeLogEntry) i.next();
|
||||
if (userList.containsKey(entry.getAuthor()))
|
||||
{
|
||||
entry.setAuthor(userList.getProperty(entry.getAuthor()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the XML document from the currently available details
|
||||
* @throws FileNotFoundException when the output file previously provided
|
||||
* does not exist
|
||||
* @throws UnsupportedEncodingException when the platform doesn't support
|
||||
* ISO-8859-1 encoding
|
||||
*/
|
||||
private void createDocument() throws FileNotFoundException,
|
||||
UnsupportedEncodingException
|
||||
{
|
||||
|
||||
PrintWriter out = new PrintWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(output), getOutputEncoding()));
|
||||
out.println(toXML());
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an XML document representing this change log and it's entries
|
||||
*/
|
||||
private String toXML()
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("<?xml version=\"1.0\" encoding=\"")
|
||||
.append(getOutputEncoding())
|
||||
.append("\" ?>\n")
|
||||
.append("<changelog>\n");
|
||||
|
||||
for (Iterator i = getEntries().iterator(); i.hasNext();)
|
||||
{
|
||||
buffer.append(((ChangeLogEntry) i.next()).toXML());
|
||||
}
|
||||
|
||||
buffer.append("</changelog>\n");
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for property entries.
|
||||
* @return Value of property entries.
|
||||
*/
|
||||
public Collection getEntries()
|
||||
{
|
||||
if (entries == null)
|
||||
{
|
||||
entries = Arrays.asList(new Object[0]);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for property entries.
|
||||
* @param entries New value of property entries.
|
||||
*/
|
||||
public void setEntries(Collection entries)
|
||||
{
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the developers.
|
||||
* @return List
|
||||
*/
|
||||
public List getDevelopers()
|
||||
{
|
||||
return developers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the developers.
|
||||
* @param developers The developers to set
|
||||
*/
|
||||
public void setDevelopers(List developers)
|
||||
{
|
||||
this.developers = developers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the outputEncoding.
|
||||
* @return String
|
||||
*/
|
||||
public String getOutputEncoding()
|
||||
{
|
||||
return outputEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the outputEncoding.
|
||||
* @param outputEncoding The outputEncoding to set
|
||||
*/
|
||||
public void setOutputEncoding(String outputEncoding)
|
||||
{
|
||||
this.outputEncoding = outputEncoding;
|
||||
}
|
||||
|
||||
} // end of ChangeLog
|
||||
@ -0,0 +1,282 @@
|
||||
package org.apache.maven.changelog;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Change Log Entry - holds details about revisions to a file.
|
||||
*
|
||||
* @task add time of change to the entry
|
||||
* @task investigate betwixt for toXML method
|
||||
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
|
||||
* @version $Id: ChangeLogEntry.java,v 1.1 2003/01/24 03:44:51 jvanzyl Exp $
|
||||
*/
|
||||
public class ChangeLogEntry
|
||||
{
|
||||
/**
|
||||
* Formatter used by the getDateFormatted method.
|
||||
*/
|
||||
private static final SimpleDateFormat DATE_FORMAT =
|
||||
new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
/**
|
||||
* Formatter used by the getTimeFormatted method.
|
||||
*/
|
||||
private static final SimpleDateFormat TIME_FORMAT =
|
||||
new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
/**
|
||||
* Formatter used to parse CVS date/timestamp.
|
||||
*/
|
||||
private static final SimpleDateFormat CVS_TIMESTAMP_FORMAT =
|
||||
new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||
|
||||
/** Date the changes were committed */
|
||||
private Date date;
|
||||
|
||||
/** User who made changes */
|
||||
private String author;
|
||||
|
||||
/** comment provided at commit time */
|
||||
private String comment = "";
|
||||
|
||||
/** ChangeLogFiles committed on the date, by the author, with comment*/
|
||||
private Vector files = new Vector();
|
||||
|
||||
/**
|
||||
* Constructor for the Entry object
|
||||
*
|
||||
* @param date the date of the change
|
||||
* @param author who made the change
|
||||
* @param comment the commit comments for the change
|
||||
*/
|
||||
public ChangeLogEntry(String date, String author, String comment)
|
||||
{
|
||||
setDate(date);
|
||||
setAuthor(author);
|
||||
setComment(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used when attributes aren't available until later
|
||||
*/
|
||||
public ChangeLogEntry()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a file to the list for this entry
|
||||
* @param file a {@link ChangeLogFile}
|
||||
*/
|
||||
public void addFile(ChangeLogFile file)
|
||||
{
|
||||
files.addElement(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a feature to the File attribute of the Entry object.
|
||||
* @param file the file name committed
|
||||
* @param revision the revision of the latest change
|
||||
*/
|
||||
public void addFile(String file, String revision)
|
||||
{
|
||||
files.addElement(new ChangeLogFile(file, revision));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a string representation of the entry
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return author + "\n" + date + "\n" + files + "\n" + comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide the changelog entry as an XML snippet.
|
||||
*
|
||||
* @task make sure comment doesn't contain CDATA tags - MAVEN114
|
||||
* @return a changelog-entry in xml format
|
||||
*/
|
||||
public String toXML()
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
buffer.append("\t<changelog-entry>\n")
|
||||
.append("\t\t<date>")
|
||||
.append(getDateFormatted())
|
||||
.append("</date>\n")
|
||||
.append("\t\t<time>")
|
||||
.append(getTimeFormatted())
|
||||
.append("</time>\n")
|
||||
.append("\t\t<author><![CDATA[")
|
||||
.append(author)
|
||||
.append("]]></author>\n");
|
||||
|
||||
for (Enumeration e = files.elements(); e.hasMoreElements();)
|
||||
{
|
||||
ChangeLogFile file = (ChangeLogFile) e.nextElement();
|
||||
buffer.append("\t\t<file>\n")
|
||||
.append("\t\t\t<name>")
|
||||
.append(file.getName())
|
||||
.append("</name>\n")
|
||||
.append("\t\t\t<revision>")
|
||||
.append(file.getRevision())
|
||||
.append("</revision>\n");
|
||||
buffer.append("\t\t</file>\n");
|
||||
}
|
||||
buffer.append("\t\t<msg><![CDATA[")
|
||||
.append(comment)
|
||||
.append("]]></msg>\n");
|
||||
buffer.append("\t</changelog-entry>\n");
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for property author.
|
||||
* @return Value of property author.
|
||||
*/
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for property author.
|
||||
* @param author New value of property author.
|
||||
*/
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for property comment.
|
||||
* @return Value of property comment.
|
||||
*/
|
||||
public String getComment()
|
||||
{
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for property comment.
|
||||
* @param comment New value of property comment.
|
||||
*/
|
||||
public void setComment(String comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for property date.
|
||||
* @return Value of property date.
|
||||
*/
|
||||
public Date getDate()
|
||||
{
|
||||
return (Date) date.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for property date.
|
||||
* @param date New value of property date.
|
||||
*/
|
||||
public void setDate(Date date)
|
||||
{
|
||||
this.date = new Date(date.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for property date that takes a string and parses it
|
||||
* @param date - a string in yyyy/MM/dd HH:mm:ss format
|
||||
*/
|
||||
public void setDate(String date)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.date = CVS_TIMESTAMP_FORMAT.parse(date);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
throw new IllegalArgumentException("I don't understand this date: "
|
||||
+ date);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return date in yyyy-mm-dd format
|
||||
*/
|
||||
public String getDateFormatted()
|
||||
{
|
||||
return DATE_FORMAT.format(getDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return time in HH:mm:ss format
|
||||
*/
|
||||
public String getTimeFormatted()
|
||||
{
|
||||
return TIME_FORMAT.format(getDate());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package org.apache.maven.changelog;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* An AbstractFactory interface for creating the required ChangeLogGenerator
|
||||
* and ChangeLogParser pairs.
|
||||
*
|
||||
* @author Glenn McAllister
|
||||
* @version $Id: ChangeLogFactory.java,v 1.1 2003/01/24 03:44:51 jvanzyl Exp $
|
||||
*/
|
||||
public interface ChangeLogFactory
|
||||
{
|
||||
/**
|
||||
* Create the ChangeLogGenerator that extracts data from an SCM to be
|
||||
* parsed by an associated ChangeLogParser.
|
||||
*
|
||||
* @return The ChangeLogGenerator for a particular SCM.
|
||||
*/
|
||||
ChangeLogGenerator createGenerator();
|
||||
|
||||
/**
|
||||
* Create the ChangeLogParser that consumes the output from the
|
||||
* ChangeLogGenerator to produce the set of ChangeLogEntry objects.
|
||||
*
|
||||
* @return The ChangeLogParser for a particular SCM.
|
||||
*/
|
||||
ChangeLogParser createParser();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user