]> source.dussan.org Git - archiva.git/commitdiff
Fixed error when proxy is built from parent
authorEdwin L. Punzalan <epunzalan@apache.org>
Thu, 16 Feb 2006 03:01:23 +0000 (03:01 +0000)
committerEdwin L. Punzalan <epunzalan@apache.org>
Thu, 16 Feb 2006 03:01:23 +0000 (03:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@378149 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-proxy/src/test/conf/maven-proxy-complete.conf
maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java

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