From f1f0d418699c8b8fc337b4ff38f84ea941e4528b Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Thu, 16 Feb 2006 03:01:23 +0000 Subject: [PATCH] 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 --- .../src/test/conf/maven-proxy-complete.conf | 2 +- .../proxy/DefaultProxyManagerTest.java | 2 +- .../configuration/ProxyConfigurationTest.java | 54 +++++++++++-------- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/maven-repository-proxy/src/test/conf/maven-proxy-complete.conf b/maven-repository-proxy/src/test/conf/maven-proxy-complete.conf index c7722a864..d32682efb 100644 --- a/maven-repository-proxy/src/test/conf/maven-proxy-complete.conf +++ b/maven-repository-proxy/src/test/conf/maven-proxy-complete.conf @@ -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 diff --git a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java index 0b0824ae9..859580070 100644 --- a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java +++ b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java @@ -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 ); diff --git a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java index 3900c0278..c4ea859cc 100644 --- a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java +++ b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java @@ -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 ); + try + { + File confFile = getTestFile( "src/test/conf/maven-proxy-complete.conf" ); - assertTrue( config.getRepositoryCachePath().endsWith( "target" ) ); + config.loadMavenProxyConfiguration( confFile ); - assertEquals( "Count repositories", 4, config.getRepositories().size() ); + assertTrue( config.getRepositoryCachePath().endsWith( "target" ) ); - for ( Iterator repos = config.getRepositories().iterator(); repos.hasNext(); ) - { - ProxyRepository repo = (ProxyRepository) repos.next(); + assertEquals( "Count repositories", 4, config.getRepositories().size() ); - if ( "local-repo".equals( repo.getKey() ) ) + 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() -- 2.39.5