diff options
author | Martin Stockhammer <martin.stockhammer@ars.de> | 2017-11-20 08:20:42 +0100 |
---|---|---|
committer | Martin Stockhammer <martin.stockhammer@ars.de> | 2017-11-20 08:20:42 +0100 |
commit | 754b2d594076355d6e9d0b7698d309c87a0d672b (patch) | |
tree | fc263ab07783ed35617a0d6a085a0b458d1ef0fb /archiva-modules/archiva-base/archiva-proxy | |
parent | 2fe8227634acfeaf7837e953e0f8fd2a44dae3a5 (diff) | |
download | archiva-754b2d594076355d6e9d0b7698d309c87a0d672b.tar.gz archiva-754b2d594076355d6e9d0b7698d309c87a0d672b.zip |
Adding local path to repository API
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy')
4 files changed, 29 insertions, 7 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index c4bfff309..4dcf74760 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -354,7 +354,7 @@ public abstract class AbstractProxyTestCase protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout ) throws Exception { - MavenManagedRepository repo = new MavenManagedRepository(id, name); + MavenManagedRepository repo = new MavenManagedRepository(id, name, Paths.get(path).getParent()); repo.setLocation( new URI(path) ); repo.setLayout( layout ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index 3980d87c2..40fa894ca 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -123,7 +123,7 @@ public class HttpProxyTransferTest // Make the destination dir. Files.createDirectories(destRepoDir); - MavenManagedRepository repo = new MavenManagedRepository( MANAGED_ID, "Default Managed Repository" ); + MavenManagedRepository repo = new MavenManagedRepository( MANAGED_ID, "Default Managed Repository", Paths.get(repoPath).getParent() ); repo.setLocation( new URI(repoPath) ); repo.setLayout( "default" ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java index 54a0b94da..30de66392 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java @@ -23,6 +23,7 @@ import org.apache.archiva.configuration.*; import org.apache.archiva.redback.components.registry.Registry; import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.components.registry.RegistryListener; +import org.apache.commons.lang.StringUtils; import org.easymock.EasyMock; import org.easymock.IMocksControl; import org.springframework.stereotype.Service; @@ -160,4 +161,24 @@ public class MockConfiguration return Paths.get(""); } } + + + @Override + public Path getRepositoryBaseDir() { + return getDataDirectory().resolve("repositories"); + } + + @Override + public Path getRemoteRepositoryBaseDir() { + return getDataDirectory().resolve("remotes"); + } + + @Override + public Path getDataDirectory() { + if (configuration!=null && StringUtils.isNotEmpty(configuration.getArchivaRuntimeConfiguration().getDataDirectory())) { + return Paths.get(configuration.getArchivaRuntimeConfiguration().getDataDirectory()); + } else { + return getAppServerBaseDir().resolve("data"); + } + } } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index 834ce5ba2..c923ba960 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -40,6 +40,7 @@ import org.apache.archiva.repository.features.StagingRepositoryFeature; import org.springframework.stereotype.Service; import java.net.URI; +import java.nio.file.Paths; import java.time.Duration; import java.time.Period; import java.util.HashSet; @@ -69,19 +70,19 @@ public class RepositoryProviderMock implements RepositoryProvider @Override public EditableManagedRepository createManagedInstance( String id, String name ) { - return new BasicManagedRepository( id, name ); + return new BasicManagedRepository( id, name , Paths.get("target/repositories")); } @Override public EditableRemoteRepository createRemoteInstance( String id, String name ) { - return new BasicRemoteRepository( id, name ); + return new BasicRemoteRepository( id, name, Paths.get("target/remotes") ); } @Override public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException { - BasicManagedRepository managedRepository = new BasicManagedRepository( configuration.getId( ), configuration.getName( ) ); + BasicManagedRepository managedRepository = new BasicManagedRepository( configuration.getId( ), configuration.getName( ) , Paths.get("target/repositories")); updateManagedInstance( managedRepository, configuration ); return managedRepository; } @@ -128,7 +129,7 @@ public class RepositoryProviderMock implements RepositoryProvider public ManagedRepository createStagingInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException { String id = configuration.getId( ) + StagingRepositoryFeature.STAGING_REPO_POSTFIX; - BasicManagedRepository managedRepository = new BasicManagedRepository( id, configuration.getName( ) ); + BasicManagedRepository managedRepository = new BasicManagedRepository( id, configuration.getName( ), Paths.get("target/repositories") ); updateManagedInstance( managedRepository, configuration ); return managedRepository; } @@ -136,7 +137,7 @@ public class RepositoryProviderMock implements RepositoryProvider @Override public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration ) throws RepositoryException { - BasicRemoteRepository remoteRepository = new BasicRemoteRepository( configuration.getId( ), configuration.getName( ) ); + BasicRemoteRepository remoteRepository = new BasicRemoteRepository( configuration.getId( ), configuration.getName( ), Paths.get("target/remotes") ); updateRemoteInstance( remoteRepository, configuration ); return remoteRepository; } |