diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/ant/.cvsignore b/ant/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/ant/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/ant/plugin.jelly b/ant/plugin.jelly new file mode 100644 index 00000000..82cdf80b --- /dev/null +++ b/ant/plugin.jelly @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${maven.ant.excludeTests} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ant/plugin.properties b/ant/plugin.properties new file mode 100644 index 00000000..c0d990d0 --- /dev/null +++ b/ant/plugin.properties @@ -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 diff --git a/ant/project.properties b/ant/project.properties new file mode 100644 index 00000000..128930fb --- /dev/null +++ b/ant/project.properties @@ -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} \ No newline at end of file diff --git a/ant/project.xml b/ant/project.xml new file mode 100644 index 00000000..2a7a4d98 --- /dev/null +++ b/ant/project.xml @@ -0,0 +1,46 @@ + + + + ${basedir}/../project.xml + 3 + maven-ant-plugin + Maven Ant Plug-in + 1.2-SNAPSHOT + + + Generates ant build files from a maven project, so that plain + ant users can build your project + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/ant/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/ant/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Java Developer + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + diff --git a/ant/xdocs/.cvsignore b/ant/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/ant/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/ant/xdocs/changes.xml b/ant/xdocs/changes.xml new file mode 100644 index 00000000..086a14b0 --- /dev/null +++ b/ant/xdocs/changes.xml @@ -0,0 +1,53 @@ + + + + Changes + dIon Gillard + + + + + + Added the new maven.ant.excludedTests property + + + If a project has no test source, the test targets are empty. + + +

+ Fixing a chicken-and-egg problem. The "test" and "compile-tests" + tasks were putting target/${final.name}.jar into the classpath. +

+

+ But... the "jar" target that creates that jarfile is dependent + upon those two targets. +

+

+ 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. +

+
+ + Added the maven.ant.generatebuild.file property and docs + + + Added more documentation on properties and supported SCM systems + +
+ + + Fix documentation + + + Fix for bug Maven-52: generated ant build should execute the unit tests before generating a jar. + + + + + Original release for Maven 1.0-beta6 + + + +
+ diff --git a/ant/xdocs/goals.xml b/ant/xdocs/goals.xml new file mode 100644 index 00000000..74df0c3d --- /dev/null +++ b/ant/xdocs/goals.xml @@ -0,0 +1,36 @@ + + + + + Maven Ant Plug-in Goals + dIon Gillard + + + + + + ant + + This is the default goal of the plugin and simply attains + the ant:generate-build goal. + + + + ant:generate-build + + Generates an ant + build.xml in the current directory which has targets to +
    +
  • Compile the java source code
  • +
  • Create a jar from the compiled java code
  • +
  • Create a distribution
  • +
  • Run unit tests
  • +
  • Generate JavaDoc
  • +
  • Download all required jar files
  • +
  • Download and install Maven
  • +
+
+
+
+ +
diff --git a/ant/xdocs/index.xml b/ant/xdocs/index.xml new file mode 100644 index 00000000..a4297ce6 --- /dev/null +++ b/ant/xdocs/index.xml @@ -0,0 +1,27 @@ + + + + + Maven Ant Plug-in + Jason van Zyl + + + +
+

+ 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 :-) +

+

+ For more information on the functionality provided by this plugin, + please see the Goals document. +

+

+ For more information on how to customise the functionality provided + by this plugin, please see the properties + document. +

+
+ +
diff --git a/ant/xdocs/navigation.xml b/ant/xdocs/navigation.xml new file mode 100644 index 00000000..5ee9068c --- /dev/null +++ b/ant/xdocs/navigation.xml @@ -0,0 +1,16 @@ + + + + Maven Ant Plugin + + + + + + + + + + + + diff --git a/ant/xdocs/properties.xml b/ant/xdocs/properties.xml new file mode 100644 index 00000000..5e838978 --- /dev/null +++ b/ant/xdocs/properties.xml @@ -0,0 +1,44 @@ + + + + + Maven Ant Plugin Properties + dIon Gillard + + + +
+ + + + + + + + + + + + + + + + + + + +
Property nameOptional?Description
maven.ant.excludeTestsYes + Holds a comma separated list of source file patterns that + will be excluded in the generated Ant build, e.g. +
+ +maven.ant.excludeTests=**/*Test.java,**/*Suite.java + +
maven.ant.generatebuild.fileYes + Sets the name of the ant buildfile to create. + Defaults to "build.xml". This is used by the "ant:generate-build" + goal. +
+
+ +
\ No newline at end of file diff --git a/antlr/.cvsignore b/antlr/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/antlr/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/antlr/plugin.jelly b/antlr/plugin.jelly new file mode 100644 index 00000000..38862a72 --- /dev/null +++ b/antlr/plugin.jelly @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + ${maven.antlr.grammars} + + + + + ${grammar} + + + + + + + + + + + + diff --git a/antlr/plugin.properties b/antlr/plugin.properties new file mode 100644 index 00000000..2dfceb3b --- /dev/null +++ b/antlr/plugin.properties @@ -0,0 +1 @@ +maven.antlr.src.dir=MAVEN_ANTLR_SRC_DIR_NOT_SET diff --git a/antlr/project.properties b/antlr/project.properties new file mode 100644 index 00000000..5e723259 --- /dev/null +++ b/antlr/project.properties @@ -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} \ No newline at end of file diff --git a/antlr/project.xml b/antlr/project.xml new file mode 100644 index 00000000..ccad5602 --- /dev/null +++ b/antlr/project.xml @@ -0,0 +1,89 @@ + + + + ${basedir}/../project.xml + 3 + maven-antlr-plugin + Maven Antlr Plugin + 1.1-SNAPSHOT + + + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/antlr/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/antlr/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + Stéphane Mor + smor + stephanemor@yahoo.fr + Hasgard Systèmes et Réseaux + + Java Developer + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + ant + 1.5.1 + + root + + + + + commons-jelly+tags-antlr + SNAPSHOT + + root.maven + + + + + commons-lang + 1.0-b1.1 + + root.maven + + + + + antlr + 2.7.1 + antlrall-2.7.1.jar + + root + + + + + + diff --git a/antlr/xdocs/.cvsignore b/antlr/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/antlr/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/antlr/xdocs/changes.xml b/antlr/xdocs/changes.xml new file mode 100644 index 00000000..8664acb6 --- /dev/null +++ b/antlr/xdocs/changes.xml @@ -0,0 +1,22 @@ + + + + Changes + dIon Gillard + + + + + + Added documentation for navigation, changes, properties and goals + + + + + + Original release for Maven 1.0-beta6 + + + + + diff --git a/antlr/xdocs/goals.xml b/antlr/xdocs/goals.xml new file mode 100644 index 00000000..d39b3b2a --- /dev/null +++ b/antlr/xdocs/goals.xml @@ -0,0 +1,49 @@ + + + + + Maven Ant Plug-in Goals + dIon Gillard + + + +
+

+ Note: The goals in this plugin are only executed + when the maven.antlr.src.dir property + is set +

+ + + + + + + + + + +
GoalDescription
antlr:generate +

+ Generates code for all grammars defined in the + ${maven.antlr.grammars} + property. +

+

+ This goal is called before the java:compile + goal so that code is generated before compilation. +

+
antlr:prepare-filesystem +

+ Creates the ${maven.build.dir}/antlr + directory which holds antlr generated code. +

+

+ This directory is added to the code to be compiled by + Maven, as specified by the maven.compile.src.set + property. +

+
+
+ +
diff --git a/antlr/xdocs/index.xml b/antlr/xdocs/index.xml new file mode 100644 index 00000000..a5de973d --- /dev/null +++ b/antlr/xdocs/index.xml @@ -0,0 +1,30 @@ + + + + + Maven Antlr Plug-in + dIon Gillard + + + +
+

+ This plugin generates code based on user-supplied Antlr grammars. +

+

+ The code is automatically generated before the java:compile + goal, so that the generated code is automatically processed as if + it was part of the normal application source code. +

+

+ For more information on the functionality provided by this plugin, + please see the Goals document. +

+

+ For more information on how to customise the functionality provided + by this plugin, please see the properties + document. +

+
+ +
diff --git a/antlr/xdocs/navigation.xml b/antlr/xdocs/navigation.xml new file mode 100644 index 00000000..cdabea26 --- /dev/null +++ b/antlr/xdocs/navigation.xml @@ -0,0 +1,16 @@ + + + + Maven Antlr Plugin + + + + + + + + + + + + diff --git a/antlr/xdocs/properties.xml b/antlr/xdocs/properties.xml new file mode 100644 index 00000000..e5687617 --- /dev/null +++ b/antlr/xdocs/properties.xml @@ -0,0 +1,62 @@ + + + + + Maven Antlr Plugin Properties + dIon Gillard + + + +
+ + + + + + + + + + + + + + + + +
Property nameOptional?Description
maven.antlr.grammarsNo + Sets the grammars to generate code for. +
maven.antlr.src.dirNo + Must be set to allow antlr processing to happen. + FIXME: It appears this property isn't used? +
+
+
+ + + + + + + + + + + + + + + + +
Property nameOptional?Description
maven.build.dirYes + This is the directory that output files are generated to. The + antlr generated code is placed in the antlr + directory below this +
maven.compile.src.setYes + 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 +
+
+ +
\ No newline at end of file diff --git a/aspectj/plugin.jelly b/aspectj/plugin.jelly new file mode 100644 index 00000000..a7c4b09d --- /dev/null +++ b/aspectj/plugin.jelly @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + maven.javadoc.author,maven.javadoc.destdir, + maven.javadoc.links,maven.javadoc.maxmemory, + maven.javadoc.private,maven.javadoc.stylesheet, + maven.javadoc.use,maven.javadoc.version + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/aspectj/project.properties b/aspectj/project.properties new file mode 100644 index 00000000..5e723259 --- /dev/null +++ b/aspectj/project.properties @@ -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} \ No newline at end of file diff --git a/aspectj/project.xml b/aspectj/project.xml new file mode 100644 index 00000000..46e4632d --- /dev/null +++ b/aspectj/project.xml @@ -0,0 +1,90 @@ + + + + ${basedir}/../project.xml + 3 + maven-aspectj-plugin + Maven AspectJ Plug-in + 1.1-SNAPSHOT + + + + + Eclipse Plugin for AspectJ + + http://jakarta.apache.org/turbine/maven/reference/plugins/aspectj/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/aspectj/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + Vincent Massol + vmassol + vmassol@octo.com + Octo Technology + + Java Developer + + + + + + + + aspectj:aspectjrt + 1.0.6 + + root + + + + + aspectj:aspectj-ant + 1.0.6 + + root + + + + + aspectj:aspectj-tools + 1.0.6 + + root + + + + + + + + + + ${basedir} + + target/** + src/** + xdocs/** + maven.xml + maven.log + velocity.log + .cvsignore + + + + + + + diff --git a/aspectj/xdocs/.cvsignore b/aspectj/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/aspectj/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/aspectj/xdocs/changes.xml b/aspectj/xdocs/changes.xml new file mode 100644 index 00000000..8664acb6 --- /dev/null +++ b/aspectj/xdocs/changes.xml @@ -0,0 +1,22 @@ + + + + Changes + dIon Gillard + + + + + + Added documentation for navigation, changes, properties and goals + + + + + + Original release for Maven 1.0-beta6 + + + + + diff --git a/aspectj/xdocs/goals.xml b/aspectj/xdocs/goals.xml new file mode 100644 index 00000000..75e99caf --- /dev/null +++ b/aspectj/xdocs/goals.xml @@ -0,0 +1,42 @@ + + + + + Maven AspectJ Plug-in Goals + dIon Gillard + + + +
+ + + + + + + + + + +
GoalDescription
aspectj + This is the default goal of the plugin and simply attains + the aspectj:compile goal. +
aspectj:compile + Compiles source code as found in the + + ... + +]]> + + element from your + + project descriptor +

+ Code is only recompiled if any of the source is newer than + the jar file +

+
+
+ +
diff --git a/aspectj/xdocs/index.xml b/aspectj/xdocs/index.xml new file mode 100644 index 00000000..4cd91ed5 --- /dev/null +++ b/aspectj/xdocs/index.xml @@ -0,0 +1,26 @@ + + + + + Maven AspectJ Plug-in + dIon Gillard + + + +
+

+ This plugin provides the basic facilities for compiling + code using AspectJ. +

+

+ For more information on the functionality provided by this plugin, + please see the Goals document. +

+

+ For more information on how to customise the functionality provided + by this plugin, please see the properties + document. +

+
+ +
diff --git a/aspectj/xdocs/navigation.xml b/aspectj/xdocs/navigation.xml new file mode 100644 index 00000000..ba656f3c --- /dev/null +++ b/aspectj/xdocs/navigation.xml @@ -0,0 +1,16 @@ + + + + Maven AspectJ Plugin + + + + + + + + + + + + diff --git a/aspectj/xdocs/properties.xml b/aspectj/xdocs/properties.xml new file mode 100644 index 00000000..ad64f88a --- /dev/null +++ b/aspectj/xdocs/properties.xml @@ -0,0 +1,112 @@ + + + + + Maven AspectJ Plugin Properties + dIon Gillard + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Property nameOptional?Description
maven.compile.debugYes + Specifies wether to include debugging information in the compiled + class files; the default value is on. + Used by the "java:compile" goal. +
maven.compile.deprecationYes + Specifies wether source should be compiled with deprecation + information; the default value is off. + Used by the "java:compile" goal. +
maven.compile.optimizeYes + Specifies whether source should be compiled with optimization; the + default value is off. + Used by the "java:compile" goal. +
maven.compile.src.setYes + The source directories maven uses to compile java code. +
pom.build.sourceModificationsYes + This property is the list of the + + + + + + + + + + +]]> + source modifications in your + + project descriptor. This property is used during compilation to exclude or + include classes from compilation depending on whether a named class is available +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Property nameOptional?Description
sourcesPresentYes + 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. +
maven.build.destYes + The destination directory for compiled code +
maven.dependency.classpathYes + This property holds the Ant path of all the dependent jar + files listed in the dependencies block of your + + project descriptor +
+
+ +
\ No newline at end of file diff --git a/cactus/.cvsignore b/cactus/.cvsignore new file mode 100644 index 00000000..f7c90c3b --- /dev/null +++ b/cactus/.cvsignore @@ -0,0 +1,6 @@ +target +maven.log +velocity.log +build.properties +.classpath +.project diff --git a/cactus/LICENSE.txt b/cactus/LICENSE.txt new file mode 100644 index 00000000..5a4aec31 --- /dev/null +++ b/cactus/LICENSE.txt @@ -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 + * . + * + * ==================================================================== + */ diff --git a/cactus/announcements/1.0.ann b/cactus/announcements/1.0.ann new file mode 100644 index 00000000..fbe2c091 --- /dev/null +++ b/cactus/announcements/1.0.ann @@ -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 \ No newline at end of file diff --git a/cactus/announcements/1.1.ann b/cactus/announcements/1.1.ann new file mode 100644 index 00000000..49513864 --- /dev/null +++ b/cactus/announcements/1.1.ann @@ -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 \ No newline at end of file diff --git a/cactus/cactus.dvsl b/cactus/cactus.dvsl new file mode 100644 index 00000000..4014bdf8 --- /dev/null +++ b/cactus/cactus.dvsl @@ -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) +

+ [summary] + [package list] + [test cases] +

+#end + +## Prints a standard header for a test suite. +## +#macro (testSuiteHeader) + + Name + Tests + Errors + Failures + Time(s) + +#end + +## Prints a standard header for a test case. +## +#macro (testCaseHeader) + + Name + Status + Type + Time(s) + +#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 +

+ + $context.toolbox.htmlescape.getText($current.value()) + +#end + +## Generates the report if unit tests were present. +## +#macro (generateReport) + #navbar () +

+ The following document contains the results of the Cactus tests. +

+ + + ################################################################### +
+ #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")) + + + + + + + + + + + + + + + +
TestsErrorsFailuresSuccess rateTime(s)
#formatAsNumber ($testCount "0")#formatAsNumber ($errorCount "0")#formatAsNumber ($failureCount "0")#formatAsNumber ($successRate "0.00%")#formatAsNumber ($timeCount "0.000")
+

+ Note: failures are anticipated and checked for with + assertions while errors are unanticipated. +

+
+ + ################################################################### +
+ #navbar () + + #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)")) + + + + + + + + #end +
$package#formatAsNumber ($testCount "0")#formatAsNumber ($failureCount "0")#formatAsNumber ($errorCount "0")#formatAsNumber ($timeCount "0.000")
+

+ Note: package statistics are not computed recursively, they only + sum up all of its testsuites numbers. +

+ + #foreach ($testsuite in $node.selectNodes("./testsuite[not(./@package = preceding-sibling::testsuite/@package)]")) + #set ($package = "$testsuite.attribute('package')") + #set ($quotedPackage = "$quote$package$quote") + + + #testSuiteHeader () + #foreach ($test in $node.selectNodes("/testsuites/testsuite[./@package = $quotedPackage]")) + + + + + + + + #end +
$test.attribute('name')#formatAsNumber ($test.attribute('tests') "0")#formatAsNumber ($test.attribute('errors') "0")#formatAsNumber ($test.attribute('failures') "0")#formatAsNumber ($test.attribute('time') "0.000")
+
+ #end +
+ + ################################################################### +
+ #navbar () + #foreach ($testsuite in $node.selectNodes("./testsuite")) + + + #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")) + + #end + + #foreach ($testcase in $testsuite.selectNodes("./testcase")) + + + #if ($testcase.get("failure")) + + + #elseif ($testcase.get("error")) + + + #else + + + #end + #if ($testcase.attribute("time")) + + #else + + #end + + #end +
#displayFailure ($error)
$testcase.attribute("name")Failure #displayFailure ($testcase.selectSingleNode("failure")) Error #displayFailure ($testcase.selectSingleNode("error")) Success#formatAsNumber ($testcase.attribute("time") "0.000")
+
+ #end +
+#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") + + + + + Cactus Test Results + + + +
+ + #if (! $node.get("testsuite")) +

+ This project does not contain any unit tests. +

+
+ #else + #generateReport() + #end + + +
+#end + diff --git a/cactus/plugin.jelly b/cactus/plugin.jelly new file mode 100644 index 00000000..1560d8a9 --- /dev/null +++ b/cactus/plugin.jelly @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Either a war or a webapp must exist. Please call the War plugin + first. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + You must define the test case to run via -Dtestcase=classname + Example: maven -Dtestcase=MyTest cactus:single + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cactus/plugin.properties b/cactus/plugin.properties new file mode 100644 index 00000000..eb93bdc6 --- /dev/null +++ b/cactus/plugin.properties @@ -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 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= diff --git a/cactus/project.properties b/cactus/project.properties new file mode 100644 index 00000000..13d5a338 --- /dev/null +++ b/cactus/project.properties @@ -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 diff --git a/cactus/project.xml b/cactus/project.xml new file mode 100644 index 00000000..a383d979 --- /dev/null +++ b/cactus/project.xml @@ -0,0 +1,184 @@ + + + + ${basedir}/../project.xml + 3 + maven-cactus-plugin + Maven Cactus Plug-in + 1.2-SNAPSHOT + + + Plugin for Cactus (http://jakarta.apache.org/cactus) that + allows to automatically start containers, run Cactus tests and stop + the containers. + + + Cactus plugin + + http://jakarta.apache.org/turbine/maven/reference/plugins/cactus/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/cactus/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + 1.0 + 1.0 + MAVEN_CACTUS_1_0 + + + 1.1 + 1.1 + MAVEN_CACTUS_1_1 + + + 1.2 + 1.2 + HEAD + + + + + + Vincent Massol + vmassol + vmassol@octo.com + OCTO Technology + + Java Developer + Architect + Release Manager + + + + + + + Eric Pugh + EPugh@upstate.com + + + + + + + cactus:cactus + 13-1.4.1 + + root.maven + + + + + cactus:cactus-ant + 1.4.1 + + root.maven + + + + + commons-httpclient + 2.0alpha1-20020829 + + root.maven + + + + + commons-logging + 1.0.1 + + root.maven + + + + + aspectj:aspectjrt + 1.0.6 + + root.maven + + + + + httpunit + 1.5 + + root.maven + + + + + nekohtml + 0.6.5 + + root.maven + + + + + junit + 3.8.1 + + root + + + + + ant:ant + 1.5.1 + + root + + + + + commons-jelly + SNAPSHOT + + root.maven + + + + + commons-jelly+tags-ant + SNAPSHOT + + root.maven + + + + + commons-beanutils + 1.4.1 + + root.maven + + + + + + xml-apis + 1.0.b2 + + root + + + + + + xerces + 2.0.2 + + root + + + + + + + diff --git a/cactus/src/main/org/apache/maven/cactus/CactusScanner.java b/cactus/src/main/org/apache/maven/cactus/CactusScanner.java new file mode 100644 index 00000000..7d2e60b4 --- /dev/null +++ b/cactus/src/main/org/apache/maven/cactus/CactusScanner.java @@ -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 + * . + * + * ==================================================================== + */ +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: + *
    + *
  • It extends {@link AbstractTestCase}
  • + *
  • It is not abstract
  • + *
  • It has at least one method that starts with "test", returns void and + * takes no parameters
  • + *
+ * + * @author Vincent Massol + * @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); + } +} diff --git a/cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java b/cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java new file mode 100644 index 00000000..75e5d925 --- /dev/null +++ b/cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java @@ -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 + * . + * + * ==================================================================== + */ +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 Vincent Massol + * @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; + } +} diff --git a/cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java b/cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java new file mode 100644 index 00000000..9d590ac4 --- /dev/null +++ b/cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java @@ -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 + * . + * + * ==================================================================== + */ +import org.apache.commons.jelly.TagLibrary; + +/** + * Maven tag library for use in Jelly scripts. + * + * @author Vincent Massol + * @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); + } +} diff --git a/cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java b/cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java new file mode 100644 index 00000000..036e44ed --- /dev/null +++ b/cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java @@ -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 + * . + * + * ==================================================================== + */ +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 Vincent Massol + * @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; + } +} diff --git a/cactus/src/plugin-resources/conf/cactus.properties b/cactus/src/plugin-resources/conf/cactus.properties new file mode 100644 index 00000000..b69e2da3 --- /dev/null +++ b/cactus/src/plugin-resources/conf/cactus.properties @@ -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 diff --git a/cactus/src/plugin-resources/conf/containers/resin2x/resin.conf b/cactus/src/plugin-resources/conf/containers/resin2x/resin.conf new file mode 100644 index 00000000..dd9a9ceb --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/resin2x/resin.conf @@ -0,0 +1,21 @@ + + + + + . + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cactus/src/plugin-resources/conf/containers/tomcat4x/server.xml b/cactus/src/plugin-resources/conf/containers/tomcat4x/server.xml new file mode 100644 index 00000000..ab77ff97 --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/tomcat4x/server.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cactus/src/plugin-resources/conf/containers/tomcat4x/tomcat-users.xml b/cactus/src/plugin-resources/conf/containers/tomcat4x/tomcat-users.xml new file mode 100644 index 00000000..ff0637a2 --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/tomcat4x/tomcat-users.xml @@ -0,0 +1,3 @@ + + + diff --git a/cactus/src/plugin-resources/conf/containers/weblogic7x/DefaultAuthenticatorInit.ldift b/cactus/src/plugin-resources/conf/containers/weblogic7x/DefaultAuthenticatorInit.ldift new file mode 100644 index 00000000..114a4c8d --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/weblogic7x/DefaultAuthenticatorInit.ldift @@ -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@ + diff --git a/cactus/src/plugin-resources/conf/containers/weblogic7x/SerializedSystemIni.dat b/cactus/src/plugin-resources/conf/containers/weblogic7x/SerializedSystemIni.dat new file mode 100644 index 00000000..467266d3 --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/weblogic7x/SerializedSystemIni.dat @@ -0,0 +1,2 @@ +yô + tfÈ2ùs©®û"È4ÄÇ-jj{˜©ƒD6bò( \ No newline at end of file diff --git a/cactus/src/plugin-resources/conf/containers/weblogic7x/config.xml b/cactus/src/plugin-resources/conf/containers/weblogic7x/config.xml new file mode 100644 index 00000000..ee9ae2a5 --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/weblogic7x/config.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/cactus/src/plugin-resources/conf/containers/weblogic7x/fileRealm.properties b/cactus/src/plugin-resources/conf/containers/weblogic7x/fileRealm.properties new file mode 100644 index 00000000..64b2afa3 --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/weblogic7x/fileRealm.properties @@ -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 diff --git a/cactus/src/plugin-resources/conf/containers/weblogic7x/weblogic.xml b/cactus/src/plugin-resources/conf/containers/weblogic7x/weblogic.xml new file mode 100644 index 00000000..0eaaf4ec --- /dev/null +++ b/cactus/src/plugin-resources/conf/containers/weblogic7x/weblogic.xml @@ -0,0 +1,10 @@ + + + + + + test + testuser + + + \ No newline at end of file diff --git a/cactus/src/plugin-resources/conf/excluded.properties b/cactus/src/plugin-resources/conf/excluded.properties new file mode 100644 index 00000000..8f5e3915 --- /dev/null +++ b/cactus/src/plugin-resources/conf/excluded.properties @@ -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.* + diff --git a/cactus/src/plugin-resources/conf/web.xml b/cactus/src/plugin-resources/conf/web.xml new file mode 100644 index 00000000..d8579ab3 --- /dev/null +++ b/cactus/src/plugin-resources/conf/web.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/cactus/src/plugin-resources/conf/web.xml.dvsl b/cactus/src/plugin-resources/conf/web.xml.dvsl new file mode 100644 index 00000000..e864e273 --- /dev/null +++ b/cactus/src/plugin-resources/conf/web.xml.dvsl @@ -0,0 +1,118 @@ +## ----------------------------------------------------- +## X M L R O O T +## ----------------------------------------------------- +#match ("web-app") + + + + + + $context.applyTemplates("icon") + $context.applyTemplates("display-name") + $context.applyTemplates("description") + $context.applyTemplates("distributable") + $context.applyTemplates("context-param") + + + FilterRedirector + org.apache.cactus.server.FilterTestRedirector + + + $context.applyTemplates("filter") + + + FilterRedirector + /FilterRedirector + + + $context.applyTemplates("filter-mapping") + $context.applyTemplates("listener") + + + ServletRedirector + org.apache.cactus.server.ServletTestRedirector + + + + ServletRedirectorSecure + org.apache.cactus.server.ServletTestRedirector + + + + JspRedirector + /jspRedirector.jsp + + + $context.applyTemplates("servlet") + + + ServletRedirector + /ServletRedirector + + + + ServletRedirectorSecure + /ServletRedirectorSecure + + + + JspRedirector + /JspRedirector + + + $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") + + + + SecurityRestriction + Protect the Cactus redirector servlet. + /ServletRedirectorSecure + GET + POST + + + Authorized Users Group + test + + + NONE + + + + + BASIC + + + + Test role + test + + + $context.applyTemplates("env-entry") + $context.applyTemplates("ejb-ref") + $context.applyTemplates("ejb-local-ref") + + +#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 +#end +#end diff --git a/cactus/src/plugin-resources/conf/web/jspRedirector.jsp b/cactus/src/plugin-resources/conf/web/jspRedirector.jsp new file mode 100644 index 00000000..923a103e --- /dev/null +++ b/cactus/src/plugin-resources/conf/web/jspRedirector.jsp @@ -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); +%> \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/project.properties b/cactus/src/plugin-resources/sample/project.properties new file mode 100644 index 00000000..30dd9cf2 --- /dev/null +++ b/cactus/src/plugin-resources/sample/project.properties @@ -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 + diff --git a/cactus/src/plugin-resources/sample/project.xml b/cactus/src/plugin-resources/sample/project.xml new file mode 100644 index 00000000..9dc20fa4 --- /dev/null +++ b/cactus/src/plugin-resources/sample/project.xml @@ -0,0 +1,74 @@ + + + + + 3 + + + maven-cactus-sample + + + Cactus Sample + + + 1.0-SNAPSHOT + + + + Apache Software Foundation + http://jakarta.apache.org/ + + + + 2002 + + + org.apache.maven.cactus.sample + + + A sample project using the Cactus plugin for Maven + + + http://jakarta.apache.org/turbine/maven/ + + + + scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven + http://cvs.apache.org/viewcvs/jakarta-turbine-maven/ + + + + + + + + + + + + servletapi + 2.3 + + + + + + src/java + + src/test + + + **/Test*.java + + + + + + \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java new file mode 100644 index 00000000..b45fe1f3 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java @@ -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 + * . + * + * ==================================================================== + */ + +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 Nicholas Lesiecki + * + * @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; + } +} \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java new file mode 100644 index 00000000..03fe72d2 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java @@ -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 + * . + * + * ==================================================================== + */ + +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 Vincent Massol + * + * @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 init() + */ + 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 web.xml. + * + * @param theRequest the incmoing HTTP request + * @param theResponse the returned HTTP response + * @param theChain the chain of filters extracted from the definition + * given in web.xml 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 + * web.xml). 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 + * web.xml). 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() + { + } +} \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java new file mode 100644 index 00000000..1ad25086 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java @@ -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 + * . + * + * ==================================================================== + */ + +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(); + } +} diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java new file mode 100644 index 00000000..56ef1530 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java @@ -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 + * . + * + * ==================================================================== + */ + +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 ServletOutputStream cannot be + * modified after a resource has committed it. + * + * Note: This code was adapted from the Filter tutorial found + * {@link + * here} + * + * @author Vincent Massol + * + * @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 + * DataOutputStream 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); + } +} \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java new file mode 100644 index 00000000..d0dd68d9 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java @@ -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 + * . + * + * ==================================================================== + */ + +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 HttpServletResponse 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 + * here} + * + * @author Vincent Massol + * + * @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 + * HttpServletResponseWrapper 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 + * HttpServletResponseWrapper 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); + } +} \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java new file mode 100644 index 00000000..18c75b09 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java @@ -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 + * . + * + * ==================================================================== + */ + +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 SampleBodyTag class. + * + * @author Nciholas Lesiecki + * + * @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 (TestSuite) 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); + } +} \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleFilter.java b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleFilter.java new file mode 100644 index 00000000..2f886c0b --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleFilter.java @@ -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 + * . + * + * ==================================================================== + */ + +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 SampleFilter filter class. + * + * @author Vincent Massol + * + * @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 (TestSuite) 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", "

header

"); + filter.init(config); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + filter.addHeader(baos); + + assertEquals("

header

", 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", "

footer

"); + filter.init(config); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + filter.addFooter(baos); + + assertEquals("

footer

", 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", "

header

"); + config.setInitParameter("footer", "

footer

"); + filter.init(config); + + FilterChain mockFilterChain = new FilterChain() + { + public void doFilter(ServletRequest theRequest, + ServletResponse theResponse) throws IOException, + ServletException + { + PrintWriter writer = theResponse.getWriter(); + + writer.print("

some content

"); + 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("

header

some content

footer

", + theResponse.getText()); + } +} \ No newline at end of file diff --git a/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleServlet.java b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleServlet.java new file mode 100644 index 00000000..834a61d7 --- /dev/null +++ b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleServlet.java @@ -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 + * . + * + * ==================================================================== + */ + +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)); + } + +} diff --git a/cactus/src/plugin-resources/scripts/resin.2x.jelly b/cactus/src/plugin-resources/scripts/resin.2x.jelly new file mode 100644 index 00000000..e1875d93 --- /dev/null +++ b/cactus/src/plugin-resources/scripts/resin.2x.jelly @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + Property maven.cactus.resin2x.home is not defined + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cactus/src/plugin-resources/scripts/tomcat.4x.jelly b/cactus/src/plugin-resources/scripts/tomcat.4x.jelly new file mode 100644 index 00000000..7f88f16b --- /dev/null +++ b/cactus/src/plugin-resources/scripts/tomcat.4x.jelly @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + Property maven.cactus.tomcat4x.home is not defined + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cactus/src/plugin-resources/scripts/weblogic.7x.jelly b/cactus/src/plugin-resources/scripts/weblogic.7x.jelly new file mode 100644 index 00000000..994c55e1 --- /dev/null +++ b/cactus/src/plugin-resources/scripts/weblogic.7x.jelly @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + Property maven.cactus.weblogic7x.home is not defined + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cactus/xdocs/.cvsignore b/cactus/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/cactus/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/cactus/xdocs/changes.xml b/cactus/xdocs/changes.xml new file mode 100644 index 00000000..5a7419af --- /dev/null +++ b/cactus/xdocs/changes.xml @@ -0,0 +1,84 @@ + + + + Changes + Vincent Massol + + + + + + + Added Checkstyle report to Cactus plugin web site. + + + The plugin now works even if not connected to the internet. + + + Fixed problem when the web.xml 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. + + + + + + Added support for HttpUnit integration out of the box (i.e. the + HttpUnit jars are automatically added by the Cactus plugin). + + + Ability to exclude Cactus tests (for long running tests for example, + in debug period). + + + The web.xml elements required for Cactus are now + automatically added to the user project web.xml. + + + 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. + + + Added automatic discovery of Cactus Test Cases and ignore test support + classes. + + + 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. + + + Improved documentation: "news" section on front page and improved + "Quick Start" page. + + + Support for WebLogic 7.x. + + + + + + Sample project showing how to use the Cactus plugin. + + + Generates HTML reports + + + Support for Resin 2.x. + + + Support for Tomcat 4.x (supports hot redeploy). + + + Creation of the Cactus plugin + + + + + + diff --git a/cactus/xdocs/features.xml b/cactus/xdocs/features.xml new file mode 100644 index 00000000..5b7f3749 --- /dev/null +++ b/cactus/xdocs/features.xml @@ -0,0 +1,51 @@ + + + + + Features of the Cactus plugin + Vincent Massol + + + +
+
    +
  • + Support for the following containers: +
      +
    • + Support for Tomcat 4.x +
    • +
    • + Support for Resin 2.x +
    • +
    • + Support for WebLogic 7.x +
    • +
    +
  • +
  • + HTML report generation (integrated with Maven reports). +
  • +
  • + Support for keeping the server running between redeployments. +
  • +
  • + Automatic discovery of Cactus Test Cases and ignore test support + classes. +
  • +
  • + Ability to use either the Text or Swing Test Runner for running the + Cactus tests. +
  • +
  • + Automatically merge the web.xml elements needed by + Cactus to the user project web.xml file. +
  • +
  • + Ability to exclude Cactus tests (for long running tests for example, + in debug period). +
  • +
+
+ +
diff --git a/cactus/xdocs/goals.xml b/cactus/xdocs/goals.xml new file mode 100644 index 00000000..6555bbc0 --- /dev/null +++ b/cactus/xdocs/goals.xml @@ -0,0 +1,52 @@ + + + + + Maven cactus Plug-in Goals + dIon Gillard + + + + + cactus:compile + Compile Cactus tests + + + cactus:generate + Generate HTML report + + + cactus:init + Creates objects useful for several goals + + + cactus:merge-webxml + Generate a web.xml which is the merge betweem the user project web.xml and the webapp elements needed by Cactus + + + cactus:single + Execute a single test defined using the 'testcase' variable + + + cactus:test-init + Test initialization + + + cactus:test-swing + Start the tests using the swing runner + + + cactus:test-text + Start the tests using the text runner + + + cactus:webapp + Create the Cactus webapp + + + cactus:webapp-update + Generate an expanded Cactus webapp from a project expanded webapp + + + + \ No newline at end of file diff --git a/cactus/xdocs/index.xml b/cactus/xdocs/index.xml new file mode 100644 index 00000000..f9eaaf14 --- /dev/null +++ b/cactus/xdocs/index.xml @@ -0,0 +1,62 @@ + + + + + Maven Cactus Plug-in + Vincent Massol + + + +
+

+ This is a plugin for + Cactus that + allows to automatically start containers, run Cactus tests and stop + the containers. +

+

+ Currently, this plugin only supports the Servlet API 2.3. +

+
+
+ + + + + + + + + + + + + +
DateDescription
16 Nov 2002 + Release of version 1.1. +
06 Nov 2002 + Release of version 1.0. Read the announcement + here. +
+
+
+

+ Check the features page for all features + of this plugin. +

+

+ Then, you should read the Quick Start page + which provides details about how to use the plugin. +

+

+ A sample application using Cactus is packaged within the Cactus plugin. + Go to where you installed Maven and look into the + plugins/maven-cactus-plugin-*/sample directory. +

+

+ The latest changes are available here. +

+
+ + +
diff --git a/cactus/xdocs/navigation.xml b/cactus/xdocs/navigation.xml new file mode 100644 index 00000000..c5429794 --- /dev/null +++ b/cactus/xdocs/navigation.xml @@ -0,0 +1,22 @@ + + + + Maven Cactus Plugin + + + + + + + + + + + + + + + + + + diff --git a/cactus/xdocs/properties.xml b/cactus/xdocs/properties.xml new file mode 100644 index 00000000..41044b16 --- /dev/null +++ b/cactus/xdocs/properties.xml @@ -0,0 +1,164 @@ + + + + + cactus Properties + dIon Gillard + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyOptional?Description
maven.cactus.test.fileset.excludeYes +

Default value is + + .

+
maven.cactus.testrunner.swing.excludedYes +

Default value is + ${plugin.dir}/conf/excluded.properties.

+
maven.cactus.build.dirYes +

Default value is + ${maven.build.dir}/cactus.

+
maven.cactus.src.dirYes +

Default value is + src/test-cactus.

+
maven.cactus.classes.dirYes +

Default value is + ${maven.cactus.build.dir}/classes.

+
maven.cactus.scripts.dirYes +

Default value is + ${plugin.dir}/scripts.

+
maven.cactus.webxml.dvslYes +

Default value is + ${plugin.dir}/conf/web.xml.dvsl.

+
maven.cactus.test.reportsDirectoryYes +

Default value is + ${maven.cactus.build.dir}/test-reports.

+
maven.cactus.build.resources.dirYes +

Default value is + ${maven.cactus.build.dir}/resources.

+
maven.cactus.jspRedirectorYes +

Default value is + ${plugin.dir}/conf/web/jspRedirector.jsp.

+
maven.cactus.configFileYes +

Default value is + ${plugin.dir}/conf/cactus.properties.

+
maven.cactus.junit.usefileYes +

Default value is + true.

+
maven.cactus.test.fileset.includeYes +

Default value is + **/*.class.

+
maven.cactus.prewar.dirYes +

Default value is + ${maven.war.build.dir}.

+
maven.cactus.emptywebxmlYes +

Default value is + ${plugin.dir}/conf/web.xml.

+
maven.cactus.portYes +

Default value is + 8080.

+
maven.cactus.conf.containers.dirYes +

Default value is + ${plugin.dir}/conf/containers.

+
maven.cactus.testrunnerYes +

Default value is + text.

+
+
+ +
\ No newline at end of file diff --git a/cactus/xdocs/tasks.xml b/cactus/xdocs/tasks.xml new file mode 100644 index 00000000..a1e3f6d4 --- /dev/null +++ b/cactus/xdocs/tasks.xml @@ -0,0 +1,52 @@ + + + + + Tasks + Vincent Massol + + + +
+

+ Lists of todos and ideas for future versions. +

+ + +

+

    +
  • + Describe plugin properties in the Maven plugin documentation. +
  • +
  • + 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. +
  • +
  • + Transform cactus Ant scripts to Jelly scripts for : + Tomcat 3.x, Orion 1.5, Orion 1.6, WebLogic 6.x, + Enhydra 5.x +
  • +
  • + Add more scripts for JBoss/Jonas/Jetty. +
  • +
  • + Add a test-all goal that runs the tests on all + defined containers. +
  • +
  • + Support packaging as an EAR for EJB unit testing. Requires the + EAR plugin first. +
  • +
  • + Add the rhino jar for HttpUnit javascript support. +
  • +
+

+
+ +
+ + +
diff --git a/cactus/xdocs/using.xml b/cactus/xdocs/using.xml new file mode 100644 index 00000000..87c6de47 --- /dev/null +++ b/cactus/xdocs/using.xml @@ -0,0 +1,68 @@ + + + + + Using the Maven Cactus Plug-in + Vincent Massol + + + +
+
    +
  1. + Create a src/test-cactus 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 maven.cactus.src.dir property. +
  2. +
  3. + Create a build.properties file in your project root + directory (where project.xml 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: +
  4. + + + +
  5. + Call the + War + plugin's goals to generate a war for your webapp. For example: + maven war. Note that in the future you would also be + able to call the Ear plugin if your application is an EAR. +
  6. +
  7. + Then, simply run the Cactus goal for your container. For example, + type maven cactus:test-tomcat-4x to run the tests with + Tomcat 4.x. You can type maven -g for a full list of the + available goals. +
  8. +
  9. + If you wish to generate Cactus HTML test reports, type + maven cactus:generate site. +
  10. +
+ +

+ 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. +

+

+ It is possible (and recommended for performance reasons) to run all the + goals in one Maven invocation. For example: + maven war cactus:test-tomcat-4x cactus:generate site. You + can also put that sequence in your project's maven.xml + file. +

+ +
+ + +
diff --git a/castor/.cvsignore b/castor/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/castor/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/castor/plugin.jelly b/castor/plugin.jelly new file mode 100644 index 00000000..9f751d80 --- /dev/null +++ b/castor/plugin.jelly @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/castor/plugin.properties b/castor/plugin.properties new file mode 100644 index 00000000..de80acb6 --- /dev/null +++ b/castor/plugin.properties @@ -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 diff --git a/castor/project.properties b/castor/project.properties new file mode 100644 index 00000000..c43339ba --- /dev/null +++ b/castor/project.properties @@ -0,0 +1,3 @@ +# ------------------------------------------------------------------- +# P R O J E C T P R O P E R T I E S +# ------------------------------------------------------------------- diff --git a/castor/project.xml b/castor/project.xml new file mode 100644 index 00000000..5b024770 --- /dev/null +++ b/castor/project.xml @@ -0,0 +1,46 @@ + + + + ${basedir}/../project.xml + 3 + maven-castor-plugin + Maven Castor Plug-in + 1.0 + + + Various goals for making development with Plexus easy. + + + Plexus Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/castor/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/castor/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + castor + 0.9.4 + + root + + + + + + diff --git a/castor/xdocs/.cvsignore b/castor/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/castor/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/castor/xdocs/changes.xml b/castor/xdocs/changes.xml new file mode 100644 index 00000000..8c68b109 --- /dev/null +++ b/castor/xdocs/changes.xml @@ -0,0 +1,16 @@ + + + + Changes + Jason van Zyl + + + + + + Original release for Maven 1.0-beta8 + + + + + diff --git a/castor/xdocs/goals.xml b/castor/xdocs/goals.xml new file mode 100644 index 00000000..75b2c1cc --- /dev/null +++ b/castor/xdocs/goals.xml @@ -0,0 +1,20 @@ + + + + + Maven Castor Plug-in Goals + Jason van Zyl + + + + + + castor:srcgen + + For a given project generate a plexus runtime using the required + components. + + + + + diff --git a/castor/xdocs/index.xml b/castor/xdocs/index.xml new file mode 100644 index 00000000..d737b075 --- /dev/null +++ b/castor/xdocs/index.xml @@ -0,0 +1,16 @@ + + + + + Maven Castor Plug-in + Jason van Zyl + + + +
+

+ A plugin that currently just sets up castor for use in Jelly +

+
+ +
diff --git a/castor/xdocs/navigation.xml b/castor/xdocs/navigation.xml new file mode 100644 index 00000000..dcc3b265 --- /dev/null +++ b/castor/xdocs/navigation.xml @@ -0,0 +1,16 @@ + + + + Maven Castor Plugin + + + + + + + + + + + + diff --git a/castor/xdocs/properties.xml b/castor/xdocs/properties.xml new file mode 100644 index 00000000..e6db8607 --- /dev/null +++ b/castor/xdocs/properties.xml @@ -0,0 +1,25 @@ + + + + + Maven Castor Plugin Properties + Jason van Zyl + + + +
+ + + + + + + + + + + +
Property nameOptional?Description
+
+ +
diff --git a/changelog/.cvsignore b/changelog/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/changelog/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/changelog/plugin.jelly b/changelog/plugin.jelly new file mode 100644 index 00000000..e1838c44 --- /dev/null +++ b/changelog/plugin.jelly @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + ${pom.repository.connection} + + Generating the changelog report + + + + + + + + + + The Changelog is available in the online mode only. + + + + + diff --git a/changelog/plugin.properties b/changelog/plugin.properties new file mode 100644 index 00000000..8c7b78d9 --- /dev/null +++ b/changelog/plugin.properties @@ -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 diff --git a/changelog/project.properties b/changelog/project.properties new file mode 100644 index 00000000..5e723259 --- /dev/null +++ b/changelog/project.properties @@ -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} \ No newline at end of file diff --git a/changelog/project.xml b/changelog/project.xml new file mode 100644 index 00000000..396b3a6d --- /dev/null +++ b/changelog/project.xml @@ -0,0 +1,120 @@ + + + + ${basedir}/../project.xml + 3 + maven-changelog-plugin + Maven Changelog Plug-in + 1.2-SNAPSHOT + + + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/changelog/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/changelog/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Java Developer + Documentation + + + + + Pete Kazmier + kaz + pete-apache-dev@kazmier.com + + + Documentation + Java Developer + + + + + Emmanuel Venisse + evenisse + evenisse@ifrance.com + Fi System + + Java Developer + + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + + ant + 1.5.1 + + root + + + + + commons-jelly+tags-jsl + SNAPSHOT + + root.maven + + + + + commons-jelly + commons-jelly-tags-xml + SNAPSHOT + http://jakarta.apache.org/commons/sandbox/jelly/tags/xml/ + + root.maven + + + + + commons-logging + 1.0.1 + + + + junit + 3.8.1 + + + + regexp + 1.2 + + + + + maven + b5 + maven.jar + + + + + + diff --git a/changelog/src/main/org/apache/maven/changelog/AbstractChangeLogGenerator.java b/changelog/src/main/org/apache/maven/changelog/AbstractChangeLogGenerator.java new file mode 100644 index 00000000..ef9d5fe3 --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/AbstractChangeLogGenerator.java @@ -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 + * . + * + * ==================================================================== + */ + +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 Jeff Martin + * @author Jason van Zyl + * @author dIon Gillard + * @author Stefan Bodewig + * @author Peter Donald + * @author Pete Kazmier + * @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; + } + +} diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLog.java b/changelog/src/main/org/apache/maven/changelog/ChangeLog.java new file mode 100644 index 00000000..5f923b59 --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLog.java @@ -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 + * . + * + * ==================================================================== + */ + +// 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 Glenn McAllister + * @author Jeff Martin + * @author Jason van Zyl + * @author dIon Gillard + * @author Stefan Bodewig + * @author Peter Donald + * @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 + * clFactory 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("\n") + .append("\n"); + + for (Iterator i = getEntries().iterator(); i.hasNext();) + { + buffer.append(((ChangeLogEntry) i.next()).toXML()); + } + + buffer.append("\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 diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java b/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java new file mode 100644 index 00000000..6692ad2f --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java @@ -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 + * . + * + * ==================================================================== + */ + +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 dIon Gillard + * @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\n") + .append("\t\t") + .append(getDateFormatted()) + .append("\n") + .append("\t\t\n") + .append("\t\t\n"); + + for (Enumeration e = files.elements(); e.hasMoreElements();) + { + ChangeLogFile file = (ChangeLogFile) e.nextElement(); + buffer.append("\t\t\n") + .append("\t\t\t") + .append(file.getName()) + .append("\n") + .append("\t\t\t") + .append(file.getRevision()) + .append("\n"); + buffer.append("\t\t\n"); + } + buffer.append("\t\t\n"); + buffer.append("\t\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()); + } + +} diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLogFactory.java b/changelog/src/main/org/apache/maven/changelog/ChangeLogFactory.java new file mode 100644 index 00000000..70b40d01 --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLogFactory.java @@ -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 + * . + * + * ==================================================================== + */ + +/** + * 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(); +} diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLogFile.java b/changelog/src/main/org/apache/maven/changelog/ChangeLogFile.java new file mode 100644 index 00000000..3b4ebbf9 --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLogFile.java @@ -0,0 +1,145 @@ +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 + * . + * + * ==================================================================== + */ + +/** + * A set of information about revisions of a file as returned by CVS's log + * command + * @task remove previous revision along with parser changes + * @author dIon Gillard + * @version $Id: ChangeLogFile.java,v 1.1 2003/01/24 03:44:51 jvanzyl Exp $ + */ +public class ChangeLogFile +{ + /** the name of the file relative to the project directory. */ + private String name; + /** the latest revision of the file. */ + private String revision; + + /** + * Constructor for the ChangeLogFile object without all details available + * @param name file name + */ + public ChangeLogFile(String name) + { + setName(name); + } + + /** + * Constructor for the ChangeLogFile object + * + * @param name file name + * @param rev latest revision of the file + */ + public ChangeLogFile(String name, String rev) + { + setName(name); + setRevision(rev); + } + + /** + * Gets the name attribute of the ChangeLogFile object. + * @return the file name + */ + public String getName() + { + return name; + } + + /** + * Gets the revision attribute of the ChangeLogFile object. + * @return the latest revision of the file + */ + public String getRevision() + { + return revision; + } + + /** + * Setter for property name. + * @param name New value of property name. + */ + public void setName(String name) + { + this.name = name; + } + + /** + * Setter for property revision. + * @param revision New value of property revision. + */ + public void setRevision(String revision) + { + this.revision = revision; + } + + /** + * Provide a version of the object as a string for debugging purposes + * @return a {@link String} made up of the properties of the object + */ + public String toString() + { + StringBuffer buffer = new StringBuffer(getName()); + if (getRevision() != null) + { + buffer.append(", ").append(getRevision()); + } + return buffer.toString(); + } + +} // end of ChangeLogFile + diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLogGenerator.java b/changelog/src/main/org/apache/maven/changelog/ChangeLogGenerator.java new file mode 100644 index 00000000..6d3c9975 --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLogGenerator.java @@ -0,0 +1,107 @@ +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 + * . + * + * ==================================================================== + */ + +import java.io.IOException; +import java.util.Collection; + +/** + * Instances of ChangeLogGenerator are intended to provide an + * {@link java.io.InputStream} for a {@link ChangeLogParser} to parse into + * individual {@link ChangeLogEntry} objects. + * + * @author Glenn McAllister + * @author dion + * @version $Id: ChangeLogGenerator.java,v 1.1 2003/01/24 03:44:51 jvanzyl Exp $ + */ +public interface ChangeLogGenerator +{ + /** + * Initialize the ChangeLogGenerator instance with in the controlling + * {@link ChangeLog} instance. Any configuration required for the generator + * should be obtained from the changeLog. This method is + * guaranteed to be called before {@link #getEntries}. + * + * @param changeLog the controlling ChangeLog instance + */ + void init(ChangeLog changeLog); + + /** + * Return a Collection of ChangeLogEntry objects. This method should + * create an {@link java.io.InputStream} that contains the change log + * insformation which is then passed to the parser to create + * the individual {@link ChangeLogEntry} objects. + * + *

This method is guaranteed to be called after {@link #init} and before + * {@link #cleanup}. This method must invoke only the {@link + * ChangeLogParser#parse} method.

+ * + * @param parser the parser that will create the individual ChangeLogEntry + * objects. + * @return a Collection of ChangeLogEntry objects + * @throws IOException if there is an error while creating the + * ChangeLogEntry objects + */ + Collection getEntries(ChangeLogParser parser) throws IOException; + + /** + * Provides the opportunity for the generator to do any required cleanup. + * This method is guaranteed to be called after the getEntries method even + * if an exception is thrown from getEntries. + */ + void cleanup(); +} diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLogParser.java b/changelog/src/main/org/apache/maven/changelog/ChangeLogParser.java new file mode 100644 index 00000000..7674c2f1 --- /dev/null +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLogParser.java @@ -0,0 +1,102 @@ +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 + * . + * + * ==================================================================== + */ + +import java.io.InputStream; +import java.io.IOException; +import java.util.Collection; + +/** + * Instance of ChangeLogParser are intended to parse an {@link + * java.io.InputStream} created by a {@link ChangeLogGenerator} into individual + * {@link ChangeLogEntry} objects. + * + * @author Glenn McAllister + * @version $Id: ChangeLogParser.java,v 1.1 2003/01/24 03:44:51 jvanzyl Exp $ + */ +public interface ChangeLogParser +{ + /** + * Initialize the ChangeLogParser instance with the controlling {@link + * ChangeLog} instance. Any configuration required for the parser should + * be obtained from the changeLog. This method is guaranteed + * to be called before {@link #parse}. + * + * @param changeLog the controlling ChangeLog instance + */ + void init(ChangeLog changeLog); + + /** + * Returns a {@link java.util.Collection} of ChangeLogEntry objects, parsed + * from the {@link java.io.InputStream}. This method is guaranteed to be + * called after {@link #init} and before {@link #cleanup}. However, it is + * up to a {@link ChangeLogGenerator} instance to call this method, so no + * guarantee can be made this this method will be called. + * + * @param in the input stream to parse + * @return a Collection of ChangeLogEntry objects + * @throws IOException if there is an error while parsing the input stream + */ + Collection parse(InputStream in) throws IOException; + + /** + * Provides the opportunity for the parser to do any required cleanup. + * This method is guaranteed to be called after the {@link #init} (and + * presumably the {@link #parse}) method. + */ + void cleanup(); +} diff --git a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogFactory.java b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogFactory.java new file mode 100644 index 00000000..07ac6aa0 --- /dev/null +++ b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogFactory.java @@ -0,0 +1,98 @@ +package org.apache.maven.cvslib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import org.apache.maven.changelog.ChangeLogFactory; +import org.apache.maven.changelog.ChangeLogGenerator; +import org.apache.maven.changelog.ChangeLogParser; + +/** + * Provides CVS specific instances of the ChangeLogGenerator and + * ChangeLogParser interfaces. + * + * @author Glenn McAllister + * @version $Id: CvsChangeLogFactory.java,v 1.1 2003/01/24 03:44:53 jvanzyl Exp $ + */ +public class CvsChangeLogFactory implements ChangeLogFactory +{ + /** + * Default no-arg constructor. + */ + public CvsChangeLogFactory() + { + } + + /** + * Create a CVS specific ChangeLogGenerator. + * + * @return a CVS specific ChangeLogGenerator. + */ + public ChangeLogGenerator createGenerator() + { + return new CvsChangeLogGenerator(); + } + + /** + * Create a CVS specific ChangeLogParser. + * + * @return a CVS specific ChangeLogParser. + */ + public ChangeLogParser createParser() + { + return new CvsChangeLogParser(); + } +} diff --git a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java new file mode 100644 index 00000000..066a3711 --- /dev/null +++ b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java @@ -0,0 +1,223 @@ +package org.apache.maven.cvslib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import java.io.InputStream; +import java.io.IOException; +import java.util.Date; +import java.util.StringTokenizer; +import java.text.SimpleDateFormat; +// commons imports +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +// maven imports +import org.apache.maven.changelog.AbstractChangeLogGenerator; +import org.apache.maven.util.AsyncStreamReader; +// ant imports +import org.apache.tools.ant.types.Commandline; + +/** + * A CVS implementation of the {@link org.apache.maven.changelog.ChangeLog} + * interface. + * + * @task Check CVS exists first by running cvs -version instead of current hack + * @author Glenn McAllister + * @author Jeff Martin + * @author Jason van Zyl + * @author dIon Gillard + * @author Stefan Bodewig + * @author Peter Donald + * @author Pete Kazmier + * @version + * $Id: CvsChangeLogGenerator.java,v 1.1 2003/01/24 03:44:53 jvanzyl Exp $ + */ +class CvsChangeLogGenerator extends AbstractChangeLogGenerator +{ + /** Log */ + private static final Log LOG = LogFactory.getLog( + CvsChangeLogGenerator.class); + + /** + * @return the cvs command line to be executed. + */ + protected Commandline getScmLogCommand() + { + if (getConnection() == null) + { + throw new IllegalArgumentException("repository connection string" + + " not specified"); + } + StringTokenizer tokenizer = new StringTokenizer(getConnection(), ":"); + if (tokenizer.countTokens() < 6) + { + throw new IllegalArgumentException("repository connection string" + + " contains less than six tokens"); + } + tokenizer.nextToken(); // skip 'scm' + if (!tokenizer.nextToken().equals("cvs")) + { + throw new IllegalArgumentException("repository connection string" + + " does not specify 'cvs' as the scm"); + } + Commandline command = new Commandline(); + + command.setExecutable("cvs"); + command.createArgument().setValue("-d"); + // from format: + // scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven/src/plugins-build/changelog/ + // to format: + // :pserver:anoncvs@cvs.apache.org:/home/cvspublic + // use tokens 3+4+5 + StringBuffer connectionBuffer = new StringBuffer(":"); + connectionBuffer + .append(tokenizer.nextToken()) + .append(":") + .append(tokenizer.nextToken()) + .append(":") + .append(tokenizer.nextToken()); + command.createArgument().setValue(connectionBuffer.toString()); + command.createArgument().setValue("log"); + + if (dateRange != null) + { + command.createArgument().setValue(dateRange); + } + + return command; + } + + /** + * Construct the CVS command-line argument that is used 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 String getScmDateArgument(Date before, Date to) + { + SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); + return "-d " + outputDate.format(before) + "<" + outputDate.format(to); + } + + /** + * Handle ChangeLogParser IOExceptions. + * + * @param ioe The IOException thrown. + * @throws IOException If the handler doesn't wish to handle the + * exception. + */ + protected void handleParserException(IOException ioe) + throws IOException + { + if (ioe.getMessage().indexOf("CreateProcess") != -1 + || ioe.getMessage().indexOf("cvs: not found") != -1) + { + // can't find CVS on Win32 or Linux... + if (LOG.isWarnEnabled()) + { + LOG.warn("Unable to find cvs executable. " + + "Changelog will be empty"); + } + } + else + { + throw ioe; + } + } + + /** + * Set the error stream for reading from cvs log. This stream will be read + * on a separate thread. + * @param is - an {@link java.io.InputStream} + */ + public void setProcessErrorStream(InputStream is) + { + errorReader = new CvsAsyncErrorReader(is); + } + + /** + * A private AsyncStreamReader class that "swallows" the "cvs server: + * Logging" lines. + */ + private static class CvsAsyncErrorReader extends AsyncStreamReader + { + /** + * The obvious constructor. + * + * @param anInputStream the input stream to consume + */ + public CvsAsyncErrorReader(InputStream anInputStream) + { + super(anInputStream); + } + + /** + * If the line does not start with "cvs server: Logging", it's ok to + * consume it. + * + * @param line the line to check + * @return true if the line does not start with "cvs + * server: Logging" + */ + protected boolean okToConsume(String line) + { + return !line.startsWith("cvs server: Logging"); + } + } +} diff --git a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogParser.java b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogParser.java new file mode 100644 index 00000000..6b229e1d --- /dev/null +++ b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogParser.java @@ -0,0 +1,361 @@ +package org.apache.maven.cvslib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.TreeMap; + +import org.apache.maven.changelog.ChangeLog; +import org.apache.maven.changelog.ChangeLogParser; +import org.apache.maven.changelog.ChangeLogEntry; +import org.apache.maven.changelog.ChangeLogFile; + +/** + * A class to parse cvs log output + * + * @author dIon Gillard + * @version $Id: CvsChangeLogParser.java,v 1.1 2003/01/24 03:44:53 jvanzyl Exp $ + */ +class CvsChangeLogParser implements ChangeLogParser +{ + /** + * Custom date/time formatter. Rounds ChangeLogEntry times to the nearest + * minute. + */ + private static final SimpleDateFormat ENTRY_KEY_TIMESTAMP_FORMAT = + new SimpleDateFormat("yyyyMMddHHmm"); + + /** + * rcs entries, in reverse (date, time, author, comment) order + */ + private Map entries = new TreeMap(Collections.reverseOrder()); + + // state machine constants for reading cvs output + /** expecting file information */ + private static final int GET_FILE = 1; + /** expecting date */ + private static final int GET_DATE = 2; + /** expecting comments */ + private static final int GET_COMMENT = 3; + /** expecting revision */ + private static final int GET_REVISION = 4; + /** Marks start of file data*/ + private static final String START_FILE = "Working file: "; + /** Marks end of file */ + private static final String END_FILE = "===================================" + + "=========================================="; + /** Marks start of revision */ + private static final String START_REVISION = "----------------------------"; + /** Marks revision data */ + private static final String REVISION_TAG = "revision "; + /** Marks date data */ + private static final String DATE_TAG = "date: "; + + /** current status of the parser */ + private int status = GET_FILE; + + /** the current log entry being processed by the parser*/ + private ChangeLogEntry currentLogEntry = null; + + /** the current file being processed by the parser */ + private ChangeLogFile currentFile = null; + + /** + * Create a new ChangeLogParser. + */ + public CvsChangeLogParser() + { + } + + /** + * initialize the parser from the change log + * @param changeLog the controlling task + * @see ChangeLogParser#init(ChangeLog) + */ + public void init(ChangeLog changeLog) + { + } + + /** + * Clean up any parser resources + * @see ChangeLogParser#cleanup() + */ + public void cleanup() + { + } + + /** + * Parse the input stream into a collection. + * @param anInputStream an input stream containing cvs log output + * @return a collection of ChangeLogEntry's + * @throws IOException when there are errors reading the provided stream + */ + public Collection parse(InputStream anInputStream) throws IOException + { + BufferedReader stream = new BufferedReader( + new InputStreamReader(anInputStream)); + + // current state transitions in the state machine - starts with Get File + // Get File -> Get Revision + // Get Revision -> Get Date or Get File + // Get Date -> Get Comment + // Get Comment -> Get Comment or Get Revision + String line = null; + while ((line = stream.readLine()) != null) + { + switch (getStatus()) + { + case GET_FILE: + processGetFile(line); + break; + case GET_REVISION: + processGetRevision(line); + break; + case GET_DATE: + processGetDate(line); + break; + case GET_COMMENT: + processGetComment(line); + break; + default: + throw new IllegalStateException("Unknown state: " + status); + } + } + + return entries.values(); + } + + /** + * Add a change log entry to the list (if it's not already there) + * with the given file. + * @param entry a {@link ChangeLogEntry} to be added to the list if another + * with the same key doesn't exist already. If the entry's author + * is null, the entry wont be added + * @param file a {@link ChangeLogFile} to be added to the entry + */ + private void addEntry(ChangeLogEntry entry, ChangeLogFile file) + { + // do not add if entry is not populated + if (entry.getAuthor() == null) + { + return; + } + + String key = ENTRY_KEY_TIMESTAMP_FORMAT.format(entry.getDate()) + + entry.getAuthor() + entry.getComment(); + + if (!entries.containsKey(key)) + { + entry.addFile(file); + entries.put(key, entry); + } + else + { + ChangeLogEntry existingEntry = (ChangeLogEntry) entries.get(key); + existingEntry.addFile(file); + } + } + + /** + * Process the current input line in the Get File state. + * @param line a line of text from the cvs log output + */ + private void processGetFile(String line) + { + if (line.startsWith(START_FILE)) + { + setCurrentLogEntry(new ChangeLogEntry()); + setCurrentFile(new ChangeLogFile(line.substring(START_FILE.length(), + line.length()))); + setStatus(GET_REVISION); + } + } + + /** + * Process the current input line in the Get Revision state. + * @param line a line of text from the cvs log output + */ + private void processGetRevision(String line) + { + if (line.startsWith(REVISION_TAG)) + { + getCurrentFile().setRevision(line.substring(REVISION_TAG.length())); + setStatus(GET_DATE); + } + else if (line.startsWith(END_FILE)) + { + // If we encounter an end of file line, it means there + // are no more revisions for the current file. + // there could also be a file still being processed. + setStatus(GET_FILE); + addEntry(getCurrentLogEntry(), getCurrentFile()); + } + } + + /** + * Process the current input line in the Get Date state. + * @param line a line of text from the cvs log output + */ + private void processGetDate(String line) + { + if (line.startsWith(DATE_TAG)) + { + StringTokenizer tokenizer = new StringTokenizer(line, " ;"); + // date: YYYY/mm/dd HH:mm:ss; author: name + tokenizer.nextToken(); // date tag + String date = tokenizer.nextToken(); + String time = tokenizer.nextToken(); + getCurrentLogEntry().setDate(date + " " + time); + tokenizer.nextToken(); // author tag + // assumes author can't contain spaces + String author = tokenizer.nextToken(); + getCurrentLogEntry().setAuthor(author); + setStatus(GET_COMMENT); + } + } + + /** + * Process the current input line in the Get Comment state. + * @param line a line of text from the cvs log output + */ + private void processGetComment(String line) + { + if (line.startsWith(START_REVISION)) + { + // add entry, and set state to get revision + addEntry(getCurrentLogEntry(), getCurrentFile()); + // new change log entry + setCurrentLogEntry(new ChangeLogEntry()); + // same file name, but different rev + setCurrentFile(new ChangeLogFile(getCurrentFile().getName())); + setStatus(GET_REVISION); + } + else if (line.startsWith(END_FILE)) + { + addEntry(getCurrentLogEntry(), getCurrentFile()); + setStatus(GET_FILE); + } + else + { + // keep gathering comments + getCurrentLogEntry().setComment( + getCurrentLogEntry().getComment() + line + "\n"); + } + } + + /** + * Getter for property currentFile. + * @return Value of property currentFile. + */ + private ChangeLogFile getCurrentFile() + { + return currentFile; + } + + /** + * Setter for property currentFile. + * @param currentFile New value of property currentFile. + */ + private void setCurrentFile(ChangeLogFile currentFile) + { + this.currentFile = currentFile; + } + + /** + * Getter for property currentLogEntry. + * @return Value of property currentLogEntry. + */ + private ChangeLogEntry getCurrentLogEntry() + { + return currentLogEntry; + } + + /** + * Setter for property currentLogEntry. + * @param currentLogEntry New value of property currentLogEntry. + */ + private void setCurrentLogEntry(ChangeLogEntry currentLogEntry) + { + this.currentLogEntry = currentLogEntry; + } + + /** + * Getter for property status. + * @return Value of property status. + */ + private int getStatus() + { + return status; + } + + /** + * Setter for property status. + * @param status New value of property status. + */ + private void setStatus(int status) + { + this.status = status; + } +} diff --git a/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogFactory.java b/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogFactory.java new file mode 100644 index 00000000..34667a76 --- /dev/null +++ b/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogFactory.java @@ -0,0 +1,98 @@ +package org.apache.maven.starteamlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import org.apache.maven.changelog.ChangeLogFactory; +import org.apache.maven.changelog.ChangeLogGenerator; +import org.apache.maven.changelog.ChangeLogParser; + +/** + * Provides Starteam specific instances of the ChangeLogGenerator and + * ChangeLogParser interfaces. + * + * @author Emmanuel Venisse + * @version $Id: StarteamChangeLogFactory.java,v 1.1 2003/01/24 03:44:53 jvanzyl Exp $ + */ +public class StarteamChangeLogFactory implements ChangeLogFactory +{ + /** + * Default no-arg constructor. + */ + public StarteamChangeLogFactory() + { + } + + /** + * Create a Starteam specific ChangeLogGenerator. + * + * @return a Starteam specific ChangeLogGenerator. + */ + public ChangeLogGenerator createGenerator() + { + return new StarteamChangeLogGenerator(); + } + + /** + * Create a Starteam specific ChangeLogParser. + * + * @return a Starteam specific ChangeLogParser. + */ + public ChangeLogParser createParser() + { + return new StarteamChangeLogParser(); + } +} diff --git a/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogGenerator.java b/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogGenerator.java new file mode 100644 index 00000000..6aa47bff --- /dev/null +++ b/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogGenerator.java @@ -0,0 +1,142 @@ +package org.apache.maven.starteamlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import java.io.IOException; +import java.util.Date; +// commons imports +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +// maven imports +import org.apache.maven.changelog.AbstractChangeLogGenerator; +// ant imports +import org.apache.tools.ant.types.Commandline; + +/** + * A Starteam implementation of the {@link org.apache.maven.changelog.ChangeLog} + * interface. + * + * @author Emmanuel Venisse + * @version $Id: StarteamChangeLogGenerator.java,v 1.1 2003/01/24 03:44:53 jvanzyl Exp $ + */ +class StarteamChangeLogGenerator extends AbstractChangeLogGenerator +{ + /** Log */ + private static final Log LOG = LogFactory.getLog( + StarteamChangeLogGenerator.class); + /** + * Constructs the appropriate command line to execute the starteam + * log command whose output is then later parsed. + * + * @return the starteam command line to be executed. + */ + protected Commandline getScmLogCommand() + { + Commandline command = new Commandline(); + command.setExecutable("stcmd"); + command.createArgument().setValue("hist"); + command.createArgument().setValue("-nologo"); + command.createArgument().setValue("-is"); + command.createArgument().setValue("-p"); + + String repo = changeLogExecutor.getRepositoryConnection(); + + if ("starteam".equals(repo.substring(4, 12))) + { + repo = repo.substring(13); + command.createArgument().setValue("\"" + repo + "\""); + } + return command; + } + + /** + * Construct the Starteam command-line argument that is used to specify + * the appropriate date range. This date option doesn't supported with + * Starteam + * + * @param before The starting point. + * @param to The ending point. + * @return An empty string + */ + protected String getScmDateArgument(Date before, Date to) + { + return ""; + } + + /** + * Handle ChangeLogParser IOExceptions. + * + * @param ioe The IOException thrown. + * @throws IOException If the handler doesn't wish to handle the + * exception. + */ + protected void handleParserException(IOException ioe) + throws IOException + { + if (ioe.getMessage().indexOf("CreateProcess") != -1 + || ioe.getMessage().indexOf("Starteam: not found") != -1) + { + // can't find Starteam on Win32 or Linux... + LOG.error( + "Unable to find Starteam executable. Changelog will be empty("+ioe+")"); + } + else + { + throw ioe; + } + } +} diff --git a/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogParser.java b/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogParser.java new file mode 100644 index 00000000..302e2652 --- /dev/null +++ b/changelog/src/main/org/apache/maven/starteamlib/StarteamChangeLogParser.java @@ -0,0 +1,446 @@ +package org.apache.maven.starteamlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.text.ParseException; +import java.util.Date; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.TreeMap; + +import org.apache.maven.changelog.ChangeLog; +import org.apache.maven.changelog.ChangeLogParser; +import org.apache.maven.changelog.ChangeLogEntry; +import org.apache.maven.changelog.ChangeLogFile; +// commons imports +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A class to parse starteam log output + * + * @author Emmanuel Venisse + * @version $Id: StarteamChangeLogParser.java,v 1.1 2003/01/24 03:44:54 jvanzyl Exp $ + */ +class StarteamChangeLogParser implements ChangeLogParser +{ + /** + * Custom date/time formatter. Rounds ChangeLogEntry times to the nearest + * minute. + */ + private static final SimpleDateFormat ENTRY_KEY_TIMESTAMP_FORMAT = + new SimpleDateFormat("yyyyMMddHHmm"); + + private static SimpleDateFormat localFormat = new SimpleDateFormat(); + + /** + * rcs entries, in reverse (date, time, author, comment) order + */ + private Map entries = new TreeMap(Collections.reverseOrder()); + + /** Log */ + private static final Log LOG = LogFactory.getLog( + StarteamChangeLogGenerator.class); + // state machine constants for reading Starteam output + /** expecting file information */ + private static final int GET_FILE = 1; + /** expecting date */ + private static final int GET_AUTHOR = 2; + /** expecting comments */ + private static final int GET_COMMENT = 3; + /** expecting revision */ + private static final int GET_REVISION = 4; + /** Marks start of file data*/ + private static final String START_FILE = "History for: "; + /** Marks end of file */ + private static final String END_FILE = "===================================" + + "=========================================="; + /** Marks start of revision */ + private static final String START_REVISION = "----------------------------"; + /** Marks revision data */ + private static final String REVISION_TAG = "Branch Revision: "; + /** Marks author data */ + private static final String AUTHOR_TAG = "Author: "; + /** Marks date data */ + private static final String DATE_TAG = " Date: "; + + /** current status of the parser */ + private int status = GET_FILE; + + /** the current log entry being processed by the parser*/ + private ChangeLogEntry currentLogEntry = null; + + /** the current file being processed by the parser */ + private ChangeLogFile currentFile = null; + + /** the controlling task */ + private ChangeLog changeLog = null; + + /** the before date */ + private Date beforeDate; + + /** the to date */ + private Date toDate; + + /** the test mode (In test mode, we dont't use the date range*/ + private boolean testMode = false; + + /** + * Create a new ChangeLogParser. + */ + public StarteamChangeLogParser() + { + } + + /** + * initialize the parser from the change log + * @param changeLog the controlling task + * @see ChangeLogParser#init(ChangeLog) + */ + public void init(ChangeLog changeLog) + { + this.changeLog = changeLog; + if (changeLog.getRange() != null && + changeLog.getRange().length() != 0) + { + setDateRange(changeLog.getRange()); + } + } + + /** + * Clean up any parser resources + * @see ChangeLogParser#cleanup() + */ + public void cleanup() + { + } + + /** + * Set the date formatter for parse starteam stream + * Use only with StarteamChangeLogParserTest class + * @param aSimpleDateFormat a simpleDateFormat for replace the local format + */ + public void setDateFormatInFile(SimpleDateFormat aSimpleDateFormat) + { + localFormat = aSimpleDateFormat; + testMode = true; + } + + /** + * Parse the input stream into a collection. + * @param anInputStream an input stream containing Starteam log output + * @return a collection of ChangeLogEntry's + * @throws IOException when there are errors reading the provided stream + */ + public Collection parse(InputStream anInputStream) throws IOException + { + BufferedReader stream = new BufferedReader( + new InputStreamReader(anInputStream)); + + // current state transitions in the state machine - starts with Get File + // Get File -> Get Revision + // Get Revision -> Get Date or Get File + // Get Date -> Get Comment + // Get Comment -> Get Comment or Get Revision + String line = null; + while ((line = stream.readLine()) != null) + { + switch (getStatus()) + { + case GET_FILE: + processGetFile(line); + break; + case GET_REVISION: + processGetRevision(line); + break; + case GET_AUTHOR: + processGetAuthor(line); + break; + case GET_COMMENT: + processGetComment(line); + break; + default: + throw new IllegalStateException("Unknown state: " + status); + } + } + + return entries.values(); + } + + /** + * Add a change log entry to the list (if it's not already there) + * with the given file. + * @param entry a {@link ChangeLogEntry} to be added to the list if another + * with the same key doesn't exist already. If the entry's author + * is null, the entry wont be added + * @param file a {@link ChangeLogFile} to be added to the entry + */ + private void addEntry(ChangeLogEntry entry, ChangeLogFile file) + { + // do not add if entry is not populated + if (entry.getAuthor() == null) + { + return; + } + + // do not add if entry is out of date range + if (!testMode) + { + if (beforeDate != null && toDate != null) + { + if (entry.getDate().before(beforeDate) || entry.getDate().after(toDate)) + { + return; + } + } + } + + String key = ENTRY_KEY_TIMESTAMP_FORMAT.format(entry.getDate()) + + entry.getAuthor() + entry.getComment(); + + if (!entries.containsKey(key)) + { + entry.addFile(file); + entries.put(key, entry); + } + else + { + ChangeLogEntry existingEntry = (ChangeLogEntry) entries.get(key); + existingEntry.addFile(file); + } + } + + /** + * Process the current input line in the Get File state. + * @param line a line of text from the Starteam log output + */ + private void processGetFile(String line) + { + if (line.startsWith(START_FILE)) + { + setCurrentLogEntry(new ChangeLogEntry()); + setCurrentFile(new ChangeLogFile(line.substring(START_FILE.length(), + line.length()))); + setStatus(GET_REVISION); + } + } + + /** + * Process the current input line in the Get Revision state. + * @param line a line of text from the Starteam log output + */ + private void processGetRevision(String line) + { + int pos; + if ((pos=line.indexOf(REVISION_TAG)) != -1) + { + getCurrentFile().setRevision(line.substring(pos + REVISION_TAG.length())); + setStatus(GET_AUTHOR); + } + else if (line.startsWith(END_FILE)) + { + // If we encounter an end of file line, it means there + // are no more revisions for the current file. + // there could also be a file still being processed. + setStatus(GET_FILE); + addEntry(getCurrentLogEntry(), getCurrentFile()); + } + } + + /** + * Process the current input line in the Get Author/Date state. + * @param line a line of text from the Starteam log output + */ + private void processGetAuthor(String line) + { + if (line.startsWith(AUTHOR_TAG)) + { + int posDateTag = line.indexOf(DATE_TAG); + String author = line.substring(AUTHOR_TAG.length(), posDateTag); + getCurrentLogEntry().setAuthor(author); + String date = line.substring(posDateTag + DATE_TAG.length()); + getCurrentLogEntry().setDate(parseDate(date)); + setStatus(GET_COMMENT); + } + } + + /** + * Process the current input line in the Get Comment state. + * @param line a line of text from the Starteam log output + */ + private void processGetComment(String line) + { + if (line.startsWith(START_REVISION)) + { + // add entry, and set state to get revision + addEntry(getCurrentLogEntry(), getCurrentFile()); + // new change log entry + setCurrentLogEntry(new ChangeLogEntry()); + // same file name, but different rev + setCurrentFile(new ChangeLogFile(getCurrentFile().getName())); + setStatus(GET_REVISION); + } + else if (line.startsWith(END_FILE)) + { + addEntry(getCurrentLogEntry(), getCurrentFile()); + setStatus(GET_FILE); + } + else + { + // keep gathering comments + getCurrentLogEntry().setComment( + getCurrentLogEntry().getComment() + line + "\n"); + } + } + + /** + * Getter for property currentFile. + * @return Value of property currentFile. + */ + private ChangeLogFile getCurrentFile() + { + return currentFile; + } + + /** + * Setter for property currentFile. + * @param currentFile New value of property currentFile. + */ + private void setCurrentFile(ChangeLogFile currentFile) + { + this.currentFile = currentFile; + } + + /** + * Getter for property currentLogEntry. + * @return Value of property currentLogEntry. + */ + private ChangeLogEntry getCurrentLogEntry() + { + return currentLogEntry; + } + + /** + * Setter for property currentLogEntry. + * @param currentLogEntry New value of property currentLogEntry. + */ + private void setCurrentLogEntry(ChangeLogEntry currentLogEntry) + { + this.currentLogEntry = currentLogEntry; + } + + /** + * Getter for property status. + * @return Value of property status. + */ + private int getStatus() + { + return status; + } + + /** + * Setter for property status. + * @param status New value of property status. + */ + private void setStatus(int status) + { + this.status = status; + } + + /** + * Converts the date timestamp from the svn output into a date + * object. + * + * @return A date representing the timestamp of the log entry. + */ + private Date parseDate(String date) + { + try + { + return localFormat.parse(date.toString()); + } + catch (ParseException e) + { + LOG.error("ParseException Caught", e); + return null; + } + } + + /** + * Set the beforeDate and toDate member based on the number of days + * obtained from the ChangeLog. + * + * @param numDaysString The number of days of log output to + * generate. + */ + private void setDateRange(String numDaysString) + { + int days = Integer.parseInt(numDaysString); + + beforeDate = new Date( + System.currentTimeMillis() - (long) days * 24 * 60 * 60 * 1000); + toDate = new Date( + System.currentTimeMillis() + (long) 1 * 24 * 60 * 60 * 1000); + } +} diff --git a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogFactory.java b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogFactory.java new file mode 100644 index 00000000..0ad4f3b6 --- /dev/null +++ b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogFactory.java @@ -0,0 +1,98 @@ +package org.apache.maven.svnlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import org.apache.maven.changelog.ChangeLogFactory; +import org.apache.maven.changelog.ChangeLogGenerator; +import org.apache.maven.changelog.ChangeLogParser; + +/** + * Provides Subversion specific instances of the ChangeLogGenerator and + * ChangeLogParser interfaces. + * + * @author Pete Kazmier + * @version $Id: SvnChangeLogFactory.java,v 1.1 2003/01/24 03:44:54 jvanzyl Exp $ + */ +public class SvnChangeLogFactory implements ChangeLogFactory +{ + /** + * Default no-arg constructor. + */ + public SvnChangeLogFactory() + { + } + + /** + * Create a Subversion specific ChangeLogGenerator. + * + * @return a Subversion specific ChangeLogGenerator. + */ + public ChangeLogGenerator createGenerator() + { + return new SvnChangeLogGenerator(); + } + + /** + * Create a Subversion specific ChangeLogParser. + * + * @return a Subversion specific ChangeLogParser. + */ + public ChangeLogParser createParser() + { + return new SvnChangeLogParser(); + } +} diff --git a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java new file mode 100644 index 00000000..c39f0d83 --- /dev/null +++ b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java @@ -0,0 +1,153 @@ +package org.apache.maven.svnlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import java.io.InputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.Date; +import java.text.SimpleDateFormat; +// commons imports +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +// maven imports +import org.apache.maven.changelog.AbstractChangeLogGenerator; +import org.apache.maven.util.AsyncStreamReader; +// ant imports +import org.apache.tools.ant.types.Commandline; + +/** + * A Subversion implementation of the {@link org.apache.maven.changelog.ChangeLog} + * interface. + * + * @author Glenn McAllister + * @author Jeff Martin + * @author Jason van Zyl + * @author dIon Gillard + * @author Stefan Bodewig + * @author Peter Donald + * @author Pete Kazmier + * @version + * $Id: SvnChangeLogGenerator.java,v 1.1 2003/01/24 03:44:54 jvanzyl Exp $ + */ +class SvnChangeLogGenerator extends AbstractChangeLogGenerator +{ + /** Log */ + private static final Log LOG = LogFactory.getLog( + SvnChangeLogGenerator.class); + /** + * Constructs the appropriate command line to execute the subversion + * log command whose output is then later parsed. + * + * @return the cvs command line to be executed. + */ + protected Commandline getScmLogCommand() + { + Commandline command = new Commandline(); + + command.setExecutable("svn"); + command.createArgument().setValue("log"); + command.createArgument().setValue("-v"); + + if (dateRange != null) + { + command.createArgument().setValue(dateRange); + } + + return command; + } + + /** + * Construct the svn command-line argument that is used to specify + * the appropriate date range. This date option takes the format of + * "-D start:end" in the case of Subversion. + * + * @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 String getScmDateArgument(Date before, Date to) + { + SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); + // Specify to:before as that will sort the log entries for us + return "-D " + outputDate.format(to) + ":" + outputDate.format(before); + } + + /** + * Handle ChangeLogParser IOExceptions. + * + * @param ioe The IOException thrown. + * @throws IOException If the handler doesn't wish to handle the + * exception. + */ + protected void handleParserException(IOException ioe) + throws IOException + { + if (ioe.getMessage().indexOf("CreateProcess") != -1 + || ioe.getMessage().indexOf("svn: not found") != -1) + { + // can't find svn on Win32 or Linux... + LOG.error( + "Unable to find svn executable. Changelog will be empty"); + } + else + { + throw ioe; + } + } +} diff --git a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java new file mode 100644 index 00000000..b01879ef --- /dev/null +++ b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java @@ -0,0 +1,321 @@ +package org.apache.maven.svnlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.ArrayList; +import java.util.StringTokenizer; +// commons imports +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +// maven +import org.apache.maven.changelog.ChangeLog; +import org.apache.maven.changelog.ChangeLogParser; +import org.apache.maven.changelog.ChangeLogEntry; +import org.apache.maven.changelog.ChangeLogFile; +// regexp +import org.apache.regexp.RE; +import org.apache.regexp.RESyntaxException; + +/** + * A class to parse the log output from Subversion. + * + * @author dIon Gillard + * @author Pete Kazmier + * @version $Id: SvnChangeLogParser.java,v 1.1 2003/01/24 03:44:55 jvanzyl Exp $ + */ +class SvnChangeLogParser implements ChangeLogParser +{ + /** Date formatter for svn timestamp (after a little massaging) */ + private static final SimpleDateFormat SVN_TIMESTAMP = + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzzzzzzzz"); + + /** Log */ + private static final Log LOG = LogFactory.getLog( + SvnChangeLogParser.class); + + /** State machine constant: expecting header */ + private static final int GET_HEADER = 1; + + /** State machine constant: expecting file information */ + private static final int GET_FILE = 2; + + /** State machine constant: expecting comments */ + private static final int GET_COMMENT = 3; + + /** A file line begins with a space character */ + private static final String FILE_BEGIN_TOKEN = " "; + + /** The file section ends with a blank line */ + private static final String FILE_END_TOKEN = ""; + + /** The filename starts after 5 characters */ + private static final int FILE_START_INDEX = 5; + + /** The comment section ends with a dashed line */ + private static final String COMMENT_END_TOKEN = + "------------------------------------" + + "------------------------------------"; + + /** The pattern used to match svn header lines */ + private static final String pattern = + "^rev (\\d+):\\s+" + // revision number + "(\\w+)\\s+\\|\\s+" + // author username + "(\\d+-\\d+-\\d+ " + // date 2002-08-24 + "\\d+:\\d+:\\d+) " + // time 16:01:00 + "([\\-+])(\\d\\d)(\\d\\d)"; // gmt offset -0400 + + /** Current status of the parser */ + private int status = GET_HEADER; + + /** List of change log entries */ + private Collection entries = new ArrayList(); + + /** The current log entry being processed by the parser */ + private ChangeLogEntry currentLogEntry; + + /** The current revision of the entry being processed by the parser */ + private String currentRevision; + + /** The current comment of the entry being processed by the parser */ + private StringBuffer currentComment; + + /** The regular expression used to match header lines */ + private RE headerRegexp; + + /** The invoking changelog controller (useful to log messages) */ + private ChangeLog changeLog; + + /** + * Default constructor. + */ + public SvnChangeLogParser() + { + try + { + headerRegexp = new RE(pattern); + } + catch (RESyntaxException ignored) + { + LOG.error("Could not create regexp to parse svn log file", ignored); + } + } + + /** + * Initialize the parser from the change log. + * + * @param changeLog The controlling task + * @see ChangeLogParser#init(ChangeLog) + */ + public void init(ChangeLog changeLog) + { + this.changeLog = changeLog; + } + + /** + * Clean up any parser resources. + * + * @see ChangeLogParser#cleanup() + */ + public void cleanup() + { + } + + /** + * Parse the input stream into a collection. + * + * @param anInputStream An input stream containing svn log output + * @return A collection of ChangeLogEntry's + * @throws IOException When there are errors reading the provided stream + */ + public Collection parse(InputStream anInputStream) throws IOException + { + BufferedReader stream = new BufferedReader( + new InputStreamReader(anInputStream)); + + // current state transitions in the state machine - starts with Get Header + // Get Header -> Get File + // Get File -> Get Comment or Get (another) File + // Get Comment -> Get (another) Comment + String line = null; + while ((line = stream.readLine()) != null) + { + switch (status) + { + case GET_HEADER: + processGetHeader(line); + break; + case GET_FILE: + processGetFile(line); + break; + case GET_COMMENT: + processGetComment(line); + break; + default: + throw new IllegalStateException("Unknown state: " + status); + } + } + return entries; + } + + /** + * Process the current input line in the GET_HEADER state. The + * author, date, and the revision of the entry are gathered. Note, + * Subversion does not have per-file revisions, instead, the entire + * repository is given a single revision number, which is used for + * the revision number of each file. + * + * @param line A line of text from the svn log output + */ + private void processGetHeader(String line) + { + if (!headerRegexp.match(line)) + { + return; + } + + currentRevision = headerRegexp.getParen(1); + currentLogEntry = new ChangeLogEntry(); + currentLogEntry.setAuthor(headerRegexp.getParen(2)); + currentLogEntry.setDate(parseDate()); + + status = GET_FILE; + } + + /** + * Process the current input line in the GET_FILE state. This state + * adds each file entry line to the current change log entry. Note, + * the revision number for the entire entry is used for the revision + * number of each file. + * + * @param line A line of text from the svn log output + */ + private void processGetFile(String line) + { + if (line.startsWith(FILE_BEGIN_TOKEN)) + { + // Skip the status flags and just get the name of the file + String name = line.substring(FILE_START_INDEX); + currentLogEntry.addFile(new ChangeLogFile(name, currentRevision)); + + status = GET_FILE; + } + else if (line.equals(FILE_END_TOKEN)) + { + // Create a buffer for the collection of the comment now + // that we are leaving the GET_FILE state. + currentComment = new StringBuffer(); + + status = GET_COMMENT; + } + } + + /** + * Process the current input line in the GET_COMMENT state. This + * state gathers all of the comments that are part of a log entry. + * + * @param line a line of text from the svn log output + */ + private void processGetComment(String line) + { + if (line.equals(COMMENT_END_TOKEN)) + { + currentLogEntry.setComment(currentComment.toString()); + entries.add(currentLogEntry); + + status = GET_HEADER; + } + else + { + currentComment.append(line).append('\n'); + } + } + + /** + * Converts the date timestamp from the svn output into a date + * object. + * + * @return A date representing the timestamp of the log entry. + */ + private Date parseDate() + { + try + { + StringBuffer date = new StringBuffer() + .append(headerRegexp.getParen(3)) + .append(" GMT") + .append(headerRegexp.getParen(4)) + .append(headerRegexp.getParen(5)) + .append(':') + .append(headerRegexp.getParen(6)); + + return SVN_TIMESTAMP.parse(date.toString()); + } + catch (ParseException e) + { + LOG.error("ParseException Caught", e); + return null; + } + } +} diff --git a/changelog/src/main/org/apache/maven/util/AsyncStreamReader.java b/changelog/src/main/org/apache/maven/util/AsyncStreamReader.java new file mode 100644 index 00000000..5d65548f --- /dev/null +++ b/changelog/src/main/org/apache/maven/util/AsyncStreamReader.java @@ -0,0 +1,136 @@ +package org.apache.maven.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 + * . + * + * ==================================================================== + */ + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; + +/** + * A class to asynchronously read the provided InputStream and + * provide the output as a String + * + * @author dIon Gillard + * @version $Id: AsyncStreamReader.java,v 1.1 2003/01/24 03:44:56 jvanzyl Exp $ + */ +public class AsyncStreamReader extends Thread +{ + /** buffer to dump output to */ + private StringBuffer streamBuffer = new StringBuffer(); + + /** stream to read from */ + private BufferedReader stream; + + /** + * Create a reader to process the provided stream + * @param anInputStream any input stream + */ + public AsyncStreamReader(InputStream anInputStream) + { + if (anInputStream == null) + { + throw new NullPointerException("input stream parameter is null"); + } + stream = new BufferedReader(new InputStreamReader(anInputStream)); + } + + /** + * Read lines from the input stream provided, appending to a buffer + * for retrieval via the toString() method + */ + public void run() + { + String line; + try + { + while ((line = stream.readLine()) != null) + { + if (okToConsume(line)) + { + streamBuffer.append(line); + streamBuffer.append('\n'); + } + } + } + catch (IOException ioe) + { + ioe.printStackTrace(); + } + } + + /** + * @return the contents of the buffer + */ + public String toString() + { + return streamBuffer.toString(); + } + + /** + * Indicate if its ok to consume (add to the buffer) this line. This + * implementation always returns true. + * + * @param line the line to check. + * @return if its ok to add this line to the buffer. + */ + protected boolean okToConsume(String line) + { + return true; + } + +} // end of AsyncStreamReader diff --git a/changelog/src/plugin-resources/changelog.jsl b/changelog/src/plugin-resources/changelog.jsl new file mode 100644 index 00000000..938d36dd --- /dev/null +++ b/changelog/src/plugin-resources/changelog.jsl @@ -0,0 +1,64 @@ + + + + + + + + + Changelog Report + + +
+ + + + + + + + + + + + + + +
DateAuthorFile/Message
+ + + + + + + ${name} + + v${revision} + +

+ + + + + + + +

+
+ +
+
+
diff --git a/changelog/src/test-resources/starteamlib/starteamlog.txt b/changelog/src/test-resources/starteamlib/starteamlog.txt new file mode 100644 index 00000000..fda2b594 --- /dev/null +++ b/changelog/src/test-resources/starteamlib/starteamlog.txt @@ -0,0 +1,45 @@ +Folder: maven (working dir: C:\Test\maven) +Folder: src (working dir: C:\Test\maven\src) +History for: File2.java +Description: First release +Locked by: +Status: Current +---------------------------- +Revision: 2 View: GRP_Dev Branch Revision: 1.1 +Author: Emmanuel VENISSE Date: 11/09/02 15:08:20 GMT+02:00 +Add method print + +---------------------------- +Revision: 1 View: GRP_Dev Branch Revision: 1.0 +Author: Emmanuel VENISSE Date: 11/09/02 15:06:55 GMT+02:00 +============================================================================= + +History for: File1.java +Description: First release +Locked by: +Status: Current +---------------------------- +Revision: 2 View: GRP_Dev Branch Revision: 1.1 +Author: Emmanuel VENISSE Date: 11/09/02 15:08:41 GMT+02:00 +Add method main + +---------------------------- +Revision: 1 View: GRP_Dev Branch Revision: 1.0 +Author: Emmanuel VENISSE Date: 11/09/02 15:06:55 GMT+02:00 +============================================================================= + +Folder: test (working dir: C:\Test\maven\test) +History for: TestFile1.java +Description: First release +Locked by: +Status: Current +---------------------------- +Revision: 2 View: GRP_Dev Branch Revision: 1.1 +Author: Emmanuel VENISSE Date: 11/09/02 15:08:42 GMT+02:00 +Add method main + +---------------------------- +Revision: 1 View: GRP_Dev Branch Revision: 1.0 +Author: Emmanuel VENISSE Date: 11/09/02 15:06:55 GMT+02:00 +============================================================================= + diff --git a/changelog/src/test-resources/svnlib/svnlog.txt b/changelog/src/test-resources/svnlib/svnlog.txt new file mode 100644 index 00000000..add0caf0 --- /dev/null +++ b/changelog/src/test-resources/svnlib/svnlog.txt @@ -0,0 +1,212 @@ +------------------------------------------------------------------------ +rev 15: kaz | 2002-08-26 14:33:26 -0400 (Mon, 26 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/build.xml + M /poolserver/trunk/project.properties + +Minor formatting changes. + +------------------------------------------------------------------------ +rev 14: kaz | 2002-08-26 10:24:58 -0400 (Mon, 26 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/build.xml + +Cleaned up some whitespace. + +------------------------------------------------------------------------ +rev 13: kaz | 2002-08-24 12:56:37 -0400 (Sat, 24 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/src/java + +Added an svn:ignore property to ignore the 'tags' file. + +------------------------------------------------------------------------ +rev 12: kaz | 2002-08-24 12:31:41 -0400 (Sat, 24 Aug 2002) | 3 lines +Changed paths: + D /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/.SnmpPhysicalGateway.java.swp + +Ditching a vim swap file. + +------------------------------------------------------------------------ +rev 11: kaz | 2002-08-24 00:20:25 -0400 (Sat, 24 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/SnmpPhysicalGateway.java + +Did some basic refactoring and just preparing to go-time. + +------------------------------------------------------------------------ +rev 10: kaz | 2002-08-24 00:19:39 -0400 (Sat, 24 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/build.xml + +Added a ctags target in the event I have to use vim. + +------------------------------------------------------------------------ +rev 9: kaz | 2002-08-23 11:11:52 -0400 (Fri, 23 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/build.xml + +Testing script out again ... + +------------------------------------------------------------------------ +rev 8: kaz | 2002-08-23 11:07:46 -0400 (Fri, 23 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/build.xml + +Testing svn commit-email script ... + +------------------------------------------------------------------------ +rev 7: pete | 2002-08-23 11:03:39 -0400 (Fri, 23 Aug 2002) | 4 lines +Changed paths: + M /poolserver/trunk/build.xml + +Reformatted the indentation (really just an excuse to test out +subversion). + +------------------------------------------------------------------------ +rev 6: kaz | 2002-08-23 10:36:23 -0400 (Fri, 23 Aug 2002) | 3 lines +Changed paths: + M /poolserver/trunk/resources/WEB-INF/lib/xerces-1.4.4.jar + +Replacing the xerces library as it seems to be corrupted. + +------------------------------------------------------------------------ +rev 5: kaz | 2002-08-22 11:28:22 -0400 (Thu, 22 Aug 2002) | 3 lines +Changed paths: + A /poolserver/trunk/build.xml + A /poolserver/trunk/poolserver.zargo + A /poolserver/trunk/project.properties + A /poolserver/trunk/resources + A /poolserver/trunk/resources/WEB-INF + A /poolserver/trunk/resources/WEB-INF/conf + A /poolserver/trunk/resources/WEB-INF/conf/Fulcrum.properties + A /poolserver/trunk/resources/WEB-INF/conf/TurbineResources.properties + A /poolserver/trunk/resources/WEB-INF/conf/demo-pipeline.xml + A /poolserver/trunk/resources/WEB-INF/lib + A /poolserver/trunk/resources/WEB-INF/lib/JavaGroups-2.0.jar + A /poolserver/trunk/resources/WEB-INF/lib/activation-1.0.1.jar + A /poolserver/trunk/resources/WEB-INF/lib/antlr.jar + A /poolserver/trunk/resources/WEB-INF/lib/avalon-framework.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-beanutils.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-betwixt-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-codec-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-collections-2.0.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-configuration-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-digester-1.1.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-email-0.1-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-fileupload-0.1-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-http.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-io.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-lang-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-logging-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-pool.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-util-1.0-rc2-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/commons-xo-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/dom4j-1.3.jar + A /poolserver/trunk/resources/WEB-INF/lib/fulcrum-3.0-b2-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/jakarta-regexp-1.3-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/jcs-1.0-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/jdbc2_0-stdext.jar + A /poolserver/trunk/resources/WEB-INF/lib/jta.jar + A /poolserver/trunk/resources/WEB-INF/lib/junit-3.7.jar + A /poolserver/trunk/resources/WEB-INF/lib/log4j-1.1.3.jar + A /poolserver/trunk/resources/WEB-INF/lib/lucene-1.2.jar + A /poolserver/trunk/resources/WEB-INF/lib/mail-1.2.jar + A /poolserver/trunk/resources/WEB-INF/lib/ojb-0.9.jar + A /poolserver/trunk/resources/WEB-INF/lib/postgresql.jar + A /poolserver/trunk/resources/WEB-INF/lib/servlet-2.3.jar + A /poolserver/trunk/resources/WEB-INF/lib/snmp.jar + A /poolserver/trunk/resources/WEB-INF/lib/stratum-1.0-b2-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/torque-3.0-b3-dev.jar + A /poolserver/trunk/resources/WEB-INF/lib/turbine-3.0alpha.jar + A /poolserver/trunk/resources/WEB-INF/lib/velocity-1.3-rc1.jar + A /poolserver/trunk/resources/WEB-INF/lib/xalan-2.1.0.jar + A /poolserver/trunk/resources/WEB-INF/lib/xerces-1.4.4.jar + A /poolserver/trunk/resources/WEB-INF/web.xml + A /poolserver/trunk/resources/css + A /poolserver/trunk/resources/css/ns4_only.css + A /poolserver/trunk/resources/css/pool.css + A /poolserver/trunk/resources/css/print.css + A /poolserver/trunk/resources/css/tigris.css + A /poolserver/trunk/resources/images + A /poolserver/trunk/resources/images/icon_alert.gif + A /poolserver/trunk/resources/images/icon_alertsml.gif + A /poolserver/trunk/resources/images/icon_confirmsml.gif + A /poolserver/trunk/resources/images/nw_min.gif + A /poolserver/trunk/resources/images/strich.gif + A /poolserver/trunk/resources/images/sw_min.gif + A /poolserver/trunk/resources/logs + A /poolserver/trunk/resources/logs/services.log + A /poolserver/trunk/resources/logs/torque.log + A /poolserver/trunk/resources/logs/trace.log + A /poolserver/trunk/resources/logs/turbine.log + A /poolserver/trunk/resources/logs/velocity.log + A /poolserver/trunk/resources/logs/velocity.log.1 + A /poolserver/trunk/resources/sampler.html + A /poolserver/trunk/resources/scripts + A /poolserver/trunk/resources/scripts/tigris.js + A /poolserver/trunk/resources/templates + A /poolserver/trunk/resources/templates/layouts + A /poolserver/trunk/resources/templates/layouts/Default.vm + A /poolserver/trunk/resources/templates/navigations + A /poolserver/trunk/resources/templates/navigations/Administration.vm + A /poolserver/trunk/resources/templates/navigations/Default.vm + A /poolserver/trunk/resources/templates/navigations/HowDoI.vm + A /poolserver/trunk/resources/templates/navigations/PoolTools.vm + A /poolserver/trunk/resources/templates/navigations/ProjectInfo.vm + A /poolserver/trunk/resources/templates/screens + A /poolserver/trunk/resources/templates/screens/.Pool.vm.swp + A /poolserver/trunk/resources/templates/screens/Default.vm + A /poolserver/trunk/resources/templates/screens/Error.vm + A /poolserver/trunk/resources/templates/screens/Pool.vm + A /poolserver/trunk/src + A /poolserver/trunk/src/java + A /poolserver/trunk/src/java/net + A /poolserver/trunk/src/java/net/ibasis + A /poolserver/trunk/src/java/net/ibasis/poolserver + A /poolserver/trunk/src/java/net/ibasis/poolserver/AbstractPhysicalGateway.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/AbstractPool.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/CallCounter.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/CompositePool.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/Gateway.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/GatewayAttribute.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/PhysicalGateway.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/Utilization.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/impl + A /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp + A /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/.SnmpPhysicalGateway.java.swp + A /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/DialPeerAttribute.java + A /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/SnmpPhysicalGateway.java + A /poolserver/trunk/src/target + A /poolserver/trunk/src/target/.dependency-info + A /poolserver/trunk/src/target/.dependency-info/-outtosrc-.i + A /poolserver/trunk/src/target/.dependency-info/-timestamp-.i + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.AbstractPhysicalGateway.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.AbstractPool.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.CallCounter.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.CompositePool.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.Gateway.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.GatewayAttribute.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.PhysicalGateway.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.PoolTreeTest.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.Utilization.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver/.UtilizationTest.di + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver.impl.snmp + A /poolserver/trunk/src/target/.dependency-info/net.ibasis.poolserver.impl.snmp/.SnmpPhysicalGateway.di + A /poolserver/trunk/src/test + A /poolserver/trunk/src/test/net + A /poolserver/trunk/src/test/net/ibasis + A /poolserver/trunk/src/test/net/ibasis/poolserver + A /poolserver/trunk/src/test/net/ibasis/poolserver/PoolTreeTest.java + A /poolserver/trunk/src/test/net/ibasis/poolserver/UtilizationTest.java + +Initial import of sources. + +------------------------------------------------------------------------ +rev 2: kaz | 2002-08-22 11:25:16 -0400 (Thu, 22 Aug 2002) | 1 line +Changed paths: + A /poolserver/trunk + +Poolserver Main Trunk +------------------------------------------------------------------------ diff --git a/changelog/src/test/org/apache/maven/changelog/ChangeLogEntryTest.java b/changelog/src/test/org/apache/maven/changelog/ChangeLogEntryTest.java new file mode 100644 index 00000000..8bf1e199 --- /dev/null +++ b/changelog/src/test/org/apache/maven/changelog/ChangeLogEntryTest.java @@ -0,0 +1,266 @@ +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 + * . + */ + +import java.util.Calendar; +import java.util.Date; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +/** + * Tests for the {@link ChangeLogEntry} class + * + * @author dion + * @version $Id: ChangeLogEntryTest.java,v 1.1 2003/01/24 03:44:56 jvanzyl Exp $ + */ +public class ChangeLogEntryTest extends TestCase +{ + + /** the {@link ChangeLogEntry} used for testing */ + private ChangeLogEntry instance; + + /** + * Create a test with the given name + * @param testName the name of the test + */ + public ChangeLogEntryTest(String testName) + { + super(testName); + } + + /** + * Run the test using the {@link TestRunner} + * @param args command line provided arguments + */ + public static void main(String[] args) + { + TestRunner.run(suite()); + } + + /** + * Create a test suite for this class + * @return a {@link TestSuite} for all tests in this class + */ + public static Test suite() + { + return new TestSuite(ChangeLogEntryTest.class); + } + + /** + * Initialize per test data + */ + public void setUp() + { + instance = new ChangeLogEntry(); + instance.setAuthor("dion"); + instance.setComment("comment"); + instance.setDate("2002/04/01 00:00:00"); + } + + /** + * Test of addFile methods: using ChangeLogFile + */ + public void testAddFileWithFile() + { + ChangeLogFile file = new ChangeLogFile("maven:dummy"); + instance.addFile(file); + assertTrue("File name not found in list", + instance.toString().indexOf("maven:dummy") != -1 ); + } + + /** + * Test of addFile methods: using file & revision + */ + public void testAddFileWithFileAndRevision() + { + instance.addFile("maven:dummy", "x.y"); + assertTrue("File name not found in list", + instance.toString().indexOf("maven:dummy") != -1); + assertTrue("Revision not found in list", + instance.toString().indexOf("x.y") != -1); + } + + /** + * Test of toString method + */ + public void testToString() + { + //dion, Mon Apr 01 00:00:00 EST 2002, [], comment + String value = instance.toString(); + assertTrue("author not found in string", value.indexOf("dion") != -1); + assertTrue("comment not found in string", + value.indexOf("comment") != -1); + assertTrue("date not found in string", + value.indexOf("Mon Apr 01") != -1); + assertTrue("empty file list not found in string", + value.indexOf("[]") != -1); + } + + /** + * Test of toXML method + */ + public void testToXML() + { + String value = instance.toXML(); + String trimmedValue = value.trim(); + assertTrue("XML doesn't start with changelog-entry", + trimmedValue.startsWith("")); + assertTrue("XML doesn't contain date", + value.indexOf("2002-04-01") != -1); + assertTrue("XML doesn't contain author CDATA", + value.indexOf("") != -1); + assertTrue("XML doesn't contain comment CDATA", + value.indexOf("") != -1); + } + + /** + * Test of getAuthor method + */ + public void testGetAuthor() + { + assertEquals("Author value not retrieved correctly", "dion", + instance.getAuthor()); + } + + /** + * Test of setAuthor method + */ + public void testSetAuthor() + { + instance.setAuthor("maven:dion"); + assertEquals("Author not set correctly", "maven:dion", + instance.getAuthor()); + } + + /** + * Test of getComment method + */ + public void testGetComment() + { + assertEquals("Comment value not retrieved correctly", "comment", + instance.getComment()); + } + + /** + * Test of setComment method + */ + public void testSetComment() + { + instance.setComment("maven:comment"); + assertEquals("Comment not set correctly", "maven:comment", + instance.getComment()); + } + + /** + * Test of getDate method + */ + public void testGetDate() + { + Calendar cal = Calendar.getInstance(); + cal.set(2002, 3, 1, 0, 0, 0); + cal.set(Calendar.MILLISECOND, 0); + assertEquals("Date value not retrieved correctly", cal.getTime(), + instance.getDate()); + } + + /** + * Test of setDate method with Date object + */ + public void testSetDate() + { + Calendar cal = Calendar.getInstance(); + Date date = cal.getTime(); + instance.setDate(date); + assertEquals("Date value not set correctly", date, instance.getDate()); + } + + /** + * Test of setDate method with String + */ + public void testSetDateFromString() + { + instance.setDate("2002/03/04 00:00:00"); + Calendar cal = Calendar.getInstance(); + cal.set(2002, 2, 4, 0, 0, 0); + cal.set(Calendar.MILLISECOND, 0); + assertEquals("Date value not set correctly from a string", + cal.getTime(), instance.getDate()); + } + + + /** + * Test of getDateFormatted method + */ + public void testGetDateFormatted() + { + assertEquals("Date not formatted correctly", "2002-04-01", + instance.getDateFormatted()); + } + + /** + * Test of getDateFormatted method + */ + public void testGetTimeFormatted() + { + assertEquals("Time not formatted correctly", "00:00:00", + instance.getTimeFormatted()); + } + + // Add test methods here, they have to start with 'test' name. + // for example: + // public void testHello() {} +} diff --git a/changelog/src/test/org/apache/maven/changelog/ChangeLogFileTest.java b/changelog/src/test/org/apache/maven/changelog/ChangeLogFileTest.java new file mode 100644 index 00000000..f5c5daa1 --- /dev/null +++ b/changelog/src/test/org/apache/maven/changelog/ChangeLogFileTest.java @@ -0,0 +1,161 @@ +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 + * . + */ + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +/** + * Test cases for {@link ChangeLogFile} + * @author dIon Gillard + * @version $Id: ChangeLogFileTest.java,v 1.1 2003/01/24 03:44:56 jvanzyl Exp $ + */ +public class ChangeLogFileTest extends TestCase +{ + + /** the {@link ChangeLogFile} used for testing */ + private ChangeLogFile instance; + + /** + * Create a test with the given name + * @param testName the name of the test + */ + public ChangeLogFileTest(String testName) + { + super(testName); + } + + /** + * Run the test using the {@link TestRunner} + * @param args command line provided arguments + */ + public static void main(String[] args) + { + TestRunner.run(suite()); + } + + /** + * Create a test suite for this class + * @return a {@link TestSuite} for all tests in this class + */ + public static Test suite() + { + return new TestSuite(ChangeLogFileTest.class); + } + + /** + * Initialize per test data + */ + public void setUp() + { + instance = new ChangeLogFile("maven:dummy", "maven:rev"); + } + + /** + * Test of getName method + */ + public void testGetName() + { + assertEquals("Name not being retrieved correctly", "maven:dummy", + instance.getName()); + } + + /** + * Test of getRevision method + */ + public void testGetRevision() + { + assertEquals("Revision not being retrieved correctly", "maven:rev", + instance.getRevision()); + } + + /** + * Test of setName method + */ + public void testSetName() + { + instance.setName("maven:dummy:name"); + assertEquals("Name not set correctly", "maven:dummy:name", + instance.getName()); + } + + /** + * Test of setRevision method + */ + public void testSetRevision() + { + instance.setRevision("maven:rev:test"); + assertEquals("Revision not set correctly", "maven:rev:test", + instance.getRevision()); + } + + /** + * Test of toString method + */ + public void testToString() + { + String value = instance.toString(); + assertTrue("Name not found in string", + value.indexOf(instance.getName()) != -1); + assertTrue("Revision not found in string", + value.indexOf(instance.getRevision()) != -1); + } + + // Add test methods here, they have to start with 'test' name. + // for example: + // public void testHello() { +} diff --git a/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogFactoryTest.java b/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogFactoryTest.java new file mode 100644 index 00000000..feae87b2 --- /dev/null +++ b/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogFactoryTest.java @@ -0,0 +1,109 @@ +package org.apache.maven.cvslib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import junit.framework.TestCase; + +/** + * Unit Tests for {@link CvsChangeLogFactory} + * @author dion + * @version $Id: CvsChangeLogFactoryTest.java,v 1.1 2003/01/24 03:44:56 jvanzyl Exp $ + */ +public class CvsChangeLogFactoryTest extends TestCase +{ + /** the instance being tested */ + private CvsChangeLogFactory instance; + + /** + * Create a test with the given name + * @param testName the name of the test + */ + public CvsChangeLogFactoryTest(String testName) + { + super(testName); + } + + /** + * Initialize per test data + * @throws Exception when there is an unexpected problem + */ + public void setUp() throws Exception + { + instance = new CvsChangeLogFactory(); + } + + /** test the constructor */ + public void testConstructor() + { + assertNotNull("new instance wasn't created", instance); + } + + /** test creating the generator */ + public void testCreateGenerator() + { + testConstructor(); + assertNotNull("Generator was not created", instance.createGenerator()); + } + + /** test creating the parser */ + public void testCreateParser() + { + testConstructor(); + assertNotNull("Parser was not created", instance.createParser()); + } + +} diff --git a/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogParserTest.java b/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogParserTest.java new file mode 100644 index 00000000..536d4040 --- /dev/null +++ b/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogParserTest.java @@ -0,0 +1,123 @@ +package org.apache.maven.cvslib; + +/* ==================================================================== + * 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 + * . + */ + +import java.io.FileInputStream; +import java.util.Collection; +import java.util.Iterator; +import junit.framework.TestCase; + +import org.apache.maven.changelog.ChangeLogEntry; + + +/** + * Test cases for {@link CvsChangeLogParser} + * @author dion + * @version $Id: CvsChangeLogParserTest.java,v 1.1 2003/01/24 03:44:56 jvanzyl Exp $ + */ +public class CvsChangeLogParserTest extends TestCase +{ + + /** the {@link CvsChangeLogParser} used for testing */ + private CvsChangeLogParser instance; + /** file with test results to check against */ + private String testFile; + + /** + * Create a test with the given name + * @param testName the name of the test + */ + public CvsChangeLogParserTest(String testName) + { + super(testName); + } + + /** + * Initialize per test data + * @throws Exception when there is an unexpected problem + */ + public void setUp() throws Exception + { + String baseDir = System.getProperty("basedir"); + assertNotNull("The system property basedir was not defined.", baseDir); + testFile = baseDir + "/src/test-resources/cvslib/cvslog.txt"; + instance = new CvsChangeLogParser(); + } + + /** + * Test of parse method + * @throws Exception when there is an unexpected problem + */ + public void testParse() throws Exception + { + FileInputStream fis = new FileInputStream(testFile); + Collection entries = instance.parse(fis); + assertEquals("Wrong number of entries returned", 3, entries.size()); + ChangeLogEntry entry = null; + for (Iterator i = entries.iterator(); i.hasNext(); ) + { + entry = (ChangeLogEntry) i.next(); + assertTrue("ChangeLogEntry erroneously picked up", + entry.toString().indexOf("ChangeLogEntry.java") == -1); + } + + } + + // Add test methods here, they have to start with 'test' name. + // for example: + // public void testHello() {} + + +} diff --git a/changelog/src/test/org/apache/maven/starteamlib/StarteamChangeLogFactoryTest.java b/changelog/src/test/org/apache/maven/starteamlib/StarteamChangeLogFactoryTest.java new file mode 100644 index 00000000..7a434437 --- /dev/null +++ b/changelog/src/test/org/apache/maven/starteamlib/StarteamChangeLogFactoryTest.java @@ -0,0 +1,109 @@ +package org.apache.maven.starteamlib; + +/* ==================================================================== + * 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 + * . + * + * ==================================================================== + */ + +import junit.framework.TestCase; + +/** + * Unit Tests for {@link StarteamChangeLogFactory} + * @author Emmanuel Venisse + * @version $Id: StarteamChangeLogFactoryTest.java,v 1.1 2003/01/24 03:44:56 jvanzyl Exp $ + */ +public class StarteamChangeLogFactoryTest extends TestCase +{ + /** the instance being tested */ + private StarteamChangeLogFactory instance; + + /** + * Create a test with the given name + * @param testName the name of the test + */ + public StarteamChangeLogFactoryTest(String testName) + { + super(testName); + } + + /** + * Initialize per test data + * @throws Exception when there is an unexpected problem + */ + public void setUp() throws Exception + { + instance = new StarteamChangeLogFactory(); + } + + /** test the constructor */ + public void testConstructor() + { + assertNotNull("new instance wasn't created", instance); + } + + /** test creating the generator */ + public void testCreateGenerator() + { + testConstructor(); + assertNotNull("Generator was not created", instance.createGenerator()); + } + + /** test creating the parser */ + public void testCreateParser() + { + testConstructor(); + assertNotNull("Parser was not created", instance.createParser()); + } + +} diff --git a/changelog/src/test/org/apache/maven/starteamlib/StarteamChangeLogParserTest.java b/changelog/src/test/org/apache/maven/starteamlib/StarteamChangeLogParserTest.java new file mode 100644 index 00000000..ad19cf28 --- /dev/null +++ b/changelog/src/test/org/apache/maven/starteamlib/StarteamChangeLogParserTest.java @@ -0,0 +1,121 @@ +package org.apache.maven.starteamlib; + +/* ==================================================================== + * 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 + * . + */ + +import java.io.FileInputStream; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Iterator; +import java.util.Locale; +import junit.framework.TestCase; + +import org.apache.maven.changelog.ChangeLogEntry; + + +/** + * Test cases for {@link StarteamChangeLogParser} + * @author Emmanuel Venisse + * @version $Id: StarteamChangeLogParserTest.java,v 1.1 2003/01/24 03:44:57 jvanzyl Exp $ + */ +public class StarteamChangeLogParserTest extends TestCase +{ + + /** the {@link StarteamChangeLogParser} used for testing */ + private StarteamChangeLogParser instance; + /** file with test results to check against */ + private String testFile; + + /** + * Create a test with the given name + * @param testName the name of the test + */ + public StarteamChangeLogParserTest(String testName) + { + super(testName); + } + + /** + * Initialize per test data + * @throws Exception when there is an unexpected problem + */ + public void setUp() throws Exception + { + String baseDir = System.getProperty("basedir"); + assertNotNull("The system property basedir was not defined.", baseDir); + testFile = baseDir + "/src/test-resources/starteamlib/starteamlog.txt"; + instance = new StarteamChangeLogParser(); + } + + /** + * Test of parse method + * @throws Exception when there is an unexpected problem + */ + public void testParse() throws Exception + { + FileInputStream fis = new FileInputStream(testFile); + instance.setDateFormatInFile(new SimpleDateFormat("dd/MM/yy HH:mm", Locale.FRENCH)); + Collection entries = instance.parse(fis); + assertEquals("Wrong number of entries returned", 3, entries.size()); + ChangeLogEntry entry = null; + for (Iterator i = entries.iterator(); i.hasNext(); ) + { + entry = (ChangeLogEntry) i.next(); + assertTrue("ChangeLogEntry erroneously picked up", + entry.toString().indexOf("ChangeLogEntry.java") == -1); + } + + } + +} diff --git a/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java b/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java new file mode 100644 index 00000000..e3b96c1b --- /dev/null +++ b/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java @@ -0,0 +1,145 @@ +package org.apache.maven.svnlib; + +/* ==================================================================== + * 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 + * . + */ + +import java.io.FileInputStream; +import java.util.List; +import java.util.Locale; +import java.util.ArrayList; +import java.util.Date; +import java.text.SimpleDateFormat; +import junit.framework.TestCase; + +import org.apache.maven.changelog.ChangeLogEntry; + +/** + * Test cases for {@link SvnChangeLogParser} + * @author Pete Kazmier + * @version $Id: SvnChangeLogParserTest.java,v 1.1 2003/01/24 03:44:57 jvanzyl Exp $ + */ +public class SvnChangeLogParserTest extends TestCase +{ + /** Date formatter */ + private static final SimpleDateFormat DATE = + new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US); + + /** The {@link SvnChangeLogParser} used for testing */ + private SvnChangeLogParser parser; + + /** File with test results to check against */ + private String testFile; + + /** + * Create a test with the given name. + * + * @param testName the name of the test. + */ + public SvnChangeLogParserTest(String testName) + { + super(testName); + } + + /** + * Initialize per test data. + * + * @throws Exception when there is an unexpected problem. + */ + public void setUp() throws Exception + { + String baseDir = System.getProperty("basedir"); + assertNotNull("The system property basedir was not defined.", baseDir); + testFile = baseDir + "/src/test-resources/svnlib/svnlog.txt"; + parser = new SvnChangeLogParser(); + } + + /** + * Test the subversion parser. + * + * @throws Exception when there is an unexpected problem + */ + public void testParse() throws Exception + { + FileInputStream fis = new FileInputStream(testFile); + List entries = new ArrayList(parser.parse(fis)); + + assertEquals("Wrong number of entries returned", 12, entries.size()); + + ChangeLogEntry entry = (ChangeLogEntry) entries.get(0); + assertEquals("Entry 0 was parsed incorrectly", + "kaz\n" + + DATE.parse("Mon Aug 26 14:33:26 EDT 2002") + "\n" + + "[/poolserver/trunk/build.xml, 15, " + + "/poolserver/trunk/project.properties, 15]\n" + + "Minor formatting changes.\n\n", + entry.toString()); + + entry = (ChangeLogEntry) entries.get(6); + assertEquals("Entry 6 was parsed incorrectly", + "kaz\n" + + DATE.parse("Fri Aug 23 11:11:52 EDT 2002") + "\n" + + "[/poolserver/trunk/build.xml, 9]\n" + + "Testing script out again ...\n\n", + entry.toString()); + + entry = (ChangeLogEntry) entries.get(8); + assertEquals("Entry 8 was parsed incorrectly", + "pete\n" + + DATE.parse("Fri Aug 23 11:03:39 EDT 2002") + "\n" + + "[/poolserver/trunk/build.xml, 7]\n" + + "Reformatted the indentation (really just an excuse to test out\n" + + "subversion).\n\n", + entry.toString()); + } +} diff --git a/changelog/xdocs/.cvsignore b/changelog/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/changelog/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/changelog/xdocs/changes.xml b/changelog/xdocs/changes.xml new file mode 100644 index 00000000..46cb4c36 --- /dev/null +++ b/changelog/xdocs/changes.xml @@ -0,0 +1,27 @@ + + + + Changes + dIon Gillard + + + + + +

+ Added more documentation +

+
+ + Reworked CVS changelog plugin to use the project repository + connection string, rather than relying on CVS/Entries + +
+ + + Fix for Maven-5 + + + +
+ diff --git a/changelog/xdocs/goals.xml b/changelog/xdocs/goals.xml new file mode 100644 index 00000000..c3c28e5b --- /dev/null +++ b/changelog/xdocs/goals.xml @@ -0,0 +1,31 @@ + + + + + Maven Ant Plug-in Goals + dIon Gillard + + + +
+ + + + + + + + + + +
GoalDescription
changelog + This is the default goal of the plugin and simply attains + the changelog:generate goal. +
changelog:generate + Generates a report from the source control system showing + changes by date along with the message, if any, provided + by the developer when making the change +
+
+ +
diff --git a/changelog/xdocs/index.xml b/changelog/xdocs/index.xml new file mode 100644 index 00000000..2149b1a9 --- /dev/null +++ b/changelog/xdocs/index.xml @@ -0,0 +1,29 @@ + + + + + Maven Changelog Plug-in + Jason van Zyl + dIon Gillard + + + +
+

+ This plugin produces a nicely formatted changelog report so project + team members can see at a glance what changes have been made + recently to the project. Currently, there are three supported + source control systems: CVS, StarTeam and Subversion. +

+

+ For more information on the functionality provided by this plugin, + please see the Goals document. +

+

+ For more information on how to customise the functionality provided + by this plugin, please see the properties + document. +

+
+ +
diff --git a/changelog/xdocs/navigation.xml b/changelog/xdocs/navigation.xml new file mode 100644 index 00000000..34e63b3e --- /dev/null +++ b/changelog/xdocs/navigation.xml @@ -0,0 +1,18 @@ + + + + Maven Change log Plugin + + + + + + + + + + + + + + diff --git a/changelog/xdocs/properties.xml b/changelog/xdocs/properties.xml new file mode 100644 index 00000000..e8e81d70 --- /dev/null +++ b/changelog/xdocs/properties.xml @@ -0,0 +1,88 @@ + + + + + Changelog Properties + Stéphane MOR + + + +
+ + + + + + + + + + + + + + + + + + + + + +
Property nameOptional?Description
maven.changelog.rangeYes + Specifies the range to use when generating the change log. + This is used by the "changelog" goal. The default value is + 5 days. Note: when using the Subversion + changelog factory, you must set this property to an + empty value because the Subversion ra_dav module (used to + access DAV repositories) does not support date operations + yet. If you are using a local repository (ra_local), then + this does not apply to you. +
maven.changelog.factoryYes + Specifies a fully qualified class name implementing the + org.apache.maven.changelog.ChangeLogFactory interface. + The class creates the ChangeLogGenerator and + ChangeLogParser pair required to create the change + log. This is used by the "changelog" and "activity" goals. + The default value is + org.apache.maven.cvslib.CvsChangeLogFactory. In + addition, there is also a Subversion factory ( + org.apache.maven.svnlib.SvnChangeLogFactory) as well as + a StarTeam factory ( + org.apache.maven.starteamlib.StarteamChangeLogFactory). +
maven.docs.outputencodingYes + The output encoding for the generated xml documents. Set by + the xdoc plugin, it defaults to ISO-8859-1 +
+
+
+ + + + + + + + + + + + + + + + +
Property nameOptional?Description
maven.gen.docsYes + The directory where the generated report is created. + This directory holds the generated documents for + processing by the xdoc plugin. +
maven.mode.onlineYes + Used by the plugin to check if the user is currently 'online' + and hence has access to the source code repository. +
+
+ +
diff --git a/checkstyle/.cvsignore b/checkstyle/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/checkstyle/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/checkstyle/plugin.jelly b/checkstyle/plugin.jelly new file mode 100644 index 00000000..ec76d8c8 --- /dev/null +++ b/checkstyle/plugin.jelly @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + Using ${checkstyleProperties} for checkstyle ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${checkstyle.header.file} + + + + + + + + ====================================================================== + = W A R N I N G = + ====================================================================== + = Your project doesn't contain a header file specified as: = + = ${header} + = Checkstyle needs it to check the existence of the License in your = + = source files. If it can't find this file, it throws an error. = + = A temporary solution is to create an empty LICENSE.txt file. = + = Though, we recommend that you edit this License. = + ====================================================================== + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/checkstyle/plugin.properties b/checkstyle/plugin.properties new file mode 100644 index 00000000..dd47382f --- /dev/null +++ b/checkstyle/plugin.properties @@ -0,0 +1,16 @@ +# ------------------------------------------------------------------- +# P L U G I N P R O P E R I E S +# ------------------------------------------------------------------- +# Checkstyle plugin +# ------------------------------------------------------------------- + +maven.build.dir = ${basedir}/target +maven.checkstyle.includes = **/*.java +maven.checkstyle.excludes = +maven.checkstyle.fail.on.violation = false +maven.checkstyle.cache.file = ${maven.build.dir}/checkstyle-cachefile +maven.checkstyle.format = sun + +# If useFile is false then the checkstyle task will display violations +# on stdout. +maven.checkstyle.usefile = true \ No newline at end of file diff --git a/checkstyle/project.properties b/checkstyle/project.properties new file mode 100644 index 00000000..5e723259 --- /dev/null +++ b/checkstyle/project.properties @@ -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} \ No newline at end of file diff --git a/checkstyle/project.xml b/checkstyle/project.xml new file mode 100644 index 00000000..9467e305 --- /dev/null +++ b/checkstyle/project.xml @@ -0,0 +1,135 @@ + + + + ${basedir}/../project.xml + 3 + maven-checkstyle-plugin + Maven Checkstyle Plug-in + 1.1 + + + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/checkstyle/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/checkstyle/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + Bob McWhirter + werken + bob@werken.com + The Werken Company + + Java Developer + + + + + Vincent Massol + vmassol + vmassol@octo.com + Octo Technology + + Java Developer + + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + + antlr + 2.7.1 + antlrall-2.7.1.jar + + root + + + + + checkstyle + 2.3 + + root + + + + + commons-jelly+tags-jsl + SNAPSHOT + + root.maven + + + + + commons-jelly + commons-jelly-tags-xml + SNAPSHOT + http://jakarta.apache.org/commons/sandbox/jelly/tags/xml/ + + root.maven + + + + + commons-jelly + commons-jelly-tags-util + SNAPSHOT + http://jakarta.apache.org/commons/sandbox/jelly/tags/util/ + + root.maven + + + + + regexp + 1.2 + + root + + + + + + + + + + diff --git a/checkstyle/src/plugin-resources/checkstyle.jsl b/checkstyle/src/plugin-resources/checkstyle.jsl new file mode 100644 index 00000000..de6fd677 --- /dev/null +++ b/checkstyle/src/plugin-resources/checkstyle.jsl @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + Checkstyle Results + + + +
+

+ The following document contains the results of + Checkstyle. +

+
+ +
+ + + + + + + + + + + +
FilesErrors
${fileCount}${errorCount}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
FilesErrors
+ ${name} + ${errorCount}
+ + + + + + + + + + + + + + + + + + + + +
ErrorLine
+ + ${htmlescape.getText(errorMessage)} + + + + + + + + ${line} + + + ${line} + + +
+
+
+
+
+ +
+
+
diff --git a/checkstyle/src/plugin-resources/sun-checkstyle.properties b/checkstyle/src/plugin-resources/sun-checkstyle.properties new file mode 100644 index 00000000..b101018b --- /dev/null +++ b/checkstyle/src/plugin-resources/sun-checkstyle.properties @@ -0,0 +1,7 @@ +# Sample checkstyle properties file to use with maven to support the +# sun code conventions +# +# To use this file, place the following in your project.properties: +# +# maven.checkstyle.properties=${maven.home}/plugins/checkstyle/sun-code-conventions-checkstyle.properties +# diff --git a/checkstyle/src/plugin-resources/turbine-checkstyle.properties b/checkstyle/src/plugin-resources/turbine-checkstyle.properties new file mode 100644 index 00000000..8f6e0852 --- /dev/null +++ b/checkstyle/src/plugin-resources/turbine-checkstyle.properties @@ -0,0 +1,39 @@ +# +# Checkstyle settings ... default turbine project code settings, these can be +# overridden in a project specific properties file. +# +checkstyle.lcurly.type = nl +checkstyle.lcurly.method = nl +checkstyle.lcurly.other = nl +checkstyle.rcurly = alone +#checkstyle.paren.pad = nospace +#checkstyle.allow.tabs = false +#checkstyle.allow.protected = false +#checkstyle.allow.package = false +#checkstyle.allow.no.author = false +checkstyle.tab.width = 4 +checkstyle.ignore.maxlinelen = @version +checkstyle.maxfilelen = 2000 +#checkstyle.maxlinelen = 80 +#checkstyle.maxmethodlen = 150 +#checkstyle.maxconstructorlen = 150 +#checkstyle.ignore.importlength = false +#checkstyle.pattern.member = ^[a-z][a-zA-Z0-9]*$ +checkstyle.pattern.publicmember = ^f[A-Z][a-zA-Z0-9]*$ +#checkstyle.pattern.parameter = ^[a-z][a-zA-Z0-9]*$ +#checkstyle.pattern.const = ^[A-Z]([A-Z0-9_]*[A-Z0-9])?$ +#checkstyle.pattern.static = ^[a-z][a-zA-Z0-9]*$ +#checkstyle.pattern.type = ^[A-Z][a-zA-Z0-9]*$ +#checkstyle.pattern.method = ^[a-z][a-zA-Z0-9]*$ +#checkstyle.pattern.localvar = ^[a-z][a-zA-Z0-9]*$ +#checkstyle.javadoc.scope = private +#checkstyle.require.package.html = false +#checkstyle.ignore.imports = false +checkstyle.illegal.imports = +#checkstyle.ignore.whitespace = false +#checkstyle.ignore.cast.whitespace = false +#checkstyle.ignore.braces = false +#checkstyle.ignore.public.in.interface = false +checkstyle.header.file = LICENSE.txt +#checkstyle.header.regexp = false +checkstyle.header.ignoreline = 1,6 diff --git a/checkstyle/xdocs/.cvsignore b/checkstyle/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/checkstyle/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/checkstyle/xdocs/changes.xml b/checkstyle/xdocs/changes.xml new file mode 100644 index 00000000..2a251814 --- /dev/null +++ b/checkstyle/xdocs/changes.xml @@ -0,0 +1,20 @@ + + + + Changes + Vincent Massol + + + + + + Added a new maven.checkstyle.useFile property. + If false, the checkstyle task will display violations on stdout. + If true, a text file will be created with the violations. Note: + this is in addition to the XML result file (containing the + violations in XML format) which is always created. + + + + + diff --git a/checkstyle/xdocs/goals.xml b/checkstyle/xdocs/goals.xml new file mode 100644 index 00000000..a178fdf8 --- /dev/null +++ b/checkstyle/xdocs/goals.xml @@ -0,0 +1,42 @@ + + + + + Maven Checkstyle Plug-in Goals + dIon Gillard + + + +
+ + + + + + + + + + + + + + +
GoalDescription
checkstyle + This is the default goal of the plugin and simply has a pre-requisite + of the checkstyle:check-license-file goal. +
checkstyle:generate-report + Generates an xml report from the source code showing how well the + code conforms to the Checkstyle + definitions defined by the project. +
checkstyle:check-license-file + Checks the existence of the LICENSE.txt file that checkstyle uses + for ensuring the top of a source file has a valid license block. +

+ If the license file exists, the checkstyle:generate-report + goal is attained. +

+
+
+ +
diff --git a/checkstyle/xdocs/index.xml b/checkstyle/xdocs/index.xml new file mode 100644 index 00000000..b0b5acda --- /dev/null +++ b/checkstyle/xdocs/index.xml @@ -0,0 +1,17 @@ + + + + + Maven CheckStyle Plug-in + Jason van Zyl + + + +
+

+ This plugin generates a nicely formatted checkstyle report so + code violations can be easily found and corrected. +

+
+ +
diff --git a/checkstyle/xdocs/navigation.xml b/checkstyle/xdocs/navigation.xml new file mode 100644 index 00000000..1b52ac49 --- /dev/null +++ b/checkstyle/xdocs/navigation.xml @@ -0,0 +1,16 @@ + + + + Maven Checkstyle Plugin + + + + + + + + + + + + diff --git a/checkstyle/xdocs/properties.xml b/checkstyle/xdocs/properties.xml new file mode 100644 index 00000000..92d6306f --- /dev/null +++ b/checkstyle/xdocs/properties.xml @@ -0,0 +1,87 @@ + + + + Checkstyle Properties + Stéphane MOR + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyOptional?Description
maven.checkstyle.includesYes + Specifies a comma-separated list of Ant patterns to use + when matching files in the source tree to be included in the + Checkstyle report. The pattern specified is relative to + ${maven.src.dir}. The default value is + **/*.java, which matches all Java source files + in the source tree (specified by the ${maven.src.dir} + property. +
maven.checkstyle.excludesYes + Specifies a comma-separated list of Ant patterns to use when + matching files in the source tree to be excluded from the + Checkstyle report. The pattern specified is relative to + ${maven.src.dir}. The default value is to not + exclude any files. +
maven.checkstyle.propertiesYes + Specifies the location of the checkstyle properties that will be + used to check the source. +

+ There is also a sample file shipped with maven of the Jakarta + Turbine project + coding style, which maven adheres to. +

+

For more information on checkstyle properties, please see the + CheckStyle Home Page +

+

The default value is + ${plugin.dir}/core/sun-code-conventions-checkstyle.properties. +

+
maven.checkstyle.fail.on.violationYes + Specifies if the maven:check-source task + should fail upon a violation. This will stop the build + process. The default value is false. +
maven.checkstyle.cache.fileYes + Specifies the cache file used to speed up Checkstyle on + successive runs. The default value is + ${maven.build.dest}/checkstyle-cachefile. +
maven.checkstyle.useFileYes + If false, the checkstyle task will display violations on stdout. + If true, a text file will be created with the violations. Note: + this is in addition to the XML result file (containing the + violations in XML format) which is always created. +
+
+ +
+ diff --git a/clover/.cvsignore b/clover/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/clover/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/clover/plugin.jelly b/clover/plugin.jelly new file mode 100644 index 00000000..fccf1703 --- /dev/null +++ b/clover/plugin.jelly @@ -0,0 +1,127 @@ + + + + + + + + + + + + ${pat} + + + + + + + + + + + + ${pom.getContext().setVariable('build.compiler',"org.apache.tools.ant.taskdefs.CloverCompilerAdapter")} + + + + ${pom.getContext().removeVariable('build.compiler')} + + + + + + + + + + + + + + + ${pom.getPluginContext('maven-java-plugin').setVariable('maven.build.dest',tmp)} + ${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest',tmp)} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clover/plugin.properties b/clover/plugin.properties new file mode 100644 index 00000000..09990f3e --- /dev/null +++ b/clover/plugin.properties @@ -0,0 +1,19 @@ +# ------------------------------------------------------------------- +# Default Maven properties for the Clover Plugin +# ------------------------------------------------------------------- +# These are the properties that we believe are immutable so we +# keep them apart from the project specific properties. +# ------------------------------------------------------------------- + +maven.build.clover = ${maven.build.dir}/clover +maven.build.clover.classes = ${maven.build.clover}/classes +#maven.build.clover.src = ${maven.build.clover}/src +#clover.tmpdir = ${maven.build.clover.src} + +# Location of Clover database +# (used only if maven.compile.clover = true) +maven.clover.database.dir = ${maven.build.clover}/database + +clover.preserve=true +clover.flushpolicy=interval +clover.flushpolicy.interval=10 diff --git a/clover/project.properties b/clover/project.properties new file mode 100644 index 00000000..5e723259 --- /dev/null +++ b/clover/project.properties @@ -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} \ No newline at end of file diff --git a/clover/project.xml b/clover/project.xml new file mode 100644 index 00000000..b81c0f9b --- /dev/null +++ b/clover/project.xml @@ -0,0 +1,96 @@ + + + + ${basedir}/../project.xml + 3 + maven-clover-plugin + Maven Clover Plug-in + 1.1 + + + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/clover/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/clover/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + Bob McWhirter + werken + bob@werken.com + The Werken Company + + Java Developer + + + + + Vincent Massol + vmassol + vmassol@octo.com + Octo Technology + + Java Developer + + + + + Stéphane Mor + smor + stephanemor@yahoo.fr + Hasgard Systèmes et Réseaux + + Java Developer + + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + + clover + 1.0 + + root + + + + + velocity + 1.3 + + root.maven + + + + + + + diff --git a/clover/xdocs/.cvsignore b/clover/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/clover/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/clover/xdocs/build-file.xml b/clover/xdocs/build-file.xml new file mode 100644 index 00000000..d34b6d54 --- /dev/null +++ b/clover/xdocs/build-file.xml @@ -0,0 +1,116 @@ + + + + + Vincent Massol + Maven Clover Plug-in Build File Documentation + + + +
+

+ Maven utilizes Ant + to provide users with an easy-to-use and familiar interface to + manage projects that have been described with a valid Maven project descriptor. + The build files that Maven + installs are stored in ${maven.home} directory. +

+

+ This document describes the Ant build file and targets + that are available when using the Clover Plug-in with Maven. +

+

+ The current recommended approach to using Maven is to add + delegators to these Maven-provided targets in your project's + main build file. This will enable you to use your existing + build file with the additional Maven functionality. In + addition, it is also recommended that you load a standard set of + property files. The property files will setup your environment, + ${lib.repo} and ${maven.home}, and + allow you to override Maven defaults properties. Please refer + to the Integration document for + more information on how to integrate these build targets into + your project. +

+

+ The following table contains a brief overview of the + build file that is installed as part of the Maven Clover Plug-in in the + ${maven.home}/plugin/clover directory. In addition, + the various Ant targets in this file is discussed. +

+ + + + + + +
Build FileDescription
build.xml + Contains targets to generate Clover test coverage reports. +
+

+ The build file utilizes various properties for default and + user-configurable settings. All Clover Plug-in properties are described + in the Properties document. + + The rest of this document assumes your project follows the standard + Directory Layout; however, it is + possible to override many of these defaults. +

+
+
+ + + + + + + + + + + + + + +
TargetDescription
maven:clover-testRuns unit tests on Clover-instrumented code and generates + coverage data.
maven:clover-report-htmlGenerates HTML Clover Test coverage reports.
maven:clover-report-swingRun Clover Test coverage reports with the Swing viewer
+

+ +

+ This target instruments your code, runs your unit tests on it + and generates a Clover database file. This target must be called + prior to calling one of the report targets below. +

+

+ Note : There is a limitation in Clover 0.5b. The + test coverage results are written to Clover database on JVM shutdown + only. Thus be careful to execute the maven:clover-test + target separately from the maven:clover-report-* ones + or the report will show a 0% coverage result! In other words, do not + type "ant maven:clover-test maven:clover-report-*". + Instead, do it in 2 JVM invocations : + "ant maven:clover-tests" and + "ant maven:clover-report-*". +

+ + +

+ Prior to running this target you should have called the + maven:clover-test one which generates a test + result database file. This target generates an HTML report + from that database file. The report shows exactly what lines of + your code were exercised by your tests. +

+
+ +

+ Prior to running this target you should have called the + maven:clover-test one which generates a test + result database file. This target runs a Swing viewer + displaying the content of that database file. +

+
+
+ +
diff --git a/clover/xdocs/changes.xml b/clover/xdocs/changes.xml new file mode 100644 index 00000000..8a053962 --- /dev/null +++ b/clover/xdocs/changes.xml @@ -0,0 +1,30 @@ + + + + Changes + Vincent Massol + + + + + + The Clover plugin now depends on version 1.0 of the Clover jar. + + + A special 30-days redistributable clover 1.0 jar (fully functional) + has been uploaded to Maven remote repository, making this plugin + transparent to use. + + + Creation of this changes page. + + + + + This changes did not exist at that time. Please refer to CVS for + history changes before version 1.1. + + + + + diff --git a/clover/xdocs/dirlayout.xml b/clover/xdocs/dirlayout.xml new file mode 100644 index 00000000..98f1c19e --- /dev/null +++ b/clover/xdocs/dirlayout.xml @@ -0,0 +1,54 @@ + + + + + Vincent Massol + Maven Clover Plug-in Directory Layout + + + + +
+

+ Having a common directory layout would allow for users familiar + with one Maven project to immediately feel at home in another + Maven project. The advantages are analogous to adopting a + site-wide look-and-feel. Common Maven procedures strengthen the + Maven brand. +

+

+ The next two sections document the directory layout expected by + Maven and the directory layout created by Maven. Please try to + conform to this structure as much as possible; however, if you + must these settings can be overridden via properties as + documented in the Integration document. +

+
+
+ + + + + + + + + + + + + + + + +
Directory nameContentComment
target/cloverContains instrumented code and clover database. + This directory is used by the Clover Plug-in as a placeholder for + the instrumented code and also as the location of the Clover + database. +
target/docs/cloverContains generated Clover reports. + Clover generates its HTML reports in this directory. +
+
+ +
diff --git a/clover/xdocs/futures.xml b/clover/xdocs/futures.xml new file mode 100644 index 00000000..52701969 --- /dev/null +++ b/clover/xdocs/futures.xml @@ -0,0 +1,21 @@ + + + + + Vincent Massol + Futures for the Clover Plug-in + + + +
+

+ The following is a list of things that are being contemplated + for the Maven Clover Plug-in. +

+
    +
  1. Also run integration unit tests before generating the reports
  2. +
  3. Export the name of the Clover database as a property
  4. +
+
+ +
diff --git a/clover/xdocs/goals.xml b/clover/xdocs/goals.xml new file mode 100644 index 00000000..a2400cee --- /dev/null +++ b/clover/xdocs/goals.xml @@ -0,0 +1,28 @@ + + + + + Maven clover Plug-in Goals + dIon Gillard + + + + + clover + Generate HTML test coverage reports with Clover + + + clover:html-report + Generate HTML test coverage reports with Clover + + + clover:on + Create the needed directory structure + + + clover:swing-report + Generate Swing test coverage reports with Clover + + + + \ No newline at end of file diff --git a/clover/xdocs/index.xml b/clover/xdocs/index.xml new file mode 100644 index 00000000..fd561749 --- /dev/null +++ b/clover/xdocs/index.xml @@ -0,0 +1,73 @@ + + + + + Maven Clover Plug-in + Vincent Massol + + + +
+

+ This document provides an overview of the Maven Clover Plug-in. +

+

+ The documents presented here are references, if you are looking + for more verbose usage material, please refer to the Getting Started section. +

+ +

+ The Clover Plug-in is the place where Clover tools are found + in Maven. +

+

+ Clover is a tool that generates Test Coverage reports. It is free for + non-commercial use. If your project is a commercial project you will + need to get a license for the Clover jar before using this Plug-in. +

+

+ In order to use this Plug-in you need to place the clover jar in your + ANT_HOME/lib directory. +

+
+ + + + + + + + + + + + + + + +
DocumentDescription
Build File + This document provides detailed information on the various + targets that are available as part of the Maven Clover Plug-in. + These targets can be delegated to by your project's local + build file. +
Properties + The behavior of the Maven Clover Plug-in can be altered via + properties. This document describes each property + available as the default used. +
Directory Layout + The preferred directory layout structure is documented + here. This is a useful document if you are trying to + determine what a particular component of your directory + hierarchy is used for. +
Futures + These are the current thoughts on additional items + that could or should be added to the plug-in. + They may or may not make it to an actual task list of a + developer. +
+
+
+ +
diff --git a/clover/xdocs/navigation.xml b/clover/xdocs/navigation.xml new file mode 100644 index 00000000..331d75a9 --- /dev/null +++ b/clover/xdocs/navigation.xml @@ -0,0 +1,19 @@ + + + + Maven + + + + + + + + + + + + + + + diff --git a/clover/xdocs/properties.xml b/clover/xdocs/properties.xml new file mode 100644 index 00000000..ec32b273 --- /dev/null +++ b/clover/xdocs/properties.xml @@ -0,0 +1,51 @@ + + + + + Vincent Massol + Maven Clover Plug-in Properties Documentation + + + +
+

+ The following is an overview of the various properties (and + default values) used by the Maven Clover Plug-in build file. Most of these + properties are optional and have defaults; however, there are + mandatory properties that must be set as described in this document. +

+

+ These properties can be overridden to change the default behavior of + the Maven Clover Plug-in. If you need to override any of these + properties, please refer to the + Integration + document for the preferred method of setting properties in your project. +

+ + + + + + +
SectionDescription
Misc + These properties specify various settings that control the + behaviour of the Clover Plug-in. +
+
+ +
+ + + + + + + +
PropertyOptional?Description
maven.clover.database.dirNo + Specifies the location of the Clover database. The default value is + ${maven.build.dir}/clover/database. +
+
+ +
diff --git a/codeswitcher/.cvsignore b/codeswitcher/.cvsignore new file mode 100644 index 00000000..bca2cda9 --- /dev/null +++ b/codeswitcher/.cvsignore @@ -0,0 +1,3 @@ +target +maven.log +velocity.log diff --git a/codeswitcher/plugin.jelly b/codeswitcher/plugin.jelly new file mode 100644 index 00000000..6401bbdc --- /dev/null +++ b/codeswitcher/plugin.jelly @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/codeswitcher/plugin.properties b/codeswitcher/plugin.properties new file mode 100644 index 00000000..a9251985 --- /dev/null +++ b/codeswitcher/plugin.properties @@ -0,0 +1,5 @@ +# ------------------------------------------------------------------- +# P L U G I N P R O P E R I E S +# ------------------------------------------------------------------- +# POM plugin. +# ------------------------------------------------------------------- diff --git a/codeswitcher/project.properties b/codeswitcher/project.properties new file mode 100644 index 00000000..0c0e2eae --- /dev/null +++ b/codeswitcher/project.properties @@ -0,0 +1,5 @@ +# ------------------------------------------------------------------- +# P R O J E C T P R O P E R T I E S +# ------------------------------------------------------------------- +maven.xdoc.version=${pom.currentVersion} +maven.xdoc.date=left \ No newline at end of file diff --git a/codeswitcher/project.xml b/codeswitcher/project.xml new file mode 100644 index 00000000..89883a7a --- /dev/null +++ b/codeswitcher/project.xml @@ -0,0 +1,66 @@ + + + + ${basedir}/../project.xml + 3 + maven-codeswitcher-plugin + Maven CodeSwitcher Plugin + 1.0 + + + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/codeswitcher/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/codeswitcher/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + + ant + 1.5.1 + + root + + + + + commons-lang + 1.0-b1.1 + + root.maven + + + + + + + diff --git a/codeswitcher/src/main/org/apache/maven/codeswitcher/CodeSwitcher.java b/codeswitcher/src/main/org/apache/maven/codeswitcher/CodeSwitcher.java new file mode 100644 index 00000000..7f9ced69 --- /dev/null +++ b/codeswitcher/src/main/org/apache/maven/codeswitcher/CodeSwitcher.java @@ -0,0 +1,541 @@ +/* Copyrights and Licenses + * + * This product includes Hypersonic SQL. + * Originally developed by Thomas Mueller and the Hypersonic SQL Group. + * + * Copyright (c) 1995-2000 by the Hypersonic SQL Group. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. + * - 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. + * - All advertising materials mentioning features or use of this software must display the + * following acknowledgment: "This product includes Hypersonic SQL." + * - Products derived from this software may not be called "Hypersonic SQL" nor may + * "Hypersonic SQL" appear in their names without prior written permission of the + * Hypersonic SQL Group. + * - Redistributions of any form whatsoever must retain the following acknowledgment: "This + * product includes Hypersonic SQL." + * 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 Hypersonic SQL Group 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 any 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 + * Hypersonic SQL Group. + * + * + * For work added by the HSQL Development Group: + * + * Copyright (c) 2001-2002, The HSQL Development Group + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer, including earlier + * license statements (above) and comply with all above license conditions. + * + * 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, including earlier + * license statements (above) and comply with all above license conditions. + * + * Neither the name of the HSQL Development Group nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS 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 HSQL DEVELOPMENT GROUP, HSQLDB.ORG, + * OR 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. + */ +package org.apache.maven.codeswitcher; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.LineNumberReader; + +import java.util.ArrayList; +import java.util.List; +import java.util.Iterator; + +import org.apache.commons.lang.StringUtils; + +import org.apache.tools.ant.DirectoryScanner; + +/** + * changes the source code to support different JDK or profile settings + * + * @version 1.7.0 + */ +public class CodeSwitcher +{ + private final static String ls = System.getProperty("line.separator", "\n"); + private List onSwitches; + private List offSwitches; + private List switches; + private final static int MAX_LINELENGTH = 82; + + private String[] files; + + /** + * Constructor declaration + */ + public CodeSwitcher() + { + onSwitches = new ArrayList(); + offSwitches = new ArrayList(); + switches = new ArrayList(); + } + + /** + * Method declaration + * + * @param a + */ + public void execute() + { + System.out.println("On Switches"); + System.out.println(onSwitches); + + System.out.println("Off Switches"); + System.out.println(offSwitches); + + process(); + } + + /** + * Set the on switches + */ + public void setOnSwitches(String onSwitchesCSV) + { + String[] onSwitchesArray = StringUtils.split(onSwitchesCSV, ","); + + for (int i = 0; i < onSwitchesArray.length; i++) + { + onSwitches.add(onSwitchesArray[i]); + } + } + + /** + * Set the off switches + */ + public void setOffSwitches(String offSwitchesCSV) + { + String[] offSwitchesArray = StringUtils.split(offSwitchesCSV, ","); + + for (int i = 0; i < offSwitchesArray.length; i++) + { + offSwitches.add(offSwitchesArray[i]); + } + } + + /** + * Set the directory of sources to preprocess + */ + public void setDirectory(String directory) + { + // Grab all the java source files in the listed + // directory. + files = getFiles(new File(directory), "**/*.java"); + } + + /** + * Method declaration + */ + private void process() + { + for (int i = 0; i < files.length; i++) + { + System.out.print("."); + + String file = files[i]; + + if (!processFile(file)) + { + System.out.println("in file " + file + " !"); + } + } + + System.out.println(""); + } + + /** + * Method declaration + * + * @param s + * @return + */ + private boolean isLongline(String s) + { + char c = s.charAt(s.length() - 1); + + if (",(+-&|".indexOf(c) >= 0) + { + return true; + } + + return false; + } + + /** + * Method declaration + * + * @param name + * @return + */ + private boolean processFile(String name) + { + File f = new File(name); + File fnew = new File(name + ".new"); + int state = 0;// 0=normal 1=inside_if 2=inside_else + boolean switchoff = false; + boolean working = false; + + try + { + LineNumberReader read = new LineNumberReader(new FileReader(f)); + FileWriter write = new FileWriter(fnew); + + while (true) + { + String line = read.readLine(); + + if (line == null) + { + break; + } + + if (working) + { + if (line.equals("/*") || line.equals("*/")) + { + continue; + } + } + + if (!line.startsWith("//#")) + { + write.write(line + ls); + } + else + { + if (line.startsWith("//#ifdef ")) + { + if (state != 0) + { + printError( + "'#ifdef' not allowed inside '#ifdef'"); + + return false; + } + + write.write(line + ls); + + state = 1; + + String s = line.substring(9); + + if (onSwitches.indexOf(s) != -1) + { + working = true; + switchoff = false; + } + else if (offSwitches.indexOf(s) != -1) + { + working = true; + + write.write("/*" + ls); + + switchoff = true; + } + + if (switches.indexOf(s) == -1) + { + switches.add(s); + } + } + else if (line.startsWith("//#else")) + { + if (state != 1) + { + printError("'#else' without '#ifdef'"); + + return false; + } + + state = 2; + + if (!working) + { + write.write(line + ls); + } + else if (switchoff) + { + write.write("*/" + ls); + write.write(line + ls); + + switchoff = false; + } + else + { + write.write(line + ls); + write.write("/*" + ls); + + switchoff = true; + } + } + else if (line.startsWith("//#endif")) + { + if (state == 0) + { + printError("'#endif' without '#ifdef'"); + + return false; + } + + state = 0; + + if (working && switchoff) + { + write.write("*/" + ls); + } + + write.write(line + ls); + + working = false; + } + else + { + write.write(line + ls); + } + } + } + + if (state != 0) + { + printError("'#endif' missing"); + + return false; + } + + read.close(); + write.flush(); + write.close(); + + File fbak = new File(name + ".bak"); + + fbak.delete(); + f.renameTo(fbak); + + File fcopy = new File(name); + + fnew.renameTo(fcopy); + fbak.delete(); + + return true; + } + catch (Exception e) + { + printError(e.getMessage()); + + return false; + } + } + + /** + * Method declaration + * + * @param name + * @return + */ + int testFile(String name) + { + + File f = new File(name); + + try + { + LineNumberReader read = new LineNumberReader(new FileReader(f)); + int l = 1; + int + maxline = 0; + boolean longline = false; + + while (true) + { + String line = read.readLine(); + + if (line == null) + { + break; + } + + if (line.length() > MAX_LINELENGTH + && !line.startsWith("org.hsqldb.test.Profile.")) + { + System.out.println("long line in " + name + " at line " + + l); + } + + if (line.startsWith(" ")) + { + int spaces = 0; + + for (; spaces < line.length(); spaces++) + { + if (line.charAt(spaces) != ' ') + { + break; + } + } + + if (spaces > 3 && testLine(line) && !longline) + { + maxline++; + } + else if (isLongline(line)) + { + longline = true; + } + else + { + longline = false; + } + + String s = line.substring(spaces); + + if (s.startsWith("if(")) + { + if (!s.endsWith(" {")) + { + System.out.println("if( without { in " + name + + " at line " + l); + } + } + else if (s.startsWith("} else if(")) + { + if (!s.endsWith(" {")) + { + System.out.println("} else if without { in " + + name + " at line " + l); + } + } + else if (s.startsWith("while(")) + { + if (!s.endsWith(" {")) + { + System.out.println("while( without { in " + name + + " at line " + l); + } + } + else if (s.startsWith("switch(")) + { + if (!s.endsWith(" {")) + { + System.out.println("switch( without { in " + name + + " at line " + l); + } + } + else if (s.startsWith("do ")) + { + if (!s.endsWith(" {")) + { + System.out.println("do without { in " + name + + " at line " + l); + } + } + } + + l++; + } + + read.close(); + + return maxline; + } + catch (Exception e) + { + printError(e.getMessage()); + } + + return -1; + } + + /** + * Method declaration + * + * @param line + * @return + */ + private boolean testLine(String line) + { + + if (!line.endsWith(";")) + { + return false; + } + + if (line.trim().startsWith("super(")) + { + return false; + } + + return true; + } + + /** + * Method declaration + * + * @param error + */ + private void printError(String error) + { + System.out.println(""); + System.out.println("ERROR: " + error); + } + + /** + * Get a set of files from a specifed directory with a set of includes. + * + * @param directory Directory to scan + * @param includes Comma separated list of includes + * @return files + */ + public String[] getFiles(File directory, String includes) + { + String[] includePatterns = null; + if (includes != null) + { + includePatterns = StringUtils.split(includes, ","); + } + DirectoryScanner directoryScanner = new DirectoryScanner(); + directoryScanner.setBasedir(directory); + directoryScanner.setIncludes(includePatterns); + directoryScanner.scan(); + String[] files = directoryScanner.getIncludedFiles(); + + for (int i = 0; i < files.length; i++) + { + files[i] = new File(directory, files[i]).getAbsolutePath(); + } + + return files; + } + +} diff --git a/codeswitcher/xdocs/.cvsignore b/codeswitcher/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/codeswitcher/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/codeswitcher/xdocs/changes.xml b/codeswitcher/xdocs/changes.xml new file mode 100644 index 00000000..8c68b109 --- /dev/null +++ b/codeswitcher/xdocs/changes.xml @@ -0,0 +1,16 @@ + + + + Changes + Jason van Zyl + + + + + + Original release for Maven 1.0-beta8 + + + + + diff --git a/codeswitcher/xdocs/goals.xml b/codeswitcher/xdocs/goals.xml new file mode 100644 index 00000000..16600d33 --- /dev/null +++ b/codeswitcher/xdocs/goals.xml @@ -0,0 +1,19 @@ + + + + + Maven CodeSwitcher Plug-in Goals + Jason van Zyl + + + + + + codeswitcher:init + + Set up the code switcher tag library + + + + + diff --git a/codeswitcher/xdocs/index.xml b/codeswitcher/xdocs/index.xml new file mode 100644 index 00000000..838ed959 --- /dev/null +++ b/codeswitcher/xdocs/index.xml @@ -0,0 +1,16 @@ + + + + + Maven CodeSwitcher Plug-in + Jason van Zyl + + + +
+

+ A preprocessor plug-in for Maven. +

+
+ +
diff --git a/codeswitcher/xdocs/navigation.xml b/codeswitcher/xdocs/navigation.xml new file mode 100644 index 00000000..af4e91ba --- /dev/null +++ b/codeswitcher/xdocs/navigation.xml @@ -0,0 +1,15 @@ + + + + Maven CodeSwitcher Plugin + + + + + + + + + + + diff --git a/codeswitcher/xdocs/properties.xml b/codeswitcher/xdocs/properties.xml new file mode 100644 index 00000000..b2ed8979 --- /dev/null +++ b/codeswitcher/xdocs/properties.xml @@ -0,0 +1,25 @@ + + + + + Maven CodeSwitcher Plugin Properties + Jason van Zyl + + + +
+ + + + + + + + + + + +
Property nameOptional?Description
+
+ +
diff --git a/console/.cvsignore b/console/.cvsignore new file mode 100644 index 00000000..bca2cda9 --- /dev/null +++ b/console/.cvsignore @@ -0,0 +1,3 @@ +target +maven.log +velocity.log diff --git a/console/plugin.jelly b/console/plugin.jelly new file mode 100644 index 00000000..088b37db --- /dev/null +++ b/console/plugin.jelly @@ -0,0 +1,64 @@ + + + + + + + + + + + + + ${goal} + Setting property ${propertyPieces[0]} to ${propertyPieces[1]} + + + + + + + + + + + + + + ${goal} + + + + + + +${ex} + + + + +Bye ! + + + + + + + +${listGoal.name} + + + +The following commands are available: + + list - list all available goals + help - this message + <goalname> - attain a goal + quit - quits the console + + + diff --git a/console/plugin.properties b/console/plugin.properties new file mode 100644 index 00000000..50858d7d --- /dev/null +++ b/console/plugin.properties @@ -0,0 +1,10 @@ +# ------------------------------------------------------------------- +# P L U G I N P R O P E R T I E S +# ------------------------------------------------------------------- +# Xdoc plugin. +# ------------------------------------------------------------------- + +# The name of the first goal that is displayed when entering the +# console (defaults to "help"). The usage section is displayed in +# any case). +maven.console.first = ${maven.default.goal} diff --git a/console/project.xml b/console/project.xml new file mode 100644 index 00000000..f4ff09e4 --- /dev/null +++ b/console/project.xml @@ -0,0 +1,59 @@ + + + + ${basedir}/../project.xml + 3 + maven-console-plugin + Maven Console Plug-in + 1.0-SNAPSHOT + + Console for Maven + + http://jakarta.apache.org/turbine/maven/reference/plugins/console/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/console/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + James Birchfield + moatas + jim@bnainc.net + Birchfield &amp; Associates, Inc. + + Java Developer + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + + + + commons-jelly+tags-interaction + SNAPSHOT + + root.maven + + + + + commons-jelly+tags-log + SNAPSHOT + + root.maven + + + + + + diff --git a/console/xdocs/.cvsignore b/console/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/console/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/console/xdocs/changes.xml b/console/xdocs/changes.xml new file mode 100644 index 00000000..ed127b4e --- /dev/null +++ b/console/xdocs/changes.xml @@ -0,0 +1,21 @@ + + + + Changes + dIon Gillard + + + + + + We can now set the first goal to be set as default when starting the + console. This way, a project can set its own default goal, so that + you doesn't have to "guess" what he is supposed to do. + + + Plugin graciously donated by Jim + + + + + diff --git a/console/xdocs/goals.xml b/console/xdocs/goals.xml new file mode 100644 index 00000000..5faf1f8d --- /dev/null +++ b/console/xdocs/goals.xml @@ -0,0 +1,33 @@ + + + + + Maven Console Goals + dIon Gillard + + + +
+ + + + + + + + + + + + + + +
GoalDescription
console + This is the default goal of the plugin and starts the console + awaiting input. +
console:listGoals + Lists the goals available for the currently loaded project +
console:helpDisplays a help message along with a list of valid commands
+
+ +
diff --git a/console/xdocs/index.xml b/console/xdocs/index.xml new file mode 100644 index 00000000..35c6358b --- /dev/null +++ b/console/xdocs/index.xml @@ -0,0 +1,36 @@ + + + + + Maven Console + dIon Gillard + + + +
+

+ This plugin provides an interactive environment for executing + Maven goals for a project. This cuts down on the JVM and Maven + start-up times allowing for lightning-fast repetitive execution + of Maven. +

+

+ The console simply loads the current project.xml and waits for + the user to supply a goal (or other command) to execute. The + following commands are currently implemented: +

    +
  • help - displays the valid commands for the console
  • +
  • list - lists valid goals for the loaded project
  • +
+

+

+ For more information on the functionality provided by this plugin, + please see the Goals document. +

+

+ You can customize some features with + properties. +

+
+ +
diff --git a/console/xdocs/navigation.xml b/console/xdocs/navigation.xml new file mode 100644 index 00000000..87253b8f --- /dev/null +++ b/console/xdocs/navigation.xml @@ -0,0 +1,15 @@ + + + + Maven Console + + + + + + + + + + + diff --git a/console/xdocs/properties.xml b/console/xdocs/properties.xml new file mode 100644 index 00000000..aa9be770 --- /dev/null +++ b/console/xdocs/properties.xml @@ -0,0 +1,26 @@ + + + + + Console Properties + Stéphane MOR + + + +
+ + + + + + + +
PropertyOptional?Description
maven.console.firstYes + Sets the name of the first default goal, which is displayed + when the console starts. + The default value is ${maven.default.goal}. + The help is displayed in any case. +
+
+ +
diff --git a/console/xdocs/tasks.xml b/console/xdocs/tasks.xml new file mode 100644 index 00000000..1e28c2c3 --- /dev/null +++ b/console/xdocs/tasks.xml @@ -0,0 +1,21 @@ + + + + + Maven Console Tasks + Stéphane MOR + + + +
+

+

    +
  • + Find a way to switch projects easily, so that + we load all the plugins once for all projects. +
  • +
+

+
+ +
diff --git a/deploy/.cvsignore b/deploy/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/deploy/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/deploy/plugin.jelly b/deploy/plugin.jelly new file mode 100644 index 00000000..4c252706 --- /dev/null +++ b/deploy/plugin.jelly @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Moving ${artifact} to the ${resolvedDirectory} on ${siteAddress} + + + + + + + + + + + + + + + + + + + + + + + + + + + Executing ${siteCommand} with the username ${username} on ${siteAddress} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${excludes} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deploy/project.properties b/deploy/project.properties new file mode 100644 index 00000000..cd5297db --- /dev/null +++ b/deploy/project.properties @@ -0,0 +1,2 @@ +maven.xdoc.date=left +maven.xdoc.version=${pom.currentVersion} \ No newline at end of file diff --git a/deploy/project.xml b/deploy/project.xml new file mode 100644 index 00000000..58ed8db0 --- /dev/null +++ b/deploy/project.xml @@ -0,0 +1,109 @@ + + + + ${basedir}/../project.xml + 3 + maven-deploy-plugin + Maven Deploy Plug-in + 1.0 + + + + + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/deploy/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/deploy/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + Stéphane Mor + smor + stephanemor@yahoo.fr + Hasgard Systèmes et Réseaux + + Java Developer + + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + + + maven + beta-8 + maven.jar + + + + commons-jelly + SNAPSHOT + + + + commons-jelly+tags-log + SNAPSHOT + + root.maven + + + + + + + jsch + 0.0.9 + + + + jce + 1.2.2 + + + + commons-httpclient + SNAPSHOT + + + + commons-net + SNAPSHOT + + + + + + diff --git a/deploy/xdocs/.cvsignore b/deploy/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/deploy/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/deploy/xdocs/goals.xml b/deploy/xdocs/goals.xml new file mode 100644 index 00000000..dd3b25e4 --- /dev/null +++ b/deploy/xdocs/goals.xml @@ -0,0 +1,22 @@ + + + + + Maven Deploy Goals + dIon Gillard + + + +
+ + + + + + +
GoalDescription
deploy:pom + Deploy project.xml, a.k.a. the POM to the central repository. +
+
+ +
diff --git a/deploy/xdocs/index.xml b/deploy/xdocs/index.xml new file mode 100644 index 00000000..fdfaf759 --- /dev/null +++ b/deploy/xdocs/index.xml @@ -0,0 +1,18 @@ + + + + + Maven Deployment Plug-in + Jason van Zyl + + + +
+

+ This plugin is a general deployment mechanism used for deploying + artifacts into the central Maven repository and for deploying + a project's site. +

+
+ +
diff --git a/deploy/xdocs/navigation.xml b/deploy/xdocs/navigation.xml new file mode 100644 index 00000000..64d062f3 --- /dev/null +++ b/deploy/xdocs/navigation.xml @@ -0,0 +1,15 @@ + + + + Maven Deploy Plugin + + + + + + + + + + + diff --git a/deploy/xdocs/properties.xml b/deploy/xdocs/properties.xml new file mode 100644 index 00000000..9fe3914e --- /dev/null +++ b/deploy/xdocs/properties.xml @@ -0,0 +1,35 @@ + + + + + Deploy Properties + Stéphane MOR + + + +
+ + + + + + + + + + + +
maven.scp.executableYes + Specifies the name (and possibly location) of the remote secure + copy executable to use (SCP). This is used by the "deploy:pom" goal. + The default value is scp (i.e. an executable + named scp must be in your path). +
maven.ssh.executableYes + Specifies the name (and possibly location) of the remote secure + shell executable to use (SSH). This is used by the "deploy:pom" goal. + The default value is ssh (i.e. an executable + named ssh must be in your path). +
+
+ +
diff --git a/developer-activity/.cvsignore b/developer-activity/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/developer-activity/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/developer-activity/plugin.jelly b/developer-activity/plugin.jelly new file mode 100644 index 00000000..d12351ef --- /dev/null +++ b/developer-activity/plugin.jelly @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + ${pom.repository.connection} + + Generating the developer activity report + + + + + + + + + + + + + + + + + + + The Activity report is only available in online mode. + + + + + + diff --git a/developer-activity/plugin.properties b/developer-activity/plugin.properties new file mode 100644 index 00000000..03ede927 --- /dev/null +++ b/developer-activity/plugin.properties @@ -0,0 +1,14 @@ +# ------------------------------------------------------------------- +# P L U G I N P R O P E R I E S +# ------------------------------------------------------------------- +# Activity log plugin. +# ------------------------------------------------------------------- + +maven.src.dir = ${basedir}/src +maven.build.dir = ${basedir}/target + +maven.docs.dest = ${maven.build.dir}/docs +maven.docs.outputencoding = ISO-8859-1 + +maven.activitylog.range = 30 +maven.changelog.factory = org.apache.maven.cvslib.CvsChangeLogFactory diff --git a/developer-activity/project.xml b/developer-activity/project.xml new file mode 100644 index 00000000..215698c0 --- /dev/null +++ b/developer-activity/project.xml @@ -0,0 +1,39 @@ + + + + ${basedir}/../project.xml + 3 + maven-developer-activity-plugin + Maven Activity Plug-in + 1.2-SNAPSHOT + + + This document provides a report of activity in terms of CVS commits and + breaks it out by developer. + + + + + + + + commons-jelly+tags-jsl + SNAPSHOT + + root.maven + + + + + commons-jelly + commons-jelly-tags-xml + SNAPSHOT + http://jakarta.apache.org/commons/sandbox/jelly/tags/xml/ + + root.maven + + + + + + diff --git a/developer-activity/src/plugin-resources/developer-activity.jsl b/developer-activity/src/plugin-resources/developer-activity.jsl new file mode 100644 index 00000000..9a3b3a92 --- /dev/null +++ b/developer-activity/src/plugin-resources/developer-activity.jsl @@ -0,0 +1,55 @@ + + + + + + + + Developer Activity Analysis + + + +
+

+ + Timeframe: ${maven.activitylog.range} days, + Total Commits: + + Total Number of Files Changed: + +

+ + + + + + + + + + + + + + + + + + + +
NameNumber of CommitsNumber of files changed
${name}${commits}${changedFiles}
+
+ +
+
+ + + + + +
diff --git a/dist/.cvsignore b/dist/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/dist/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/dist/plugin.jelly b/dist/plugin.jelly new file mode 100644 index 00000000..52eafb22 --- /dev/null +++ b/dist/plugin.jelly @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + +-------------------------------------------------------+ + | C R E A T I N G B I N A R Y D I S T R I B U T I O N | + +-------------------------------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-------------------------------------------------------+ + | C R E A T I N G S O U R C E D I S T R I B U T I O N | + +-------------------------------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Building snapshot distribution: ${maven.final.name} + + + + + + diff --git a/dist/plugin.properties b/dist/plugin.properties new file mode 100644 index 00000000..604a7e9f --- /dev/null +++ b/dist/plugin.properties @@ -0,0 +1,14 @@ +# ------------------------------------------------------------------- +# P L U G I N P R O P E R I E S +# ------------------------------------------------------------------- +# Distribution plugin. +# ------------------------------------------------------------------- + +maven.build.dir = ${basedir}/target + +maven.docs.src = ${basedir}/xdocs +maven.docs.dest = ${maven.build.dir}/docs +maven.docs.outputencoding = ISO-8859-1 +maven.gen.docs = ${maven.build.dir}/generated-xdocs + +maven.src.docbook-simple=${maven.src.dir}/sdocbook diff --git a/dist/project.properties b/dist/project.properties new file mode 100644 index 00000000..5e723259 --- /dev/null +++ b/dist/project.properties @@ -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} \ No newline at end of file diff --git a/dist/project.xml b/dist/project.xml new file mode 100644 index 00000000..b0f0483d --- /dev/null +++ b/dist/project.xml @@ -0,0 +1,71 @@ + + + + ${basedir}/../project.xml + 3 + maven-dist-plugin + Maven Distribution Plug-in + 1.1 + Java Project Management Tools + + http://jakarta.apache.org/turbine/maven/reference/plugins/dist/ + http://jira.werken.com/BrowseProject.jspa?id=10030 + jakarta.apache.org + /www/jakarta.apache.org/turbine/maven/reference/plugins/dist/ + /www/jakarta.apache.org/builds/jakarta-turbine-maven/ + + + + dIon Gillard + dion + dion@multitask.com.au + Multitask Consulting + + Documentation + + + + + Bob McWhirter + werken + bob@werken.com + The Werken Company + + Java Developer + + + + + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + + + + + ant + 1.5.1 + + root + + + + + commons-lang + 1.0-b1.1 + + root.maven + + + + + + + diff --git a/dist/xdocs/.cvsignore b/dist/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/dist/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/dist/xdocs/changes.xml b/dist/xdocs/changes.xml new file mode 100644 index 00000000..fa6e4e27 --- /dev/null +++ b/dist/xdocs/changes.xml @@ -0,0 +1,16 @@ + + + + Changes + Vincent Massol + + + + + + Released. + + + + + diff --git a/dist/xdocs/goals.xml b/dist/xdocs/goals.xml new file mode 100644 index 00000000..a23b7b1c --- /dev/null +++ b/dist/xdocs/goals.xml @@ -0,0 +1,88 @@ + + + + + Maven Distribution Plug-in Goals + dIon Gillard + + + + + + dist + + This is the default goal of the plugin and simply attains + the dist:build goal. + + + + dist:build + + This goal builds a complete distribution. It is achieved by + attaining the dist:build-bin and + dist:build-src goals. + + + + dist:build-bin + + Build a binary distribution made up of +
    +
  • a .tar.gz file
  • +
  • a .zip file
  • +
+ The contents of which come from the maven.dist.bin.archive.dir + directory. +
+
+ + dist:build-setup + + Creates the maven.dist.dir directory. + + + + dist:build-src + + Build a source distribution made up of +
    +
  • a .tar.gz file
  • +
  • a .zip file
  • +
+ The contents of which come from the maven.dist.src.archive.dir + directory. +
+
+ + dist:deploy + + Deploys a distribution to the remote repository. The distribution + is packaged as the file distributions.tar.gz. To create + this file the dist:build goal is attained. + + + + dist:deploy-snapshot + + Simply attains the dist:deploy goal after setting + the build name to a snapshot format. + + + + dist:deploy-src + + Deploys a source distribution to the remote repository. + To create this file the dist:build-src goal is attained. + + + + dist:prepare-bin-filesystem + + This goal sets up the file system in preparation of the + binary distribution. It's prerequisites are the + java:jar and javadoc:generate goals. + + +
+ +
diff --git a/dist/xdocs/index.xml b/dist/xdocs/index.xml new file mode 100644 index 00000000..00630759 --- /dev/null +++ b/dist/xdocs/index.xml @@ -0,0 +1,17 @@ + + + + + Maven Distribution Plug-in + Jason van Zyl + + + +
+

+ This plugin produces consistent distributions that can be used + for releases and snapshots. +

+
+ +
diff --git a/dist/xdocs/navigation.xml b/dist/xdocs/navigation.xml new file mode 100644 index 00000000..5d73c1e3 --- /dev/null +++ b/dist/xdocs/navigation.xml @@ -0,0 +1,15 @@ + + + + Maven Distribution Plugin + + + + + + + + + + + diff --git a/dist/xdocs/properties.xml b/dist/xdocs/properties.xml new file mode 100644 index 00000000..dd8efb62 --- /dev/null +++ b/dist/xdocs/properties.xml @@ -0,0 +1,16 @@ + + + + Distribution Properties + dIon Gillard + + + +
+ + +
PropertyOptional?Description
+
+ +
+ diff --git a/docbook/.cvsignore b/docbook/.cvsignore new file mode 100644 index 00000000..e5e33942 --- /dev/null +++ b/docbook/.cvsignore @@ -0,0 +1,3 @@ +target +velocity.log +maven.log diff --git a/docbook/plugin.jelly b/docbook/plugin.jelly new file mode 100644 index 00000000..45ed54fe --- /dev/null +++ b/docbook/plugin.jelly @@ -0,0 +1,22 @@ + + + + + + + + + + ${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')} + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ + + + + + + +
+
+
+ + + + + + + + + + + + +
+ + +
+
+ + +
+ + + + +
+
+ + + + + + | + + + + + + + + + + + + + +
+ + +

+ ${_sectionName} +

+
+ +
+
+ + +
+ + +

+ ${_sectionName} +

+
+ +
+
+ + +
+
+
+
+ + + + + +
+
+ + + + + + + + + + + + + + ${rowMode} + + ${attr.value} + + + + + + + + + + + + + + +
+ +

+ + + + + + + + +

+

Goals

+ + + +
GoalDescription
+
+
+ + + + + + + + + + + + + + + ${rowMode} + + ${_goalName} + + + + + + + + + + + + + + + + + + +
DateAuthorFiles/Message
+
+ + + + + + + + + + + + + + + ${rowMode} + + + + +
+ +
+
+ + + ${pom.repository.url} + ${url}?&content-type=text/vnd.viewcvs-markup + - + v +
+
+ + + + + + + + + + + + + diff --git a/xdoc/src/plugin-resources/templates/cvs-usage.xml b/xdoc/src/plugin-resources/templates/cvs-usage.xml new file mode 100644 index 00000000..5bf43d85 --- /dev/null +++ b/xdoc/src/plugin-resources/templates/cvs-usage.xml @@ -0,0 +1,56 @@ + + + + #set ($conn = $project.repository.cvsRoot) + #set ($module = $project.repository.cvsModule) + #set ($url = $escape.getText($project.repository.url)) + + + Maven + CVS + + + +
+

+ $url +

+
+ +
+

+ This project's CVS repository can be checked out through anonymous (pserver) + CVS with the following instruction set. + When prompted for a password for anonymous, simply press the Enter key. +

+ +

+ cvs -d $conn login +
+ cvs -z3 -d $conn co $module +

+ +

+ Updates from within the module's directory do not need the -d parameter. +

+
+ +
+ +

+ Only project developers can access the CVS tree via this method. + SSH1 must be installed on your client machine. Substitute + name with the proper value. Enter your site password when prompted. +

+ +

+ export CVS_RSH=ssh +
+ cvs -z3 -d $conn co $module +

+ +
+ + +
+ diff --git a/xdoc/src/plugin-resources/templates/dependencies.xml b/xdoc/src/plugin-resources/templates/dependencies.xml new file mode 100644 index 00000000..ee27c792 --- /dev/null +++ b/xdoc/src/plugin-resources/templates/dependencies.xml @@ -0,0 +1,43 @@ + + + + + Dependencies + + + +
+ #if ($project.dependencies.size() == 0) +

+ There are no dependencies for this project. It is a standalone + application that does not depend on any other project. +

+ #else +

+ The following is a list of dependencies for this project. These + dependencies are required to compile and run the application: +

+ + + + + + + #foreach ($dep in $project.dependencies) + + + + + + #end +
IDVersionJAR
+ #if ($dep.url && $dep.url.length() != 0) + $!dep.groupId + #else + $!dep.groupId + #end + $!dep.version$!dep.artifact
+ #end +
+ +
diff --git a/xdoc/src/plugin-resources/templates/index.xml b/xdoc/src/plugin-resources/templates/index.xml new file mode 100644 index 00000000..44cbe2b0 --- /dev/null +++ b/xdoc/src/plugin-resources/templates/index.xml @@ -0,0 +1,15 @@ + + + + + $!project.name + + + +
+

+ $!project.description +

+
+ +
diff --git a/xdoc/src/plugin-resources/templates/issue-tracking.xml b/xdoc/src/plugin-resources/templates/issue-tracking.xml new file mode 100644 index 00000000..aae6ba7c --- /dev/null +++ b/xdoc/src/plugin-resources/templates/issue-tracking.xml @@ -0,0 +1,18 @@ + + + + + Maven + Issue Tracking + + + +
+

+ #set ($url = $escape.getText($project.issueTrackingUrl)) + $url +

+
+ +
+ diff --git a/xdoc/src/plugin-resources/templates/mail-lists.xml b/xdoc/src/plugin-resources/templates/mail-lists.xml new file mode 100644 index 00000000..82772850 --- /dev/null +++ b/xdoc/src/plugin-resources/templates/mail-lists.xml @@ -0,0 +1,55 @@ + + +#macro (displayLink $label $link) + + #if ($link && $link.length() != 0) + #if ($link.startsWith("http")) + $label + #else + $label + #end + #else + Not Available + #end + +#end + + + + + Mailing Lists + + + +
+ #if ($project.mailingLists.size() == 0) +

+ There are no mailing lists established for this project. Please + check back at a later date. +

+ #else +

+ These are the mailing lists that have been established for this + project. For each list, there is a subscribe, unsubscribe, and an + archive link. +

+ + + + + + + + #foreach ($list in $project.mailingLists) + + + #displayLink("Subscribe" $list.subscribe) + #displayLink("Unsubscribe" $list.unsubscribe) + #displayLink("Archive" $list.archive) + + #end +
List NameSubscribeUnsubscribeArchive
$list.name
+ #end +
+ +
diff --git a/xdoc/src/plugin-resources/templates/maven-reports.xml b/xdoc/src/plugin-resources/templates/maven-reports.xml new file mode 100644 index 00000000..94cc6c39 --- /dev/null +++ b/xdoc/src/plugin-resources/templates/maven-reports.xml @@ -0,0 +1,120 @@ + + + + + Project Reports + Pete Kazmier + + + +
+

+ This document provides an overview of the various reports that + are automatically generated by + Maven. + Each report is briefly described below. +

+ + + + + + + + #if ($project.repository) + + + + + + + + + + #end + + + + + + + #if ($files.file($project.build.unitTestSourceDirectory).exists()) + + + + #end + + #if ($files.file($project.build.sourceDirectory).exists()) + + + + + + + + + + #end + + #if ($files.file("$maven-docs-dest/clover").exists()) + + + + #end + #if ($files.file("$gen-xdocs/cactus-report.xml").exists()) + + + + #end +
DocumentDescription
Changes + This document provides a history of the changes made to the + project, in a user friendly format, generated from the + xdocs/changes.xml file. +
Change Log + This document provides a history of the most recent + changes made to the project taken directly from the + source code repository. +
Developer Activity + This document provides a report of activity in terms of + CVS commits and breaks it out by developer. +
File Activity + This document provides a report of activity in terms of + CVS commits and breaks it out by file. +
Tasks + This document provides a list of tasks that need to + be completed for the project, generated from the + xdocs/tasks.xml file. +
Task List + This document provides a list of tasks that need to + be completed for the project, generated from the + @task javadoc tag in java source code. +
Unit Tests + This document provides the results of the unit tests that + are part of this project. Successes and failures are + noted. +
Metric Results + This document provides information on various source code + metrics that have been computed. These metrics can + provide useful information regarding the abstractness and + total number of classes. +
Checkstyle Report + This document provides the results of the Checkstyle + report. This report provides an indication of how well + this project complies with its coding conventions. +
Javadoc Report + This document the details of javadoc execution against + the project. This encourages the reduction of javadoc + errors. +
Clover Test Coverage + This document provides the results of the Clover report. This + reports show what portion on your code has been executed by + your test suite and generates statistics. It gives a very good + idea of how good your test suite is. +
Cactus Tests + This document provides the results of the Cactus unit tests that + are part of this project. Successes and failures are noted. +
+
+
+ +
diff --git a/xdoc/src/plugin-resources/templates/project-info.xml b/xdoc/src/plugin-resources/templates/project-info.xml new file mode 100644 index 00000000..1f3d1210 --- /dev/null +++ b/xdoc/src/plugin-resources/templates/project-info.xml @@ -0,0 +1,70 @@ + + + + + Project Information + Pete Kazmier + + + +
+

+ This document provides an overview of the various documents and + links that are part of this project's general information. All + of this content is automatically generated by + Maven on + behalf of the project. +

+ + + + + + + + + + + + + + + + + #if ($project.repository.url) + + + + #end + #if ($project.issueTrackingUrl) + + + + #end +
DocumentDescription
Mailing Lists + This document provides subscription and archive + information for this project's mailing lists. +
Project Team + This document provides information on the members of + this project. These are the individuals who have + contributed to the project in one form or another. +
Dependencies + This document lists the projects dependencies and provides + information on each dependency. +
Source Repository + This is a link to the online source repository that can be + viewed via a web browser. +
Issue Tracking + This is a link to the issue tracking system for this + project. Issues (bugs, features, change requests) can be + created and queried using this link. +
+
+
+ +
diff --git a/xdoc/src/plugin-resources/templates/team-list.xml b/xdoc/src/plugin-resources/templates/team-list.xml new file mode 100644 index 00000000..fac107ca --- /dev/null +++ b/xdoc/src/plugin-resources/templates/team-list.xml @@ -0,0 +1,97 @@ + + + + + Project Team + + + + +
+

+ A successful project requires many people to play many roles. + Some members write code or documentation, while others are + valuable as testers, submitting patches and suggestions. +

+ +

+ The team is comprised of Members + and Contributors. Members + have direct access to the source of a project and actively + evolve the code-base. Contributors improve the project + through submission of patches and suggestions to the Members. + The number of Contributors to the project is unbounded. + Get involved today. All contributions to the project are + greatly appreciated. +

+
+ +
+ #if ($project.developers.size() == 0) +

+ There are no developers working on this project. Please check + back at a later date. +

+ #else +

+ The following is a list of developers with commit privileges that have + directly contributed to the project in one way or another. +

+ + + + + + + + + #foreach ($developer in $project.developers) + + #if ($developer.url.length() != 0) + + #else + + #end + + + + + + #end +
NameIdEmailOrganizationRoles
$!developer.name$!developer.name$!developer.id$!developer.email$!developer.organization + #foreach ($role in $developer.roles) + $role
+ #end +
+ #end + #if ($project.contributors.size() != 0 ) +
+

+ The following additional people have contributed to this project + through the way of suggestions, patches or documentation. +

+ + + + + + + + #foreach ($contributor in $project.contributors) + + + + + + + #end +
NameEmailOrganizationRoles
$!contributor.name$!contributor.email$!contributor.organization + #foreach ($role in $contributor.roles) + $role
+ #end +
+
+ #end +
+ +
diff --git a/xdoc/src/plugin-resources/ui.properties b/xdoc/src/plugin-resources/ui.properties new file mode 100644 index 00000000..c4672d6c --- /dev/null +++ b/xdoc/src/plugin-resources/ui.properties @@ -0,0 +1,39 @@ +# +# UI Color Prefs +# +maven.ui.body.background = #fff +maven.ui.body.foreground = #000 +maven.ui.section.background = #036 +maven.ui.section.foreground = #fff +maven.ui.subsection.background = #888 +maven.ui.subsection.foreground = #fff +maven.ui.table.header.background = #bbb +maven.ui.table.header.foreground = #fff +maven.ui.table.row.odd.background = #ddd +maven.ui.table.row.odd.foreground = #000 +maven.ui.table.row.even.background = #efefef +maven.ui.table.row.even.foreground = #000 +maven.ui.banner.background = #036 +maven.ui.banner.foreground = #fff +maven.ui.banner.border.top = #369 +maven.ui.banner.border.bottom = #003 +maven.ui.source.background = #fff +maven.ui.source.foreground = #000 +maven.ui.source.border.right = #888 +maven.ui.source.border.left = #888 +maven.ui.source.border.top = #888 +maven.ui.source.border.bottom = #888 +maven.ui.navcol.background = #eee +maven.ui.navcol.background.ns4 = #fff +maven.ui.navcol.foreground = #000 +maven.ui.navcol.foreground.ns4 = #555 +maven.ui.navcol.border.top = #fff +maven.ui.navcol.border.right = #aaa +maven.ui.navcol.border.bottom = #aaa +maven.ui.breadcrumbs.background = #ddd +maven.ui.breadcrumbs.foreground = #000 +maven.ui.breadcrumbs.border.top = #fff +maven.ui.breadcrumbs.border.bottom = #aaa +maven.ui.href.link = blue +maven.ui.href.link.active = #f30 +maven.ui.href.link.selfref = #555 diff --git a/xdoc/xdocs/.cvsignore b/xdoc/xdocs/.cvsignore new file mode 100644 index 00000000..cb6131bb --- /dev/null +++ b/xdoc/xdocs/.cvsignore @@ -0,0 +1 @@ +stylesheets diff --git a/xdoc/xdocs/changes-report.xml b/xdoc/xdocs/changes-report.xml new file mode 100644 index 00000000..38f4881c --- /dev/null +++ b/xdoc/xdocs/changes-report.xml @@ -0,0 +1,51 @@ + + + + Changes Report + Vincent Massol + + + +
+

+ I've also wanted to be able to browse Maven's website and have a summary + of all changes. Then come back a few days later and then again see + what's new. This is for example what you can see on + Cactus's changes web page +

+

+ In order to activate this report, you need to create a changes.xml + file in your xdocs directory. The format of this file is as follows: +

+ + + + Changes + Vincent Massol + + + + + Added Form-based authentication support (Submitted by Jason Robertson). + + + Added a tutorial that + explains how to build Cactus from the sources. + +[...] + + + +]]> + +

Where the "type" attribute can be: add, remove, update or fix.

+ +

+ An example of the generated report can be seen on the + PatternTesting web page +

+
+ +
\ No newline at end of file diff --git a/xdoc/xdocs/changes.xml b/xdoc/xdocs/changes.xml new file mode 100644 index 00000000..476180e3 --- /dev/null +++ b/xdoc/xdocs/changes.xml @@ -0,0 +1,52 @@ + + + + Changes + dIon Gillard + + + + + + Added a target to validate the navigation.xml files from the schema + + + Added Cactus reports to Project Reports + + + Added new $gen-xdocsvariable in the Velocity context + used to generate the templates files. It points to the location + where generated xdcos are located. + + + Added maven.xdoc.development-process-url properties. + + + Added Javadoc report to Project Reports + + + Fix table widths of changelog and changes reports + + + Fix for Maven-124, the navbar was out of sync with maven-reports.xml + + + + + Created link with development process page if development-process.xml + exist in xdocs directory, otherwise a link with development process + page on Maven site. + + + Added documentation for the new changes report. + + + Added the new changes report. + + + Added an id column for committers on the team-list page. + + + + + diff --git a/xdoc/xdocs/goals.xml b/xdoc/xdocs/goals.xml new file mode 100644 index 00000000..204f59e2 --- /dev/null +++ b/xdoc/xdocs/goals.xml @@ -0,0 +1,45 @@ + + + + + XDoc Plugin Goals + dIon Gillard + + + +
+ + + + + + + + + + + + + + + + + + + + +
GoalDescription
xdoc + The default goal. This goal simply executes the + xdoc:generate-from-pom + and xdoc:transform goals +
xdoc:generate-from-pom + Generate a set of reports from your project.xml file. + This includes the dependency, mailing list, project info, project + reports and team list pages +
init-dvsl-tag + This goal defines the DVSL tag library for generating + documentation. A single tag dvsl:dvsl is defined. +
+
+ +
diff --git a/xdoc/xdocs/index.xml b/xdoc/xdocs/index.xml new file mode 100644 index 00000000..b2353564 --- /dev/null +++ b/xdoc/xdocs/index.xml @@ -0,0 +1,29 @@ + + + + + Maven XDoc Plug-in + Jason van Zyl + + + +
+

+ This plug-in provides the primary mechanism that is used to produce + the Maven documentation. +

+

+ The documentation is in Anakia format. More information + along with samples, can be found at: +

+

+
+ + diff --git a/xdoc/xdocs/navigation.xml b/xdoc/xdocs/navigation.xml new file mode 100644 index 00000000..8378d430 --- /dev/null +++ b/xdoc/xdocs/navigation.xml @@ -0,0 +1,16 @@ + + + + Maven xdoc Plugin + + + + + + + + + + + + diff --git a/xdoc/xdocs/properties.xml b/xdoc/xdocs/properties.xml new file mode 100644 index 00000000..5becac70 --- /dev/null +++ b/xdoc/xdocs/properties.xml @@ -0,0 +1,426 @@ + + + + + Xdoc Properties + Stéphane MOR + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyOptional?Description
maven.ui.body.backgroundYes + Specifies the background color used for the body of each + page. The default value is #fff (white). +
maven.ui.body.foregroundYes + Specifies the foreground color used in the body of each + page. The default value is #000 (black). +
maven.ui.section.backgroundYes + Specifies the background color used in the primary (1st + level) section headers. The default value is + #036 (dark blue). +
maven.ui.section.foregroundYes + Specifies the foreground color used in the primary (1st + level) section headers. The default value is + #fff (white). +
maven.ui.subsection.backgroundYes + Specifies the background color used in the secondary (2nd + level) subsection headers. The default value is + #888 (gray). +
maven.ui.subsection.foregroundYes + Specifies the foreground color used in the secondary (2nd + level) subsection headers. The default value is + #fff (white). +
maven.ui.table.header.backgroundYes + Specifies the background color used in the table header row. + The default value is #bbb (gray). +
maven.ui.table.header.foregroundYes + Specifies the foreground color used in the table header row. + The default value is #fff (white). +
maven.ui.table.row.odd.backgroundYes + Specifies the background color used in the odd numbered + table rows. The default value is #ddd (gray). +
maven.ui.table.row.odd.foregroundYes + Specifies the foreground color used in the odd numbered + table rows. The default value is #000 (black). +
maven.ui.table.row.even.backgroundYes + Specifies the background color used in the even numbered + table rows. The default value is #ddd (gray). +
maven.ui.table.row.even.foregroundYes + Specifies the foreground color used in the even numbered + table rows. The default value is #000 (black). +
maven.ui.banner.backgroundYes + Specifies the background color used in the banner. The + default value is #036 (dark blue). +
maven.ui.banner.foregroundYes + Specifies the foreground color used in the banner. The + default value is #fff (white). +
maven.ui.banner.border.topYes + Specifies the color used for the top-edge border of the + banner. The default value is #369 (blue). +
maven.ui.banner.border.bottomYes + Specifies the color used for the bottom-edge border of the + banner. The default value is #003 (black). +
maven.ui.source.backgroundYes + Specifies the background color used in the source regions. + The default value is #036 (dark blue). +
maven.ui.source.foregroundYes + Specifies the foreground color used in the source regions. + The default value is #fff (white). +
maven.ui.source.border.topYes + Specifies the color used for the top-edge border of source + regions. The default value is #888 (gray). +
maven.ui.source.border.bottomYes + Specifies the color used for the bottom-edge border of + source regions. The default value is #888 + (gray). +
maven.ui.source.border.rightYes + Specifies the color used for the right-edge border of + source regions. The default value is #888 + (gray). +
maven.ui.source.border.leftYes + Specifies the color used for the left-edge border of + source regions. The default value is #888 + (gray). +
maven.ui.navcol.backgroundYes + Specifies the background color used for the navigation + column on the left-hand side of the page. The default value + is #eee (gray). +
maven.ui.navcol.background.ns4Yes + Specifies the background color used for the navigation + column on the left-hand side of the page for Netscape 4.x. + The default value is #fff. Netscape 4.x does + not properly display the entire background using this color, + only the background of the text utilizes this color. + Therefore, it is recommended that this value is set to + white. +
maven.ui.navcol.foregroundYes + Specifies the foreground color used for the navigation + column on the left-hand side of the page. The default value + is #000 (black). +
maven.ui.navcol.foreground.ns4Yes + Specifies the foreground color used for the navigation + column on the left-hand side of the page for Netscape 4.x. + The default value is #555 (gray). +
maven.ui.navcol.border.topYes + Specifies the color used for the top-edge border of the + navigation column. The default value is #fff + (white). +
maven.ui.navcol.border.rightYes + Specifies the color used for the right-edge border of the + navigation column. The default value is #aaa + (gray). +
maven.ui.navcol.border.bottomYes + Specifies the color used for the bottom-edge border of the + navigation column. The default value is #aaa + (gray). +
maven.ui.breadcrumbs.backgroundYes + Specifies the background color used for the horizontal + navigation bar located immediately under the banner (note: + this element is not displayed on the page if no links have + been specified). The default value is #ddd + (gray). +
maven.ui.breadcrumbs.foregroundYes + Specifies the foreground color used for the horizontal + navigation bar located immediately under the banner (note: + this element is not displayed on the page if no links have + been specified). The default value is #000 + (black). +
maven.ui.breadcrumbs.border.topYes + Specifies the color used for the top-edge border of the + horizontal navigation section. The default value is + #fff (white). +
maven.ui.breadcrumbs.border.bottomYes + Specifies the color used for the bottom-edge border of the + horizontal navigation section. The default value is + #aaa (gray). +
maven.ui.href.linkYes + Specifies the color used for all links. The default value is + blue. +
maven.ui.href.link.activeYes + Specifies the color used for all links that are active (i.e. + the color used when the mouse is currently over the link). + The default value is #f30 (red). +
+
+
+ + + + + + + + + + + + + + + + +
maven.docs.destYes + Specifies the location of the transformed xdocs. This is + used by the "xdoc" goal. + The default value is ${basedir}/docs. +
maven.docs.srcYes + Specifies the location of the project's xdoc + documentation. This is used by the "xdoc" goal. + The default value is ${basedir}/xdocs. +
maven.gen.docsYes + Specifies the location where Maven-generated xdocs are + stored. The generated xdocs are then later transformed to + HTML. The default value is + ${basedir}/generated-xdocs. +
+
+
+ + + + + + +
maven.docs.outputencodingYes + Specifies the output encoding of the DVSL generated docs. + The default value is ISO-8859-1, an encoding supporting + english characters as well as most + + european languages. +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
maven.xdoc.dateYes + Allows the user to show the site generation date on the generated + website. One can place the date in 5 locations with "maven.xdoc.date": +
    +
  • left : on the left side of the breadcrumbs
  • +
  • right : on the right side of the breadcrumbs, before the links
  • +
  • navigation-top : above the user links, in the navigation menu
  • +
  • navigation-bottom : under Maven's links, in the navigation menu
  • +
  • bottom : after the organization name, in the footer
  • +
+ If "maven.xdoc.date" is left empty, no date is shown on the site (default). + The default "maven.xdoc.date.locale" is "en" (ie: english). +
maven.xdoc.date.formatYes + Sets the format of the date to display. + Defaults to "dd MMMM yyyy" (eg: "14 August 2002"). +
maven.xdoc.date.localeYes + Sets the locale used for the date. + Defaults to "en", ie english. +
maven.xdoc.developmentProcessUrlYes + Sets the url of development process page. + Defaults to + http://jakarta.apache.org/turbine/maven/development-process.html. +
+
+ +