From bf219edd1656cc03dc35d9e4379890d2c2124459 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Fri, 2 Jul 2021 19:59:13 +0200 Subject: [PATCH] Refactoring of repository classes --- .../org/apache/archiva/cli/ArchivaCli.java | 4 +- .../configuration/ArchivaConfiguration.java | 7 + .../src/test/java/RepositoryProviderMock.java | 5 +- .../test/java/SimpleArtifactConsumerTest.java | 2 +- .../ArtifactMissingChecksumsConsumerTest.java | 2 +- .../AbstractRepositoryPurgeTest.java | 7 +- .../mock/RepositoryProviderMock.java | 4 +- .../lucene/NexusIndexerConsumerTest.java | 4 +- .../AbstractRepositoryAdminTest.java | 3 +- .../group/RepositoryGroupAdminTest.java | 2 +- .../archiva/repository/RepositoryHandler.java | 24 +++ .../repository/RepositoryRegistry.java | 1 + .../AbstractRepositoryValidator.java | 29 ++- .../{ => validation}/CheckedResult.java | 4 +- .../CombinedValidationResponse.java | 74 ++++++++ .../validation/CombinedValidator.java | 87 +++++++++ .../repository/validation/ErrorKeys.java | 38 ++++ .../validation/RepositoryChecker.java | 2 - .../validation/RepositoryValidator.java | 18 +- .../validation/ValidationResponse.java | 2 - .../archiva-repository-layer/pom.xml | 4 + .../base/ArchivaRepositoryRegistry.java | 9 +- .../repository/base/ConfigurationHandler.java | 2 +- .../{ => group}/AbstractRepositoryGroup.java | 8 +- .../BasicRepositoryGroupValidator.java} | 49 ++---- .../{ => group}/RepositoryGroupHandler.java | 37 +++- .../AbstractManagedRepository.java | 6 +- .../{ => managed}/BasicManagedRepository.java | 6 +- .../BasicManagedRepositoryValidator.java | 149 ++++++++++++++++ .../managed/ManagedRepositoryHandler.java | 165 ++++++++++++++++++ .../AbstractRemoteRepository.java | 6 +- .../{ => remote}/BasicRemoteRepository.java | 5 +- .../base/ArchivaRepositoryRegistryTest.java | 3 + .../BasicManagedRepositoryValidatorTest.java | 48 +++++ .../mock/RepositoryProviderMock.java | 4 +- .../RepositoryContentConsumersTest.java | 4 +- .../scanner/RepositoryScannerTest.java | 4 +- .../indexer/maven/MavenIndexManagerTest.java | 2 +- .../search/AbstractMavenRepositorySearch.java | 3 +- .../search/MavenRepositorySearchOSGITest.java | 2 +- .../MavenRepositorySearchPaginateTest.java | 3 +- .../archiva/proxy/AbstractProxyTestCase.java | 2 +- .../archiva/proxy/HttpProxyTransferTest.java | 2 +- .../archiva/proxy/MockConfiguration.java | 6 + .../mock/RepositoryProviderMock.java | 4 +- .../maven/MavenManagedRepository.java | 2 +- .../maven/MavenRemoteRepository.java | 2 +- .../maven/MavenRepositoryGroup.java | 2 +- .../maven/MavenRepositoryProvider.java | 2 +- .../storage/mock/MockConfiguration.java | 6 +- .../mock/configuration/StubConfiguration.java | 7 + .../mock/configuration/TestConfiguration.java | 7 + .../ArchivaIndexingTaskExecutorTest.java | 4 +- ...ivaRepositoryScanningTaskExecutorTest.java | 2 +- .../services/DefaultRepositoriesService.java | 2 +- .../v2/DefaultRepositoryGroupService.java | 6 +- ...ersionsOfArtifactRssFeedProcessorTest.java | 2 +- .../archiva/web/rss/RssFeedServletTest.java | 2 +- .../AbstractRepositoryServletTestCase.java | 2 +- .../webdav/ArchivaDavResourceFactoryTest.java | 2 +- .../webdav/RepositoryServletSecurityTest.java | 2 +- .../DuplicateArtifactsConsumerTest.java | 2 +- 62 files changed, 784 insertions(+), 122 deletions(-) rename archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/{ => validation}/CheckedResult.java (90%) create mode 100644 archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidationResponse.java create mode 100644 archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidator.java create mode 100644 archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ErrorKeys.java rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{ => group}/AbstractRepositoryGroup.java (95%) rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{validation/CommonGroupValidator.java => group/BasicRepositoryGroupValidator.java} (63%) rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{ => group}/RepositoryGroupHandler.java (93%) rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{ => managed}/AbstractManagedRepository.java (94%) rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{ => managed}/BasicManagedRepository.java (96%) create mode 100644 archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepositoryValidator.java create mode 100644 archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{ => remote}/AbstractRemoteRepository.java (96%) rename archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/{ => remote}/BasicRemoteRepository.java (97%) create mode 100644 archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/group/BasicManagedRepositoryValidatorTest.java diff --git a/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java index 9204b4c84..f8d901a1d 100644 --- a/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java +++ b/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java @@ -25,7 +25,7 @@ import org.apache.archiva.consumers.ConsumerException; import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.archiva.consumers.RepositoryContentConsumer; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.scanner.RepositoryScanStatistics; import org.apache.archiva.repository.scanner.RepositoryScanner; import org.apache.archiva.repository.scanner.RepositoryScannerException; @@ -36,8 +36,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import java.io.IOException; import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java index f23025702..cf90a13d3 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java @@ -19,6 +19,7 @@ package org.apache.archiva.configuration; * under the License. */ +import org.apache.archiva.components.registry.Registry; import org.apache.archiva.components.registry.RegistryException; import org.apache.archiva.components.registry.RegistryListener; @@ -138,5 +139,11 @@ public interface ArchivaConfiguration * @return */ public Path getDataDirectory(); + + /** + * Return the used configuration registry + * @return + */ + Registry getRegistry( ); } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java index 8abed28c5..10f9f2d45 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java @@ -23,9 +23,8 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.event.EventHandler; -import org.apache.archiva.event.EventType; -import org.apache.archiva.repository.base.BasicManagedRepository; -import org.apache.archiva.repository.base.BasicRemoteRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.EditableRemoteRepository; import org.apache.archiva.repository.RepositoryGroup; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java index 2554a5583..dcb92399b 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/SimpleArtifactConsumerTest.java @@ -21,7 +21,7 @@ package $package; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySessionFactory; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryRegistry; import org.junit.Before; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java index 27ad9680b..9fed19f2a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java @@ -4,7 +4,7 @@ import org.apache.archiva.checksum.ChecksumAlgorithm; import org.apache.archiva.checksum.ChecksummedFile; import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.commons.io.FileUtils; import org.assertj.core.api.Assertions; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index b2f66aa7f..ed42ef475 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -24,11 +24,9 @@ import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.repository.maven.metadata.storage.Maven2RepositoryPathTranslator; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.ReleaseScheme; import org.apache.archiva.repository.RepositoryContentProvider; import org.apache.archiva.metadata.audit.RepositoryListener; @@ -43,7 +41,6 @@ import org.junit.Before; import org.junit.runner.RunWith; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; -import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import javax.inject.Inject; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index d11008a68..0c8f71f14 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -23,8 +23,8 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.event.EventHandler; -import org.apache.archiva.repository.base.BasicManagedRepository; -import org.apache.archiva.repository.base.BasicRemoteRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.EditableRemoteRepository; import org.apache.archiva.repository.EditableRepositoryGroup; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index 241eeb09b..eb735e6fd 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -25,9 +25,9 @@ import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.FileTypes; import org.apache.archiva.components.taskqueue.TaskQueueException; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.ReleaseScheme; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java index 993151a83..406faf36e 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java @@ -31,11 +31,10 @@ import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.redback.role.RoleManager; import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.memory.SimpleUser; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.lang3.StringUtils; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java index 49fd38573..767c70ac8 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java @@ -26,7 +26,7 @@ import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; import org.apache.archiva.metadata.model.facets.AuditEvent; import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.junit.Test; import javax.inject.Inject; diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java index 4bb414cf8..5dbcfe534 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java @@ -18,8 +18,10 @@ package org.apache.archiva.repository; */ import org.apache.archiva.configuration.Configuration; +import org.apache.archiva.repository.validation.CheckedResult; import org.apache.archiva.repository.validation.RepositoryChecker; import org.apache.archiva.repository.validation.RepositoryValidator; +import org.apache.archiva.repository.validation.ValidationResponse; import java.util.Collection; import java.util.Map; @@ -165,6 +167,28 @@ public interface RepositoryHandler */ RepositoryValidator getValidator( ); + /** + * Validates the set attributes of the given repository instance and returns the validation result. + * The repository registry uses all available validators and applies their validateRepository method to the given + * repository. Validation results will be merged per field. + * + * @param repository the repository to validate against + * @return the result of the validation. + */ + ValidationResponse validateRepository( R repository); + + /** + * Validates the set attributes of the given repository instance for a repository update and returns the validation result. + * The repository registry uses all available validators and applies their validateRepositoryForUpdate method to the given + * repository. Validation results will be merged per field. + * + * @param repository the repository to validate against + * @return the result of the validation. + */ + ValidationResponse validateRepositoryForUpdate( R repository); + + + /** * Returns true, if the repository is registered with the given id, otherwise false * @param id the repository identifier diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java index 2a5210666..ba96fe0b1 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java @@ -29,6 +29,7 @@ import org.apache.archiva.indexer.ArchivaIndexManager; import org.apache.archiva.indexer.IndexUpdateFailedException; import org.apache.archiva.repository.metadata.MetadataReader; import org.apache.archiva.repository.storage.StorageAsset; +import org.apache.archiva.repository.validation.CheckedResult; import org.apache.archiva.repository.validation.ValidationError; import org.apache.archiva.repository.validation.ValidationResponse; diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/AbstractRepositoryValidator.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/AbstractRepositoryValidator.java index 319fc50db..ae45419a1 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/AbstractRepositoryValidator.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/AbstractRepositoryValidator.java @@ -17,16 +17,26 @@ package org.apache.archiva.repository.validation; * under the License. */ -import org.apache.archiva.repository.CheckedResult; import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryRegistry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * @author Martin Stockhammer */ public abstract class AbstractRepositoryValidator implements RepositoryValidator { protected RepositoryRegistry repositoryRegistry; + private final String category; + + public AbstractRepositoryValidator( String category ) + { + this.category = category; + } @Override public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry ) @@ -34,6 +44,23 @@ public abstract class AbstractRepositoryValidator implemen this.repositoryRegistry = repositoryRegistry; } + protected String getCategory() { + return this.category; + } + + + + protected Map> appendError( Map> errorMap, String attribute, String type, Object... parameter ) + { + String errorKey = getCategory( ) + "." + attribute + "." + type; + Map> result; + result = errorMap == null ? new HashMap<>( ) : errorMap; + ValidationError error = ValidationError.ofKey( errorKey, parameter ); + List errList = result.computeIfAbsent( error.getAttribute( ), k -> new ArrayList<>( ) ); + errList.add( error ); + return result; + } + protected abstract ValidationResponse apply( R repo, boolean update ); @Override diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/CheckedResult.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CheckedResult.java similarity index 90% rename from archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/CheckedResult.java rename to archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CheckedResult.java index 41961a5e7..ebc10e8b8 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/CheckedResult.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CheckedResult.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository; +package org.apache.archiva.repository.validation; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,6 +17,8 @@ package org.apache.archiva.repository; * under the License. */ +import org.apache.archiva.repository.Repository; + /** * @author Martin Stockhammer */ diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidationResponse.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidationResponse.java new file mode 100644 index 000000000..388307749 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidationResponse.java @@ -0,0 +1,74 @@ +package org.apache.archiva.repository.validation; +/* + * 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.repository.Repository; +import org.apache.commons.lang3.StringUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Martin Stockhammer + */ +public class CombinedValidationResponse implements CheckedResult>> +{ + + private final Map> errorMap = new HashMap<>( ); + private final R repository; + + public CombinedValidationResponse( R repository ) + { + this.repository = repository; + } + + @Override + public R getRepository( ) + { + return repository; + } + + @Override + public boolean isValid( ) + { + return errorMap.size()==0; + } + + @Override + public Map> getResult( ) + { + return errorMap; + } + + public void addErrors(String key, List errorList) { + if ( StringUtils.isNotEmpty( key ) && errorList!=null && errorList.size()>0) { + this.errorMap.put( key, errorList ); + } + } + + public void addErrors(Map> errorMap) { + if (errorMap!=null) { + errorMap.entrySet( ).stream( ).forEach( e -> addErrors( e.getKey( ), e.getValue( ) ) ); + } + } + + public void addResult(CheckedResult>> result) { + this.addErrors( result.getResult( ) ); + } +} diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidator.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidator.java new file mode 100644 index 000000000..a0dd444ec --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/CombinedValidator.java @@ -0,0 +1,87 @@ +package org.apache.archiva.repository.validation; +/* + * 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.repository.Repository; +import org.apache.archiva.repository.RepositoryRegistry; + +import java.util.List; +import java.util.Map; + +/** + * A combined validator cumulates the validation results of multiple validators + * + * @author Martin Stockhammer + */ +public class CombinedValidator +implements RepositoryValidator { + + private final List> validatorList; + private final Class flavourClazz; + + public CombinedValidator( Class flavourClazz, List> validatorList ) + { + if (flavourClazz==null) { + throw new IllegalArgumentException( "The flavour class may not be null" ); + } + this.flavourClazz = flavourClazz; + if (validatorList==null) { + throw new IllegalArgumentException( "The validator list may not be null" ); + } + this.validatorList = validatorList; + } + + @Override + public CheckedResult>> apply( R r ) + { + CombinedValidationResponse response = new CombinedValidationResponse<>( r ); + validatorList.stream( ).forEach( + v -> response.addResult( v.apply( r ) ) + ); + return response; + } + + @Override + public CheckedResult>> applyForUpdate( R repo ) + { + CombinedValidationResponse response = new CombinedValidationResponse<>( repo ); + validatorList.stream( ).forEach( + v -> response.addResult( v.applyForUpdate( repo ) ) + ); + return response; + + } + + @Override + public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry ) + { + // Not used + } + + @Override + public Class getFlavour( ) + { + return flavourClazz; + } + + @Override + public boolean isFlavour( Class clazz ) + { + return flavourClazz.isAssignableFrom( clazz ); + } +} diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ErrorKeys.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ErrorKeys.java new file mode 100644 index 000000000..315d4dfc4 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ErrorKeys.java @@ -0,0 +1,38 @@ +package org.apache.archiva.repository.validation; +/* + * 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.components.registry.Registry; + +/** + * @author Martin Stockhammer + */ +public interface ErrorKeys +{ + String ISNULL = "isnull"; + String ISEMPTY = "empty"; + String EXISTS = "exists"; + String MANAGED_REPOSITORY_EXISTS = "managed_repo_exists"; + String REMOTE_REPOSITORY_EXISTS = "remote_repo_exists"; + String REPOSITORY_GROUP_EXISTS = "group_exists"; + String MAX_LENGTH_EXCEEDED = "max_length"; + String INVALID_CHARS = "invalid_chars"; + String BELOW_MIN = "min"; + String INVALID_SCHEDULING_EXPRESSION = "scheduling_exp_invalid"; + String INVALID_LOCATION = "location_invalid"; +} diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryChecker.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryChecker.java index f208d10fe..28972491f 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryChecker.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryChecker.java @@ -17,11 +17,9 @@ package org.apache.archiva.repository.validation; * under the License. */ -import org.apache.archiva.repository.CheckedResult; import org.apache.archiva.repository.Repository; import java.util.function.Function; -import java.util.function.Predicate; /** * @author Martin Stockhammer diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryValidator.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryValidator.java index 041fe8a48..25382b31b 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryValidator.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/RepositoryValidator.java @@ -33,6 +33,11 @@ import java.util.function.Function; public interface RepositoryValidator extends RepositoryChecker>>, Comparable> { + String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$"; + String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$"; + String REPOSITORY_LOCATION_VALID_EXPRESSION = "^[-a-zA-Z0-9._/~:?!&=\\\\]+$"; + + int DEFAULT_PRIORITY=1000; /** @@ -81,5 +86,16 @@ public interface RepositoryValidator extends RepositoryChe Class getFlavour(); - boolean isFlavour(Class clazz); + default boolean isFlavour(Class clazz) { + return getFlavour( ).isAssignableFrom( clazz ); + } + + @SuppressWarnings( "unchecked" ) + default RepositoryValidator narrowTo( Class clazz ) { + if (isFlavour( clazz )) { + return (RepositoryValidator) this; + } else { + throw new IllegalArgumentException( "Could not narrow to " + clazz ); + } + } } diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ValidationResponse.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ValidationResponse.java index 377a3ccb2..f52db1fc7 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ValidationResponse.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/validation/ValidationResponse.java @@ -17,7 +17,6 @@ package org.apache.archiva.repository.validation; * under the License. */ -import org.apache.archiva.repository.CheckedResult; import org.apache.archiva.repository.Repository; import java.util.ArrayList; @@ -25,7 +24,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Function; /** * A validation response gives information about the validation status for certain attributes. diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index 496450386..877487935 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -78,6 +78,10 @@ org.apache.archiva.components.registry archiva-components-spring-registry-api + + org.apache.archiva.components + archiva-components-spring-quartz + com.cronutils cron-utils diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java index d3eb836c2..34a4f956c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java @@ -38,7 +38,8 @@ import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.IndexCreationFailedException; import org.apache.archiva.indexer.IndexManagerFactory; import org.apache.archiva.indexer.IndexUpdateFailedException; -import org.apache.archiva.repository.CheckedResult; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; +import org.apache.archiva.repository.validation.CheckedResult; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.EditableRemoteRepository; import org.apache.archiva.repository.EditableRepository; @@ -52,7 +53,6 @@ import org.apache.archiva.repository.RepositoryProvider; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.UnsupportedRepositoryTypeException; -import org.apache.archiva.repository.base.validation.CommonGroupValidator; import org.apache.archiva.repository.event.LifecycleEvent; import org.apache.archiva.repository.event.RepositoryEvent; import org.apache.archiva.repository.event.RepositoryIndexEvent; @@ -61,7 +61,6 @@ import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.features.StagingRepositoryFeature; import org.apache.archiva.repository.metadata.MetadataReader; import org.apache.archiva.repository.storage.StorageAsset; -import org.apache.archiva.repository.validation.RepositoryChecker; import org.apache.archiva.repository.validation.RepositoryValidator; import org.apache.archiva.repository.validation.ValidationError; import org.apache.archiva.repository.validation.ValidationResponse; @@ -240,7 +239,7 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa } - protected Map getRepositoryProviderMap( ) + public Map getRepositoryProviderMap( ) { Map map = new HashMap<>( ); if ( repositoryProviders != null ) @@ -256,7 +255,7 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa return map; } - protected RepositoryProvider getProvider( RepositoryType type ) throws RepositoryException + public RepositoryProvider getProvider( RepositoryType type ) throws RepositoryException { return repositoryProviders.stream( ).filter( repositoryProvider -> repositoryProvider.provides( ).contains( type ) ).findFirst( ).orElseThrow( ( ) -> new RepositoryException( "Repository type cannot be handled: " + type ) ); } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ConfigurationHandler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ConfigurationHandler.java index 4c21083e9..9278e022a 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ConfigurationHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ConfigurationHandler.java @@ -72,7 +72,7 @@ public class ConfigurationHandler archivaConfiguration.save( configuration, "" ); } - ReentrantReadWriteLock getLock() { + public ReentrantReadWriteLock getLock() { return lock; } } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/AbstractRepositoryGroup.java similarity index 95% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepositoryGroup.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/AbstractRepositoryGroup.java index 155e57502..d24f00ebd 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepositoryGroup.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/AbstractRepositoryGroup.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base; +package org.apache.archiva.repository.base.group; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.repository.base; * "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 - * + * 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 @@ -23,6 +22,7 @@ import org.apache.archiva.repository.EditableRepositoryGroup; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RepositoryCapabilities; import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.base.AbstractRepository; import org.apache.archiva.repository.storage.RepositoryStorage; import org.apache.commons.collections4.map.ListOrderedMap; @@ -38,7 +38,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; public class AbstractRepositoryGroup extends AbstractRepository implements EditableRepositoryGroup { - private ListOrderedMap repositories = new ListOrderedMap<>(); + private final ListOrderedMap repositories = new ListOrderedMap<>(); private int mergedIndexTTL; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/validation/CommonGroupValidator.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/BasicRepositoryGroupValidator.java similarity index 63% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/validation/CommonGroupValidator.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/BasicRepositoryGroupValidator.java index f9fd6fd1e..308dd3aed 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/validation/CommonGroupValidator.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/BasicRepositoryGroupValidator.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base.validation; +package org.apache.archiva.repository.base.group; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,7 +17,6 @@ package org.apache.archiva.repository.base.validation; * under the License. */ -import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryGroup; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.base.ConfigurationHandler; @@ -28,13 +27,13 @@ import org.apache.archiva.repository.validation.ValidationResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static org.apache.archiva.repository.validation.ErrorKeys.*; + /** * * A validator for repository groups. All validation errors are prefixed with category 'repository_group'. @@ -42,54 +41,47 @@ import java.util.regex.Pattern; * @author Martin Stockhammer */ @Service( "repositoryValidator#common#group" ) -public class CommonGroupValidator extends AbstractRepositoryValidator implements RepositoryValidator +public class BasicRepositoryGroupValidator extends AbstractRepositoryValidator implements RepositoryValidator { - private static final Pattern REPO_GROUP_ID_PATTERN = Pattern.compile( "[A-Za-z0-9\\._\\-]+" ); + private static final String CATEGORY = "repository_group"; + private static final Pattern REPO_GROUP_ID_PATTERN = Pattern.compile( "[A-Za-z0-9._\\-]+" ); private final ConfigurationHandler configurationHandler; private RepositoryRegistry repositoryRegistry; - public CommonGroupValidator( ConfigurationHandler configurationHandler ) + public BasicRepositoryGroupValidator( ConfigurationHandler configurationHandler ) { + super( CATEGORY ); this.configurationHandler = configurationHandler; } - private Map> appendError( Map> errorMap, String errorKey, Object... parameter ) - { - Map> result; - result = errorMap == null ? new HashMap<>( ) : errorMap; - ValidationError error = ValidationError.ofKey( errorKey, parameter ); - List errList = result.computeIfAbsent( error.getAttribute( ), k -> new ArrayList( ) ); - errList.add( error ); - return result; - } - - public ValidationResponse apply( RepositoryGroup repositoryGroup, boolean updateMode ) throws IllegalArgumentException + @Override + public ValidationResponse apply( RepositoryGroup repositoryGroup, boolean updateMode ) throws IllegalArgumentException { final String repoGroupId = repositoryGroup.getId( ); Map> errors = null; if ( StringUtils.isBlank( repoGroupId ) ) { - errors = appendError( errors, "repository_group.id.empty" ); + errors = appendError( null, "id", ISEMPTY ); } if ( repoGroupId.length( ) > 100 ) { - errors = appendError( errors, "repository_group.id.max_length", repoGroupId, Integer.toString( 100 ) ); + errors = appendError( errors, "id", MAX_LENGTH_EXCEEDED, repoGroupId, Integer.toString( 100 ) ); } Matcher matcher = REPO_GROUP_ID_PATTERN.matcher( repoGroupId ); if ( !matcher.matches( ) ) { - errors = appendError( errors, "repository_group.id.invalid_chars", "alphanumeric, '.', '-','_'" ); + errors = appendError( errors, "id", INVALID_CHARS, repoGroupId, new String[]{"alphanumeric, '.', '-','_'"} ); } if ( repositoryGroup.getMergedIndexTTL( ) <= 0 ) { - errors = appendError( errors, "repository_group.merged_index_ttl.min", "0" ); + errors = appendError( errors, "merged_index_ttl",BELOW_MIN, "0" ); } @@ -97,18 +89,18 @@ public class CommonGroupValidator extends AbstractRepositoryValidator(repositoryGroup, errors ); } @@ -136,9 +128,4 @@ public class CommonGroupValidator extends AbstractRepositoryValidator clazz ) - { - return RepositoryGroup.class.isAssignableFrom( clazz ); - } } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java similarity index 93% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java index 8604ba9d1..dba60f8ee 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base; +package org.apache.archiva.repository.base.group; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -20,13 +20,15 @@ package org.apache.archiva.repository.base; import org.apache.archiva.components.registry.RegistryException; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.IndeterminateConfigurationException; -import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.indexer.merger.MergedRemoteIndexesScheduler; -import org.apache.archiva.repository.CheckedResult; +import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; +import org.apache.archiva.repository.base.ConfigurationHandler; +import org.apache.archiva.repository.validation.CheckedResult; import org.apache.archiva.repository.EditableRepository; import org.apache.archiva.repository.EditableRepositoryGroup; import org.apache.archiva.repository.ManagedRepository; +import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryGroup; import org.apache.archiva.repository.RepositoryHandler; @@ -35,8 +37,10 @@ import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.event.RepositoryEvent; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.storage.StorageAsset; +import org.apache.archiva.repository.validation.CombinedValidator; import org.apache.archiva.repository.validation.RepositoryChecker; import org.apache.archiva.repository.validation.RepositoryValidator; +import org.apache.archiva.repository.validation.ValidationResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,13 +94,24 @@ public class RepositoryGroupHandler implements RepositoryHandler repositoryGroupValidator + List> repositoryGroupValidatorList ) { this.configurationHandler = configurationHandler; this.mergedRemoteIndexesScheduler = mergedRemoteIndexesScheduler; this.repositoryRegistry = repositoryRegistry; - this.validator = repositoryGroupValidator; + List> validatorList = initValidators( repositoryGroupValidatorList ); + this.validator = new CombinedValidator<>( RepositoryGroup.class, validatorList ); + } + + private List> initValidators(List> repositoryGroupValidatorList) { + if (repositoryGroupValidatorList!=null && repositoryGroupValidatorList.size()>0) { + return repositoryGroupValidatorList.stream( ).filter( + v -> v.isFlavour( RepositoryGroup.class ) + ).map( v -> v.narrowTo( RepositoryGroup.class ) ).collect( Collectors.toList( ) ); + } else { + return Collections.emptyList( ); + } } @Override @@ -565,6 +580,18 @@ public class RepositoryGroupHandler implements RepositoryHandler validateRepository( RepositoryGroup repository ) + { + return null; + } + + @Override + public ValidationResponse validateRepositoryForUpdate( RepositoryGroup repository ) + { + return null; + } + @Override public boolean has( String id ) { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/AbstractManagedRepository.java similarity index 94% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractManagedRepository.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/AbstractManagedRepository.java index 57ce041c3..aaac150e5 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractManagedRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/AbstractManagedRepository.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base; +package org.apache.archiva.repository.base.managed; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.repository.base; * "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 - * + * 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 @@ -24,6 +23,7 @@ import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.ReleaseScheme; import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.base.AbstractRepository; import org.apache.archiva.repository.storage.RepositoryStorage; import java.util.Collections; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepository.java similarity index 96% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepository.java index a82fd77a9..5840d22be 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepository.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base; +package org.apache.archiva.repository.base.managed; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.repository.base; * "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 - * + * 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 @@ -26,7 +25,6 @@ import org.apache.archiva.repository.RepositoryCapabilities; import org.apache.archiva.repository.RepositoryRequestInfo; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.StandardCapabilities; -import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.repository.storage.fs.FilesystemStorage; import org.apache.archiva.repository.storage.RepositoryStorage; import org.apache.archiva.repository.features.ArtifactCleanupFeature; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepositoryValidator.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepositoryValidator.java new file mode 100644 index 000000000..5b9e3a739 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/BasicManagedRepositoryValidator.java @@ -0,0 +1,149 @@ +package org.apache.archiva.repository.base.managed; +/* + * 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.components.registry.Registry; +import org.apache.archiva.repository.base.ConfigurationHandler; +import org.apache.archiva.repository.validation.AbstractRepositoryValidator; +import org.apache.archiva.repository.ManagedRepository; +import org.apache.archiva.repository.RepositoryRegistry; +import org.apache.archiva.repository.validation.RepositoryValidator; +import org.apache.archiva.repository.validation.ValidationError; +import org.apache.archiva.repository.validation.ValidationResponse; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.apache.archiva.components.scheduler.CronExpressionValidator; + + +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +import static org.apache.archiva.repository.validation.ErrorKeys.*; + +/** + * Validator for managed repository data. + * + * @author Martin Stockhammer + */ +@Service( "repositoryValidator#common#managed" ) +public class BasicManagedRepositoryValidator extends AbstractRepositoryValidator implements RepositoryValidator +{ + RepositoryRegistry repositoryRegistry; + private static final String CATEGORY = "managed_repository"; + private static final Pattern REPOSITORY_ID_VALID_EXPRESSION_PATTERN = Pattern.compile( REPOSITORY_ID_VALID_EXPRESSION ); + private static final Pattern REPOSITORY_NAME_VALID_EXPRESSION_PATTERN = Pattern.compile( REPOSITORY_NAME_VALID_EXPRESSION ); + private static final Pattern REPOSITORY_LOCATION_VALID_EXPRESSION_PATTERN = Pattern.compile( REPOSITORY_LOCATION_VALID_EXPRESSION ); + + private final ConfigurationHandler configurationHandler; + + + public BasicManagedRepositoryValidator( ConfigurationHandler configurationHandler) + { + super( CATEGORY ); + this.configurationHandler = configurationHandler; + } + + @Override + public ValidationResponse apply( ManagedRepository managedRepository, boolean update ) + { + Map> errors = null; + if (managedRepository==null) { + errors = appendError( errors, "id", ISNULL ); + } + final String repoId = managedRepository.getId( ); + if ( StringUtils.isBlank( repoId ) ) { + errors = appendError( errors, "id", ISEMPTY ); + } + + if (!update) + { + if ( repositoryRegistry.hasManagedRepository( managedRepository.getId( ) ) ) + { + errors = appendError( errors, "id", MANAGED_REPOSITORY_EXISTS, repoId ); + } + else if ( repositoryRegistry.hasRemoteRepository( repoId ) ) + { + errors = appendError( errors, "id", REMOTE_REPOSITORY_EXISTS, repoId ); + } + else if ( repositoryRegistry.hasRepositoryGroup( repoId ) ) + { + errors = appendError( errors, "id", REPOSITORY_GROUP_EXISTS, repoId ); + } + } + + if ( !REPOSITORY_ID_VALID_EXPRESSION_PATTERN.matcher( repoId ).matches( ) ) + { + errors = appendError( errors, "id", INVALID_CHARS, repoId, new String[]{"alphanumeric", "_", ".", "-"} ); + } + if ( StringUtils.isBlank( managedRepository.getName() ) ) + { + errors = appendError( errors, "name", ISEMPTY ); + } + + if ( !REPOSITORY_NAME_VALID_EXPRESSION_PATTERN.matcher( managedRepository.getName() ).matches( ) ) + { + errors = appendError( errors, "name", INVALID_CHARS, managedRepository.getName( ), new String[]{"alphanumeric", "whitespace", "/", "(", ")", "_", ".", "-"} ); + } + + String cronExpression = managedRepository.getSchedulingDefinition( ); + if ( StringUtils.isNotBlank( cronExpression ) ) + { + CronExpressionValidator validator = new CronExpressionValidator( ); + + if ( !validator.validate( cronExpression ) ) + { + errors = appendError( errors, "scheduling_definition", INVALID_SCHEDULING_EXPRESSION, cronExpression ); + } + } + // Cron expression may be empty + + String repoLocation = interpolateVars( managedRepository.getLocation( ).toString() ); + + if ( !REPOSITORY_LOCATION_VALID_EXPRESSION_PATTERN.matcher( repoLocation ).matches() ) + { + errors = appendError( errors, "location", INVALID_LOCATION, repoLocation, new String[]{"alphanumeric", "=", "?", "!", "&", "/", "\\", "_", ".", ":", "~", "-"} ); + } + + return new ValidationResponse<>( managedRepository, errors ); + } + + public String interpolateVars( String directory ) + { + Registry registry = configurationHandler.getArchivaConfiguration( ).getRegistry( ); + String value = StringUtils.replace( directory, "${appserver.base}", + registry.getString( "appserver.base", "${appserver.base}" ) ); + value = StringUtils.replace( value, "${appserver.home}", + registry.getString( "appserver.home", "${appserver.home}" ) ); + return value; + } + + + @Override + public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry ) + { + this.repositoryRegistry = repositoryRegistry; + } + + @Override + public Class getFlavour( ) + { + return ManagedRepository.class; + } + +} diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java new file mode 100644 index 000000000..3aa65dea2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java @@ -0,0 +1,165 @@ +package org.apache.archiva.repository.base.managed; +/* + * 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.Configuration; +import org.apache.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; +import org.apache.archiva.repository.base.ConfigurationHandler; +import org.apache.archiva.repository.validation.CheckedResult; +import org.apache.archiva.repository.ManagedRepository; +import org.apache.archiva.repository.RepositoryException; +import org.apache.archiva.repository.RepositoryHandler; +import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.validation.RepositoryChecker; +import org.apache.archiva.repository.validation.RepositoryValidator; +import org.apache.archiva.repository.validation.ValidationResponse; + +import javax.inject.Named; +import java.util.Collection; +import java.util.Map; + +/** + * Handler implementation for managed repositories. + * + * @author Martin Stockhammer + */ +public class ManagedRepositoryHandler +implements RepositoryHandler +{ + + public ManagedRepositoryHandler( ArchivaRepositoryRegistry repositoryRegistry, + ConfigurationHandler configurationHandler, + @Named( "repositoryValidator#common#managed") RepositoryValidator managedRepositoryValidator ) + { + } + + @Override + public Map newInstancesFromConfig( ) + { + return null; + } + + @Override + public ManagedRepository newInstance( RepositoryType type, String id ) throws RepositoryException + { + return null; + } + + @Override + public ManagedRepository newInstance( ManagedRepositoryConfiguration repositoryConfiguration ) throws RepositoryException + { + return null; + } + + @Override + public ManagedRepository put( ManagedRepository repository ) throws RepositoryException + { + return null; + } + + @Override + public ManagedRepository put( ManagedRepositoryConfiguration repositoryConfiguration ) throws RepositoryException + { + return null; + } + + @Override + public ManagedRepository put( ManagedRepositoryConfiguration repositoryConfiguration, Configuration configuration ) throws RepositoryException + { + return null; + } + + @Override + public CheckedResult putWithCheck( ManagedRepositoryConfiguration repositoryConfiguration, RepositoryChecker checker ) throws RepositoryException + { + return null; + } + + @Override + public void remove( String id ) throws RepositoryException + { + + } + + @Override + public void remove( String id, Configuration configuration ) throws RepositoryException + { + + } + + @Override + public ManagedRepository get( String id ) + { + return null; + } + + @Override + public ManagedRepository clone( ManagedRepository repo ) throws RepositoryException + { + return null; + } + + @Override + public void updateReferences( ManagedRepository repo, ManagedRepositoryConfiguration repositoryConfiguration ) throws RepositoryException + { + + } + + @Override + public Collection getAll( ) + { + return null; + } + + @Override + public RepositoryValidator getValidator( ) + { + return null; + } + + @Override + public ValidationResponse validateRepository( ManagedRepository repository ) + { + return null; + } + + @Override + public ValidationResponse validateRepositoryForUpdate( ManagedRepository repository ) + { + return null; + } + + @Override + public boolean has( String id ) + { + return false; + } + + @Override + public void init( ) + { + + } + + @Override + public void close( ) + { + + } +} diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/remote/AbstractRemoteRepository.java similarity index 96% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/remote/AbstractRemoteRepository.java index 51d7a98da..72f2fe892 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/remote/AbstractRemoteRepository.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base; +package org.apache.archiva.repository.base.remote; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.repository.base; * "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 - * + * 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 @@ -24,6 +23,7 @@ import org.apache.archiva.repository.EditableRemoteRepository; import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.repository.RepositoryCredentials; import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.base.AbstractRepository; import org.apache.archiva.repository.storage.RepositoryStorage; import java.net.URI; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicRemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/remote/BasicRemoteRepository.java similarity index 97% rename from archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicRemoteRepository.java rename to archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/remote/BasicRemoteRepository.java index afec07069..0b6d49b47 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicRemoteRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/remote/BasicRemoteRepository.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.base; +package org.apache.archiva.repository.base.remote; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.repository.base; * "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 - * + * 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 diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistryTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistryTest.java index 00bbbc8c1..6601ad2c0 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistryTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistryTest.java @@ -30,6 +30,9 @@ import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/group/BasicManagedRepositoryValidatorTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/group/BasicManagedRepositoryValidatorTest.java new file mode 100644 index 000000000..5b950f923 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/base/group/BasicManagedRepositoryValidatorTest.java @@ -0,0 +1,48 @@ +package org.apache.archiva.repository.base.group; + +/* + * 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.junit.jupiter.api.Test; + +/** + * @author Martin Stockhammer + */ +class BasicManagedRepositoryValidatorTest +{ + + @Test + void apply( ) + { + } + + @Test + void applyForUpdate( ) + { + } + + @Test + void getFlavour( ) + { + } + + @Test + void isFlavour( ) + { + } +} \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index 90dd593e6..c98ba066b 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -30,8 +30,8 @@ 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.apache.archiva.repository.base.BasicManagedRepository; -import org.apache.archiva.repository.base.BasicRemoteRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.apache.archiva.repository.base.PasswordCredentials; import org.springframework.stereotype.Service; 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 adb5cb0ca..37989d9b3 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 @@ -23,8 +23,8 @@ import junit.framework.TestCase; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.archiva.repository.base.BasicManagedRepository; -import org.apache.archiva.repository.base.BasicRemoteRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java index 45476eebf..8ac297925 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java @@ -24,8 +24,8 @@ import org.apache.archiva.common.filelock.DefaultFileLockManager; import org.apache.archiva.common.filelock.FileLockManager; import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.archiva.repository.base.BasicManagedRepository; -import org.apache.archiva.repository.base.BasicRemoteRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.EditableRemoteRepository; import org.apache.archiva.repository.ManagedRepository; 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 e8fc6ce1a..793a1908e 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,7 +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.base.group.RepositoryGroupHandler; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.features.RemoteIndexFeature; import org.apache.archiva.repository.maven.MavenManagedRepository; 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 575d078ad..a5b8f647e 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,8 +31,7 @@ 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.base.group.RepositoryGroupHandler; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.lang3.SystemUtils; 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 90093edf0..112083760 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,7 +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.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.easymock.EasyMock; import org.junit.After; import org.junit.Test; 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 f1aa3eb9b..124c4d1b3 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,12 +24,11 @@ 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.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import javax.inject.Inject; diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index c442d5168..ec1a5319d 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -24,7 +24,7 @@ import org.apache.archiva.configuration.*; import org.apache.archiva.policies.*; import org.apache.archiva.proxy.model.RepositoryProxyHandler; import org.apache.archiva.repository.*; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.maven.wagon.Wagon; diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index c59f0ee5a..a2ab1a299 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -34,7 +34,7 @@ import org.apache.archiva.repository.content.BaseRepositoryContentLayout; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.content.Artifact; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; 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 fb9fe0b87..13e45d27b 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 @@ -205,4 +205,10 @@ public class MockConfiguration return getAppServerBaseDir().resolve("data"); } } + + @Override + public Registry getRegistry( ) + { + return null; + } } diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index e30a0f2b3..73ad62ef4 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -23,8 +23,8 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.event.EventHandler; -import org.apache.archiva.repository.base.BasicManagedRepository; -import org.apache.archiva.repository.base.BasicRemoteRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; +import org.apache.archiva.repository.base.remote.BasicRemoteRepository; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.EditableRemoteRepository; import org.apache.archiva.repository.EditableRepositoryGroup; diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java index a09e1e6df..4005b87c2 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java @@ -28,7 +28,7 @@ import org.apache.archiva.repository.RepositoryRequestInfo; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.StandardCapabilities; import org.apache.archiva.repository.UnsupportedFeatureException; -import org.apache.archiva.repository.base.AbstractManagedRepository; +import org.apache.archiva.repository.base.managed.AbstractManagedRepository; import org.apache.archiva.repository.features.ArtifactCleanupFeature; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.features.RepositoryFeature; diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRemoteRepository.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRemoteRepository.java index 696eeff5c..6c73f65ac 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRemoteRepository.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRemoteRepository.java @@ -8,7 +8,7 @@ import org.apache.archiva.repository.RepositoryCapabilities; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.StandardCapabilities; import org.apache.archiva.repository.UnsupportedFeatureException; -import org.apache.archiva.repository.base.AbstractRemoteRepository; +import org.apache.archiva.repository.base.remote.AbstractRemoteRepository; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.features.RemoteIndexFeature; import org.apache.archiva.repository.features.RepositoryFeature; diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java index 5d2628f8d..c1be960f1 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java @@ -26,7 +26,7 @@ import org.apache.archiva.repository.ReleaseScheme; import org.apache.archiva.repository.RepositoryCapabilities; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.StandardCapabilities; -import org.apache.archiva.repository.base.AbstractRepositoryGroup; +import org.apache.archiva.repository.base.group.AbstractRepositoryGroup; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.storage.fs.FilesystemStorage; import org.slf4j.Logger; diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java index 1deadfe38..de7d279ee 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java @@ -41,7 +41,7 @@ import org.apache.archiva.repository.RepositoryGroup; import org.apache.archiva.repository.RepositoryProvider; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.UnsupportedURIException; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.base.PasswordCredentials; import org.apache.archiva.repository.event.RepositoryEvent; import org.apache.archiva.repository.features.ArtifactCleanupFeature; 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 7085e96a4..35896ba1f 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 @@ -201,7 +201,11 @@ public class MockConfiguration } } - + @Override + public Registry getRegistry( ) + { + return null; + } } 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 6a34278f6..b63208f04 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 @@ -18,6 +18,7 @@ package org.apache.archiva.repository.maven.mock.configuration; * under the License. */ +import org.apache.archiva.components.registry.Registry; import org.apache.archiva.components.registry.RegistryException; import org.apache.archiva.components.registry.RegistryListener; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -149,4 +150,10 @@ public class StubConfiguration } } + + @Override + public Registry getRegistry( ) + { + return null; + } } 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 78625d715..f88bd7cc7 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 @@ -1,5 +1,6 @@ package org.apache.archiva.repository.maven.mock.configuration; +import org.apache.archiva.components.registry.Registry; import org.apache.archiva.components.registry.RegistryException; import org.apache.archiva.components.registry.RegistryListener; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -138,4 +139,10 @@ public class TestConfiguration return getAppServerBaseDir().resolve("data"); } } + + @Override + public Registry getRegistry( ) + { + return null; + } } 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 d778d5c3b..f8c4a3443 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 @@ -23,10 +23,10 @@ import junit.framework.TestCase; import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.UnsupportedBaseContextException; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.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.base.group.RepositoryGroupHandler; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java index 443078efb..edacadf75 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java @@ -29,7 +29,7 @@ import org.apache.archiva.mock.MockRepositorySessionFactory; import org.apache.archiva.components.taskqueue.execution.TaskExecutor; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.junit.After; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java index 06c2e4ee6..8a8f0deb9 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java @@ -47,7 +47,7 @@ import org.apache.archiva.redback.system.SecuritySystem; import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.UserManagerException; import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.repository.content.BaseRepositoryContentLayout; import org.apache.archiva.repository.content.ContentNotFoundException; import org.apache.archiva.repository.content.LayoutException; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java index 2d73a53f2..4927b2161 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java @@ -34,19 +34,15 @@ package org.apache.archiva.rest.services.v2;/* * under the License. */ -import org.apache.archiva.components.registry.RegistryException; import org.apache.archiva.components.rest.model.PagedResult; import org.apache.archiva.components.rest.util.QueryHelper; -import org.apache.archiva.configuration.Configuration; -import org.apache.archiva.configuration.IndeterminateConfigurationException; import org.apache.archiva.configuration.RepositoryGroupConfiguration; -import org.apache.archiva.repository.CheckedResult; +import org.apache.archiva.repository.validation.CheckedResult; import org.apache.archiva.repository.EditableRepositoryGroup; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.base.ConfigurationHandler; import org.apache.archiva.repository.validation.ValidationError; -import org.apache.archiva.repository.validation.ValidationResponse; import org.apache.archiva.rest.api.model.v2.MergeConfiguration; import org.apache.archiva.rest.api.model.v2.RepositoryGroup; import org.apache.archiva.rest.api.services.v2.ArchivaRestServiceException; diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java index 0a35b1852..28b679a25 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java @@ -28,7 +28,7 @@ import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.storage.fs.FilesystemStorage; diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java index a012a5388..ad7ee23a5 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java @@ -23,7 +23,7 @@ package org.apache.archiva.web.rss; import junit.framework.TestCase; import org.apache.archiva.common.filelock.DefaultFileLockManager; import org.apache.archiva.configuration.ArchivaConfiguration; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.storage.fs.FilesystemStorage; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java index e81e0692b..49974fd24 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java @@ -30,7 +30,7 @@ import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RepositoryType; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest; import org.apache.commons.io.FileUtils; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java index e2b259c5c..8d1bde66d 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java @@ -34,7 +34,7 @@ import org.apache.archiva.configuration.FileTypes; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.repository.maven.content.MavenContentHelper; import org.apache.archiva.repository.maven.metadata.storage.ArtifactMappingProvider; import org.apache.archiva.proxy.ProxyRegistry; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java index b8310c740..a73b2f448 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java @@ -35,7 +35,7 @@ import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.memory.SimpleUser; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.metadata.audit.TestAuditListener; -import org.apache.archiva.repository.base.RepositoryGroupHandler; +import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.security.ServletAuthenticator; import org.apache.archiva.security.common.ArchivaRoleConstants; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; diff --git a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java index c3f39cf16..4a81b5fc8 100644 --- a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java +++ b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java @@ -28,7 +28,7 @@ import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; -import org.apache.archiva.repository.base.BasicManagedRepository; +import org.apache.archiva.repository.base.managed.BasicManagedRepository; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.junit.Before; import org.junit.Test; -- 2.39.5