o Fixed bad protocol & basedir after mirroring

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@803057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-11 10:24:33 +00:00
parent 497a490d0f
commit 483a0d1f90
2 changed files with 20 additions and 11 deletions

View File

@ -187,18 +187,11 @@ public class MavenArtifactRepository
public void setUrl( String url )
{
this.url = url;
this.protocol = protocol( url );
this.basedir = basedir( url );
}
public void setBasedir( String basedir )
{
this.basedir = basedir;
}
public void setProtocol( String protocol )
{
this.protocol = protocol;
}
// Path Utils
/**

View File

@ -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 @@ public class MirrorProcessorTest
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.
*