maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r680971 - /maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
Date Wed, 30 Jul 2008 10:53:59 GMT
Author: brett
Date: Wed Jul 30 03:53:57 2008
New Revision: 680971

URL: http://svn.apache.org/viewvc?rev=680971&view=rev
Log:
additional ftp tests

Modified:
    maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java

Modified: maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java?rev=680971&r1=680970&r2=680971&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
Wed Jul 30 03:53:57 2008
@@ -22,11 +22,14 @@
 import java.io.File;
 
 import org.apache.ftpserver.interfaces.FtpServerInterface;
+import org.apache.maven.wagon.FileTestUtils;
 import org.apache.maven.wagon.StreamingWagonTestCase;
 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.repository.Repository;
 import org.apache.maven.wagon.resource.Resource;
+import org.codehaus.plexus.util.FileUtils;
 
 /**
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
@@ -45,16 +48,14 @@
     protected void setupWagonTestingFixtures()
         throws Exception
     {
-        super.setUp();
-
         server = (FtpServerInterface) lookup( FtpServerInterface.ROLE );
     }
-    
+
     protected void createDirectory( Wagon wagon, String resourceToCreate, String dirName
)
         throws Exception
     {
         super.createDirectory( wagon, resourceToCreate, dirName );
-        
+
         getRepositoryDirectory().mkdirs();
     }
 
@@ -83,7 +84,7 @@
     protected long getExpectedLastModifiedOnGet( Repository repository, Resource resource
)
     {
         File file = new File( getRepositoryDirectory(), resource.getName() );
-        
+
         // granularity for FTP is minutes
         return ( file.lastModified() / 60000 ) * 60000;
     }
@@ -92,4 +93,39 @@
     {
         return getTestFile( "target/test-output/local-repository" );
     }
+
+    public void testNoPassword()
+        throws Exception
+    {
+        AuthenticationInfo authenticationInfo = new AuthenticationInfo();
+        authenticationInfo.setUserName( "me" );
+        try
+        {
+            getWagon().connect( new Repository( "id", getTestRepositoryUrl() ), authenticationInfo
);
+        }
+        catch ( AuthenticationException e )
+        {
+            assertTrue( true );
+        }
+    }
+
+    public void testDefaultUserName()
+        throws Exception
+    {
+        setupWagonTestingFixtures();
+
+        AuthenticationInfo authenticationInfo = new AuthenticationInfo();
+        authenticationInfo.setPassword( "secret" );
+        try
+        {
+            getWagon().connect( new Repository( "id", getTestRepositoryUrl() ), authenticationInfo
);
+            fail();
+        }
+        catch ( AuthenticationException e )
+        {
+            assertEquals( System.getProperty( "user.name" ), authenticationInfo.getUserName()
);
+        }
+
+        tearDownWagonTestingFixtures();
+    }
 }



---------------------------------------------------------------------
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