maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r292842 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src: main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
Date Fri, 30 Sep 2005 19:54:05 GMT
Author: evenisse
Date: Fri Sep 30 12:53:57 2005
New Revision: 292842

URL: http://svn.apache.org/viewcvs?rev=292842&view=rev
Log:
Allow empty password in scm cvs url with pserver protocol. It's for anonymous connection

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java?rev=292842&r1=292841&r2=292842&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
Fri Sep 30 12:53:57 2005
@@ -319,7 +319,7 @@
 
                     port = new Integer( tokens[2] ).intValue();
                 }
-                else if ( tokens[2].indexOf( "@" ) > 0 )
+                else if ( tokens[2].indexOf( "@" ) >= 0 )
                 {
                     //<username>:<password>@<hostname>
                     user = tokens[1];

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java?rev=292842&r1=292841&r2=292842&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
Fri Sep 30 12:53:57 2005
@@ -77,10 +77,28 @@
         assertEquals( ":pserver:anoncvs@cvs.apache.org:2401/home/cvspublic", repo.getCvsRoot()
);
     }
 
+    public void testParseRemotePserverConnection2()
+        throws Exception
+    {
+        String url = "pserver:anoncvs:@cvs.apache.org:/home/cvspublic:maven";
+
+        CvsScmProviderRepository repo = testUrl( url );
+
+        assertEquals( "pserver", repo.getTransport() );
+
+        assertEquals( "anoncvs", repo.getUser() );
+
+        assertEquals( "cvs.apache.org", repo.getHost() );
+
+        assertEquals( "/home/cvspublic", repo.getPath() );
+
+        assertEquals( ":pserver:anoncvs@cvs.apache.org:2401/home/cvspublic", repo.getCvsRoot()
);
+    }
+
     public void testParseRemotePserverConnectionWithPort()
         throws Exception
     {
-        String url = "pserver:anoncvs@cvs.apache.org:2401:/home/cvspublic:maven";
+        String url = "pserver:anoncvs:@cvs.apache.org:2401:/home/cvspublic:maven";
 
         CvsScmProviderRepository repo = testUrl( url );
 
@@ -88,6 +106,8 @@
 
         assertEquals( "anoncvs", repo.getUser() );
 
+        assertEquals( "", repo.getPassword() );
+
         assertEquals( "cvs.apache.org", repo.getHost() );
 
         assertEquals( "/home/cvspublic", repo.getPath() );
@@ -183,9 +203,11 @@
     //
     // ----------------------------------------------------------------------
 
-    private CvsScmProviderRepository testUrl( String url, char delimiter )
+    private CvsScmProviderRepository testUrl( String url, char delimiter, int nbErrorMessages
)
         throws Exception
     {
+        assertEquals( nbErrorMessages, scmManager.validateScmRepository( "scm:cvs" + delimiter
+ url ).size() );
+
         ScmRepository repository = scmManager.makeScmRepository( "scm:cvs" + delimiter +
url );
 
         assertNotNull( "ScmManager.makeScmRepository() returned null", repository );
@@ -201,7 +223,13 @@
     private CvsScmProviderRepository testUrl( String url )
         throws Exception
     {
-        return testUrl( url, ':' );
+        return testUrl( url, ':', 0 );
+    }
+
+    private CvsScmProviderRepository testUrl( String url, char delimiter )
+        throws Exception
+    {
+        return testUrl( url, delimiter, 0 );
     }
 
     private void testIllegalUrl( String url )
@@ -209,7 +237,7 @@
     {
         try
         {
-            testUrl( "scm:cvs:" + url );
+            testUrl( "scm:cvs:" + url, ':', 1 );
 
             fail( "Expected a ScmRepositoryException while testing the url '" + url + "'."
);
         }



Mime
View raw message