From 17f2989fe13244ad4bb047e4764d4aecda40560a Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Wed, 1 Nov 2017 15:40:05 +0100 Subject: [PATCH] Adapting some plugins to the new repository api --- .../cassandra/MockRepositoryStorage.java | 2 +- .../consumers/DuplicateArtifactsConsumer.java | 2 +- .../consumers/DuplicateArtifactsConsumerTest.java | 11 ++++++----- .../archiva/configuration/StubConfiguration.java | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java index e96be30a9..c09221fad 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java @@ -112,7 +112,7 @@ public class MockRepositoryStorage } @Override - public String getFilePath( String requestPath, ManagedRepository managedRepository ) + public String getFilePath( String requestPath, org.apache.archiva.repository.ManagedRepository managedRepository ) { return null; } diff --git a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java index 0006f3732..ae684b613 100644 --- a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java +++ b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java @@ -19,7 +19,6 @@ package org.apache.archiva.reports.consumers; * under the License. */ -import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.checksum.ChecksumAlgorithm; import org.apache.archiva.checksum.ChecksummedFile; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -37,6 +36,7 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.redback.components.registry.Registry; import org.apache.archiva.redback.components.registry.RegistryListener; +import org.apache.archiva.repository.ManagedRepository; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java index 7849536b6..49cc241b2 100644 --- a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java +++ b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java @@ -20,7 +20,6 @@ package org.apache.archiva.reports.consumers; */ import junit.framework.TestCase; -import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.consumers.ConsumerException; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.MetadataFacet; @@ -29,6 +28,8 @@ import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.metadata.model.facets.RepositoryProblemFacet; +import org.apache.archiva.repository.BasicManagedRepository; +import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.junit.Before; import org.junit.Test; @@ -45,6 +46,7 @@ import java.nio.file.NoSuchFileException; import java.nio.file.Paths; import java.util.Arrays; import java.util.Date; +import java.util.Locale; import static org.mockito.Mockito.*; @@ -59,7 +61,7 @@ public class DuplicateArtifactsConsumerTest @Named( value = "knownRepositoryContentConsumer#duplicate-artifacts" ) private DuplicateArtifactsConsumer consumer; - private ManagedRepository config; + private BasicManagedRepository config; private MetadataRepository metadataRepository; @@ -95,9 +97,8 @@ public class DuplicateArtifactsConsumerTest assertNotNull( consumer ); - config = new ManagedRepository(); - config.setId( TEST_REPO ); - config.setLocation( Paths.get( "target/test-repository" ).toAbsolutePath().toString() ); + config = new BasicManagedRepository(TEST_REPO, TEST_REPO); + config.setLocation( Paths.get( "target/test-repository" ).toAbsolutePath().toUri() ); metadataRepository = mock( MetadataRepository.class ); diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/configuration/StubConfiguration.java b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/configuration/StubConfiguration.java index b4659ac34..1709f1930 100644 --- a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/configuration/StubConfiguration.java +++ b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/configuration/StubConfiguration.java @@ -23,6 +23,9 @@ import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.components.registry.RegistryListener; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Locale; + @Service("archivaConfiguration#mocked") public class StubConfiguration implements ArchivaConfiguration @@ -77,4 +80,16 @@ public class StubConfiguration { // no op } + + @Override + public Locale getDefaultLocale( ) + { + return Locale.getDefault(); + } + + @Override + public List getLanguagePriorities( ) + { + return Locale.LanguageRange.parse( "en,fr,de" ); + } } -- 2.39.5