maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r803057 - in /maven/components/trunk/maven-compat/src: main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java test/java/org/apache/maven/repository/MirrorProcessorTest.java
Date Tue, 11 Aug 2009 10:24:33 GMT
Author: bentmann
Date: Tue Aug 11 10:24:33 2009
New Revision: 803057

URL: http://svn.apache.org/viewvc?rev=803057&view=rev
Log:
o Fixed bad protocol & basedir after mirroring

Modified:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
    maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java?rev=803057&r1=803056&r2=803057&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
(original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
Tue Aug 11 10:24:33 2009
@@ -187,18 +187,11 @@
     public void setUrl( String url )
     {
         this.url = url;
-    }
 
-    public void setBasedir( String basedir )
-    {
-        this.basedir = basedir;
+        this.protocol = protocol( url );
+        this.basedir = basedir( url );
     }
 
-    public void setProtocol( String protocol )
-    {
-        this.protocol = protocol;
-    }
-    
     // Path Utils
     
     /**

Modified: maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java?rev=803057&r1=803056&r2=803057&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
(original)
+++ maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
Tue Aug 11 10:24:33 2009
@@ -1,5 +1,8 @@
 package org.apache.maven.repository;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
@@ -172,7 +175,20 @@
         assertFalse( mirrorBuilder.matchPattern( getRepo( "c", "http://localhost" ), "!a,external:*"
) );
         assertTrue( mirrorBuilder.matchPattern( getRepo( "c", "http://somehost" ), "!a,external:*"
) );
     }     
-    
+
+    public void testMirrorProperUrlAndProtocolAndBasedir()
+    {
+        mirrorBuilder.addMirror( "mirror-id", "central", "file:///tmp", null );
+
+        List<ArtifactRepository> repos = Arrays.asList( getRepo( "central", "http://repo1.maven.org"
) );
+        repos = mirrorBuilder.getMirrors( repos );
+
+        ArtifactRepository repo = repos.get( 0 );
+        assertEquals( "file:///tmp", repo.getUrl() );
+        assertEquals( "file", repo.getProtocol() );
+        assertEquals( "/tmp", repo.getBasedir() );
+    }
+
     /**
      * Build an ArtifactRepository object.
      * 



Mime
View raw message