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/11/05 00:12:28 UTC

svn commit: r711465 - in /maven/plugins/trunk/maven-changes-plugin/src/test: java/org/apache/maven/plugin/announcement/ java/org/apache/maven/plugin/announcement/AnnouncementMojoTest.java unit/announce-changes.xml

Author: olamy
Date: Tue Nov  4 15:12:27 2008
New Revision: 711465

URL: http://svn.apache.org/viewvc?rev=711465&view=rev
Log:
add files (junit) missed in previous commit 711463


Added:
    maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/announcement/
    maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/announcement/AnnouncementMojoTest.java   (with props)
    maven/plugins/trunk/maven-changes-plugin/src/test/unit/announce-changes.xml   (with props)

Added: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/announcement/AnnouncementMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/announcement/AnnouncementMojoTest.java?rev=711465&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/announcement/AnnouncementMojoTest.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/announcement/AnnouncementMojoTest.java Tue Nov  4 15:12:27 2008
@@ -0,0 +1,97 @@
+package org.apache.maven.plugin.announcement;
+
+import java.io.File;
+import java.io.FileReader;
+
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+
+/*
+ * 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>
+ * @version $Id$
+ */
+public class AnnouncementMojoTest
+    extends AbstractMojoTestCase
+{
+
+    public void testAnnounceGeneration()
+        throws Exception
+    {
+        File pom = new File( getBasedir(), "/src/test/unit/plugin-config.xml" );
+        AnnouncementMojo mojo = (AnnouncementMojo) lookupMojo( "announcement-generate", pom );
+
+        setVariableValueToObject( mojo, "xmlPath", new File( getBasedir(), "/src/test/unit/announce-changes.xml" ) );
+
+        File outputDirectory = new File( getBasedir(), "target/test" );
+
+        if ( outputDirectory.exists() )
+        {
+            FileUtils.deleteDirectory( outputDirectory );
+            outputDirectory.mkdirs();
+        }
+        else
+        {
+            outputDirectory.mkdirs();
+        }
+        setVariableValueToObject( mojo, "outputDirectory", outputDirectory );
+        setVariableValueToObject( mojo, "version", "1.1" );
+        setVariableValueToObject( mojo, "template", "announcement.vm" );
+        setVariableValueToObject( mojo, "templateDirectory",
+                                  "/src/main/resources/org/apache/maven/plugin/announcement/" );
+        setVariableValueToObject( mojo, "basedir", getBasedir() );
+        setVariableValueToObject( mojo, "introduction", "Nice library" );
+        mojo.execute();
+
+        FileReader fileReader = new FileReader( new File( outputDirectory, "announcement.vm" ) );
+        String result = IOUtil.toString( fileReader );
+
+        assertContains( "Nice library", result );
+        
+        assertContains( "Changes in this version include:", result );
+        
+        assertContains( "New features:", result );
+
+        assertContains( "o Added additional documentation on how to configure the plugin.", result );
+
+        assertContains( "Fixed Bugs:", result );
+
+        assertContains( "o Enable retrieving component-specific issues.  Issue: MCHANGES-88.", result );
+
+        assertContains( "Changes:", result );
+
+        assertContains( "o Handle different issue systems.", result );
+
+        assertContains( "o Updated dependencies.", result );
+
+        assertContains( "Removed:", result );
+
+        assertContains( "o The element type \" link \" must be terminated by the matching end-tag.", result );
+
+        assertContains( "Deleted the erroneous code.", result );
+    }
+
+    protected void assertContains( String content, String announce )
+    {
+        assertTrue( announce.indexOf( content ) > 0 );
+    }
+}

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

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

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

Added: maven/plugins/trunk/maven-changes-plugin/src/test/unit/announce-changes.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/unit/announce-changes.xml?rev=711465&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/unit/announce-changes.xml (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/unit/announce-changes.xml Tue Nov  4 15:12:27 2008
@@ -0,0 +1,64 @@
+<!--
+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 xmlns="http://maven.apache.org/changes/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <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="jruiz" type="remove">
+        The element type " link " must be terminated by the matching end-tag.
+        Deleted the erroneous code.
+        <fixes issue="MCHANGES-1"/>
+        <fixes issue="JIRA-12"/>
+        <dueto name="John Doe" email="john@doe.com"/>
+        <dueto name="Jane Doe"/>
+      </action>
+      <action dev="you" type="update" system="bugzilla">
+        Handle different issue systems.
+        <fixes issue="bug-12345"/>
+        <dueto name="John Doe" email="john@doe.com"/>
+      </action>
+      <action dev="him" type="update">
+        Updated dependencies.
+        <dueto name="John Doe" email="john@doe.com"/>
+        <dueto name="Jane Doe"/>
+      </action>
+    </release>
+
+    <release version="1.0" date="2005-01-01" description="First release">
+      <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="others@users.com">
+        Uploaded documentation on how to use the plugin.
+        <fixes issue="MCHANGES-88"/>
+        <fixes issue="JIRA-YYY"/>
+        <dueto name="John Doe" email="john@doe.com"/>
+        <dueto name="Jane Doe"/>
+      </action>
+    </release>
+  </body>
+</document>
\ No newline at end of file

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

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

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