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-consumers | |
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-consumers')
6 files changed, 21 insertions, 16 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java index 55151f337..a140842a2 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java @@ -39,7 +39,9 @@ import org.apache.archiva.repository.features.RemoteIndexFeature; 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 +71,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 +130,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 +138,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; } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java index 68d03a873..0b134ba05 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java @@ -84,7 +84,7 @@ public class SimpleArtifactConsumerTest Files.createDirectories( repoDir ); repoDir.toFile().deleteOnExit(); - testRepository = new BasicManagedRepository("test-consumer-repository","Test-Consumer-Repository" ); + testRepository = new BasicManagedRepository("test-consumer-repository","Test-Consumer-Repository", Paths.get("target/repositories") ); testRepository.setLocation( repoDir.toAbsolutePath().toUri() ); repositoryRegistry.putRepository(testRepository); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java index 1ad70c389..5851e6770 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java @@ -47,9 +47,10 @@ public class ArtifactMissingChecksumsConsumerTest { super.setUp(); - repoConfig = new BasicManagedRepository( "test-repo", "Test Repository"); + Path basePath = Paths.get("target/test-classes"); + repoConfig = new BasicManagedRepository( "test-repo", "Test Repository", basePath); repoConfig.setLayout( "default" ); - repoConfig.setLocation( Paths.get( "target/test-classes/test-repo/" ).toUri() ); + repoConfig.setLocation(basePath.resolve("test-repo/" ).toUri() ); consumer = applicationContext.getBean( "knownRepositoryContentConsumer#create-missing-checksums", KnownRepositoryContentConsumer.class ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index d65d1a491..e9e73530b 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -166,13 +166,14 @@ public abstract class AbstractRepositoryPurgeTest public org.apache.archiva.repository.ManagedRepository getRepoConfiguration( String repoId, String repoName ) throws URISyntaxException { - config = new BasicManagedRepository( repoId, repoName); + Path basePath = Paths.get("target/test-" + getName()).toAbsolutePath(); + config = new BasicManagedRepository( repoId, repoName, basePath); config.addActiveReleaseScheme( ReleaseScheme.RELEASE ); config.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT ); ArtifactCleanupFeature atf = config.getFeature( ArtifactCleanupFeature.class ).get(); atf.setRetentionPeriod( Period.ofDays( TEST_DAYS_OLDER) ); String path = AbstractRepositoryPurgeTest.fixPath( - Paths.get( "target/test-" + getName() + "/" + repoId ).toAbsolutePath().toString() ); + basePath.resolve( repoId ).toAbsolutePath().toString() ); config.setLocation( new URI( path ) ); atf.setDeleteReleasedSnapshots( true ); atf.setRetentionCount( TEST_RETENTION_COUNT ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index ad98c9963..286dd38e4 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/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; } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index 2a8546a72..e34dc7e12 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -132,7 +132,7 @@ public class NexusIndexerConsumerTest // initialize to set the file types to be processed nexusIndexerConsumer.initialize(); - repositoryConfig = new BasicManagedRepository( "test-repo", "Test Repository" ); + repositoryConfig = new BasicManagedRepository( "test-repo", "Test Repository", Paths.get("target/test-classes") ); repositoryConfig.setLocation( new URI("target/test-classes/test-repo") ); repositoryConfig.setLayout( "default" ); repositoryConfig.setScanned( true ); |