maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r804401 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src: main/java/org/apache/maven/scm/provider/bazaar/repository/ test/java/org/apache/maven/scm/provider/bazaar/repository/
Date Fri, 14 Aug 2009 22:46:24 GMT
Author: struberg
Date: Fri Aug 14 22:46:24 2009
New Revision: 804401

URL: http://svn.apache.org/viewvc?rev=804401&view=rev
Log:
SCM-489 add support for the protocols bzr, bzr+ssh, ssh

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepository.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepositoryTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepository.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepository.java?rev=804401&r1=804400&r2=804401&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepository.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepository.java
Fri Aug 14 22:46:24 2009
@@ -44,6 +44,13 @@
 
     private static final String HTTPS = "https://";
 
+    private static final String BZR = "bzr://";
+
+    private static final String BZR_SSH = "bzr+ssh://";
+
+    /** this is basically an abbreviation of {@value #BZR_SSH} */
+    private static final String SSH = "ssh://";
+
     private static final String UNKNOWN = "";
 
     private final String path;
@@ -140,6 +147,18 @@
         {
             prot = HTTPS;
         }
+        else if ( url.startsWith( BZR ) )
+        {
+            prot = BZR;
+        }
+        else if ( url.startsWith( BZR_SSH ) )
+        {
+            prot = BZR_SSH;
+        }
+        else if ( url.startsWith( SSH ) )
+        {
+            prot = SSH;
+        }
 
         return prot;
     }
@@ -273,7 +292,13 @@
 
     private boolean needsAuthentication()
     {
-        return SFTP.equals( protocol ) || FTP.equals( protocol ) || HTTPS.equals( protocol
) || AFTP.equals( protocol );
+        return SFTP.equals( protocol ) || 
+               FTP.equals( protocol ) || 
+               HTTPS.equals( protocol ) || 
+               AFTP.equals( protocol ) ||
+               BZR.equals( protocol ) ||
+               BZR_SSH.equals( protocol ) ||
+               SSH.equals( protocol );
     }
 
     /** {@inheritDoc} */

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepositoryTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepositoryTest.java?rev=804401&r1=804400&r2=804401&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepositoryTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/repository/BazaarScmProviderRepositoryTest.java
Fri Aug 14 22:46:24 2009
@@ -116,6 +116,34 @@
         assertNull( repo.validateURI() );
     }
 
+    public void testBzrRepo() {
+        testAuthenticationProtocolRepo( "bzr" );
+    }
+
+    public void testBzrPlusSshRepo() {
+        testAuthenticationProtocolRepo( "bzr+ssh" );
+    }
+
+    public void testSshRepo() {
+        testAuthenticationProtocolRepo( "ssh" );
+    }
+
+    private void testAuthenticationProtocolRepo(String protocol) {
+        String url = protocol + "://myserver.net/testroot/myproject/trunk/";
+        BazaarScmProviderRepository repo = new BazaarScmProviderRepository( url );
+
+        repo.setPassword( "Password" );
+        repo.setUser( "User" );
+        repo.setPassphrase( "Passphrase" );
+        assertNull( repo.validateURI() );
+
+        assertEquals( protocol +  "://User:Password@myserver.net/testroot/myproject/trunk/",
repo.getURI() );
+        assertNull( repo.validateURI() );
+        repo.setPort( 4776 );
+        assertEquals( protocol + "://User:Password@myserver.net:4776/testroot/myproject/trunk/",
repo.getURI() );
+        assertNull( repo.validateURI() );
+   
+    }
     /**
      * @throws Exception
      */



Mime
View raw message