Fixed error when proxy is built from parent

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@378149 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Edwin L. Punzalan 2006-02-16 03:01:23 +00:00
parent bd1033c24f
commit f1f0d41869
3 changed files with 37 additions and 25 deletions

View File

@ -108,7 +108,7 @@ repo.list=local-repo,www-ibiblio-org,dist-codehaus-org,private-example-com
#local-store
# The local store represents a location that local jars you host can be located.
# This could also be achieved by having a local http repository, but this is less cumbersome
repo.local-repo.url=file:///./src/test/remote-repo1
repo.local-repo.url=file:///./target/remote-repo1
repo.local-repo.description=Super Secret Custom Repository
#If copy is true, jars are copied from the store to the proxy-repo. Only configurable for file:/// repos
repo.local-repo.copy=false

View File

@ -139,7 +139,7 @@ public class DefaultProxyManagerTest
ArtifactRepositoryLayout defLayout = new DefaultRepositoryLayout();
File repo1File = new File( "src/test/remote-repo1" );
File repo1File = getTestFile( "src/test/remote-repo1" );
ProxyRepository repo1 = new ProxyRepository( "test-repo", "file://" + repo1File.getAbsolutePath(), defLayout );

View File

@ -22,6 +22,7 @@ import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
import org.apache.maven.repository.proxy.repository.ProxyRepository;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.io.IOException;
@ -97,35 +98,46 @@ public class ProxyConfigurationTest
public void testLoadValidMavenProxyConfiguration()
throws ValidationException, IOException
{
File confFile = new File( "src/test/conf/maven-proxy-complete.conf" );
//must create the test directory bec configuration is using relative path which varies
FileUtils.mkdir( "target/remote-repo1" );
config.loadMavenProxyConfiguration( confFile );
assertTrue( config.getRepositoryCachePath().endsWith( "target" ) );
assertEquals( "Count repositories", 4, config.getRepositories().size() );
for ( Iterator repos = config.getRepositories().iterator(); repos.hasNext(); )
try
{
ProxyRepository repo = (ProxyRepository) repos.next();
File confFile = getTestFile( "src/test/conf/maven-proxy-complete.conf" );
if ( "local-repo".equals( repo.getKey() ) )
config.loadMavenProxyConfiguration( confFile );
assertTrue( config.getRepositoryCachePath().endsWith( "target" ) );
assertEquals( "Count repositories", 4, config.getRepositories().size() );
for ( Iterator repos = config.getRepositories().iterator(); repos.hasNext(); )
{
assertEquals( "file:///./src/test/remote-repo1", repo.getUrl() );
}
else if ( "www-ibiblio-org".equals( repo.getKey() ) )
{
assertEquals( "http://www.ibiblio.org/maven2", repo.getUrl() );
}
else if ( "dist-codehaus-org".equals( repo.getKey() ) )
{
assertEquals( "http://dist.codehaus.org", repo.getUrl() );
}
else if ( "private-example-com".equals( repo.getKey() ) )
{
assertEquals( "http://private.example.com/internal", repo.getUrl() );
ProxyRepository repo = (ProxyRepository) repos.next();
if ( "local-repo".equals( repo.getKey() ) )
{
assertEquals( "file:///./target/remote-repo1", repo.getUrl() );
}
else if ( "www-ibiblio-org".equals( repo.getKey() ) )
{
assertEquals( "http://www.ibiblio.org/maven2", repo.getUrl() );
}
else if ( "dist-codehaus-org".equals( repo.getKey() ) )
{
assertEquals( "http://dist.codehaus.org", repo.getUrl() );
}
else if ( "private-example-com".equals( repo.getKey() ) )
{
assertEquals( "http://private.example.com/internal", repo.getUrl() );
}
}
}
//make sure to delete the test directory after tests
finally
{
FileUtils.deleteDirectory( "target/remote-repo1" );
}
}
protected void tearDown()