maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r399171 - in /maven/plugins/trunk/maven-release-plugin: ./ src/main/java/org/apache/maven/plugins/release/ src/test/java/org/apache/maven/plugins/release/ src/test/resources/mojos/ src/test/resources/mojos/clean/
Date Wed, 03 May 2006 06:41:13 GMT
Author: brett
Date: Tue May  2 23:41:11 2006
New Revision: 399171

URL: http://svn.apache.org/viewcvs?rev=399171&view=rev
Log:
[MRELEASE-98] test clean mojo

Added:
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java
  (with props)
    maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/
    maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/
    maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml   (with
props)
Modified:
    maven/plugins/trunk/maven-release-plugin/pom.xml
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java

Modified: maven/plugins/trunk/maven-release-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/pom.xml?rev=399171&r1=399170&r2=399171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-release-plugin/pom.xml Tue May  2 23:41:11 2006
@@ -114,6 +114,12 @@
       <artifactId>jaxen</artifactId>
       <version>1.1-beta-8</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java?rev=399171&r1=399170&r2=399171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
Tue May  2 23:41:11 2006
@@ -146,4 +146,9 @@
 
         return config;
     }
+
+    void setReleaseManager( ReleaseManager releaseManager )
+    {
+        this.releaseManager = releaseManager;
+    }
 }

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java?rev=399171&r1=399170&r2=399171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java
Tue May  2 23:41:11 2006
@@ -47,4 +47,9 @@
         releaseConfiguration.setReactorProjects( reactorProjects );
         releaseManager.clean( releaseConfiguration );
     }
+
+    List getReactorProjects()
+    {
+        return reactorProjects;
+    }
 }

Added: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java?rev=399171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java
(added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java
Tue May  2 23:41:11 2006
@@ -0,0 +1,59 @@
+package org.apache.maven.plugins.release;
+
+/*
+ * Copyright 2005-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.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugins.release.config.ReleaseConfiguration;
+import org.jmock.Mock;
+import org.jmock.core.constraint.IsEqual;
+import org.jmock.core.matcher.InvokeOnceMatcher;
+
+/**
+ * Test release:clean.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class CleanReleaseMojoTest
+    extends AbstractMojoTestCase
+{
+    protected CleanReleaseMojo mojo;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        mojo = (CleanReleaseMojo) lookupMojo( "clean", getTestFile( "target/test-classes/mojos/clean/clean.xml"
) );
+    }
+
+    public void testClean()
+        throws MojoFailureException, MojoExecutionException
+    {
+        ReleaseConfiguration releaseConfiguration = new ReleaseConfiguration();
+        releaseConfiguration.setReactorProjects( mojo.getReactorProjects() );
+
+        Mock mock = new Mock( ReleaseManager.class );
+        mock.expects( new InvokeOnceMatcher() ).method( "clean" ).with( new IsEqual( releaseConfiguration
) );
+        mojo.setReleaseManager( (ReleaseManager) mock.proxy() );
+
+        mojo.execute();
+
+        assertTrue( true );
+    }
+}

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

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

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml?rev=399171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml Tue
May  2 23:41:11 2006
@@ -0,0 +1,30 @@
+<!--
+  ~ Copyright 2005-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.
+  -->
+
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <reactorProjects>
+            <reactorProject implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub"/>
+          </reactorProjects>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/mojos/clean/clean.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message