You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/11/16 14:34:10 UTC

cvs commit: jakarta-cactus/integration/maven/xdocs changes.xml properties.xml features.xml

vmassol     2003/11/16 05:34:09

  Modified:    integration/maven plugin.properties project.xml plugin.jelly
               integration/maven/xdocs changes.xml properties.xml
                        features.xml
  Added:       integration/maven/src/main/org/apache/cactus/integration/maven
                        CactusScanner.java CactusScannerTag.java
                        CactusTagLibrary.java
  Log:
  - The <code>cactus:test</code> goal now automatically discovers JUnit Test Cases from non JUnit java classes and by default excludes all classes that are not tests.
  - Renamed properties <code>cactus.src.includes</code> and <code>cactus.src.excludes</code> in <code>cactus.test.includes</code> and <code>cactus.test.excludes</code>. The previous names were misleading and some Cactus useres thought it referred to inclusion/exclusion of classes during the compilation. Please also note that file to include/exclude are now <code>.class</code> files and no longer <code>.java</code> files.
  
  Revision  Changes    Path
  1.4       +2 -2      jakarta-cactus/integration/maven/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/plugin.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- plugin.properties	8 Nov 2003 12:07:52 -0000	1.3
  +++ plugin.properties	16 Nov 2003 13:34:09 -0000	1.4
  @@ -17,10 +17,10 @@
   cactus.src.dir = ${basedir}/src/test-cactus
   
   # Default Cactus test files to include in the test
  -cactus.src.includes = **/*Test*.java
  +cactus.test.includes = **/*Test*.class
   
   # Default Cactus test files to exclude from the test
  -cactus.src.excludes = **/AllTests.java,**/Test*All.java
  +cactus.test.excludes = **/All*Test*.class,**/Test*All.class
   
   # (optional). Location of a test-specific web.xml file that will be
   # merged with the application web.xml, during the War cactification. 
  
  
  
  1.5       +23 -0     jakarta-cactus/integration/maven/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/project.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- project.xml	12 Nov 2003 22:27:28 -0000	1.4
  +++ project.xml	16 Nov 2003 13:34:09 -0000	1.5
  @@ -79,8 +79,31 @@
         <artifactId>js</artifactId>
         <version>1.5R4-RC3</version>
       </dependency>
  +
  +    <!-- Note: Dependencies below are needed by the Cactus scanner tag -->
  +    <dependency>
  +      <groupId>ant</groupId>
  +      <artifactId>ant</artifactId>>
  +      <version>1.5.3-1</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>commons-jelly</groupId>
  +      <artifactId>commons-jelly</artifactId>>
  +      <version>20030902.160215</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>commons-jelly</groupId>
  +      <artifactId>commons-jelly-tags-ant</artifactId>
  +      <version>20030625.032346</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>commons-beanutils</groupId>
  +      <artifactId>commons-beanutils</artifactId>>
  +      <version>1.6.1</version>
  +    </dependency>
     </dependencies>
     <build>
  +    <sourceDirectory>src/main</sourceDirectory>
       <resources>
         <resource>
           <directory>src/plugin-resources</directory>
  
  
  
  1.8       +37 -18    jakarta-cactus/integration/maven/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/plugin.jelly,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- plugin.jelly	12 Nov 2003 22:34:32 -0000	1.7
  +++ plugin.jelly	16 Nov 2003 13:34:09 -0000	1.8
  @@ -17,7 +17,8 @@
     xmlns:doc="doc" 
     xmlns:util="jelly:util"
     xmlns:ant="jelly:ant"
  -  xmlns:define="jelly:define">
  +  xmlns:define="jelly:define"
  +  xmlns:cactus="jelly:org.apache.cactus.integration.maven.CactusTagLibrary">
   
     <!--
        ========================================================================
  @@ -35,17 +36,17 @@
     <goal name="cactus:init" prereqs="war:war">
   
       <ant:path id="cactus.classpath">
  -      <pathelement location="${plugin.getDependencyPath('cactus:cactus-ant')}"/>
  -      <pathelement location="${plugin.getDependencyPath('cactus:cactus')}"/>
  -      <pathelement location="${plugin.getDependencyPath('commons-logging:commons-logging')}"/>
  -      <pathelement location="${plugin.getDependencyPath('junit:junit')}"/>
  -      <pathelement location="${plugin.getDependencyPath('commons-httpclient:commons-httpclient')}"/>
  -      <pathelement location="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  -      <pathelement location="${plugin.getDependencyPath('httpunit:httpunit')}"/>
  -      <pathelement location="${plugin.getDependencyPath('nekohtml:nekohtml')}"/>
  -      <pathelement location="${plugin.getDependencyPath('xerces:xerces')}"/>
  -      <pathelement location="${plugin.getDependencyPath('xml-apis:xml-apis')}"/>
  -      <pathelement location="${plugin.getDependencyPath('rhino:js')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('cactus:cactus-ant')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('cactus:cactus')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('commons-logging:commons-logging')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('junit:junit')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('commons-httpclient:commons-httpclient')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('httpunit:httpunit')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('nekohtml:nekohtml')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('xerces:xerces')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('xml-apis:xml-apis')}"/>
  +      <ant:pathelement location="${plugin.getDependencyPath('rhino:js')}"/>
       </ant:path>
   
       <ant:taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>
  @@ -65,6 +66,15 @@
         <j:set var="cactusSourcePresent" value="true"/>
       </util:available>
   
  +    <!-- The Cactus scanner automatically discovers Cactus tests -->
  +
  +    <ant:path id="cactus.scanner.classpath">
  +      <ant:pathElement location="${maven.build.dest}"/>
  +      <ant:pathElement location="${cactus.target.classes.dir}"/>
  +      <ant:path refid="maven.dependency.classpath"/>
  +      <ant:path refid="cactus.classpath"/>
  +    </ant:path>
  +
     </goal>
   
     <!--
  @@ -109,7 +119,7 @@
     <goal name="cactus:compile" prereqs="cactus:init"
         description="Compiles the cactus tests">
   
  -    <mkdir dir="${cactus.target.classes.dir}"/>
  +    <ant:mkdir dir="${cactus.target.classes.dir}"/>
       
       <j:choose>
         <j:when test="${cactusSourcePresent == 'true'}">
  @@ -259,10 +269,18 @@
     	  prereqs="cactus:init,cactus:init-report,cactus:cactifywar"
         description="Run all Cactus Test Cases">
   
  +    <cactus:scanner var="cactusScanner" classpathref="cactus.scanner.classpath">
  +      <fileset dir="${cactus.target.classes.dir}">
  +        <include name="${cactus.test.includes}"/>
  +        <exclude name="${cactus.test.excludes}"/>
  +      </fileset>
  +    </cactus:scanner>
  +
       <cactus warfile="${maven.build.dir}/${pom.artifactId}-cactus.war" 
           fork="yes" errorproperty="cactustests.error" 
           failureproperty="cactustests.failure"
           printsummary="${cactus.printsummary}">
  +
         <ant:classpath>
           <ant:pathelement path="${maven.build.dest}"/>
           <ant:pathelement location="${cactus.target.classes.dir}"/>
  @@ -365,13 +383,14 @@
           </weblogic7x>            
   
         </containerset>
  +
         <ant:formatter type="plain" usefile="${cactus.junit.usefile}"/>
         <ant:formatter type="xml"/>
  -      <ant:batchtest>
  -        <ant:fileset dir="${cactus.src.dir}"
  -          includes="${cactus.src.includes}"
  -          excludes="${cactus.src.excludes}"/>
  -      </ant:batchtest>
  +
  +      <j:forEach var="test" items="${cactusScanner.iterator()}">
  +        <test name="${test}"/>
  +      </j:forEach>
  +
       </cactus>
   
       <!-- TODO: Change the Cactus stylesheet (cactus.jsl) to handle reports
  
  
  
  1.1                  jakarta-cactus/integration/maven/src/main/org/apache/cactus/integration/maven/CactusScanner.java
  
  Index: CactusScanner.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.cactus.integration.maven;
  
  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.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;
  
  import junit.framework.TestCase;
  
  /**
   * Process {@link FileSet} and extracts classes that are Cactus tests. As
   * a Cactus test can be a simple JUnit test case wrapped in a Cactus suite,
   * it is very difficult to find out only Cactus tests. Thus, in this version,
   * we are only finding JUnit tests.
   * 
   * A class is considered to be a JUnit Test Case if:
   * <ul>
   *   <li>It extends {@link TestCase}</li>
   *   <li>It is not abstract</li>
   *   <li>It has at least one method that starts with "test", returns void and
   *   takes no parameters</li>
   * </ul>
   *
   * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
   * @version $Id: CactusScanner.java,v 1.1 2003/11/16 13:34:09 vmassol 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 (isJUnitTestCase(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 JUnit test case
       */
      private boolean isJUnitTestCase(String className, Path classpath)
      {
          Class clazz = loadClass(className, classpath);
          if (clazz == null)
          {
              return false;
          }
  
          Class testCaseClass = null;
          try
          {
              testCaseClass = clazz.getClassLoader().loadClass(
                  TestCase.class.getName());
          }
          catch (ClassNotFoundException e)
          {
              log.debug("Cannot load class", e);
              return false;
          }
  
          if (!testCaseClass.isAssignableFrom(clazz))
          {
              log.debug("Not a JUnit test as class [" + className + "] does "
                  + "not inherit from [" + TestCase.class.getName()
                  + "]");
              return false;
          }
  
          // the class must not be abstract
          if (Modifier.isAbstract(clazz.getModifiers()))
          {
              log.debug("Not a JUnit 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 JUnit 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);
      }
  }
  
  
  
  1.1                  jakarta-cactus/integration/maven/src/main/org/apache/cactus/integration/maven/CactusScannerTag.java
  
  Index: CactusScannerTag.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.cactus.integration.maven;
  
  import java.lang.reflect.InvocationTargetException;
  
  import org.apache.commons.jelly.JellyTagException;
  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 &lt;junit&gt; Ant
   * task for example, in order to find out the list of tests to
   * execute.
   *
   * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
   * @version $Id: CactusScannerTag.java,v 1.1 2003/11/16 13:34:09 vmassol 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 &lt;classpath&gt; 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 JellyTagException
      {
          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 JellyTagException
      {
          try
          {
              BeanUtils.setProperty(this, name, value);
          }
          catch (IllegalAccessException anException)
          {
              throw new JellyTagException(anException);
          }
          catch (InvocationTargetException anException)
          {
              throw new JellyTagException(anException);
          }
          
      }
  
      /**
       * 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;
      }
  }
  
  
  
  1.1                  jakarta-cactus/integration/maven/src/main/org/apache/cactus/integration/maven/CactusTagLibrary.java
  
  Index: CactusTagLibrary.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
   *    Foundation" 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"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.cactus.integration.maven;
  
  import org.apache.commons.jelly.TagLibrary;
  
  /**
   * Maven tag library for use in Jelly scripts.
   *
   * @author <a href="vmassol@apache.org">Vincent Massol</a>
   * @version $Id: CactusTagLibrary.java,v 1.1 2003/11/16 13:34:09 vmassol Exp $
   */
  public class CactusTagLibrary extends TagLibrary
  {
      /**
       * Register Cactus jelly tags. 
       */
      public CactusTagLibrary()
      {
          registerTag("scanner", CactusScannerTag.class);
      }
  }
  
  
  
  1.8       +14 -0     jakarta-cactus/integration/maven/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/xdocs/changes.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- changes.xml	12 Nov 2003 22:34:32 -0000	1.7
  +++ changes.xml	16 Nov 2003 13:34:09 -0000	1.8
  @@ -9,6 +9,20 @@
   
       <release version="1.6dev" date="in CVS">
         <action dev="vmassol" type="add">
  +        The <code>cactus:test</code> goal now automatically discovers JUnit 
  +        Test Cases from non JUnit java classes and by default excludes all 
  +        classes that are not tests.
  +      </action>
  +      <action dev="vmassol" type="update">
  +        Renamed properties <code>cactus.src.includes</code> and
  +        <code>cactus.src.excludes</code> in <code>cactus.test.includes</code>
  +        and <code>cactus.test.excludes</code>. The previous names were
  +        misleading and some Cactus useres thought it referred to 
  +        inclusion/exclusion of classes during the compilation. Please also note
  +        that file to include/exclude are now <code>.class</code> files and no
  +        longer <code>.java</code> files.
  +      </action>
  +      <action dev="vmassol" type="add">
           When running reports, make sure Cactus tests do not fail the build.
         </action>
         <action dev="vmassol" type="fix">
  
  
  
  1.8       +4 -4      jakarta-cactus/integration/maven/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/xdocs/properties.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- properties.xml	8 Nov 2003 12:07:52 -0000	1.7
  +++ properties.xml	16 Nov 2003 13:34:09 -0000	1.8
  @@ -47,22 +47,22 @@
             </td>
           </tr>
           <tr>
  -          <td>cactus.src.includes</td>
  +          <td>cactus.test.includes</td>
             <td>Yes</td>
             <td>
               <p>
                 Lists of test classes that will be executed. Default value is
  -              <code>**/*Test*.java</code>.
  +              <code>**/*Test*.class</code>.
               </p>
             </td>
           </tr>
           <tr>
  -          <td>cactus.src.excludes</td>
  +          <td>cactus.test.excludes</td>
             <td>Yes</td>
             <td>
               <p>
                 Lists of classes that will be excluded in the tests. Default 
  -              value is <code>**/AllTests.java,**/Test*All.java</code>.
  +              value is <code>**/All*Test*.class,**/Test*All.class</code>.
               </p>
             </td>
           </tr>
  
  
  
  1.3       +3 -0      jakarta-cactus/integration/maven/xdocs/features.xml
  
  Index: features.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/xdocs/features.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- features.xml	29 Oct 2003 21:49:00 -0000	1.2
  +++ features.xml	16 Nov 2003 13:34:09 -0000	1.3
  @@ -32,6 +32,9 @@
           <li>
             Supports Servlet API 2.3 only.
           </li>
  +        <li>
  +          Automatically discover test classes from non-test classes.
  +        </li>
         </ul>
       </section>
    </body>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org