dion        02/04/30 07:41:00

  Modified:    .        LICENSE.txt
               src/install Copy of maven.iap
               src/templates/build build-docs.xml default.properties
               xdocs    properties.xml
  Added:       src/java/org/apache/maven/changelog ChangeLog.java
                        ChangeLogEntry.java ChangeLogFile.java
                        ChangeLogGenerator.java ChangeLogParser.java
               src/test/org/apache/maven/changelog ChangeLogEntryTest.java
                        ChangeLogFileTest.java
               src/test/org/apache/maven/cvslib CvsChangeLogParserTest.java
  Removed:     src/java/org/apache/maven ChangeLog.java
               src/java/org/apache/maven/cvslib ChangeLogEntry.java
                        ChangeLogFile.java ChangeLogParser.java
               src/test/org/apache/maven/cvslib ChangeLogEntryTest.java
                        ChangeLogFileTest.java ChangeLogParserTest.java
  Log:
  Applied Glenn McAllister's patch to allow easier addition of other vcs's to changelog
  
  Revision  Changes    Path
  1.3       +1 -1      jakarta-turbine-maven/LICENSE.txt
  
  Index: LICENSE.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/LICENSE.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LICENSE.txt       22 Apr 2002 00:18:20 -0000      1.2
  +++ LICENSE.txt       30 Apr 2002 14:40:59 -0000      1.3
  @@ -26,7 +26,7 @@
    *    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
  + *    "Apache jakarta-turbine-maven" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact [EMAIL PROTECTED]
    *
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLog.java
  
  Index: ChangeLog.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // java imports
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.OutputStreamWriter;
  import java.io.PrintWriter;
  import java.io.UnsupportedEncodingException;
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Properties;
  // maven imports
  import org.apache.maven.executor.ProjectExecutor;
  import org.apache.maven.project.Developer;
  
  /**
   * Change log task. It uses a ChangeLogGenerator and ChangeLogParser to create
   * a Collection of ChangeLogEntry objects, which are used to produce an XML
   * output that represents the list of changes.
   *
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Glenn McAllister</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Jeff Martin</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>dIon Gillard</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Stefan Bodewig</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Donald</a>
   * @version $Id: ChangeLog.java,v 1.1 2002/04/30 14:40:59 dion Exp $
   */
  public class ChangeLog extends ProjectExecutor
  {
      /**
       * Used to specify the range of log entries to retrieve.
       */
      private String range;
  
      /**
       * Input dir. Working directory for running CVS executable
       */
      private File base;
  
      /**
       * Output file for xml document
       */
      private File output;
  
      /** change log entries parsed */
      private Collection entries;
  
      /**
       * The name of the ChangeLogGenerator class, defaulting to Maven's built in
       * CVS generator.
       */
      private String clGeneratorClass = 
          "org.apache.maven.cvslib.CvsChangeLogGenerator";
  
      /**
       * The name of the ChangeLogParser class, defaulting to Maven's built in
       * CVS parser.
       */
      private String clParserClass =
          "org.apache.maven.cvslib.CvsChangeLogParser";
      
      /**
       * Set the ChangeLogGenerator class name.  If this isn't set, the generator
       * defaults to Maven's built in CVS generator.
       *
       * @param generatorClassName the fully qualified generator class name
       */
      public void setGenerator( String generatorClassName )
      {
          clGeneratorClass = generatorClassName;
      }
  
      /**
       * Set the ChangeLogParser class name.  If this value isn't set, the parser
       * defaults to Maven's built in CVS parser.
       *
       * @param parserClassName the fully qualified parser class name.
       */
      public void setParser( String parserClassName )
      {
          clParserClass = parserClassName;
      }
      
      /**
       * 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;
      }
      
      /**
       * 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 UTF-8 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
      {
          ChangeLogGenerator generator = createGenerator();
          ChangeLogParser parser = createParser();
  
          generator.init( this );
          parser.init( this );
  
          try
          {
              setEntries( generator.getEntries( parser ) );
              log("ChangeLog found: " + getEntries().size() + " entries");
          }
          finally
          {
              parser.cleanup();
              generator.cleanup();
          }
      }
  
      /**
       * Create an instance of the ChangeLogGenerator specified by the {@link
       * clGeneratorClass} member.
       *
       * @return the change log generator
       * @throws IOException if there is a problem creating the generator
       */
      private ChangeLogGenerator createGenerator() throws IOException
      {
          return (ChangeLogGenerator) createObject( clGeneratorClass );
      }
  
      /**
       * Create an instance of the ChangeLogParser specified by the {@link
       * clParserClass} member.
       *
       * @return the change log parser
       * @throws IOException if there is a problem creating the parser
       */
      private ChangeLogParser createParser() throws IOException
      {
          return (ChangeLogParser) createObject( clParserClass );
      }
  
      /**
       * Create a new instance of class <code>className</code>.
       *
       * @param className the class to instantiate
       * @return the new instance
       * @throws IOException if there is a problem creating the instance.
       */
      private Object createObject( String className ) throws IOException
      {
          try
          {
              Class clazz = Class.forName( className );
              return clazz.newInstance();
          }
          catch (ClassNotFoundException cnfe)
          {
              throw new IOException( "Cannot find class " + className +
                      " " + cnfe.toString() );
          }
          catch (IllegalAccessException iae)
          {
              throw new IOException( "Cannot access class " + className +
                      " " + iae.toString() );
          }
          catch (InstantiationException ie)
          {
              throw new IOException( "Cannot instantiate class " + className +
                      " " + ie.toString() );
          }
      }
      
      /**
       * Set up list of developers mapping id to name.
       * @todo should be a facility on the maven project itself
       * @return a list of developers ids and names
       */
      private Properties getUserList()
      {
          Properties userList = new Properties();
          
          List developers = getMavenProject().getDevelopers();
  
          Developer developer = null;
          for (Iterator i = developers.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
       *      UTF-8 encoding
       */
      private void createDocument() throws FileNotFoundException,
          UnsupportedEncodingException
      {
          
          PrintWriter out = new PrintWriter(new OutputStreamWriter(
              new FileOutputStream(output), "UTF-8"));
          out.println(toXML());
          out.flush();
          out.close();
      }
      
      /**
       * @return an XML document representing this change log and it's entries 
       */
      private String toXML()
      {
          StringBuffer buffer = new StringBuffer();
          buffer.append( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" )
              .append("<document>\n")
              .append("<properties><title>Change Log</title></properties>\n")
              .append("<body>\n")
              .append("<section name=\"Change Log\"/>\n")
              .append("<changelog>\n");
          
          for (Iterator i = getEntries().iterator(); i.hasNext(); )
          {
              buffer.append(((ChangeLogEntry) i.next()).toXML());
          }
  
          buffer.append("</changelog>\n")
              .append("</body>\n")
              .append("</document>\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;
      }
      
  } // end of ChangeLog
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogEntry.java
  
  Index: ChangeLogEntry.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.Enumeration;
  import java.util.Vector;
  
  /**
   * Change Log Entry - holds details about revisions to a file.
   *
   * @todo add time of change to the entry
   * @todo investigate betwixt for toXML method
   * @author <a href="mailto:[EMAIL PROTECTED]";>dIon Gillard</a>
   * @version $Id: ChangeLogEntry.java,v 1.1 2002/04/30 14:40:59 dion Exp $
   */
  public class ChangeLogEntry
  {
      /** 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.
       * 
       * @return a changelog-entry in xml format
       */
      public String toXML()
      {
          StringBuffer buffer = new StringBuffer();
          SimpleDateFormat outputTime = new SimpleDateFormat("hh:mm");
  
          buffer.append("\t<changelog-entry>\n")
              .append("\t\t<date>")
              .append(getDateFormatted())
              .append("</date>\n")
              .append("\t\t<time>")
              .append(getTimeFormatted())
              .append("</time>\n")
              .append("\t\t<author><![CDATA[")
              .append(author)
              .append("]]></author>\n");
          ChangeLogFile file = null;
          for (Enumeration e = files.elements(); e.hasMoreElements(); )
          {
              file = (ChangeLogFile) e.nextElement();
              buffer.append("\t\t<file>\n")
                  .append("\t\t\t<name>")
                  .append(file.getName())
                  .append("</name>\n")
                  .append("\t\t\t<revision>")
                  .append(file.getRevision())
                  .append("</revision>\n");
              buffer.append("\t\t</file>\n");
          }
          buffer.append("\t\t<msg><![CDATA[" + comment + "]]></msg>\n");
          buffer.append("\t</changelog-entry>\n");
          
          return buffer.toString();
      }
      
      /**
       * Getter for property author.
       * @return Value of property author.
       */
      public String getAuthor()
      {
          return author;
      }
      
      /**
       * Setter for property author.
       * @param author New value of property author.
       */
      public void setAuthor(String author)
      {
          this.author = author;
      }
      
      /**
       * Getter for property comment.
       * @return Value of property comment.
       */
      public String getComment()
      {
          return comment;
      }
      
      /**
       * Setter for property comment.
       * @param comment New value of property comment.
       */
      public void setComment(String comment)
      {
          this.comment = comment;
      }
      
      /**
       * Getter for property date.
       * @return Value of property date.
       */
      public Date getDate()
      {
          return date;
      }
      
      /**
       * Setter for property date.
       * @param date New value of property date.
       */
      public void setDate(Date date)
      {
          this.date = date;
      }
  
      /**
       * 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)
      {
          SimpleDateFormat inputDate = 
              new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
          try
          {
              this.date = inputDate.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()
      {
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
          return dateFormat.format(getDate());
      }
      
      /**
       * @return time in HH:mm:ss format
       */
      public String getTimeFormatted()
      {
          SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
          return timeFormat.format(getDate());
      }
  
  }
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogFile.java
  
  Index: ChangeLogFile.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * A set of information about revisions of a file as returned by CVS's log
   * command
   * @todo remove previous revision along with parser changes
   * @author <a href="mailto:[EMAIL PROTECTED]";>dIon Gillard</a>
   * @version $Id: ChangeLogFile.java,v 1.1 2002/04/30 14:40:59 dion 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
  
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogGenerator.java
  
  Index: ChangeLogGenerator.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.IOException;
  import java.util.Collection;
  
  /**
   * Instances of <code>ChangeLogGenerator</code> are intended to provide an
   * {@link java.io.InputStream} for a {@link ChangeLogParser} to parse into 
   * individual {@link ChangeLogEntry} objects.
   * 
   * @author Glenn McAllister
   * @version $Id: ChangeLogGenerator.java,v 1.1 2002/04/30 14:40:59 dion 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 <code>changeLog</code>.  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 <code>parser</code> to create
       * the individual {@link ChangeLogEntry} objects.
       *
       * <p>This method is guaranteed to be called after {@link #init} and before
       * {@link #cleanup}.  This method must invoke <em>only</em> the {@link
       * ChangeLogParser#parse} method.</p>
       *
       * @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();
  }
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogParser.java
  
  Index: ChangeLogParser.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.InputStream;
  import java.io.IOException;
  import java.util.Collection;
  
  /**
   * Instance of <code>ChangeLogParser</code> 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 2002/04/30 14:40:59 dion 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 <code>changeLog</code>.  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();
  }
  
  
  
  1.60      +5 -2      jakarta-turbine-maven/src/templates/build/build-docs.xml
  
  Index: build-docs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-docs.xml,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- build-docs.xml    28 Apr 2002 17:48:25 -0000      1.59
  +++ build-docs.xml    30 Apr 2002 14:40:59 -0000      1.60
  @@ -118,15 +118,18 @@
   
       <taskdef
         name="change-log"
  -      classname="org.apache.maven.ChangeLog">
  +      classname="org.apache.maven.changelog.ChangeLog">
         <classpath refid="maven-classpath"/>
  +      <classpath refid="classpath"/>
       </taskdef>
   
       <change-log
         projectDescriptor="project.xml"
         baseDir="."
         output="${gen.docs}/changelog.xml"
  -      days="${changelog.days}"
  +      range="${changelog.days}"
  +      generator="${changelog.generator}"
  +      parser="${changelog.parser}"
       />
   
     </target>
  
  
  
  1.28      +2 -0      jakarta-turbine-maven/src/templates/build/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/default.properties,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- default.properties        29 Apr 2002 14:22:52 -0000      1.27
  +++ default.properties        30 Apr 2002 14:40:59 -0000      1.28
  @@ -147,6 +147,8 @@
   # properties for changelog
   ##
   changelog.days = 5
  +changelog.generator = org.apache.maven.cvslib.CvsChangeLogGenerator
  +changelog.parser = org.apache.maven.cvslib.CvsChangeLogParser
   
   # -------------------------------------------------------------------
   # M A V E N  U P D A T E  S I T E  A N D  S E L F  U P D A T I N G
  
  
  
  1.1                  
jakarta-turbine-maven/src/test/org/apache/maven/changelog/ChangeLogEntryTest.java
  
  Index: ChangeLogEntryTest.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.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 2002/04/30 14:40:59 dion 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("<changelog-entry>"));
          assertTrue("XML doesn't contain date", 
              value.indexOf("<date>2002-04-01</date>") != -1);
          assertTrue("XML doesn't contain author CDATA", 
              value.indexOf("<author><![CDATA[dion]]></author>") != -1);
          assertTrue("XML doesn't contain comment CDATA",
              value.indexOf("<msg><![CDATA[comment]]></msg>") != -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() {}
  }
  
  
  
  1.1                  
jakarta-turbine-maven/src/test/org/apache/maven/changelog/ChangeLogFileTest.java
  
  Index: ChangeLogFileTest.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import junit.framework.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 2002/04/30 14:40:59 dion 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() {    
  }
  
  
  
  1.1                  
jakarta-turbine-maven/src/test/org/apache/maven/cvslib/CvsChangeLogParserTest.java
  
  Index: CvsChangeLogParserTest.java
  ===================================================================
  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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.FileInputStream;
  import java.util.Collection;
  import java.util.Iterator;
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  
  import org.apache.maven.changelog.ChangeLogEntry;
  
  /**
   * Test cases for {@link CvsChangeLogParser}
   * @author dion
   * @version $Id: CvsChangeLogParserTest.java,v 1.1 2002/04/30 14:40:59 dion 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);
      }
  
      /**
       * 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(CvsChangeLogParserTest.class);
      }
  
      /**
       * 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);
          String fs = System.getProperty("file.separator");
          assertNotNull("The system property file.separator was not defined.", 
              fs);
          testFile = baseDir + fs + "src/test-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;
          int countPrevRevision = 0;
          int countRevOnly = 0;
          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() {}
      
      
  }
  
  
  
  1.15      +35 -1     jakarta-turbine-maven/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/xdocs/properties.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- properties.xml    29 Apr 2002 19:27:24 -0000      1.14
  +++ properties.xml    30 Apr 2002 14:40:59 -0000      1.15
  @@ -1110,8 +1110,42 @@
               Specifies the number of days to use when generating the
               change log.  This is used by the <a
                 href="build-file.html#maven:cvs-change-log">maven:cvs-change-log</a>
  -            task.
  +            target.
               The default value is <code>5</code> days.
  +          </td>
  +        </tr>
  +        <tr>
  +          <td>changelog.generator</td>
  +          <td>Yes</td>
  +          <td>
  +            Specifies a fully qualified class name implementing
  +            <code>org.apache.maven.changelog.ChangeLogGenerator</code>.  This
  +            class creates an <code>InputStream</code> that is parsed by the
  +            class specified by the <code>changelog.parser</code> property to create
  +            a collection of <code>ChangeLogEntry</code> objects.  This is used
  +            by the <a
  +            href="build-file.html#maven:cvs-change-log">maven:cvs-change-log</a>
  +            target.  The default value is
  +            <a
  +            href="apidocs/org/apache/maven/cvslib/CvsChangeLogGenerator.html">
  +            org.apache.maven.cvslib.CvsChangeLogGenerator</a>.
  +          </td>
  +        </tr>
  +        <tr>
  +          <td>changelog.parser</td>
  +          <td>Yes</td>
  +          <td>
  +            Specifies a fully qualified class name implementing
  +            <code>org.apache.maven.changelog.ChangeLogParser</code>.  This
  +            class parses the <code>InputStream</code> created by the class
  +            specified by the <code>changelog.generator</code> property to
  +            create a collection of <code>ChnageLogEntry</code> objects.
  +            This is used by the <a
  +            href="build-file.html#maven:cvs-change-log">maven:cvs-change-log</a>
  +            target. The default value is
  +            <a
  +            href="apidocs/org/apache/maven/cvslib/CvsChangeLogParser.html">
  +            org.apache.maven.cvslib.CvsChangeLogParser</a>.
             </td>
           </tr>
           <tr>
  
  
  


Reply via email to