]> source.dussan.org Git - archiva.git/commitdiff
Adapting some plugins to the new repository api
authorMartin Stockhammer <martin_s@apache.org>
Wed, 1 Nov 2017 14:40:05 +0000 (15:40 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Wed, 1 Nov 2017 14:40:05 +0000 (15:40 +0100)
archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java
archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java
archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/configuration/StubConfiguration.java

index e96be30a9054f38f188bcd9663b6dd705bb22d6f..c09221fadfac23b0e5a64bd2f29c77e5753e4b3f 100644 (file)
@@ -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;
     }
index 0006f373219fe50940bd976abdbe81e25cd70c93..ae684b6134644c12da95063209aeca83c73a7eed 100644 (file)
@@ -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;
index 7849536b618066e9fd1b4075187cf8aabb6ea30c..49cc241b27b604b43d2795057f77449e8b20c73d 100644 (file)
@@ -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 );
 
index b4659ac34367ffdf2310c69c4f0dd372341be965..1709f1930f1b1d1a607e191047bd95440ef76594 100644 (file)
@@ -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<Locale.LanguageRange> getLanguagePriorities( )
+    {
+        return Locale.LanguageRange.parse( "en,fr,de" );
+    }
 }