You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2008/07/28 11:52:01 UTC

svn commit: r680301 - in /maven/plugins/trunk/maven-changes-plugin: ./ src/main/java/org/apache/maven/plugin/announcement/ src/main/java/org/apache/maven/plugin/changes/ src/main/java/org/apache/maven/plugin/jira/ src/main/mdo/ src/site/apt/ src/test/j...

Author: olamy
Date: Mon Jul 28 02:52:00 2008
New Revision: 680301

URL: http://svn.apache.org/viewvc?rev=680301&view=rev
Log:
[MCHANGES-61] Provide DTD/XSD for changes.xml
use modello to generate all changes stuff :
- beans generation 
- xpp3Reader
- documentation generation of the changes xml format
- xsd generation


Added:
    maven/plugins/trunk/maven-changes-plugin/src/main/mdo/
    maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo
    maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java   (with props)
    maven/plugins/trunk/maven-changes-plugin/src/test/unit/
    maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml   (with props)
Removed:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/Action.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/Release.java
    maven/plugins/trunk/maven-changes-plugin/src/site/apt/changes.apt
Modified:
    maven/plugins/trunk/maven-changes-plugin/pom.xml
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java
    maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ActionTest.java
    maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ReleaseTest.java

Modified: maven/plugins/trunk/maven-changes-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/pom.xml?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/pom.xml Mon Jul 28 02:52:00 2008
@@ -61,6 +61,37 @@
   </scm>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.codehaus.modello</groupId>
+          <artifactId>modello-maven-plugin</artifactId>
+          <version>1.0-alpha-21-SNAPSHOT</version>
+          <executions>
+            <execution>
+              <id>site-docs</id>
+              <phase>pre-site</phase>
+              <goals>
+                <goal>xdoc</goal>
+                <goal>xsd</goal>
+              </goals>
+            </execution>
+            <execution>
+              <id>standard</id>
+              <goals>
+                <goal>java</goal>
+                <goal>xpp3-reader</goal>
+                <goal>xpp3-writer</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>  
+        <plugin>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>2.0-beta-7</version>
+        </plugin>      
+      </plugins>
+    </pluginManagement>    
     <plugins>
       <plugin>
         <artifactId>maven-enforcer-plugin</artifactId>
@@ -85,6 +116,16 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <configuration>
+          <version>1.0.0</version>
+          <models>
+            <model>src/main/mdo/changes.mdo</model>
+          </models>
+        </configuration>
+      </plugin>      
     </plugins>
   </build>
 
@@ -334,4 +375,19 @@
     <doxiaVersion>1.0-alpha-11</doxiaVersion>
     <doxiaSitetoolsVersion>1.0-alpha-11</doxiaSitetoolsVersion>
   </properties>
-</project>
\ No newline at end of file
+  
+  <!-- remove when modello is released -->
+  <pluginRepositories>
+    <pluginRepository>
+      <id>snapshots.codehaus</id>
+      <url>http://snapshots.repository.codehaus.org/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+  
+</project>

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java Mon Jul 28 02:52:00 2008
@@ -19,12 +19,18 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.changes.Action;
 import org.apache.maven.plugin.changes.ChangesXML;
-import org.apache.maven.plugin.changes.Release;
 import org.apache.maven.plugin.jira.JiraXML;
+import org.apache.maven.plugins.changes.model.Action;
+import org.apache.maven.plugins.changes.model.Release;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 import org.apache.velocity.VelocityContext;
@@ -34,12 +40,6 @@
 import org.apache.velocity.exception.VelocityException;
 import org.codehaus.plexus.velocity.VelocityComponent;
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * Goal which generate the template for an announcement.
  *
@@ -356,7 +356,7 @@
             if ( getLog().isDebugEnabled() )
             {
                 getLog().debug( "The release: " + release.getVersion()
-                    + " has " + release.getAction().size() + " actions." );
+                    + " has " + release.getActions().size() + " actions." );
             }
 
             if ( release.getVersion() != null && release.getVersion().equals( pomVersion ) )
@@ -382,7 +382,7 @@
     private void logRelease( Release release )
     {
         Action action;
-        for ( Iterator iterator = release.getAction().iterator(); iterator.hasNext(); )
+        for ( Iterator iterator = release.getActions().iterator(); iterator.hasNext(); )
         {
             action = (Action) iterator.next();
             getLog().debug( "o " + action.getType() );

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java Mon Jul 28 02:52:00 2008
@@ -29,6 +29,8 @@
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.util.HtmlTools;
 import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugins.changes.model.Action;
+import org.apache.maven.plugins.changes.model.Release;
 
 /**
  * Generates a changes report.
@@ -315,7 +317,7 @@
             sinkSectionTitle2Anchor( sink, bundle.getString( "report.changes.label.release" ) + " "
                 + release.getVersion() + " - " + release.getDateRelease(), HtmlTools.encodeId( release.getVersion() ) );
 
-            constructActions( sink, release.getAction(), bundle );
+            constructActions( sink, release.getActions(), bundle );
 
             sink.section2_();
         }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java Mon Jul 28 02:52:00 2008
@@ -19,56 +19,83 @@
  * under the License.
  */
 
-import org.apache.maven.plugin.logging.Log;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
 import java.io.File;
-import java.util.ArrayList;
+import java.io.FileInputStream;
+import java.util.Collections;
 import java.util.List;
 
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugins.changes.model.Body;
+import org.apache.maven.plugins.changes.model.ChangesDocument;
+import org.apache.maven.plugins.changes.model.Properties;
+import org.apache.maven.plugins.changes.model.io.xpp3.ChangesXpp3Reader;
+
 /**
  * XML Parser for changes.xml files.
  *
  * @version $Id$
  */
 public class ChangesXML
-    extends DefaultHandler
 {
-    private Action action;
-
-    private List actionList;
-
-    private Release release;
-
-    private StringBuffer currentElement = new StringBuffer( 1024 );
-
-    private String currentName;
 
     private List releaseList;
 
     private String author;
 
-    private String authorEmail;
-
     private String title;
+    
+    private String authorEmail;
+    
+    private ChangesDocument changesDocument;
 
     public ChangesXML( File xmlPath, Log log )
     {
-        SAXParserFactory factory = SAXParserFactory.newInstance();
-
+        
+        if (xmlPath == null || !xmlPath.exists())
+        {
+            log.error( "changes xml file is null or not exists " );
+            return;
+        }
+        
         try
         {
-            SAXParser saxParser = factory.newSAXParser();
+            
+            ChangesXpp3Reader reader = new ChangesXpp3Reader();
 
-            saxParser.parse( xmlPath, this );
+            changesDocument = reader.read( new FileInputStream( xmlPath), false ); 
+            
+            if (changesDocument == null)
+            {
+                log.error( "cannot build changes from file " + xmlPath.getPath() );
+                return;
+            }
+            
+            Properties properties = changesDocument.getProperties();
+            
+            if (properties != null)
+            {
+                if ( properties.getAuthor() != null )
+                {
+                    this.author =properties.getAuthor().getName();
+                    this.authorEmail = properties.getAuthor().getName(); 
+                }
+                this.title = properties.getTitle();                  
+            }
+            
+            
+            Body body = changesDocument.getBody();
+            
+            
+            if ( body != null )
+            {
+                this.releaseList = changesDocument.getBody().getReleases();
+            }
+            
         }
-        catch ( Throwable t )
+        catch ( Throwable e )
         {
-            log.error( "An error occured when parsing the changes.xml file:", t );
+            // FIXME throw an Exception ?
+            log.error( "An error occured when parsing the changes.xml file:", e );
         }
     }
 
@@ -82,16 +109,6 @@
         return author;
     }
 
-    public void setAuthorEmail( String authorEmail )
-    {
-        this.authorEmail = authorEmail;
-    }
-
-    public String getAuthorEmail()
-    {
-        return authorEmail;
-    }
-
     public void setReleaseList( List releaseList )
     {
         this.releaseList = releaseList;
@@ -99,7 +116,7 @@
 
     public List getReleaseList()
     {
-        return releaseList;
+        return releaseList == null ? Collections.EMPTY_LIST : releaseList;
     }
 
     public void setTitle( String title )
@@ -112,87 +129,19 @@
         return title;
     }
 
-    public void characters( char[] buf, int offset, int len )
-        throws SAXException
+    public ChangesDocument getChangesDocument()
     {
-        currentElement.append( buf, offset, len );
+        return changesDocument;
     }
 
-    public void endElement( String namespaceURI, String sName, String qName )
-        throws SAXException
+    public String getAuthorEmail()
     {
-        if ( qName.equals( "title" ) )
-        {
-            this.title = currentElement.toString().trim();
-        }
-        else if ( qName.equals( "author" ) )
-        {
-            this.author = currentElement.toString().trim();
-        }
-        else if ( qName.equals( "action" ) )
-        {
-            action.setAction( currentElement.toString().trim() );
-
-            actionList.add( action );
-        }
-        else if ( qName.equals( "release" ) )
-        {
-            release.setAction( actionList );
-
-            releaseList.add( release );
-        }
-
-        currentElement.setLength( 0 );
+        return authorEmail;
     }
 
-    public void startElement( String namespaceURI, String sName, String qName, Attributes attrs )
-        throws SAXException
+    public void setAuthorEmail( String authorEmail )
     {
-        if ( qName.equals( "title" ) )
-        {
-            this.title = "";
-        }
-        else if ( qName.equals( "author" ) )
-        {
-            this.authorEmail = attrs.getValue( "email" );
-
-            this.author = "";
-        }
-        else if ( qName.equals( "body" ) )
-        {
-            releaseList = new ArrayList();
-        }
-        else if ( qName.equals( "release" ) )
-        {
-            release = new Release();
-
-            release.setDateRelease( attrs.getValue( "date" ) );
-
-            release.setVersion( attrs.getValue( "version" ) );
-
-            release.setDescription( attrs.getValue( "description" ) );
-
-            actionList = new ArrayList();
-        }
-        else if ( qName.equals( "action" ) )
-        {
-            action = new Action();
-
-            action.setDev( attrs.getValue( "dev" ) );
-
-            action.setDueTo( attrs.getValue( "due-to" ) );
-
-            action.setDueToEmail( attrs.getValue( "due-to-email" ) );
-
-            action.setType( attrs.getValue( "type" ) );
-
-            action.setIssue( attrs.getValue( "issue" ) );
-            
-            action.setSystem( attrs.getValue( "system" ) );
-            
-            action.setDate( attrs.getValue( "date" ) );
-        }
-
-        currentName = qName;
+        this.authorEmail = authorEmail;
     }
+
 }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java Mon Jul 28 02:52:00 2008
@@ -19,14 +19,6 @@
  * under the License.
  */
 
-import org.apache.maven.plugin.changes.Action;
-import org.apache.maven.plugin.changes.Release;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -34,6 +26,15 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.maven.plugins.changes.model.Action;
+import org.apache.maven.plugins.changes.model.Release;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
 /**
  * XML parser for <code>JiraIssue</code>s. This works on an XML file downloaded
  * from JIRA and creates a List of issues that is exposed to the user of the

Added: maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo?rev=680301&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo Mon Jul 28 02:52:00 2008
@@ -0,0 +1,265 @@
+<?xml version="1.0"?>
+
+<model>
+  <id>changes</id>
+  <name>Changes</name>
+  <description>
+    A recording of changes made during each release of a project. This
+    file should record every changes made to the project.
+  </description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.plugins.changes.model</value>
+    </default>
+  </defaults>
+  <classes>
+    <class rootElement="true" xml.tagName="document">
+      <name>ChangesDocument</name>
+      <description>
+        Record every release with their subsequent changes.
+      </description>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>properties</name>
+          <version>1.0.0</version>
+          <association>
+            <type>Properties</type>
+            <multiplicity>1</multiplicity>
+          </association>
+          <description>
+            Contains the properties of this document.
+          </description>
+        </field> 
+        <field>
+          <name>body</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <association>
+            <type>Body</type>
+          </association>
+          <description>
+            Contains the releases of this project with the actions taken
+            for each of the releases.
+          </description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>Properties</name>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>title</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+          <description>Page Title.</description>
+        </field>
+        <field>
+          <name>author</name>
+          <version>1.0.0</version>
+          <description>Page Author</description>
+          <association>
+            <type>Author</type>
+            <multiplicity>1</multiplicity>
+          </association>          
+        </field>
+      </fields>
+    </class>
+    <class xsd.compositor="sequence">
+      <name>Body</name>
+      <version>1.0.0</version>
+      <fields>
+        <field xml.listStyle="flat">
+          <name>releases</name>
+          <version>1.0.0</version>
+          <association>
+            <type>Release</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <description>The list of releases for this project.</description>
+        </field>
+      </fields>
+    </class>
+    <class xsd.compositor="sequence">
+      <name>Release</name>
+      <version>1.0.0</version>
+      <description>A single release of this project.</description>
+      <fields>
+        <field xml.attribute="true">
+          <name>version</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+          <description>
+            The version number associated with this release.
+          </description>
+        </field>
+        <field xml.attribute="true" xml.tagName="date">
+          <name>dateRelease</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+          <description>
+            <![CDATA[
+            <p>The date of this release.</p>
+            <p>This field can be any String, such as "in SVN" when the version isn't yet released. </p>
+          ]]>
+          </description>
+        </field>
+        <field xml.attribute="true">
+          <name>description</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>
+            A short description of this release.
+          </description>
+        </field>
+        <field xml.listStyle="flat">
+          <name>actions</name>
+          <version>1.0.0</version>
+          <association>
+            <type>Action</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <description>The list of actions taken for this release.</description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>Author</name>
+      <version>1.0.0</version>
+      <description>
+        A description of the author page.
+      </description>
+      <fields>
+        <field>
+          <name>name</name>
+          <version>1.0.0</version>
+          <type>Content</type>
+          <description>
+            The page author name.
+          </description>
+        </field>    
+        <field xml.attribute="true" xml.tagName="email">
+          <name>authorEmail</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>
+            The page author email.
+          </description>
+        </field>
+      </fields>
+    </class>        
+    <class>
+      <name>Action</name>
+      <version>1.0.0</version>
+      <description>
+        A single action done on the project, during this release.
+      </description>
+      <fields>
+        <field>
+          <name>action</name>
+          <version>1.0.0</version>
+          <type>Content</type>
+          <description>
+            A short description of the action taken.
+          </description>
+        </field>     
+        <field xml.attribute="true">
+          <name>dev</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+          <description>
+            <![CDATA[
+            <p>Name of developer who committed the change.</p>
+            <p>This <b>MUST</b> be the name of the developer as described in the developers section of the pom.xml file.</p>
+            ]]>
+          </description>
+        </field>
+        <field xml.attribute="true">
+          <name>dueTo</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>
+            Name of the person to be credited for this change. This can be used when a patch is submitted by a non-committer.
+          </description>
+        </field>
+        <field xml.attribute="true">
+          <name>dueToEmail</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>
+            Email of the person to be credited for this change.
+          </description>
+        </field>   
+        <field xml.attribute="true">
+          <name>issue</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+          <description>
+            <![CDATA[
+              <p>Id of the issue related to this change. This is the id in your issue tracking system.</p>
+              <p>The Changes plugin will generate a URL out of this id. The URL is constructed using the value of the issueLinkTemplate parameter.</p>
+              <p>See the <a href="changes-report.html">changes-report mojo</a> for more details.</p>
+            ]]>
+          </description>
+        </field>                     
+        <field xml.attribute="true">
+          <name>type</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+          <description>
+            <![CDATA[
+            Supported action types are the following:
+            <ul>
+              <li>add : added functionnality to the project.</li>
+              <li>fix : bug fix for the project.</li>
+              <li>update : updated some part of the project.</li>
+              <li>remove : removed some functionnality from the project.</li>
+            </ul>
+            ]]>
+          </description>
+        </field>
+        <field xml.attribute="true">
+          <name>system</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>
+            <![CDATA[
+              <p>Id of issue tracking system. If empty 'default' value will be use.</p>
+              <p>The Changes plugin will generate a URL out of this id. The URL is constructed using the value of the issueLinkTemplatePerSystem parameter.</p>
+              <p>See the <a href="changes-report.html">changes-report mojo</a> for more details.</p>
+            ]]>
+          </description>
+        </field>    
+        <field xml.attribute="true">
+          <name>date</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>fix date</description>
+        </field>              
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.9+</version>
+          <code><![CDATA[
+            public static final String ADD_ACTION = "add";
+        
+            public static final String FIX_ACTION = "fix";
+        
+            public static final String UPDATE_ACTION = "update";
+        
+            public static final String REMOVE_ACTION = "remove";
+          ]]></code>
+        </codeSegment>
+      </codeSegments>      
+    </class>
+  </classes>
+</model>
+

Modified: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ActionTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ActionTest.java?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ActionTest.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ActionTest.java Mon Jul 28 02:52:00 2008
@@ -23,6 +23,8 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.maven.plugins.changes.model.Action;
+
 public class ActionTest
     extends TestCase
 {

Added: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java?rev=680301&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java Mon Jul 28 02:52:00 2008
@@ -0,0 +1,147 @@
+package org.apache.maven.plugin.changes;
+
+import java.io.File;
+
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.console.ConsoleLogger;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 27 juil. 2008
+ * @version $Id$
+ */
+public class ChangesXMLTest
+    extends PlexusTestCase
+{
+
+    private static class MockLog
+        implements Log
+    {
+        Logger consoleLogger;
+
+        private MockLog()
+        {
+            consoleLogger = new ConsoleLogger( 1, "test" );
+        }
+
+        public void debug( CharSequence content )
+        {
+            consoleLogger.debug( content.toString() );
+        }
+
+        public void debug( Throwable error )
+        {
+            consoleLogger.debug( error.getMessage() );
+
+        }
+
+        public void debug( CharSequence content, Throwable error )
+        {
+            consoleLogger.debug( error.getMessage(), error );
+
+        }
+
+        public void error( CharSequence content )
+        {
+            consoleLogger.error( content.toString() );
+        }
+
+        public void error( Throwable error )
+        {
+            consoleLogger.error( error.getMessage() );
+        }
+
+        public void error( CharSequence content, Throwable error )
+        {
+            consoleLogger.error( error.getMessage(), error );
+
+        }
+
+        public void info( CharSequence content )
+        {
+            consoleLogger.info( content.toString() );
+        }
+
+        public void info( Throwable error )
+        {
+            consoleLogger.info( error.getMessage() );
+        }
+
+        public void info( CharSequence content, Throwable error )
+        {
+            consoleLogger.info( error.getMessage(), error );
+        }
+
+        public boolean isDebugEnabled()
+        {
+            return consoleLogger.isDebugEnabled();
+        }
+
+        public boolean isErrorEnabled()
+        {
+            return consoleLogger.isErrorEnabled();
+        }
+
+        public boolean isInfoEnabled()
+        {
+            return consoleLogger.isInfoEnabled();
+        }
+
+        public boolean isWarnEnabled()
+        {
+            return consoleLogger.isWarnEnabled();
+        }
+
+        public void warn( CharSequence content )
+        {
+            consoleLogger.warn( content.toString() );
+        }
+
+        public void warn( Throwable error )
+        {
+            consoleLogger.warn( error.getMessage() );
+
+        }
+
+        public void warn( CharSequence content, Throwable error )
+        {
+            consoleLogger.warn( content.toString(), error );
+
+        }
+
+    }
+
+    public void testParseChangesFile()
+        throws Exception
+    {
+        File changesFile = new File( getBasedir() + "/src/test/unit/changes.xml" );
+        ChangesXML changesXML = new ChangesXML( changesFile, new MockLog() );
+        assertNotNull( changesXML.getChangesDocument() );
+        assertEquals( "Changes report Project", changesXML.getTitle() );
+    }
+    
+}

Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ChangesXMLTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Modified: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ReleaseTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ReleaseTest.java?rev=680301&r1=680300&r2=680301&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ReleaseTest.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/ReleaseTest.java Mon Jul 28 02:52:00 2008
@@ -26,6 +26,8 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.maven.plugins.changes.model.Release;
+
 public class ReleaseTest
     extends TestCase
 {
@@ -71,9 +73,9 @@
     {
         List actionList = new ArrayList();
 
-        release.setAction( actionList );
+        release.setActions( actionList );
 
-        assertEquals( actionList, release.getAction() );
+        assertEquals( actionList, release.getActions() );
     }
 
 }

Added: maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml?rev=680301&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml Mon Jul 28 02:52:00 2008
@@ -0,0 +1,48 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document>
+  <properties>
+    <title>Changes report Project</title>
+    <author email="zloug@toto.com">Mr Zloug</author>
+  </properties>
+  <body>
+    <release version="1.1" date="2005-03-01" description="Subsequent release">
+      <action dev="me" type="add">
+        Added additional documentation on how to configure the plugin.
+      </action>
+      <action dev="me" type="fix" issue="MCHANGES-88">
+        Enable retrieving component-specific issues.
+      </action>
+      <action dev="me" type="fix" issue="1212" system="qc">
+        Enable retrieving component-specific issues.
+      </action>      
+      <action dev="jruiz" type="remove" due-to="others" due-to-email="users@users.com">
+        The element type " link " must be terminated by the matching end-tag.
+        Deleted the erroneous code.
+      </action>
+    </release>
+
+    <release version="1.0" date="2005-01-01" description="First release">
+      <action dev="me" type="update" date="2008-01-01">
+        Uploaded documentation on how to use the plugin.
+      </action>
+    </release>
+  </body>
+</document>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/unit/changes.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision