maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r421573 - in /maven/wagon/trunk: wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java wagon-providers/wagon-webdav/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
Date Thu, 13 Jul 2006 10:10:02 GMT
Author: carlos
Date: Thu Jul 13 03:10:01 2006
New Revision: 421573

URL: http://svn.apache.org/viewvc?rev=421573&view=rev
Log:
[WAGON-56] WebDAV Wagon putDirectory fails when multiple directories in path don't exist
Submitted By: Nathan Beyer

Modified:
    maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
    maven/wagon/trunk/wagon-providers/wagon-webdav/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java

Modified: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java?rev=421573&r1=421572&r2=421573&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
(original)
+++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
Thu Jul 13 03:10:01 2006
@@ -215,6 +215,7 @@
             writeTestFile( "a/test-resource-2.txt" );
             writeTestFile( "a/b/test-resource-3.txt" );
             writeTestFile( "c/test-resource-4.txt" );
+            writeTestFile( "d/e/f/test-resource-5.txt" );
 
             wagon.connect( testRepository, getAuthInfo() );
 
@@ -228,10 +229,58 @@
             wagon.get( "directory-copy/a/test-resource-2.txt", destFile );
             wagon.get( "directory-copy/a/b/test-resource-3.txt", destFile );
             wagon.get( "directory-copy/c/test-resource-4.txt", destFile );
+            wagon.get( "directory-copy/d/e/f/test-resource-5.txt", destFile);
 
             wagon.disconnect();
         }
 
+        tearDownWagonTestingFixtures();
+    }
+    
+    /**
+     * Test for putting a directory with a destination that multiple directories deep,
+     * all of which haven't been created.
+     * @since 1.0-beta-2
+     * @throws Exception
+     */
+    public void testWagonPutDirectoryDeepDestination()
+        throws Exception
+    {
+        setupRepositories();
+    
+        setupWagonTestingFixtures();
+    
+        Wagon wagon = getWagon();
+    
+        if ( wagon.supportsDirectoryCopy() )
+        {
+            sourceFile = new File( FileTestUtils.getTestOutputDir(), "deep0/deep1/deep2"
);
+            
+            FileUtils.deleteDirectory( sourceFile );
+            
+            writeTestFile( "test-resource-1.txt" );
+            writeTestFile( "a/test-resource-2.txt" );
+            writeTestFile( "a/b/test-resource-3.txt" );
+            writeTestFile( "c/test-resource-4.txt" );
+            writeTestFile( "d/e/f/test-resource-5.txt" );
+    
+            wagon.connect( testRepository, getAuthInfo() );
+    
+            wagon.putDirectory( sourceFile, "deep0/deep1/deep2" );
+    
+            destFile = FileTestUtils.createUniqueFile( getName(), getName() );
+    
+            destFile.deleteOnExit();
+    
+            wagon.get( "deep0/deep1/deep2/test-resource-1.txt", destFile );
+            wagon.get( "deep0/deep1/deep2/a/test-resource-2.txt", destFile );
+            wagon.get( "deep0/deep1/deep2/a/b/test-resource-3.txt", destFile );
+            wagon.get( "deep0/deep1/deep2/c/test-resource-4.txt", destFile );
+            wagon.get( "deep0/deep1/deep2/d/e/f/test-resource-5.txt", destFile);
+    
+            wagon.disconnect();
+        }
+    
         tearDownWagonTestingFixtures();
     }
 

Modified: maven/wagon/trunk/wagon-providers/wagon-webdav/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-webdav/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java?rev=421573&r1=421572&r2=421573&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-webdav/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-webdav/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
Thu Jul 13 03:10:01 2006
@@ -515,27 +515,6 @@
     public void putDirectory( File sourceDirectory, String destinationDirectory ) 
         throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
     {
-        String createPath = repository.getBasedir() + "/" + destinationDirectory + "/";
-
-        try
-        {
-            webdavResource.mkcolMethod( createPath );
-        }
-        catch ( IOException e )
-        {
-            throw new TransferFailedException( "Failed to create remote directory: " + createPath
+ " : "
-                + e.getMessage(), e );
-        }
-
-        try
-        {
-            webdavResource.setPath( repository.getBasedir() );
-        }
-        catch ( IOException e )
-        {
-            throw new TransferFailedException( "An error occurred while preparing to copy
to remote repository: "
-                + e.getMessage(), e );
-        }
         
         File [] listFiles = sourceDirectory.listFiles();
 
@@ -547,17 +526,9 @@
             }
             else
             {
-                String target = createPath + listFiles[i].getName();
-
-                try
-                {
-                    webdavResource.putMethod( target, listFiles[i] );
-                    }
-                catch ( IOException e )
-                {
-                    throw new TransferFailedException( "Failed to upload to remote repository:
" + target + " : "
-                        + e.getMessage(), e );
-                }
+                String target = destinationDirectory + "/" + listFiles[i].getName();
+                
+                put( listFiles[i], target );
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message