You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ar...@apache.org on 2006/04/26 09:41:59 UTC

svn commit: r397133 - in /maven/plugins/trunk/maven-deploy-plugin/src/test: java/org/apache/maven/plugin/deploy/ java/org/apache/maven/plugin/deploy/stubs/ resources/unit/basic-deploy-scp/

Author: aramirez
Date: Wed Apr 26 00:41:57 2006
New Revision: 397133

URL: http://svn.apache.org/viewcvs?rev=397133&view=rev
Log:
PR: MDEPLOY-30

created a stub for artifact deployer

Added:
    maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java
Modified:
    maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java
    maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactRepositoryStub2.java
    maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml

Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java?rev=397133&r1=397132&r2=397133&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java Wed Apr 26 00:41:57 2006
@@ -26,6 +26,7 @@
 import org.apache.maven.plugin.deploy.stubs.ArtifactRepositoryStub;
 import org.apache.maven.plugin.deploy.stubs.AttachedArtifactStub;
 import org.apache.maven.plugin.deploy.stubs.DeployArtifactStub;
+import org.apache.maven.plugin.deploy.stubs.ArtifactDeployerStub;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -370,7 +371,7 @@
         assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );               
     }
     
-/*
+
     public void testBasicDeployWithScpAsProtocol()
         throws Exception
     {
@@ -381,6 +382,10 @@
         
         assertNotNull( mojo );
         
+        ArtifactDeployerStub deployer = new ArtifactDeployerStub();
+        
+        setVariableValueToObject( mojo, "deployer", deployer );
+        
         File file = new File( getBasedir(),
                               "target/test-classes/unit/basic-deploy-scp/target/" +
                               "deploy-test-file-1.0-SNAPSHOT.jar" );
@@ -398,23 +403,14 @@
         {
             FileUtils.deleteDirectory( sshFile );
         }
-        
-        try
-        {
-            mojo.execute();
-            
-            fail( "failure" );
-        }
-        catch( Exception e )
-        {
-            //expected
-        }
 
+        mojo.execute();
+            
         assertTrue( sshFile.exists() );
         
         FileUtils.deleteDirectory( sshFile );
     }
-*/
+
     
     private void addFileToList( File file, List fileList )
     {

Added: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java?rev=397133&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java Wed Apr 26 00:41:57 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.deploy.stubs;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.deployer.ArtifactDeployer;
+import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
+import org.apache.maven.artifact.transform.ArtifactTransformationManager;
+import org.codehaus.plexus.util.FileUtils;
+
+public class ArtifactDeployerStub
+    implements ArtifactDeployer
+{
+    private WagonManager wagonManager;
+
+    private ArtifactTransformationManager transformationManager;
+
+    private RepositoryMetadataManager repositoryMetadataManager;
+
+    public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository,
+                        ArtifactRepository localRepository )
+        throws ArtifactDeploymentException
+    {
+        String extension = artifact.getArtifactHandler().getExtension();
+        File source = new File( basedir, finalName + "." + extension );
+        deploy( source, artifact, deploymentRepository, localRepository );
+    }
+
+    public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository,
+                        ArtifactRepository localRepository )
+        throws ArtifactDeploymentException
+    {
+
+    }
+}

Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactRepositoryStub2.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactRepositoryStub2.java?rev=397133&r1=397132&r2=397133&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactRepositoryStub2.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactRepositoryStub2.java Wed Apr 26 00:41:57 2006
@@ -19,6 +19,8 @@
 public class ArtifactRepositoryStub2
     extends ArtifactRepositoryStub
 {
+    private String protocol;
+    
     public String getUrl()
     {
         return "file://" + System.getProperty( "basedir" ) + "/target/remote-repo/basic-deploy-scp";
@@ -31,6 +33,15 @@
     
     public String getProtocol()
     {
-        return "scp";
+        if( this.protocol == null || this.protocol.equals("") )
+        {
+            this.protocol = "scp";
+        }
+        return this.protocol;
+    }
+    
+    public void setProtocol( String protocol )
+    {
+        this.protocol = protocol;
     }
 }

Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml?rev=397133&r1=397132&r2=397133&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml Wed Apr 26 00:41:57 2006
@@ -11,6 +11,7 @@
           <localRepository>${localRepository}</localRepository>
 		  <deploymentRepository implementation="org.apache.maven.plugin.deploy.stubs.ArtifactRepositoryStub2" />
 		  <updateReleaseInfo>false</updateReleaseInfo>
+		  <deployer implementation="org.apache.maven.plugin.deploy.stubs.ArtifactDeployerStub" />
 		</configuration>
       </plugin>
     </plugins>