Author: khmarbaise
Date: Sun Sep 18 17:24:00 2016
New Revision: 1761345

URL: http://svn.apache.org/viewvc?rev=1761345&view=rev
Log:
o DeployMojo
  Using ProjectDeployer instead of ArtifactDeployer
  which makes code much more simpler and using 
  ProjectDeployerRequest instead of DeployRequest.
o DeployFileMojo
  using ArtifactDeployer.
o Added slf4j-api and slf4j-noop in test scope
  to get running the tests.

Removed:
    
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployRequest.java
Modified:
    maven/plugins/trunk/maven-deploy-plugin/pom.xml
    
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
    
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
    
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
    
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
    
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java

Modified: maven/plugins/trunk/maven-deploy-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/pom.xml?rev=1761345&r1=1761344&r2=1761345&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/pom.xml Sun Sep 18 17:24:00 2016
@@ -136,6 +136,19 @@ under the License.
       <version>1.7</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-nop</artifactId>
+      <version>1.7.5</version>
+      <scope>test</scope>
+    </dependency>
+    
   </dependencies>
 
   <contributors>

Modified: 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java?rev=1761345&r1=1761344&r2=1761345&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
 Sun Sep 18 17:24:00 2016
@@ -19,10 +19,8 @@ package org.apache.maven.plugins.deploy;
  * under the License.
  */
 
-import java.util.Collection;
 import java.util.Map;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
@@ -34,8 +32,6 @@ import org.apache.maven.plugin.MojoExecu
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployer;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
 
 /**
  * @version $Id$
@@ -44,11 +40,6 @@ public abstract class AbstractDeployMojo
     extends AbstractMojo
 {
     /**
-     */
-    @Component
-    private ArtifactDeployer deployer;
-
-    /**
      * Component used to create an artifact.
      */
     @Component
@@ -86,16 +77,6 @@ public abstract class AbstractDeployMojo
     
     /* Setters and Getters */
 
-    public ArtifactDeployer getDeployer()
-    {
-        return deployer;
-    }
-
-    public void setDeployer( ArtifactDeployer deployer )
-    {
-        this.deployer = deployer;
-    }
-
     void failIfOffline()
         throws MojoFailureException
     {
@@ -128,56 +109,6 @@ public abstract class AbstractDeployMojo
         return retryFailedDeploymentCount;
     }
 
-    /**
-     * Deploy an artifact from a particular file.
-     * @param artifacts the artifact definitions
-     * @param deploymentRepository the repository to deploy to
-     * @param localRepository the local repository to install into
-     * @param retryFailedDeploymentCount TODO
-     * 
-     * @throws ArtifactDeployerException if an error occurred deploying the 
artifact
-     */
-    protected void deploy( Collection<Artifact> artifacts, ArtifactRepository 
deploymentRepository,
-                           int retryFailedDeploymentCount )
-        throws ArtifactDeployerException
-    {
-
-        // for now retry means redeploy the complete artifacts collection
-        int retryFailedDeploymentCounter = Math.max( 1, Math.min( 10, 
retryFailedDeploymentCount ) );
-        ArtifactDeployerException exception = null;
-        for ( int count = 0; count < retryFailedDeploymentCounter; count++ )
-        {
-            try
-            {
-                if ( count > 0 )
-                {
-                    getLog().info( "Retrying deployment attempt " + ( count + 
1 ) + " of "
-                                       + retryFailedDeploymentCounter );
-                }
-                
-                getDeployer().deploy( session.getProjectBuildingRequest(), 
deploymentRepository, artifacts );
-                exception = null;
-                break;
-            }
-            catch ( ArtifactDeployerException e )
-            {
-                if ( count + 1 < retryFailedDeploymentCounter )
-                {
-                    getLog().warn( "Encountered issue during deployment: " + 
e.getLocalizedMessage() );
-                    getLog().debug( e );
-                }
-                if ( exception == null )
-                {
-                    exception = e;
-                }
-            }
-        }
-        if ( exception != null )
-        {
-            throw exception;
-        }
-    }
-
     protected ArtifactRepository createDeploymentArtifactRepository( String 
id, String url,
                                                                      
ArtifactRepositoryLayout layout,
                                                                      boolean 
uniqueVersion2 )

Modified: 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java?rev=1761345&r1=1761344&r2=1761345&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
 Sun Sep 18 17:24:00 2016
@@ -61,6 +61,7 @@ import org.apache.maven.project.ProjectB
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
 import org.apache.maven.shared.artifact.DefaultArtifactCoordinate;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployer;
 import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
 import org.apache.maven.shared.repository.RepositoryManager;
 import org.codehaus.plexus.util.FileUtils;
@@ -79,13 +80,15 @@ import org.codehaus.plexus.util.xml.pull
 public class DeployFileMojo
     extends AbstractDeployMojo
 {
+    @Component
+    private ArtifactDeployer artifactDeployer;
 
     /**
      * Used for attaching the artifacts to deploy to the project.
      */
     @Component
     private MavenProjectHelper projectHelper;
-    
+
     /**
      * Used for creating the project to which the artifacts to deploy will be 
attached.
      */
@@ -218,10 +221,10 @@ public class DeployFileMojo
      */
     @Parameter( property = "files" )
     private String files;
-    
+
     @Component
     private RepositoryManager repoManager;
-    
+
     void initProperties()
         throws MojoExecutionException
     {
@@ -258,16 +261,16 @@ public class DeployFileMojo
                         try
                         {
                             pomInputStream = jarFile.getInputStream( entry );
-                            
+
                             String base = file.getName();
                             if ( base.indexOf( '.' ) > 0 )
                             {
                                 base = base.substring( 0, base.lastIndexOf( 
'.' ) );
                             }
                             pomFile = new File( file.getParentFile(), base + 
".pom" );
-                            
+
                             pomOutputStream = new FileOutputStream( pomFile );
-                            
+
                             IOUtil.copy( pomInputStream, pomOutputStream );
 
                             pomOutputStream.close();
@@ -494,18 +497,19 @@ public class DeployFileMojo
 
         try
         {
-            deploy( deployableArtifacts, deploymentRepository, 
getRetryFailedDeploymentCount() );
+            artifactDeployer.deploy( getSession().getProjectBuildingRequest(), 
deploymentRepository,
+                                     deployableArtifacts );
         }
         catch ( ArtifactDeployerException e )
         {
             throw new MojoExecutionException( e.getMessage(), e );
         }
     }
-    
+
     /**
-     * Creates a Maven project in-memory from the user-supplied groupId, 
artifactId and version.
-     * When a classifier is supplied, the packaging must be POM because the 
project with only have attachments.
-     * This project serves as basis to attach the artifacts to deploy to.
+     * Creates a Maven project in-memory from the user-supplied groupId, 
artifactId and version. When a classifier is
+     * supplied, the packaging must be POM because the project with only have 
attachments. This project serves as basis
+     * to attach the artifacts to deploy to.
      * 
      * @return The created Maven project, never <code>null</code>.
      * @throws MojoFailureException When building the project failed.
@@ -513,14 +517,10 @@ public class DeployFileMojo
     private MavenProject createMavenProject()
         throws MojoFailureException
     {
-        ModelSource modelSource = new StringModelSource( 
-                "<project>"
-              +   "<modelVersion>4.0.0</modelVersion>"
-              +   "<groupId>" + groupId + "</groupId>"
-              +   "<artifactId>" + artifactId + "</artifactId>"
-              +   "<version>" + version + "</version>"
-              +   "<packaging>" + ( classifier == null ? packaging : "pom" ) + 
"</packaging>"
-              + "</project>" );
+        ModelSource modelSource =
+            new StringModelSource( "<project>" + 
"<modelVersion>4.0.0</modelVersion>" + "<groupId>" + groupId
+                + "</groupId>" + "<artifactId>" + artifactId + "</artifactId>" 
+ "<version>" + version + "</version>"
+                + "<packaging>" + ( classifier == null ? packaging : "pom" ) + 
"</packaging>" + "</project>" );
         DefaultProjectBuildingRequest buildingRequest =
             new DefaultProjectBuildingRequest( 
getSession().getProjectBuildingRequest() );
         buildingRequest.setProcessPlugins( false );
@@ -533,10 +533,10 @@ public class DeployFileMojo
             throw new MojoFailureException( e.getMessage(), e );
         }
     }
-    
+
     /**
-     * Gets the path of the artifact constructed from the supplied groupId, 
artifactId, version, classifier
-     * and packaging within the local repository. Note that the returned path 
need not exist (yet).
+     * Gets the path of the artifact constructed from the supplied groupId, 
artifactId, version, classifier and
+     * packaging within the local repository. Note that the returned path need 
not exist (yet).
      * 
      * @return The absolute path to the artifact when installed, never 
<code>null</code>.
      */
@@ -673,7 +673,7 @@ public class DeployFileMojo
         ModelBuildingRequest buildingRequest = new 
DefaultModelBuildingRequest();
 
         DeployModelProblemCollector problemCollector = new 
DeployModelProblemCollector();
-        
+
         modelValidator.validateEffectiveModel( model, buildingRequest, 
problemCollector );
 
         if ( problemCollector.getMessageCount() > 0 )
@@ -763,15 +763,16 @@ public class DeployFileMojo
     {
         this.classifier = classifier;
     }
-    
-    private static class DeployModelProblemCollector implements 
ModelProblemCollector
+
+    private static class DeployModelProblemCollector
+        implements ModelProblemCollector
     {
         /** */
         private static final String NEWLINE = System.getProperty( 
"line.separator" );
 
         /** */
         private List<String> messages = new ArrayList<String>();
-        
+
         @Override
         public void add( Severity severity, String message, InputLocation 
location, Exception cause )
         {

Modified: 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java?rev=1761345&r1=1761344&r2=1761345&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
 Sun Sep 18 17:24:00 2016
@@ -19,7 +19,27 @@ package org.apache.maven.plugins.deploy;
  * under the License.
  */
 
-import java.io.File;
+import java.io.IOException;
+
+/*
+ * 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.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -27,18 +47,20 @@ import java.util.concurrent.atomic.Atomi
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.project.NoFileAssignedException;
+import org.apache.maven.shared.project.deploy.ProjectDeployer;
+import org.apache.maven.shared.project.deploy.ProjectDeployerRequest;
 
 /**
  * Deploys an artifact to remote repository.
@@ -60,8 +82,8 @@ public class DeployMojo
      */
     private static final AtomicInteger READYPROJECTSCOUNTER = new 
AtomicInteger();
 
-    private static final List<DeployRequest> DEPLOYREQUESTS =
-        Collections.synchronizedList( new ArrayList<DeployRequest>() );
+    private static final List<ProjectDeployerRequest> DEPLOYREQUESTS =
+        Collections.synchronizedList( new ArrayList<ProjectDeployerRequest>() 
);
 
     /**
      */
@@ -124,6 +146,12 @@ public class DeployMojo
     @Parameter( property = "maven.deploy.skip", defaultValue = "false" )
     private boolean skip;
 
+    /**
+     * Component used to deploy project.
+     */
+    @Component
+    private ProjectDeployer projectDeployer;
+
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
@@ -137,17 +165,26 @@ public class DeployMojo
             failIfOffline();
 
             // CHECKSTYLE_OFF: LineLength
-            DeployRequest currentExecutionDeployRequest =
-                new DeployRequest().setProject( project 
).setUpdateReleaseInfo( isUpdateReleaseInfo() ).setRetryFailedDeploymentCount( 
getRetryFailedDeploymentCount() ).setAltReleaseDeploymentRepository( 
altReleaseDeploymentRepository ).setAltSnapshotDeploymentRepository( 
altSnapshotDeploymentRepository ).setAltDeploymentRepository( 
altDeploymentRepository );
+            // @formatter:off
+            ProjectDeployerRequest pdr = new ProjectDeployerRequest()
+                .setProject( project )
+                .setUpdateReleaseInfo( isUpdateReleaseInfo() )
+                .setRetryFailedDeploymentCount( 
getRetryFailedDeploymentCount() )
+                .setAltReleaseDeploymentRepository( 
altReleaseDeploymentRepository )
+                .setAltSnapshotDeploymentRepository( 
altSnapshotDeploymentRepository )
+                .setAltDeploymentRepository( altDeploymentRepository );
+            // @formatter:on
             // CHECKSTYLE_ON: LineLength
 
+            ArtifactRepository repo = getDeploymentRepository( pdr );
+
             if ( !deployAtEnd )
             {
-                deployProject( currentExecutionDeployRequest );
+                deployProject( getSession().getProjectBuildingRequest(), pdr, 
repo );
             }
             else
             {
-                DEPLOYREQUESTS.add( currentExecutionDeployRequest );
+                DEPLOYREQUESTS.add( pdr );
                 addedDeployRequest = true;
             }
         }
@@ -159,121 +196,46 @@ public class DeployMojo
             {
                 while ( !DEPLOYREQUESTS.isEmpty() )
                 {
-                    deployProject( DEPLOYREQUESTS.remove( 0 ) );
+                    ArtifactRepository repo = getDeploymentRepository( 
DEPLOYREQUESTS.get( 0 ) );
+
+                    deployProject( getSession().getProjectBuildingRequest(), 
DEPLOYREQUESTS.remove( 0 ), repo );
                 }
             }
         }
         else if ( addedDeployRequest )
         {
             getLog().info( "Deploying " + project.getGroupId() + ":" + 
project.getArtifactId() + ":"
-                               + project.getVersion() + " at end" );
+                + project.getVersion() + " at end" );
         }
     }
 
-    private void deployProject( DeployRequest request )
-        throws MojoExecutionException, MojoFailureException
+    private void deployProject( ProjectBuildingRequest pbr, 
ProjectDeployerRequest pir, ArtifactRepository repo )
+        throws MojoFailureException, MojoExecutionException
     {
-        List<Artifact> deployableArtifacts = new ArrayList<Artifact>();
-        
-        Artifact artifact = request.getProject().getArtifact();
-        String packaging = request.getProject().getPackaging();
-        File pomFile = request.getProject().getFile();
-
-        List<Artifact> attachedArtifacts = 
request.getProject().getAttachedArtifacts();
-
-        ArtifactRepository repo =
-            getDeploymentRepository( request.getProject(), 
request.getAltDeploymentRepository(),
-                                     
request.getAltReleaseDeploymentRepository(),
-                                     
request.getAltSnapshotDeploymentRepository() );
-
-        String protocol = repo.getProtocol();
-
-        if ( protocol.equalsIgnoreCase( "scp" ) )
-        {
-            File sshFile = new File( System.getProperty( "user.home" ), ".ssh" 
);
-
-            if ( !sshFile.exists() )
-            {
-                sshFile.mkdirs();
-            }
-        }
-
-        // Deploy the POM
-        boolean isPomArtifact = "pom".equals( packaging );
-        if ( !isPomArtifact )
+        try
         {
-            ProjectArtifactMetadata metadata = new ProjectArtifactMetadata( 
artifact, pomFile );
-            artifact.addMetadata( metadata );
+            projectDeployer.deployProject( pbr, pir, repo );
         }
-        else
+        catch ( IOException e )
         {
-            artifact.setFile( pomFile );
+            throw new MojoFailureException( "IOException", e );
         }
-
-        if ( request.isUpdateReleaseInfo() )
+        catch ( NoFileAssignedException e )
         {
-            artifact.setRelease( true );
+            throw new MojoExecutionException( "NoFileAssignedException", e );
         }
 
-        artifact.setRepository( repo );
-
-        int retryFailedDeploymentCount = 
request.getRetryFailedDeploymentCount();
-
-        try
-        {
-            if ( isPomArtifact )
-            {
-                deployableArtifacts.add( artifact );
-            }
-            else
-            {
-                File file = artifact.getFile();
-
-                if ( file != null && file.isFile() )
-                {
-                    deployableArtifacts.add( artifact );
-                }
-                else if ( !attachedArtifacts.isEmpty() )
-                {
-                    throw new MojoExecutionException( "The packaging plugin 
for this project did not assign "
-                                   + "a main file to the project but it has 
attachments. Change packaging to 'pom'." );
-                }
-                else
-                {
-                    throw new MojoExecutionException( "The packaging for this 
project did not assign "
-                        + "a file to the build artifact" );
-                }
-            }
-
-            for ( Artifact attached : attachedArtifacts )
-            {
-                // This is here when AttachedArtifact is used, like 
m-sources-plugin:2.0.4
-                try
-                {
-                    attached.setRepository( repo );
-                }
-                catch ( UnsupportedOperationException e )
-                {
-                    getLog().warn( attached.getId() + " has been attached with 
deprecated code, "
-                        + "try to upgrade the responsible plugin" );
-                }
-                
-                deployableArtifacts.add( attached );
-            }
-            
-            deploy( deployableArtifacts, repo, retryFailedDeploymentCount );
-        }
-        catch ( ArtifactDeployerException e )
-        {
-            throw new MojoExecutionException( e.getMessage(), e );
-        }
     }
 
-    ArtifactRepository getDeploymentRepository( MavenProject project, String 
altDeploymentRepository,
-                                                String 
altReleaseDeploymentRepository,
-                                                String 
altSnapshotDeploymentRepository )
+    ArtifactRepository getDeploymentRepository( ProjectDeployerRequest pdr )
+
         throws MojoExecutionException, MojoFailureException
     {
+        MavenProject project = pdr.getProject();
+        String altDeploymentRepository = pdr.getAltDeploymentRepository();
+        String altReleaseDeploymentRepository = 
pdr.getAltReleaseDeploymentRepository();
+        String altSnapshotDeploymentRepository = 
pdr.getAltSnapshotDeploymentRepository();
+
         ArtifactRepository repo = null;
 
         String altDeploymentRepo;
@@ -320,9 +282,8 @@ public class DeployMojo
 
         if ( repo == null )
         {
-            String msg =
-                "Deployment failed: repository element was not specified in 
the POM inside"
-                    + " distributionManagement element or in 
-DaltDeploymentRepository=id::layout::url parameter";
+            String msg = "Deployment failed: repository element was not 
specified in the POM inside"
+                + " distributionManagement element or in 
-DaltDeploymentRepository=id::layout::url parameter";
 
             throw new MojoExecutionException( msg );
         }

Modified: 
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java?rev=1761345&r1=1761344&r2=1761345&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
 (original)
+++ 
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
 Sun Sep 18 17:24:00 2016
@@ -41,6 +41,7 @@ import org.apache.maven.plugins.deploy.s
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.repository.internal.MavenRepositorySystemSession;
+import org.apache.maven.shared.project.deploy.ProjectDeployerRequest;
 import org.codehaus.plexus.util.FileUtils;
 import org.junit.Ignore;
 import org.mockito.InjectMocks;
@@ -405,6 +406,13 @@ public class DeployMojoTest
                                  
"target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
         
         DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
+
+        MockitoAnnotations.initMocks( this );
+
+        ProjectBuildingRequest buildingRequest = mock ( 
ProjectBuildingRequest.class );
+        when( session.getProjectBuildingRequest() ).thenReturn( 
buildingRequest );
+        
+        setVariableValueToObject( mojo, "session", session );
         
         assertNotNull( mojo );
         
@@ -598,9 +606,12 @@ public class DeployMojoTest
 
         project.setVersion( "1.0-SNAPSHOT" );
 
+        ProjectDeployerRequest pdr =
+                        new ProjectDeployerRequest()
+                            .setProject( project )
+                            .setAltDeploymentRepository( 
"altSnapshotDeploymentRepository::default::http://localhost"; );
         assertEquals( repository,
-                      mojo.getDeploymentRepository( project, null, null,
-                                                    
"altSnapshotDeploymentRepository::default::http://localhost"; ) );
+                      mojo.getDeploymentRepository( pdr ));
     }
 
     public void testAltReleaseDeploymentRepository()
@@ -618,9 +629,13 @@ public class DeployMojoTest
 
         project.setVersion( "1.0" );
 
+        ProjectDeployerRequest pdr =
+                        new ProjectDeployerRequest()
+                            .setProject( project )
+                            .setAltReleaseDeploymentRepository( 
"altReleaseDeploymentRepository::default::http://localhost"; );
+
         assertEquals( repository,
-                      mojo.getDeploymentRepository( project, null,
-                                                    
"altReleaseDeploymentRepository::default::http://localhost";, null ) );
+                      mojo.getDeploymentRepository( pdr ));
     }
     
     private void addFileToList( File file, List<String> fileList )

Modified: 
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java?rev=1761345&r1=1761344&r2=1761345&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java
 (original)
+++ 
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java
 Sun Sep 18 17:24:00 2016
@@ -39,7 +39,7 @@ public class ArtifactDeployerStub
     }
 
     @Override
-    public void deploy( ProjectBuildingRequest arg0, ArtifactRepository arg1, 
Collection<Artifact> arg2 )
+    public void deploy( ProjectBuildingRequest arg0, ArtifactRepository arg1, 
Collection<Artifact> arg2)
         throws ArtifactDeployerException
     {
         // does nothing


Reply via email to