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
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