archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject [16/21] archiva git commit: Adapting base modules to the new repository api
Date Wed, 01 Nov 2017 14:41:02 GMT
Adapting base modules to the new repository api

Using the repository api and RepositoryRegistry for repo access


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/9469c1b6
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/9469c1b6
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/9469c1b6

Branch: refs/heads/master
Commit: 9469c1b67f5a667b99b1810ddd95642164ba2ec3
Parents: 45b601f
Author: Martin Stockhammer <martin_s@apache.org>
Authored: Wed Nov 1 15:38:00 2017 +0100
Committer: Martin Stockhammer <martin_s@apache.org>
Committed: Wed Nov 1 15:38:00 2017 +0100

----------------------------------------------------------------------
 .../DefaultLegacyRepositoryConverter.java       |   8 +-
 .../legacy/LegacyConverterArtifactConsumer.java |   4 +-
 .../archiva-base/archiva-indexer/pom.xml        |   5 +
 .../indexer/search/MavenRepositorySearch.java   |   6 +
 .../search/AbstractMavenRepositorySearch.java   |  17 ++
 .../search/MavenRepositorySearchOSGITest.java   |   4 +-
 .../search/MavenRepositorySearchTest.java       |  93 +++++---
 .../src/test/resources/spring-context.xml       |   5 +
 .../archiva/proxy/model/ProxyConnector.java     |   2 +-
 .../proxy/DefaultRepositoryProxyConnectors.java | 183 ++++++++-------
 .../archiva/proxy/AbstractProxyTestCase.java    |  43 ++--
 .../proxy/CacheFailuresTransferTest.java        |   1 +
 .../archiva/proxy/HttpProxyTransferTest.java    |  14 +-
 .../apache/archiva/proxy/MockConfiguration.java |  13 ++
 .../repository/mock/RepositoryProviderMock.java | 231 +++++++++++++++++++
 .../src/test/resources/spring-context.xml       |   5 +-
 .../scanner/DefaultRepositoryScanner.java       |   2 +-
 .../scanner/RepositoryContentConsumers.java     |   9 +-
 .../scanner/RepositoryScanStatistics.java       |   2 +-
 .../repository/scanner/RepositoryScanner.java   |   2 +-
 .../scanner/RepositoryScannerInstance.java      |   6 +-
 .../functors/TriggerBeginScanClosure.java       |   2 +-
 .../functors/TriggerScanCompletedClosure.java   |   2 +-
 .../repository/scanner/InvalidScanConsumer.java |   2 +-
 .../repository/scanner/KnownScanConsumer.java   |   4 +-
 .../scanner/RepositoryContentConsumersTest.java |  22 +-
 .../scanner/RepositoryScannerTest.java          |  27 +--
 .../repository/scanner/SampleKnownConsumer.java |   2 +-
 .../archiva-base/archiva-test-utils/pom.xml     |   7 +-
 archiva-modules/archiva-base/pom.xml            |   1 +
 30 files changed, 537 insertions(+), 187 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
index ff04828..3e8e168 100644
--- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
+++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
@@ -26,6 +26,7 @@ import org.apache.archiva.common.utils.PathUtil;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.converter.RepositoryConversionException;
+import org.apache.archiva.repository.BasicManagedRepository;
 import org.apache.archiva.repository.scanner.RepositoryScanner;
 import org.apache.archiva.repository.scanner.RepositoryScannerException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -40,6 +41,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * DefaultLegacyRepositoryConverter
@@ -90,10 +92,8 @@ public class DefaultLegacyRepositoryConverter
         {
             String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
 
-            ManagedRepository legacyRepository = new ManagedRepository();
-            legacyRepository.setId( "legacy" );
-            legacyRepository.setName( "Legacy Repository" );
-            legacyRepository.setLocation( legacyRepositoryDirectory.toAbsolutePath().toString() );
+            BasicManagedRepository legacyRepository = new BasicManagedRepository( "legacy", "Legacy Repository");
+            legacyRepository.setLocation( legacyRepositoryDirectory.toAbsolutePath().toUri() );
             legacyRepository.setLayout( "legacy" );
 
             ArtifactRepository repository =

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
index 1dc82a5..7fb542e 100644
--- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
+++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
@@ -19,7 +19,6 @@ package org.apache.archiva.converter.legacy;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.consumers.AbstractMonitoredConsumer;
@@ -28,6 +27,7 @@ import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.converter.artifact.ArtifactConversionException;
 import org.apache.archiva.converter.artifact.ArtifactConverter;
 import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.archiva.repository.ManagedRepositoryContent;
 import org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent;
 import org.apache.archiva.repository.layout.LayoutException;
@@ -85,7 +85,7 @@ public class LegacyConverterArtifactConsumer
     }
 
     @Override
-    public void beginScan( ManagedRepository repository, Date whenGathered )
+    public void beginScan( org.apache.archiva.repository.ManagedRepository repository, Date whenGathered )
         throws ConsumerException
     {
         this.managedRepository = new ManagedDefaultRepositoryContent();

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-indexer/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml
index a9f24ef..992fcf7 100644
--- a/archiva-modules/archiva-base/archiva-indexer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml
@@ -38,6 +38,11 @@
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-common</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-layer</artifactId>
+    </dependency>
+
 
     <dependency>
       <groupId>org.springframework</groupId>

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
index 0e41016..892d7b7 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
@@ -261,6 +261,12 @@ public class MavenRepositorySearch
         {
             throw new RepositorySearchException( "No search fields set." );
         }
+        System.err.println("CLAUSES "+q.getClauses());
+        if (q.getClauses()!=null) {
+            for (BooleanClause cl : q.getClauses()) {
+                System.err.println("Clause "+cl);
+            }
+        }
 
         return search( limits, q, indexingContextIds, Collections.<ArtifactInfoFilter>emptyList(),
                        searchFields.getRepositories(), searchFields.isIncludePomArtifacts() );

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
index e2946ff..ab85ec5 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
@@ -26,7 +26,9 @@ import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.utils.FileUtils;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.ConfigurationListener;
 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.index.ArtifactContext;
@@ -52,6 +54,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * @author Olivier Lamy
@@ -78,6 +81,9 @@ public abstract class AbstractMavenRepositorySearch
     @Inject
     ArtifactContextProducer artifactContextProducer;
 
+    @Inject
+    RepositoryRegistry repositoryRegistry;
+
     IMocksControl archivaConfigControl;
 
     Configuration config;
@@ -116,17 +122,28 @@ public abstract class AbstractMavenRepositorySearch
 
         DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin();
         defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig );
+        repositoryRegistry.setArchivaConfiguration( archivaConfig );
 
         search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, defaultProxyConnectorAdmin,
                                             queryCreator );
 
         defaultManagedRepositoryAdmin.setIndexer( nexusIndexer );
         defaultManagedRepositoryAdmin.setIndexCreators( indexCreators );
+        assertNotNull( repositoryRegistry );
+        defaultManagedRepositoryAdmin.setRepositoryRegistry( repositoryRegistry );
 
         config = new Configuration();
         config.addManagedRepository( createRepositoryConfig( TEST_REPO_1 ) );
         config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) );
         config.addManagedRepository( createRepositoryConfig( REPO_RELEASE ) );
+
+
+        archivaConfig.addListener( EasyMock.anyObject( ConfigurationListener.class ) );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn(config).anyTimes();
+        archivaConfigControl.replay();
+        repositoryRegistry.reload();
+        archivaConfigControl.reset();
     }
 
     @After

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java
index 7257e4a..6942930 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java
@@ -26,6 +26,7 @@ import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * @author Olivier Lamy
@@ -44,7 +45,8 @@ public class MavenRepositorySearchOSGITest
         List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
 
         // search artifactId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java
index a989311..3c10633 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java
@@ -19,15 +19,20 @@ package org.apache.archiva.indexer.search;
  * under the License.
  */
 
+import org.apache.archiva.configuration.ConfigurationEvent;
+import org.apache.archiva.configuration.ConfigurationListener;
 import org.apache.archiva.indexer.util.SearchUtil;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.maven.index_shaded.lucene.index.IndexUpgrader;
 import org.codehaus.plexus.util.FileUtils;
 import org.easymock.EasyMock;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 
+import javax.inject.Inject;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
@@ -35,6 +40,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 
 
 @RunWith( ArchivaSpringJUnit4ClassRunner.class )
@@ -106,7 +112,8 @@ public class MavenRepositorySearchTest
         List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
 
         // search artifactId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -125,9 +132,10 @@ public class MavenRepositorySearchTest
 
         archivaConfigControl.reset();
 
-        // search groupId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
+        // search groupId
         archivaConfigControl.replay();
 
         results = search.search( "user", selectedRepos, "org.apache.archiva", null, null );
@@ -149,7 +157,8 @@ public class MavenRepositorySearchTest
         List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
 
         // search artifactId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -169,7 +178,8 @@ public class MavenRepositorySearchTest
         archivaConfigControl.reset();
 
         // search groupId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -193,7 +203,8 @@ public class MavenRepositorySearchTest
         selectedRepos.add( TEST_REPO_1 );
 
         // search artifactId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -223,7 +234,8 @@ public class MavenRepositorySearchTest
         selectedRepos.add( TEST_REPO_1 );
 
         // search artifactId
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -259,7 +271,8 @@ public class MavenRepositorySearchTest
         List<String> selectedRepos = new ArrayList<>();
         selectedRepos.add( TEST_REPO_1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
         archivaConfigControl.replay();
 
         SearchResults results = search.search( "user", selectedRepos, "archiva search", null, null );
@@ -283,7 +296,8 @@ public class MavenRepositorySearchTest
         SearchResultLimits limits = new SearchResultLimits( 0 );
         limits.setPageSize( 1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -303,7 +317,8 @@ public class MavenRepositorySearchTest
         limits = new SearchResultLimits( 1 );
         limits.setPageSize( 1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -338,7 +353,8 @@ public class MavenRepositorySearchTest
 
         config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 5 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -373,7 +389,8 @@ public class MavenRepositorySearchTest
         List<String> selectedRepos = new ArrayList<>();
         selectedRepos.add( TEST_REPO_1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -392,7 +409,8 @@ public class MavenRepositorySearchTest
         List<String> selectedRepos = new ArrayList<>();
         selectedRepos.add( TEST_REPO_1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -410,8 +428,6 @@ public class MavenRepositorySearchTest
         List<String> selectedRepos = new ArrayList<>();
         selectedRepos.add( "non-existing-repo" );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
-
         archivaConfigControl.replay();
 
         SearchResults results = search.search( "user", selectedRepos, "org.apache.archiva", null, null );
@@ -433,7 +449,8 @@ public class MavenRepositorySearchTest
         List<String> previousSearchTerms = new ArrayList<>();
         previousSearchTerms.add( "archiva-test" );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -471,7 +488,8 @@ public class MavenRepositorySearchTest
         searchFields.setVersion( "1.0" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -506,7 +524,8 @@ public class MavenRepositorySearchTest
         SearchResultLimits limits = new SearchResultLimits( 0 );
         limits.setPageSize( 1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -524,7 +543,8 @@ public class MavenRepositorySearchTest
         limits = new SearchResultLimits( 1 );
         limits.setPageSize( 1 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -556,7 +576,8 @@ public class MavenRepositorySearchTest
         searchFields.setArtifactId( "artifactid-numeric" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -599,7 +620,8 @@ public class MavenRepositorySearchTest
 
         try
         {
-            EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+            EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+            EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
             archivaConfigControl.replay();
 
@@ -633,15 +655,16 @@ public class MavenRepositorySearchTest
 
         try
         {
-            EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
 
+            EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+            EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
             archivaConfigControl.replay();
 
             search.search( "user", searchFields, null );
 
             archivaConfigControl.verify();
 
-            fail( "A RepositorySearchExcecption should have been thrown." );
+            fail( "A RepositorySearchException should have been thrown." );
         }
         catch ( RepositorySearchException e )
         {
@@ -666,7 +689,8 @@ public class MavenRepositorySearchTest
         searchFields.setClassName( "org.apache.archiva.test.App" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -697,7 +721,8 @@ public class MavenRepositorySearchTest
         searchFields.setPackaging( "jar" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -725,7 +750,9 @@ public class MavenRepositorySearchTest
         searchFields.setPackaging( "war" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
+
         archivaConfigControl.replay();
 
         SearchResults results = search.search( "user", searchFields, null );
@@ -748,7 +775,8 @@ public class MavenRepositorySearchTest
         searchFields.setClassName( "com.classname.search.App" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -776,7 +804,8 @@ public class MavenRepositorySearchTest
         searchFields.setGroupId( "org.apache.archiva" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -800,7 +829,8 @@ public class MavenRepositorySearchTest
         searchFields.setClassName( "SomeClass" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 
@@ -849,8 +879,6 @@ public class MavenRepositorySearchTest
         searchFields.setClassName( "SomeClass" );
         searchFields.setRepositories( selectedRepos );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
-
         archivaConfigControl.replay();
 
         SearchResults results = search.search( "user", searchFields, null );
@@ -881,7 +909,8 @@ public class MavenRepositorySearchTest
         SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
         limits.setPageSize( 300 );
 
-        EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 5 );
+        EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes();
+        EasyMock.expect( archivaConfig.getConfiguration()).andReturn(config).anyTimes();
 
         archivaConfigControl.replay();
 

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml
index e0bf5c4..4877906 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml
@@ -28,6 +28,11 @@
        default-lazy-init="false">
 
   <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.repository.content.maven2" />
+
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
+
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java
index e8c2034..d653de5 100644
--- a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java
+++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java
@@ -137,7 +137,7 @@ public class ProxyConnector
 
         sb.append( "ProxyConnector[\n" );
         sb.append( "  source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" );
-        sb.append( "  target: [remote] " ).append( this.targetRepository.getRepository().getUrl() ).append( "\n" );
+        sb.append( "  target: [remote] " ).append( this.targetRepository.getRepository().getLocation() ).append( "\n" );
         sb.append( "  proxyId:" ).append( this.proxyId ).append( "\n" );
 
         Iterator<String> keys = this.policies.keySet().iterator();

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
index 4266bf7..a76e744 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -22,17 +22,27 @@ package org.apache.archiva.proxy;
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.NetworkProxy;
 import org.apache.archiva.admin.model.beans.ProxyConnectorRuleType;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
 import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
 import org.apache.archiva.common.filelock.FileLockException;
 import org.apache.archiva.common.filelock.FileLockManager;
 import org.apache.archiva.common.filelock.FileLockTimeoutException;
 import org.apache.archiva.common.filelock.Lock;
-import org.apache.archiva.configuration.*;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.ConfigurationNames;
+import org.apache.archiva.configuration.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration;
 import org.apache.archiva.model.ArtifactReference;
 import org.apache.archiva.model.Keys;
 import org.apache.archiva.model.RepositoryURL;
-import org.apache.archiva.policies.*;
+import org.apache.archiva.policies.DownloadErrorPolicy;
+import org.apache.archiva.policies.DownloadPolicy;
+import org.apache.archiva.policies.PolicyConfigurationException;
+import org.apache.archiva.policies.PolicyViolationException;
+import org.apache.archiva.policies.PostDownloadPolicy;
+import org.apache.archiva.policies.PreDownloadPolicy;
+import org.apache.archiva.policies.ProxyDownloadException;
 import org.apache.archiva.policies.urlcache.UrlFailureCache;
 import org.apache.archiva.proxy.common.WagonFactory;
 import org.apache.archiva.proxy.common.WagonFactoryException;
@@ -43,7 +53,16 @@ import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
 import org.apache.archiva.redback.components.registry.Registry;
 import org.apache.archiva.redback.components.registry.RegistryListener;
 import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
-import org.apache.archiva.repository.*;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.PasswordCredentials;
+import org.apache.archiva.repository.RemoteRepositoryContent;
+import org.apache.archiva.repository.RepositoryContentFactory;
+import org.apache.archiva.repository.RepositoryCredentials;
+import org.apache.archiva.repository.RepositoryException;
+import org.apache.archiva.repository.RepositoryNotFoundException;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.repository.metadata.MetadataTools;
 import org.apache.archiva.repository.metadata.RepositoryMetadataException;
 import org.apache.archiva.scheduler.ArchivaTaskScheduler;
@@ -73,11 +92,15 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
 
 /**
  * DefaultRepositoryProxyConnectors
@@ -126,6 +149,9 @@ public class DefaultRepositoryProxyConnectors
     private ArchivaTaskScheduler scheduler;
 
     @Inject
+    private RepositoryRegistry repositoryRegistry;
+
+    @Inject
     private NetworkProxyAdmin networkProxyAdmin;
 
     @Inject
@@ -157,86 +183,83 @@ public class DefaultRepositoryProxyConnectors
         {
             String key = proxyConfig.getSourceRepoId();
 
-            try
+            // Create connector object.
+            ProxyConnector connector = new ProxyConnector();
+
+            ManagedRepository repo = repositoryRegistry.getManagedRepository( proxyConfig.getSourceRepoId( ) );
+            if (repo==null) {
+                log.error("Cannot find source repository after config change "+proxyConfig.getSourceRepoId());
+                continue;
+            }
+            connector.setSourceRepository(repo.getContent());
+            RemoteRepository rRepo = repositoryRegistry.getRemoteRepository( proxyConfig.getTargetRepoId() );
+            if (rRepo==null) {
+                log.error("Cannot find target repository after config change "+proxyConfig.getSourceRepoId());
+                continue;
+            }
+            connector.setTargetRepository(rRepo.getContent());
+
+            connector.setProxyId( proxyConfig.getProxyId() );
+            connector.setPolicies( proxyConfig.getPolicies() );
+            connector.setOrder( proxyConfig.getOrder() );
+            connector.setDisabled( proxyConfig.isDisabled() );
+
+            // Copy any blacklist patterns.
+            List<String> blacklist = new ArrayList<>( 0 );
+            if ( CollectionUtils.isNotEmpty( proxyConfig.getBlackListPatterns() ) )
             {
-                // Create connector object.
-                ProxyConnector connector = new ProxyConnector();
-
-                connector.setSourceRepository(
-                    repositoryFactory.getManagedRepositoryContent( proxyConfig.getSourceRepoId() ) );
-                connector.setTargetRepository(
-                    repositoryFactory.getRemoteRepositoryContent( proxyConfig.getTargetRepoId() ) );
-
-                connector.setProxyId( proxyConfig.getProxyId() );
-                connector.setPolicies( proxyConfig.getPolicies() );
-                connector.setOrder( proxyConfig.getOrder() );
-                connector.setDisabled( proxyConfig.isDisabled() );
-
-                // Copy any blacklist patterns.
-                List<String> blacklist = new ArrayList<>( 0 );
-                if ( CollectionUtils.isNotEmpty( proxyConfig.getBlackListPatterns() ) )
-                {
-                    blacklist.addAll( proxyConfig.getBlackListPatterns() );
-                }
-                connector.setBlacklist( blacklist );
+                blacklist.addAll( proxyConfig.getBlackListPatterns() );
+            }
+            connector.setBlacklist( blacklist );
 
-                // Copy any whitelist patterns.
-                List<String> whitelist = new ArrayList<>( 0 );
-                if ( CollectionUtils.isNotEmpty( proxyConfig.getWhiteListPatterns() ) )
-                {
-                    whitelist.addAll( proxyConfig.getWhiteListPatterns() );
-                }
-                connector.setWhitelist( whitelist );
+            // Copy any whitelist patterns.
+            List<String> whitelist = new ArrayList<>( 0 );
+            if ( CollectionUtils.isNotEmpty( proxyConfig.getWhiteListPatterns() ) )
+            {
+                whitelist.addAll( proxyConfig.getWhiteListPatterns() );
+            }
+            connector.setWhitelist( whitelist );
 
-                List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations =
-                    findProxyConnectorRules( connector.getSourceRepository().getId(),
-                                             connector.getTargetRepository().getId(),
-                                             allProxyConnectorRuleConfigurations );
+            List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations =
+                findProxyConnectorRules( connector.getSourceRepository().getId(),
+                                         connector.getTargetRepository().getId(),
+                                         allProxyConnectorRuleConfigurations );
 
-                if ( !proxyConnectorRuleConfigurations.isEmpty() )
+            if ( !proxyConnectorRuleConfigurations.isEmpty() )
+            {
+                for ( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration : proxyConnectorRuleConfigurations )
                 {
-                    for ( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration : proxyConnectorRuleConfigurations )
+                    if ( StringUtils.equals( proxyConnectorRuleConfiguration.getRuleType(),
+                                             ProxyConnectorRuleType.BLACK_LIST.getRuleType() ) )
                     {
-                        if ( StringUtils.equals( proxyConnectorRuleConfiguration.getRuleType(),
-                                                 ProxyConnectorRuleType.BLACK_LIST.getRuleType() ) )
-                        {
-                            connector.getBlacklist().add( proxyConnectorRuleConfiguration.getPattern() );
-                        }
-
-                        if ( StringUtils.equals( proxyConnectorRuleConfiguration.getRuleType(),
-                                                 ProxyConnectorRuleType.WHITE_LIST.getRuleType() ) )
-                        {
-                            connector.getWhitelist().add( proxyConnectorRuleConfiguration.getPattern() );
-                        }
+                        connector.getBlacklist().add( proxyConnectorRuleConfiguration.getPattern() );
                     }
-                }
 
-                // Get other connectors
-                List<ProxyConnector> connectors = this.proxyConnectorMap.get( key );
-                if ( connectors == null )
-                {
-                    // Create if we are the first.
-                    connectors = new ArrayList<>( 1 );
+                    if ( StringUtils.equals( proxyConnectorRuleConfiguration.getRuleType(),
+                                             ProxyConnectorRuleType.WHITE_LIST.getRuleType() ) )
+                    {
+                        connector.getWhitelist().add( proxyConnectorRuleConfiguration.getPattern() );
+                    }
                 }
-
-                // Add the connector.
-                connectors.add( connector );
-
-                // Ensure the list is sorted.
-                Collections.sort( connectors, proxyOrderSorter );
-
-                // Set the key to the list of connectors.
-                this.proxyConnectorMap.put( key, connectors );
             }
-            catch ( RepositoryNotFoundException e )
-            {
-                log.warn( "Unable to use proxy connector: {}", e.getMessage(), e );
-            }
-            catch ( RepositoryException e )
+
+            // Get other connectors
+            List<ProxyConnector> connectors = this.proxyConnectorMap.get( key );
+            if ( connectors == null )
             {
-                log.warn( "Unable to use proxy connector: {}", e.getMessage(), e );
+                // Create if we are the first.
+                connectors = new ArrayList<>( 1 );
             }
 
+            // Add the connector.
+            connectors.add( connector );
+
+            // Ensure the list is sorted.
+            Collections.sort( connectors, proxyOrderSorter );
+
+            // Set the key to the list of connectors.
+            this.proxyConnectorMap.put( key, connectors );
+
 
         }
 
@@ -1176,8 +1199,14 @@ public class DefaultRepositoryProxyConnectors
         }
 
         AuthenticationInfo authInfo = null;
-        String username = remoteRepository.getRepository().getUserName();
-        String password = remoteRepository.getRepository().getPassword();
+        String username = "";
+        String password = "";
+        RepositoryCredentials repCred = remoteRepository.getRepository().getLoginCredentials();
+        if (repCred!=null && repCred instanceof PasswordCredentials) {
+            PasswordCredentials pwdCred = (PasswordCredentials) repCred;
+            username = pwdCred.getUsername();
+            password = pwdCred.getPassword()==null ? "" : new String(pwdCred.getPassword());
+        }
 
         if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) )
         {
@@ -1188,8 +1217,8 @@ public class DefaultRepositoryProxyConnectors
         }
 
         // Convert seconds to milliseconds
-        long timeoutInMilliseconds = TimeUnit.MILLISECONDS.convert( remoteRepository.getRepository().getTimeout(), //
-                                                                    TimeUnit.SECONDS );
+
+        long timeoutInMilliseconds = remoteRepository.getRepository().getTimeout().toMillis();
 
         // Set timeout  read and connect
         // FIXME olamy having 2 config values

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
----------------------------------------------------------------------
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 a8ffb63..2a43b86 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
@@ -36,6 +36,8 @@ import org.apache.archiva.policies.ReleasesPolicy;
 import org.apache.archiva.policies.SnapshotsPolicy;
 import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
 import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.RepositoryRegistry;
+import org.apache.archiva.repository.maven2.MavenManagedRepository;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.index.NexusIndexer;
@@ -55,6 +57,7 @@ import javax.inject.Inject;
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
+import java.net.URI;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -117,8 +120,7 @@ public abstract class AbstractProxyTestCase
 
     WagonDelegate delegate;
 
-    @Inject
-    protected ManagedRepositoryAdmin managedRepositoryAdmin;
+    protected RepositoryRegistry repositoryRegistry;
 
     @Inject
     protected NexusIndexer nexusIndexer;
@@ -143,38 +145,44 @@ public abstract class AbstractProxyTestCase
 
         managedDefaultDir = Paths.get( managedDefaultRepository.getRepoRoot() );
 
-        ManagedRepository repoConfig = managedDefaultRepository.getRepository();
+        org.apache.archiva.repository.ManagedRepository repoConfig = managedDefaultRepository.getRepository();
 
         ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
             ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
 
-        applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
+        applicationContext.getBean( RepositoryRegistry.class ).putRepository( repoConfig );
 
         // to prevent windauze file leaking
         removeMavenIndexes();
 
-        ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
-
-        if ( managedRepositoryAdmin.getManagedRepository( repoConfig.getId() ) != null )
-        {
-            managedRepositoryAdmin.deleteManagedRepository( repoConfig.getId(), null, true );
-        }
-
-        managedRepositoryAdmin.addManagedRepository( repoConfig, false, null );
+        repositoryRegistry = applicationContext.getBean( RepositoryRegistry.class );
+        repositoryRegistry.setArchivaConfiguration( config );
 
         // Setup target (proxied to) repository.
         saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
-                                    Paths.get( REPOPATH_PROXIED1 ).toUri().toURL().toExternalForm(), "default" );
+            Paths.get( REPOPATH_PROXIED1 ).toUri().toURL().toExternalForm(), "default" );
 
         // Setup target (proxied to) repository.
         saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2",
-                                    Paths.get( REPOPATH_PROXIED2 ).toUri().toURL().toExternalForm(), "default" );
+            Paths.get( REPOPATH_PROXIED2 ).toUri().toURL().toExternalForm(), "default" );
+
+        repositoryRegistry.reload();
+
+        if ( repositoryRegistry.getManagedRepository( repoConfig.getId() ) != null )
+        {
+            org.apache.archiva.repository.ManagedRepository managedRepository = repositoryRegistry.getManagedRepository( repoConfig.getId() );
+            repositoryRegistry.removeRepository( managedRepository );
+        }
+
+        repositoryRegistry.putRepository( repoConfig );
+
 
         // Setup the proxy handler.
         //proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
 
         proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class );
 
+
         // Setup the wagon mock.
         wagonMockControl = EasyMock.createNiceControl();
         wagonMock = wagonMockControl.createMock( Wagon.class );
@@ -345,10 +353,8 @@ public abstract class AbstractProxyTestCase
     protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
         throws Exception
     {
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setLocation( path );
+        MavenManagedRepository repo = new MavenManagedRepository(id, name);
+        repo.setLocation( new URI(path) );
         repo.setLayout( layout );
 
         ManagedRepositoryContent repoContent =
@@ -477,6 +483,7 @@ public abstract class AbstractProxyTestCase
         config.triggerChange( prefix + ".name", repoConfig.getName() );
         config.triggerChange( prefix + ".url", repoConfig.getUrl() );
         config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
+        repositoryRegistry.reload();
     }
 
     protected Path saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout )

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
index f1857fb..3445ee8 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
@@ -112,6 +112,7 @@ public class CacheFailuresTransferTest
         saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "test://bad.machine.com/repo/", "default" );
         saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://bad.machine.com/anotherrepo/", "default" );
 
+
         // Configure Connector (usually done within archiva.xml configuration)
         saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
                        SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
----------------------------------------------------------------------
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 fad03d8..8b8d08e 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
@@ -23,6 +23,8 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
+import org.apache.archiva.repository.RepositoryRegistry;
+import org.apache.archiva.repository.maven2.MavenManagedRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.NetworkProxyConfiguration;
@@ -55,10 +57,12 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.net.URI;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Locale;
 
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 
@@ -118,10 +122,8 @@ public class HttpProxyTransferTest
         // Make the destination dir.
         Files.createDirectories(destRepoDir);
 
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( MANAGED_ID );
-        repo.setName( "Default Managed Repository" );
-        repo.setLocation( repoPath );
+        MavenManagedRepository repo = new MavenManagedRepository( MANAGED_ID, "Default Managed Repository" );
+        repo.setLocation( new URI(repoPath) );
         repo.setLayout( "default" );
 
         ManagedRepositoryContent repoContent =
@@ -133,10 +135,10 @@ public class HttpProxyTransferTest
         ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
             ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
 
-        ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
+        RepositoryRegistry managedRepositoryAdmin = applicationContext.getBean( RepositoryRegistry.class );
         if ( managedRepositoryAdmin.getManagedRepository( repo.getId() ) == null )
         {
-            managedRepositoryAdmin.addManagedRepository( repo, false, null );
+            managedRepositoryAdmin.putRepository( repo );
         }
 
         //config.getConfiguration().addManagedRepository( repo );

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java
----------------------------------------------------------------------
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 935f2a6..fce6949 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
@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 import javax.annotation.PostConstruct;
 
@@ -145,4 +146,16 @@ public class MockConfiguration
     {
         // no op
     }
+
+    @Override
+    public Locale getDefaultLocale( )
+    {
+        return Locale.getDefault();
+    }
+
+    @Override
+    public List<Locale.LanguageRange> getLanguagePriorities( )
+    {
+        return Locale.LanguageRange.parse( "en,fr,de" );
+    }
 }

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..834ce5b
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java
@@ -0,0 +1,231 @@
+package org.apache.archiva.repository.mock;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.repository.BasicManagedRepository;
+import org.apache.archiva.repository.BasicRemoteRepository;
+import org.apache.archiva.repository.EditableManagedRepository;
+import org.apache.archiva.repository.EditableRemoteRepository;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.PasswordCredentials;
+import org.apache.archiva.repository.ReleaseScheme;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RepositoryCredentials;
+import org.apache.archiva.repository.RepositoryException;
+import org.apache.archiva.repository.RepositoryProvider;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.features.ArtifactCleanupFeature;
+import org.apache.archiva.repository.features.IndexCreationFeature;
+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.time.Duration;
+import java.time.Period;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Just a simple mock class for the repository provider
+ */
+@Service("mockRepositoryProvider")
+public class RepositoryProviderMock implements RepositoryProvider
+{
+
+    private static final Set<RepositoryType> TYPES = new HashSet<>( );
+
+    static
+    {
+        TYPES.add( RepositoryType.MAVEN );
+        TYPES.add( RepositoryType.NPM );
+    }
+
+    @Override
+    public Set<RepositoryType> provides( )
+    {
+        return TYPES;
+    }
+
+    @Override
+    public EditableManagedRepository createManagedInstance( String id, String name )
+    {
+        return new BasicManagedRepository( id, name );
+    }
+
+    @Override
+    public EditableRemoteRepository createRemoteInstance( String id, String name )
+    {
+        return new BasicRemoteRepository( id, name );
+    }
+
+    @Override
+    public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        BasicManagedRepository managedRepository = new BasicManagedRepository( configuration.getId( ), configuration.getName( ) );
+        updateManagedInstance( managedRepository, configuration );
+        return managedRepository;
+    }
+
+
+    @Override
+    public void updateManagedInstance( EditableManagedRepository managedRepository, ManagedRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        try
+        {
+            managedRepository.setName( managedRepository.getPrimaryLocale(), configuration.getName( ) );
+            managedRepository.setLocation( new URI( configuration.getLocation( )==null ?"" : configuration.getLocation() ) );
+            managedRepository.setBaseUri( new URI( "" ) );
+            managedRepository.setBlocksRedeployment( configuration.isBlockRedeployments( ) );
+            managedRepository.setDescription( managedRepository.getPrimaryLocale(), configuration.getDescription( ) );
+            managedRepository.setLayout( configuration.getLayout( ) );
+            managedRepository.setScanned( configuration.isScanned( ) );
+            managedRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
+            if (configuration.isReleases()) {
+                managedRepository.addActiveReleaseScheme( ReleaseScheme.RELEASE );
+            }
+            if (configuration.isSnapshots()) {
+                managedRepository.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT );
+            }
+            ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
+            acf.setRetentionPeriod( Period.ofDays( configuration.getRetentionPeriod( ) ) );
+            acf.setDeleteReleasedSnapshots( configuration.isDeleteReleasedSnapshots( ) );
+            acf.setRetentionCount( configuration.getRetentionCount( ) );
+            IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
+            icf.setIndexPath( new URI( configuration.getIndexDir( ) ) );
+            icf.setSkipPackedIndexCreation( configuration.isSkipPackedIndexCreation( ) );
+            StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
+            srf.setStageRepoNeeded( configuration.isStageRepoNeeded( ) );
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryException( "Error", e );
+        }
+
+    }
+
+
+    @Override
+    public ManagedRepository createStagingInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        String id = configuration.getId( ) + StagingRepositoryFeature.STAGING_REPO_POSTFIX;
+        BasicManagedRepository managedRepository = new BasicManagedRepository( id, configuration.getName( ) );
+        updateManagedInstance( managedRepository, configuration );
+        return managedRepository;
+    }
+
+    @Override
+    public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        BasicRemoteRepository remoteRepository = new BasicRemoteRepository( configuration.getId( ), configuration.getName( ) );
+        updateRemoteInstance( remoteRepository, configuration );
+        return remoteRepository;
+    }
+
+    @Override
+    public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        try
+        {
+            remoteRepository.setName( remoteRepository.getPrimaryLocale(), configuration.getName( ) );
+            remoteRepository.setBaseUri( new URI( "" ) );
+            remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), configuration.getDescription( ) );
+            remoteRepository.setLayout( configuration.getLayout( ) );
+            remoteRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
+            remoteRepository.setCheckPath( configuration.getCheckPath( ) );
+            remoteRepository.setExtraHeaders( configuration.getExtraHeaders( ) );
+            remoteRepository.setExtraParameters( configuration.getExtraParameters( ) );
+            remoteRepository.setTimeout( Duration.ofSeconds( configuration.getTimeout( ) ) );
+            char[] pwd = configuration.getPassword()==null ? "".toCharArray() : configuration.getPassword().toCharArray();
+            remoteRepository.setCredentials( new PasswordCredentials( configuration.getUsername( ), pwd ) );
+            remoteRepository.setLocation( new URI( configuration.getUrl( )==null ? "" : configuration.getUrl() ) );
+            RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
+            rif.setDownloadRemoteIndexOnStartup( configuration.isDownloadRemoteIndexOnStartup( ) );
+            rif.setDownloadRemoteIndex( configuration.isDownloadRemoteIndex( ) );
+            rif.setIndexUri( new URI( configuration.getIndexDir( ) ) );
+            rif.setDownloadTimeout( Duration.ofSeconds( configuration.getRemoteDownloadTimeout( ) ) );
+            rif.setProxyId( configuration.getRemoteDownloadNetworkProxyId( ) );
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryException( "Error", e );
+        }
+
+    }
+
+    @Override
+    public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository ) throws RepositoryException
+    {
+        ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration( );
+        configuration.setId( managedRepository.getId( ) );
+        configuration.setName(managedRepository.getName());
+        configuration.setLocation( managedRepository.getLocation( ) == null ? "" : managedRepository.getLocation().toString( ) );
+        configuration.setBlockRedeployments( managedRepository.blocksRedeployments( ) );
+        configuration.setDescription( managedRepository.getDescription( ) );
+        configuration.setLayout( managedRepository.getLayout( ) );
+        configuration.setScanned( managedRepository.isScanned( ) );
+        configuration.setRefreshCronExpression( managedRepository.getSchedulingDefinition( ) );
+        configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) );
+        configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) );
+        ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
+        configuration.setRetentionPeriod( acf.getRetentionPeriod( ).getDays( ) );
+        configuration.setDeleteReleasedSnapshots( acf.isDeleteReleasedSnapshots( ) );
+        configuration.setRetentionCount( acf.getRetentionCount( ) );
+        IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
+        configuration.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation( ) );
+        configuration.setIndexDir( icf.getIndexPath( ) == null ? "" : icf.getIndexPath().toString( ) );
+        StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
+        configuration.setStageRepoNeeded( srf.isStageRepoNeeded( ) );
+        return configuration;
+    }
+
+
+    @Override
+    public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) throws RepositoryException
+    {
+        RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( );
+        configuration.setId( remoteRepository.getId( ) );
+        configuration.setName( remoteRepository.getName( ) );
+        configuration.setDescription( remoteRepository.getDescription( ) );
+        configuration.setLayout( remoteRepository.getLayout( ) );
+        configuration.setRefreshCronExpression( remoteRepository.getSchedulingDefinition( ) );
+        configuration.setCheckPath( remoteRepository.getCheckPath( ) );
+        configuration.setExtraHeaders( remoteRepository.getExtraHeaders( ) );
+        configuration.setExtraParameters( remoteRepository.getExtraParameters( ) );
+        configuration.setTimeout( (int) remoteRepository.getTimeout( ).getSeconds( ) );
+        RepositoryCredentials creds = remoteRepository.getLoginCredentials( );
+        if (creds!=null)
+        {
+            PasswordCredentials pwdCreds = (PasswordCredentials) creds;
+            configuration.setUsername( pwdCreds.getUsername( ) );
+            configuration.setPassword( new String( pwdCreds.getPassword( ) ) );
+        }
+        configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) );
+        RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
+        configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) );
+        configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) );
+        configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) );
+        configuration.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) );
+        return configuration;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
index 7a57f01..6ec124f 100755
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
@@ -28,7 +28,10 @@
        default-lazy-init="true">
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.metadata.repository"/>
+  <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.repository.content.maven2,org.apache.archiva.proxy,org.apache.archiva.repository.mock"/>
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
+  <alias name="mockRepositoryProvider" alias="mavenRepositoryProvider" />
 
   <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/>
   <alias name="archivaConfiguration#mock" alias="archivaConfiguration"/>

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
index 5daae07..fff2069 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
@@ -20,11 +20,11 @@ package org.apache.archiva.repository.scanner;
  */
 
 import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.configuration.FileTypes;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.consumers.RepositoryContentConsumer;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
index 5ccdb1e..c3159c7 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -21,13 +21,14 @@ package org.apache.archiva.repository.scanner;
 
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.admin.ArchivaAdministration;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.PathUtil;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
 import org.apache.archiva.redback.components.registry.RegistryListener;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
@@ -41,6 +42,7 @@ import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 
 /**
@@ -262,7 +264,7 @@ public class RepositoryContentConsumers
      * @param localFile              the local file to execute the consumers against.
      * @param updateRelatedArtifacts TODO
      */
-    public void executeConsumers(ManagedRepository repository, Path localFile, boolean updateRelatedArtifacts )
+    public void executeConsumers( ManagedRepository repository, Path localFile, boolean updateRelatedArtifacts )
         throws RepositoryAdminException
     {
         List<KnownRepositoryContentConsumer> selectedKnownConsumers = null;
@@ -296,7 +298,8 @@ public class RepositoryContentConsumers
 
             // yuck. In case you can't read this, it says
             // "process the file if the consumer has it in the includes list, and not in the excludes list"
-            BaseFile baseFile = new BaseFile( repository.getLocation(), localFile.toFile() );
+            Path repoPath = PathUtil.getPathFromUri( repository.getLocation() );
+            BaseFile baseFile = new BaseFile( repoPath.toString(), localFile.toFile() );
             ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate( repository );
             predicate.setBasefile( baseFile );
             predicate.setCaseSensitive( false );

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
index 8e2dd83..1d9ebbe 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
@@ -19,7 +19,7 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.commons.collections.CollectionUtils;
 
 import javax.xml.bind.annotation.XmlRootElement;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
index cfa8f17..8c5cb89 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
@@ -19,9 +19,9 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.repository.ManagedRepository;
 
 import java.util.List;
 import java.util.Set;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
index 55e0e52..5928823 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
@@ -19,11 +19,12 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.PathUtil;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
 import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
@@ -216,7 +217,8 @@ public class RepositoryScannerInstance
             stats.increaseFileCount();
 
             // consume files regardless - the predicate will check the timestamp
-            BaseFile basefile = new BaseFile( repository.getLocation(), file.toFile() );
+            Path repoPath = PathUtil.getPathFromUri( repository.getLocation() );
+            BaseFile basefile = new BaseFile( repoPath.toString(), file.toFile() );
 
             // Timestamp finished points to the last successful scan, not this current one.
             if ( Files.getLastModifiedTime(file).toMillis() >= changesSince )

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
index b830854..4ae19dc 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
@@ -19,7 +19,7 @@ package org.apache.archiva.repository.scanner.functors;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.commons.collections.Closure;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.RepositoryContentConsumer;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
index 3b7cf9d..c4789be 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
@@ -19,7 +19,7 @@ package org.apache.archiva.repository.scanner.functors;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.commons.collections.Closure;
 import org.apache.archiva.consumers.RepositoryContentConsumer;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
index cee2d72..81f9440 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
@@ -19,10 +19,10 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.archiva.repository.ManagedRepository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
index f494bf4..7a48f71 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
@@ -19,12 +19,10 @@ package org.apache.archiva.repository.scanner;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
+import org.apache.archiva.repository.ManagedRepository;
 
 import java.util.ArrayList;
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/archiva/blob/9469c1b6/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
index 988e3ef..c24c0c2 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
@@ -20,11 +20,13 @@ package org.apache.archiva.repository.scanner;
  */
 
 import junit.framework.TestCase;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.repository.BasicManagedRepository;
+import org.apache.archiva.repository.BasicRemoteRepository;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.RemoteRepository;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.commons.lang.SystemUtils;
 import org.easymock.IMocksControl;
@@ -46,6 +48,8 @@ import org.springframework.test.context.ContextConfiguration;
 import javax.inject.Inject;
 import java.io.IOException;
 import java.lang.annotation.Annotation;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
@@ -72,19 +76,15 @@ public class RepositoryContentConsumersTest
 
     protected ManagedRepository createRepository( String id, String name, Path location )
     {
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setLocation( location.toAbsolutePath().toString() );
+        BasicManagedRepository repo = new BasicManagedRepository( id, name  );
+        repo.setLocation( location.toAbsolutePath().toUri() );
         return repo;
     }
 
-    protected RemoteRepository createRemoteRepository( String id, String name, String url )
+    protected RemoteRepository createRemoteRepository( String id, String name, String url ) throws URISyntaxException
     {
-        RemoteRepository repo = new RemoteRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setUrl( url );
+        BasicRemoteRepository repo = new BasicRemoteRepository(id, name);
+        repo.setLocation( new URI( url ) );
         return repo;
     }
 


Mime
View raw message