diff options
author | Martin Stockhammer <martin_s@apache.org> | 2021-06-01 22:46:51 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2021-06-01 22:46:51 +0200 |
commit | 0ce53483a85b6b7a3a14417434edf56934b474ba (patch) | |
tree | 148acd378bdb456482396cb46c315024840fd807 /archiva-modules/archiva-maven | |
parent | ca18ec34d706efa6fdc6ecde6277ba6004e8eb4e (diff) | |
download | archiva-0ce53483a85b6b7a3a14417434edf56934b474ba.tar.gz archiva-0ce53483a85b6b7a3a14417434edf56934b474ba.zip |
Centralizing repository group handling. First part.
Diffstat (limited to 'archiva-modules/archiva-maven')
10 files changed, 57 insertions, 4 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java index c025180ed..e8fc6ce1a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java @@ -24,6 +24,7 @@ import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.IndexCreationFailedException; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.base.RepositoryGroupHandler; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.features.RemoteIndexFeature; import org.apache.archiva.repository.maven.MavenManagedRepository; @@ -61,6 +62,9 @@ public class MavenIndexManagerTest { @Inject ArchivaRepositoryRegistry repositoryRegistry; + @Inject + RepositoryGroupHandler groupHandler; + private Path indexPath; private MavenManagedRepository repository; diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java index b94e6b8e5..575d078ad 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java @@ -31,6 +31,8 @@ import org.apache.archiva.indexer.search.SearchResults; import org.apache.archiva.proxy.ProxyRegistry; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; import org.apache.archiva.repository.Repository; +import org.apache.archiva.repository.base.ConfigurationHandler; +import org.apache.archiva.repository.base.RepositoryGroupHandler; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.lang3.SystemUtils; @@ -93,6 +95,9 @@ public abstract class AbstractMavenRepositorySearch ArchivaRepositoryRegistry repositoryRegistry; @Inject + RepositoryGroupHandler repositoryGroupHandler; + + @Inject ProxyRegistry proxyRegistry; @Inject @@ -143,7 +148,7 @@ public abstract class AbstractMavenRepositorySearch archivaConfig.addListener( EasyMock.anyObject( ConfigurationListener.class ) ); EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes(); EasyMock.expect( archivaConfig.getConfiguration() ).andReturn(config).anyTimes(); - archivaConfig.save(EasyMock.anyObject(Configuration.class)); + archivaConfig.save(EasyMock.anyObject(Configuration.class), EasyMock.anyString()); EasyMock.expectLastCall().anyTimes(); archivaConfigControl.replay(); repositoryRegistry.reload(); @@ -158,7 +163,7 @@ public abstract class AbstractMavenRepositorySearch archivaConfigControl.reset(); EasyMock.expect( archivaConfig.getDefaultLocale() ).andReturn( Locale.getDefault( ) ).anyTimes(); EasyMock.expect( archivaConfig.getConfiguration() ).andReturn(config).anyTimes(); - archivaConfig.save(EasyMock.anyObject(Configuration.class)); + archivaConfig.save(EasyMock.anyObject(Configuration.class), EasyMock.anyString()); EasyMock.expectLastCall().anyTimes(); archivaConfigControl.replay(); repositoryRegistry.removeRepository(TEST_REPO_1); @@ -259,7 +264,7 @@ public abstract class AbstractMavenRepositorySearch archivaConfigControl.reset(); archivaConfig.addListener( EasyMock.anyObject( ConfigurationListener.class ) ); EasyMock.expect( archivaConfig.getConfiguration() ).andReturn(config).anyTimes(); - archivaConfig.save(EasyMock.anyObject(Configuration.class)); + archivaConfig.save(EasyMock.anyObject(Configuration.class), EasyMock.anyString()); EasyMock.expectLastCall().anyTimes(); archivaConfigControl.replay(); repositoryRegistry.reload(); diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchOSGITest.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchOSGITest.java index 8fe10eaf7..90093edf0 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchOSGITest.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchOSGITest.java @@ -23,6 +23,7 @@ import org.apache.archiva.indexer.search.SearchFields; import org.apache.archiva.indexer.search.SearchResultHit; import org.apache.archiva.indexer.search.SearchResults; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; +import org.apache.archiva.repository.base.RepositoryGroupHandler; import org.easymock.EasyMock; import org.junit.After; import org.junit.Test; @@ -43,6 +44,9 @@ public class MavenRepositorySearchOSGITest @Inject ArchivaRepositoryRegistry repositoryRegistry; + @Inject + RepositoryGroupHandler repositoryGroupHandler; + @After @Override public void tearDown() throws Exception { diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchPaginateTest.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchPaginateTest.java index 72cc69fc9..f1aa3eb9b 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchPaginateTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchPaginateTest.java @@ -24,6 +24,7 @@ import org.apache.archiva.indexer.search.SearchResultLimits; import org.apache.archiva.indexer.search.SearchResults; import org.apache.archiva.indexer.util.SearchUtil; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; +import org.apache.archiva.repository.base.RepositoryGroupHandler; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.junit.After; import org.junit.Test; @@ -31,6 +32,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; +import javax.inject.Inject; import java.util.Arrays; /** @@ -42,9 +44,12 @@ public class MavenRepositorySearchPaginateTest extends TestCase { - @Autowired + @Inject ArchivaRepositoryRegistry repositoryRegistry; + @Inject + RepositoryGroupHandler repositoryGroupHandler; + @After public void endTests() { assert repositoryRegistry!=null; diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java index 7e3d945fa..fb9fe0b87 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java @@ -111,6 +111,12 @@ public class MockConfiguration /* do nothing */ } + @Override + public void save( Configuration configuration, String eventTag ) throws RegistryException, IndeterminateConfigurationException + { + // do nothing + } + public void triggerChange( String name, String value ) { for ( org.apache.archiva.components.registry.RegistryListener listener : registryListeners ) diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/storage/mock/MockConfiguration.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/storage/mock/MockConfiguration.java index 018f85eac..7085e96a4 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/storage/mock/MockConfiguration.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/storage/mock/MockConfiguration.java @@ -27,6 +27,7 @@ import org.apache.archiva.configuration.ArchivaRuntimeConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ConfigurationListener; import org.apache.archiva.configuration.FileType; +import org.apache.archiva.configuration.IndeterminateConfigurationException; import org.apache.archiva.configuration.RepositoryScanningConfiguration; import org.apache.commons.lang3.StringUtils; import org.easymock.IMocksControl; @@ -109,6 +110,12 @@ public class MockConfiguration /* do nothing */ } + @Override + public void save( Configuration configuration, String eventTag ) throws RegistryException, IndeterminateConfigurationException + { + // do nothing + } + public void triggerChange( String name, String value ) { for(RegistryListener listener: registryListeners) diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/RepositoryRegistryMock.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/RepositoryRegistryMock.java index 9966d8bb1..4ceed3865 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/RepositoryRegistryMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/RepositoryRegistryMock.java @@ -22,6 +22,7 @@ import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; +import org.apache.archiva.repository.base.ConfigurationHandler; import java.util.Map; import java.util.TreeMap; @@ -31,6 +32,11 @@ public class RepositoryRegistryMock extends ArchivaRepositoryRegistry private Map<String, ManagedRepository> managedRepositories = new TreeMap<>(); + public RepositoryRegistryMock( ConfigurationHandler configurationHandler ) + { + super( configurationHandler ); + } + @Override public ManagedRepository putRepository(ManagedRepository managedRepository) throws RepositoryException { diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/StubConfiguration.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/StubConfiguration.java index 470f24b07..6a34278f6 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/StubConfiguration.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/StubConfiguration.java @@ -57,6 +57,12 @@ public class StubConfiguration } @Override + public void save( Configuration configuration, String eventTag ) throws RegistryException, IndeterminateConfigurationException + { + this.configuration = configuration; + } + + @Override public boolean isDefaulted() { return false; diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/TestConfiguration.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/TestConfiguration.java index 9914da986..78625d715 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/TestConfiguration.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/configuration/TestConfiguration.java @@ -52,6 +52,12 @@ public class TestConfiguration } @Override + public void save( Configuration configuration, String eventTag ) throws RegistryException, IndeterminateConfigurationException + { + this.configuration = configuration; + } + + @Override public boolean isDefaulted() { return false; diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java index 450ebd3ef..d778d5c3b 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java @@ -26,6 +26,7 @@ import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; import org.apache.archiva.repository.base.BasicManagedRepository; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.ReleaseScheme; +import org.apache.archiva.repository.base.RepositoryGroupHandler; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; @@ -74,6 +75,9 @@ public class ArchivaIndexingTaskExecutorTest ArchivaRepositoryRegistry repositoryRegistry; @Inject + RepositoryGroupHandler repositoryGroupHandler; + + @Inject private IndexUpdater indexUpdater; private ManagedRepository repo; |