maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r407548 - in /maven/scm/trunk/maven-scm-plugin/src: main/java/org/apache/maven/scm/plugin/ test/java/org/apache/maven/scm/plugin/ test/resources/mojos/changelog/
Date Thu, 18 May 2006 13:35:51 GMT
Author: evenisse
Date: Thu May 18 06:35:51 2006
New Revision: 407548

URL: http://svn.apache.org/viewvc?rev=407548&view=rev
Log:
Add more tests

Added:
    maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java
  (with props)
    maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/
    maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml   (with
props)
    maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml
  (with props)
    maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml
  (with props)
    maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml
  (with props)
Modified:
    maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ChangeLogMojo.java

Modified: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ChangeLogMojo.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ChangeLogMojo.java?rev=407548&r1=407547&r2=407548&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ChangeLogMojo.java
(original)
+++ maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ChangeLogMojo.java
Thu May 18 06:35:51 2006
@@ -100,11 +100,11 @@
         }
         catch ( IOException e )
         {
-            throw new MojoExecutionException( "Cannot run checkout command : ", e );
+            throw new MojoExecutionException( "Cannot run changelog command : ", e );
         }
         catch ( ScmException e )
         {
-            throw new MojoExecutionException( "Cannot run checkout command : ", e );
+            throw new MojoExecutionException( "Cannot run changelog command : ", e );
         }
     }
 
@@ -131,5 +131,4 @@
                                               e );
         }
     }
-
 }

Added: maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java?rev=407548&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java
(added)
+++ maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java
Thu May 18 06:35:51 2006
@@ -0,0 +1,129 @@
+package org.apache.maven.scm.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.scm.provider.svn.SvnScmTestUtils;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed 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:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class ChangeLogMojoTest
+    extends AbstractMojoTestCase
+{
+    File repository;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        repository = getTestFile( "target/repository" );
+
+        FileUtils.forceDelete( repository );
+
+        SvnScmTestUtils.initializeRepository( repository );
+    }
+
+    public void testChangeLog()
+        throws Exception
+    {
+        ChangeLogMojo mojo = (ChangeLogMojo) lookupMojo( "changelog", getTestFile(
+            "src/test/resources/mojos/changelog/changelog.xml" ) );
+
+        String connectionUrl = mojo.getConnectionUrl();
+        connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
+        connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
+        mojo.setConnectionUrl( connectionUrl );
+        mojo.setWorkingDirectory( new File( getBasedir() ) );
+        mojo.setConnectionType( "connection" );
+
+        mojo.execute();
+    }
+
+    public void testChangeLogWithParameters()
+        throws Exception
+    {
+        ChangeLogMojo mojo = (ChangeLogMojo) lookupMojo( "changelog", getTestFile(
+            "src/test/resources/mojos/changelog/changelogWithParameters.xml" ) );
+
+        String connectionUrl = mojo.getConnectionUrl();
+        connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
+        connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
+        mojo.setConnectionUrl( connectionUrl );
+        mojo.setWorkingDirectory( new File( getBasedir() ) );
+        mojo.setConnectionType( "connection" );
+
+        mojo.execute();
+    }
+
+    public void testChangeLogWithBadUserDateFormat()
+        throws Exception
+    {
+        ChangeLogMojo mojo = (ChangeLogMojo) lookupMojo( "changelog", getTestFile(
+            "src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml" ) );
+
+        String connectionUrl = mojo.getConnectionUrl();
+        connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
+        connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
+        mojo.setConnectionUrl( connectionUrl );
+        mojo.setWorkingDirectory( new File( getBasedir() ) );
+        mojo.setConnectionType( "connection" );
+
+        try
+        {
+            mojo.execute();
+
+            fail( "mojo execution must fail." );
+        }
+        catch ( MojoExecutionException e )
+        {
+            assertTrue( true );
+        }
+    }
+
+    public void testChangeLogWithBadConnectionUrl()
+        throws Exception
+    {
+        ChangeLogMojo mojo = (ChangeLogMojo) lookupMojo( "changelog", getTestFile(
+            "src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml" ) );
+
+        String connectionUrl = mojo.getConnectionUrl();
+        connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
+        connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
+        mojo.setConnectionUrl( connectionUrl );
+        mojo.setWorkingDirectory( new File( getBasedir() ) );
+        mojo.setConnectionType( "connection" );
+
+        try
+        {
+            mojo.execute();
+
+            fail( "mojo execution must fail." );
+        }
+        catch ( MojoExecutionException e )
+        {
+            assertTrue( true );
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ChangeLogMojoTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml?rev=407548&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml (added)
+++ maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml Thu
May 18 06:35:51 2006
@@ -0,0 +1,14 @@
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-scm-plugin</artifactId>
+        <configuration>
+          <settings implementation="org.apache.maven.settings.Settings"/>
+          <connectionUrl>scm:svn:file:///${basedir}/target/repository</connectionUrl>
+          <connectionType>connection</connectionType>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelog.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml?rev=407548&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml
(added)
+++ maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml
Thu May 18 06:35:51 2006
@@ -0,0 +1,14 @@
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-scm-plugin</artifactId>
+        <configuration>
+          <settings implementation="org.apache.maven.settings.Settings"/>
+          <connectionUrl>scm:svn:http://a.bad.host/repos/trunk</connectionUrl>
+          <connectionType>connection</connectionType>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadConnectionUrl.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml?rev=407548&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml
(added)
+++ maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml
Thu May 18 06:35:51 2006
@@ -0,0 +1,17 @@
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-scm-plugin</artifactId>
+        <configuration>
+          <settings implementation="org.apache.maven.settings.Settings"/>
+          <connectionUrl>scm:svn:file:///${basedir}/target/repository</connectionUrl>
+          <connectionType>connection</connectionType>
+          <startDate>aabbccddeeffgg</startDate>
+          <endDate>2004-11-04</endDate>
+          <userDateFormat>yyyyMMdd</userDateFormat>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithBadUserDateFormat.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml?rev=407548&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml
(added)
+++ maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml
Thu May 18 06:35:51 2006
@@ -0,0 +1,16 @@
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-scm-plugin</artifactId>
+        <configuration>
+          <settings implementation="org.apache.maven.settings.Settings"/>
+          <connectionUrl>scm:svn:file:///${basedir}/target/repository</connectionUrl>
+          <connectionType>connection</connectionType>
+          <startDate>2004-11-01</startDate>
+          <endDate>2004-11-04</endDate>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/test/resources/mojos/changelog/changelogWithParameters.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message