Author: rfscholte
Date: Fri Mar  9 21:43:54 2012
New Revision: 1299068

URL: http://svn.apache.org/viewvc?rev=1299068&view=rev
Log:
Fix MRELEASE-736: Add dryRun flag to release:perform

Added:
    maven/release/trunk/maven-release-plugin/src/it/projects/perform/
    
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/
    
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml
    
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java
Modified:
    maven/release/trunk/maven-release-plugin/pom.xml
    
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
    
maven/release/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java

Modified: maven/release/trunk/maven-release-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/pom.xml?rev=1299068&r1=1299067&r2=1299068&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/pom.xml (original)
+++ maven/release/trunk/maven-release-plugin/pom.xml Fri Mar  9 21:43:54 2012
@@ -194,7 +194,7 @@
                 <id>integration-test-prepare</id>
                 <configuration>
                   <setupIncludes>
-                    
<setupInclude>setup/maven-scm-provider-*/pom.xml</setupInclude>
+                    <setupInclude>setup/*/pom.xml</setupInclude>
                   </setupIncludes>
                   <pomIncludes>
                     <pomInclude>projects/prepare/*/*pom.xml</pomInclude>
@@ -224,7 +224,23 @@
                   </goals>
                 </configuration>
                 <goals>
-                  <goal>install</goal>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>integration-test-perform</id>
+                <configuration>
+                  <pomIncludes>
+                    <pomInclude>projects/perform/*/pom.xml</pomInclude>
+                  </pomIncludes>
+                  <goals>
+                    <goal>clean</goal>
+                    
<goal>${project.groupId}:${project.artifactId}:${project.version}:clean</goal>
+                    
<goal>${project.groupId}:${project.artifactId}:${project.version}:prepare</goal>
+                    
<goal>${project.groupId}:${project.artifactId}:${project.version}:perform</goal>
+                  </goals>
+                </configuration>
+                <goals>
                   <goal>run</goal>
                 </goals>
               </execution>

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml?rev=1299068&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml
 Fri Mar  9 21:43:54 2012
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugin.release.its</groupId>
+  <artifactId>mrelease-736</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <scm>
+    <connection>scm:dummy|nul</connection>
+    <developerConnection>scm:dummy|nul</developerConnection>
+  </scm>
+  
+  <distributionManagement>
+    <snapshotRepository>
+      <id>dummy</id>
+      <url>dummy:nul</url>
+    </snapshotRepository>
+  </distributionManagement>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.its.release</groupId>
+        <artifactId>wagon-provider-dummy</artifactId>
+        <version>1.0</version>
+      </extension>
+    </extensions>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-release-plugin</artifactId>
+        <version>@project.version@</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.maven.its.release</groupId>
+            <artifactId>maven-scm-provider-dummy</artifactId>
+            <version>1.0</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties?rev=1299068&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties
 Fri Mar  9 21:43:54 2012
@@ -0,0 +1 @@
+dryRun=true
\ No newline at end of file

Added: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties?rev=1299068&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties
 Fri Mar  9 21:43:54 2012
@@ -0,0 +1 @@
+invoker.goals = install

Added: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml?rev=1299068&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml
 Fri Mar  9 21:43:54 2012
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.release</groupId>
+  <artifactId>wagon-provider-dummy</artifactId>
+  <version>1.0</version>
+
+  <name>Maven Wagon Dummy Provider</name>
+  <description>
+    Provides a minimal Wagon provider to test the deploy operations of the 
Maven Release Plugin.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-provider-api</artifactId>
+      <version>2.2</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <version>1.3.8</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java?rev=1299068&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java
 Fri Mar  9 21:43:54 2012
@@ -0,0 +1,183 @@
+package org.apache.maven.wagon.providers.dummy;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.events.SessionListener;
+import org.apache.maven.wagon.events.TransferListener;
+import org.apache.maven.wagon.proxy.ProxyInfo;
+import org.apache.maven.wagon.proxy.ProxyInfoProvider;
+import org.apache.maven.wagon.repository.Repository;
+
+/**
+ * DummyWagonProvider which does absolutely nothing
+ * 
+ * @author Robert Scholte
+ * 
+ * @plexus.component role="org.apache.maven.wagon.Wagon" role-hint="dummy" 
instantiation-strategy="per-lookup"
+ */
+public class DummyWagonProvider implements Wagon
+{
+
+    public void get( String resourceName, File destination )
+        throws TransferFailedException, ResourceDoesNotExistException, 
AuthorizationException
+    {
+    }
+
+    public boolean getIfNewer( String resourceName, File destination, long 
timestamp )
+        throws TransferFailedException, ResourceDoesNotExistException, 
AuthorizationException
+    {
+        return false;
+    }
+
+    public void put( File source, String destination )
+        throws TransferFailedException, ResourceDoesNotExistException, 
AuthorizationException
+    {
+    }
+
+    public void putDirectory( File sourceDirectory, String 
destinationDirectory )
+        throws TransferFailedException, ResourceDoesNotExistException, 
AuthorizationException
+    {
+    }
+
+    public boolean resourceExists( String resourceName )
+        throws TransferFailedException, AuthorizationException
+    {
+        return false;
+    }
+
+    public List<String> getFileList( String destinationDirectory )
+        throws TransferFailedException, ResourceDoesNotExistException, 
AuthorizationException
+    {
+        return null;
+    }
+
+    public boolean supportsDirectoryCopy()
+    {
+        return false;
+    }
+
+    public Repository getRepository()
+    {
+        return null;
+    }
+
+    public void connect( Repository source )
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void connect( Repository source, ProxyInfo proxyInfo )
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void connect( Repository source, ProxyInfoProvider 
proxyInfoProvider )
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void connect( Repository source, AuthenticationInfo 
authenticationInfo )
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void connect( Repository source, AuthenticationInfo 
authenticationInfo, ProxyInfo proxyInfo )
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void connect( Repository source, AuthenticationInfo 
authenticationInfo, ProxyInfoProvider proxyInfoProvider )
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void openConnection()
+        throws ConnectionException, AuthenticationException
+    {
+    }
+
+    public void disconnect()
+        throws ConnectionException
+    {
+    }
+
+    public void setTimeout( int timeoutValue )
+    {
+    }
+
+    public int getTimeout()
+    {
+        return 0;
+    }
+
+    public void setReadTimeout( int timeoutValue )
+    {
+    }
+
+    public int getReadTimeout()
+    {
+        return 0;
+    }
+
+    public void addSessionListener( SessionListener listener )
+    {
+    }
+
+    public void removeSessionListener( SessionListener listener )
+    {
+    }
+
+    public boolean hasSessionListener( SessionListener listener )
+    {
+        return false;
+    }
+
+    public void addTransferListener( TransferListener listener )
+    {
+    }
+
+    public void removeTransferListener( TransferListener listener )
+    {
+    }
+
+    public boolean hasTransferListener( TransferListener listener )
+    {
+        return false;
+    }
+
+    public boolean isInteractive()
+    {
+        return false;
+    }
+
+    public void setInteractive( boolean interactive )
+    {
+    }
+}
\ No newline at end of file

Modified: 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java?rev=1299068&r1=1299067&r2=1299068&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
 Fri Mar  9 21:43:54 2012
@@ -25,6 +25,7 @@ import org.apache.maven.plugin.MojoExecu
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.shared.release.ReleaseExecutionException;
 import org.apache.maven.shared.release.ReleaseFailureException;
+import org.apache.maven.shared.release.ReleasePerformRequest;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -91,6 +92,14 @@ public class PerformReleaseMojo
     {
         return releaseProfiles;
     }
+    
+    /**
+     * Dry run: don't checkout anything from the scm repository, or modify the 
checkout.
+     * The goals (by default at least {@code deploy}) will be executed against 
the <strong>current</strong> project.
+     *
+     * @parameter expression="${dryRun}" default-value="false"
+     */
+    private boolean dryRun;
 
     /**
      * {@inheritDoc}
@@ -130,8 +139,14 @@ public class PerformReleaseMojo
                 }
             }
             releaseDescriptor.setPerformGoals( goals );
+            
+            ReleasePerformRequest performRequest  = new 
ReleasePerformRequest();
+            performRequest.setReleaseDescriptor( releaseDescriptor );
+            performRequest.setReleaseEnvironment( getReleaseEnvironment() );
+            performRequest.setReactorProjects( reactorProjects );
+            performRequest.setDryRun( dryRun );
 
-            releaseManager.perform( releaseDescriptor, 
getReleaseEnvironment(), reactorProjects );
+            releaseManager.perform( performRequest );
         }
         catch ( ReleaseExecutionException e )
         {

Modified: 
maven/release/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java?rev=1299068&r1=1299067&r2=1299068&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
 Fri Mar  9 21:43:54 2012
@@ -19,9 +19,7 @@ package org.apache.maven.plugins.release
  * under the License.
  */
 
-import static org.mockito.Matchers.eq;
 import static org.mockito.Matchers.isA;
-import static org.mockito.Matchers.isNull;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -29,7 +27,6 @@ import static org.mockito.Mockito.verify
 
 import java.io.File;
 import java.util.Arrays;
-import java.util.List;
 
 import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.model.Profile;
@@ -41,8 +38,9 @@ import org.apache.maven.project.MavenPro
 import org.apache.maven.shared.release.ReleaseExecutionException;
 import org.apache.maven.shared.release.ReleaseFailureException;
 import org.apache.maven.shared.release.ReleaseManager;
+import org.apache.maven.shared.release.ReleasePerformRequest;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
-import org.apache.maven.shared.release.env.ReleaseEnvironment;
+import org.mockito.ArgumentCaptor;
 
 /**
  * Test release:perform.
@@ -54,7 +52,6 @@ public class PerformReleaseMojoTest
 {
     private File workingDirectory;
 
-    @SuppressWarnings( "unchecked" )
     public void testPerform()
         throws Exception
     {
@@ -68,16 +65,20 @@ public class PerformReleaseMojoTest
 
         ReleaseManager mock = mock( ReleaseManager.class );
         mojo.setReleaseManager( mock );
-
+        
         // execute
         mojo.execute();
         
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
         verifyNoMoreInteractions( mock );
     }
 
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithFlatStructure()
         throws Exception
     {
@@ -97,12 +98,16 @@ public class PerformReleaseMojoTest
         mojo.execute();
         
         // verify
-        verify( mock ).perform( eq(releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
         verifyNoMoreInteractions( mock );
     }
 
     
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithoutSite()
         throws Exception
     {
@@ -124,7 +129,12 @@ public class PerformReleaseMojoTest
         mojo.execute();
 
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
         verifyNoMoreInteractions( mock );
     }
 
@@ -142,7 +152,6 @@ public class PerformReleaseMojoTest
         return mojo;
     }
 
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithExecutionException()
         throws Exception
     {
@@ -155,9 +164,7 @@ public class PerformReleaseMojoTest
         releaseDescriptor.setPerformGoals( "deploy site-deploy" );
 
         ReleaseManager mock = mock( ReleaseManager.class );
-        doThrow( new ReleaseExecutionException( "..." ) ).when( mock 
).perform( eq( releaseDescriptor ),
-                                                                               
 isA( ReleaseEnvironment.class ),
-                                                                               
 isNull( List.class ) );
+        doThrow( new ReleaseExecutionException( "..." ) ).when( mock 
).perform( isA( ReleasePerformRequest.class ) );
         mojo.setReleaseManager( mock );
 
         // execute
@@ -173,13 +180,16 @@ public class PerformReleaseMojoTest
         }
         
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ),
-                                isA( ReleaseEnvironment.class ),
-                                isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
+
         verifyNoMoreInteractions( mock );
     }
 
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithExecutionFailure()
         throws Exception
     {
@@ -193,9 +203,7 @@ public class PerformReleaseMojoTest
 
         ReleaseManager mock = mock( ReleaseManager.class );
         ReleaseFailureException cause = new ReleaseFailureException( "..." );
-        doThrow( cause ).when( mock ).perform( eq( releaseDescriptor ),
-                                               isA( ReleaseEnvironment.class ),
-                                               isNull( List.class ) );
+        doThrow( cause ).when( mock ).perform( isA( 
ReleasePerformRequest.class ) );
 
         mojo.setReleaseManager( mock );
 
@@ -212,13 +220,16 @@ public class PerformReleaseMojoTest
         }
         
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ),
-                                isA( ReleaseEnvironment.class ),
-                                isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
+
         verifyNoMoreInteractions( mock );
     }
 
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithScm()
         throws Exception
     {
@@ -238,11 +249,16 @@ public class PerformReleaseMojoTest
         mojo.execute();
         
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
+
         verifyNoMoreInteractions( mock );
     }
 
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithProfiles()
         throws Exception
     {
@@ -269,11 +285,16 @@ public class PerformReleaseMojoTest
         mojo.execute();
 
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
+
         verifyNoMoreInteractions( mock );
     }
 
-    @SuppressWarnings( "unchecked" )
     public void testPerformWithProfilesAndArguments()
         throws Exception
     {
@@ -300,11 +321,16 @@ public class PerformReleaseMojoTest
         mojo.execute();
 
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
+
         verifyNoMoreInteractions( mock );
     }
 
-       @SuppressWarnings( "unchecked" )
     public void testPerformWithMultilineGoals()
         throws Exception
     {
@@ -323,7 +349,13 @@ public class PerformReleaseMojoTest
         mojo.execute();
 
         // verify
-        verify( mock ).perform( eq( releaseDescriptor ), isA( 
ReleaseEnvironment.class ), isNull( List.class ) );
+        ArgumentCaptor<ReleasePerformRequest> argument = 
ArgumentCaptor.forClass(ReleasePerformRequest.class);
+        verify( mock ).perform( argument.capture() );
+        assertEquals( releaseDescriptor, 
argument.getValue().getReleaseDescriptor() );
+        assertNotNull( argument.getValue().getReleaseEnvironment()  );
+        assertNull( argument.getValue().getReactorProjects() );
+        assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
+
         verifyNoMoreInteractions( mock );
     }
 


Reply via email to