</dependency>
<!-- Test scope -->
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>repository-statistics</artifactId>
+ <version>${archiva.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.archiva.components.cache</groupId>
<artifactId>archiva-components-spring-cache-ehcache</artifactId>
</dependency>
<!-- Test scope -->
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>repository-statistics</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
* under the License.
*/
-import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.consumers.RepositoryContentConsumer;
return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
}
- catch ( RepositoryAdminException e )
+ catch ( ConsumerException e )
{
- throw new RepositoryScannerException( e.getMessage(), e );
- } finally
+ throw new RepositoryScannerException( e.getMessage( ), e );
+ }
+ finally
{
repositoryContentConsumers.releaseSelectedKnownConsumers( knownContentConsumers );
}
import org.apache.archiva.common.utils.BaseFile;
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.consumers.RepositoryContentConsumer;
import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
import org.apache.commons.collections4.Closure;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.functors.IfClosure;
import org.springframework.beans.BeansException;
* @return the list of consumer ids that have been selected by the configuration.
*/
public List<String> getSelectedKnownConsumerIds()
- throws RepositoryAdminException
+ throws ConsumerException
{
- return archivaAdministration.getKnownContentConsumers();
+ try
+ {
+ return archivaAdministration.getKnownContentConsumers();
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ConsumerException( e.getMessage( ), e );
+ }
}
/**
* @return the list of consumer ids that have been selected by the configuration.
*/
public List<String> getSelectedInvalidConsumerIds()
- throws RepositoryAdminException
+ throws ConsumerException
{
- return archivaAdministration.getInvalidContentConsumers();
+ try
+ {
+ return archivaAdministration.getInvalidContentConsumers();
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ConsumerException( e.getMessage( ), e );
+ }
}
/**
* @return the map of String ids to {@link KnownRepositoryContentConsumer} objects.
*/
public Map<String, KnownRepositoryContentConsumer> getSelectedKnownConsumersMap()
- throws RepositoryAdminException
+ throws ConsumerException
{
Map<String, KnownRepositoryContentConsumer> consumerMap = new HashMap<>();
* @return the map of String ids to {@link InvalidRepositoryContentConsumer} objects.
*/
public Map<String, InvalidRepositoryContentConsumer> getSelectedInvalidConsumersMap()
- throws RepositoryAdminException
+ throws ConsumerException
{
Map<String, InvalidRepositoryContentConsumer> consumerMap = new HashMap<>();
* by the active configuration.
*/
public List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
- throws RepositoryAdminException
+ throws ConsumerException
{
// FIXME only for testing
if ( selectedKnownConsumers != null )
* by the active configuration.
*/
public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
- throws RepositoryAdminException
+ throws ConsumerException
{
// FIXME only for testing
List<InvalidRepositoryContentConsumer> ret = new ArrayList<>();
- List<String> invalidSelected = getSelectedInvalidConsumerIds();
+ List<String> invalidSelected = null;
+ try
+ {
+ invalidSelected = getSelectedInvalidConsumerIds();
+ }
+ catch ( ConsumerException e )
+ {
+ e.printStackTrace( );
+ }
for ( InvalidRepositoryContentConsumer consumer : getAvailableInvalidConsumers() )
{
* NOTE: Make sure that there is no repository scanning task executing before invoking this so as to prevent
* the index writer/reader of the current index-content consumer executing from getting closed. For an example,
* see ArchivaDavResource#executeConsumers( File ).
- *
- * @param repository the repository configuration to use.
+ * @param repository the repository configuration to use.
* @param localFile the local file to execute the consumers against.
* @param updateRelatedArtifacts TODO
*/
public void executeConsumers( ManagedRepository repository, Path localFile, boolean updateRelatedArtifacts )
- throws RepositoryAdminException
+ throws ConsumerException
{
List<KnownRepositoryContentConsumer> selectedKnownConsumers = null;
// Run the repository consumers
<!-- TEST Scope -->
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>repository-statistics</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
</properties>
<dependencies>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-admin-api</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.archiva.components</groupId>
<artifactId>archiva-components-spring-taskqueue</artifactId>
</properties>
<dependencies>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-scheduler-repository-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-scheduler-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
- <artifactId>archiva-scheduler-repository-api</artifactId>
- <version>${project.version}</version>
+ <artifactId>archiva-storage-api</artifactId>
</dependency>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-storage-fs</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva.components</groupId>
- <artifactId>archiva-components-spring-quartz</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-filelock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-proxy-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
- <artifactId>repository-statistics</artifactId>
+ <artifactId>archiva-model</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-scanner</artifactId>
</dependency>
-
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-layer</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>metadata-repository-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>metadata-statistics-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components</groupId>
+ <artifactId>archiva-components-spring-taskqueue</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components</groupId>
+ <artifactId>archiva-components-spring-quartz</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ </dependency>
<!-- Test scope -->
<dependency>
- <groupId>org.apache.maven.indexer</groupId>
- <artifactId>indexer-core</artifactId>
- <classifier>shaded-lucene</classifier>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-admin-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-jcl</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
+ <groupId>org.apache.archiva.maven</groupId>
+ <artifactId>archiva-maven-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-test-utils</artifactId>
- <version>${project.version}</version>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-provider-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-mock</artifactId>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http-shared</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
+ <groupId>org.apache.maven.indexer</groupId>
+ <artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.apache.archiva.components.cache</groupId>
- <artifactId>archiva-components-spring-cache-ehcache</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-test-utils</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
* under the License.
*/
-import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.RepositorySession;
@Inject
RepositoryRegistry repositoryRegistry;
- @Inject
- private ManagedRepositoryAdmin managedRepositoryAdmin;
-
@Inject
private RepositoryScanner repoScanner;
this.task = null;
}
}
- catch ( RepositoryAdminException e )
+ catch ( MetadataRepositoryException e )
{
- log.error( e.getMessage(), e );
- throw new TaskExecutionException( e.getMessage(), e );
+ e.printStackTrace( );
}
- catch ( MetadataRepositoryException e )
+ catch ( org.apache.archiva.consumers.ConsumerException e )
{
e.printStackTrace( );
}
this.repositoryStatisticsManager = repositoryStatisticsManager;
}
- public ManagedRepositoryAdmin getManagedRepositoryAdmin()
- {
- return managedRepositoryAdmin;
- }
-
- public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
- {
- this.managedRepositoryAdmin = managedRepositoryAdmin;
- }
}
+++ /dev/null
-package org.apache.archiva.mock;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.admin.model.AuditInformation;
-import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- */
-public class MockManagedRepositoryAdmin
- implements ManagedRepositoryAdmin
-{
- private ArchivaConfiguration archivaConfiguration;
-
- @Override
- public List<ManagedRepository> getManagedRepositories()
- throws RepositoryAdminException
- {
- List<ManagedRepositoryConfiguration> managedRepoConfigs =
- getArchivaConfiguration().getConfiguration().getManagedRepositories();
-
- List<ManagedRepository> managedRepos = new ArrayList<>( managedRepoConfigs.size() );
-
- for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
- {
- // TODO add staging repo information back too
- ManagedRepository repo =
- new ManagedRepository( Locale.getDefault( ), repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
- repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
- repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
- repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getRetentionPeriod(),
- repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(), true );
-
- managedRepos.add( repo );
- }
-
- return managedRepos;
- }
-
- @Override
- public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
- throws RepositoryAdminException
- {
- return null;
- }
-
- @Override
- public ManagedRepository getManagedRepository( String repositoryId )
- throws RepositoryAdminException
- {
- List<ManagedRepository> repos = getManagedRepositories();
- for ( ManagedRepository repo : repos )
- {
- if ( StringUtils.equals( repo.getId(), repositoryId ) )
- {
- return repo;
- }
- }
- return null;
- }
-
- @Override
- public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation,
- boolean deleteContent )
- throws RepositoryAdminException
- {
- return null;
- }
-
- @Override
- public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation )
- throws RepositoryAdminException
- {
- return null;
- }
-
- @Override
- public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation, boolean resetStats )
- throws RepositoryAdminException
- {
- return null;
- }
-
- public ArchivaConfiguration getArchivaConfiguration()
- {
- return archivaConfiguration;
- }
-
- public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
- {
- this.archivaConfiguration = archivaConfiguration;
- }
-
-
-}
*/
import junit.framework.TestCase;
+import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.codehaus.plexus.util.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
Path sourceRepoDir = Paths.get( "src/test/repositories/default-repository" );
repoDir = Paths.get( "target/default-repository" );
- org.apache.archiva.common.utils.FileUtils.deleteDirectory( repoDir );
+ FileUtils.deleteDirectory( repoDir );
assertFalse( "Default Test Repository should not exist.", Files.exists(repoDir) );
Files.createDirectories(repoDir);
- FileUtils.copyDirectoryStructure( sourceRepoDir.toFile(), repoDir.toFile() );
+ org.apache.commons.io.FileUtils.copyDirectory( sourceRepoDir.toFile(), repoDir.toFile() );
// set the timestamps to a time well in the past
Calendar cal = Calendar.getInstance();
cal.add( Calendar.YEAR, -1 );
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
-import org.codehaus.plexus.util.FileUtils;
+import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
Path newArtifactGroup = repoDir.resolve( "org/apache/archiva" );
assertFalse( "newArtifactGroup should not exist.", Files.exists(newArtifactGroup) );
- FileUtils.copyDirectoryStructure( Paths.get( "target/test-classes/test-repo/org/apache/archiva" ).toFile(),
+ FileUtils.copyDirectory( Paths.get( "target/test-classes/test-repo/org/apache/archiva" ).toFile(),
newArtifactGroup.toFile() );
// update last modified date
Path newArtifactGroup = repoDir.resolve( "org/apache/archiva" );
assertFalse( "newArtifactGroup should not exist.", Files.exists(newArtifactGroup) );
- FileUtils.copyDirectoryStructure( Paths.get( "target/test-classes/test-repo/org/apache/archiva" ).toFile(),
+ FileUtils.copyDirectory( Paths.get( "target/test-classes/test-repo/org/apache/archiva" ).toFile(),
newArtifactGroup.toFile() );
// update last modified date, placing shortly after last scan
Path newArtifactGroup = repoDir.resolve( "org/apache/archiva" );
assertFalse( "newArtifactGroup should not exist.", Files.exists(newArtifactGroup) );
- FileUtils.copyDirectoryStructure( Paths.get( "target/test-classes/test-repo/org/apache/archiva" ).toFile(),
+ FileUtils.copyDirectory( Paths.get( "target/test-classes/test-repo/org/apache/archiva" ).toFile(),
newArtifactGroup.toFile() );
// update last modified date, placing in middle of last scan
<context:annotation-config/>
- <bean name="managedRepoAdmin#test" class="org.apache.archiva.mock.MockManagedRepositoryAdmin">
- <property name="archivaConfiguration" ref="archivaConfiguration#test-repository-scanning"/>
- </bean>
<bean name="archivaAdministration#mock" class="org.apache.archiva.mock.MockArchivaAdministration">
<property name="archivaConfiguration" ref="archivaConfiguration#test-repository-scanning"/>
</bean>
<bean name="taskExecutor#test-repository-scanning" class="org.apache.archiva.scheduler.repository.ArchivaRepositoryScanningTaskExecutor">
- <property name="managedRepositoryAdmin" ref="managedRepoAdmin#test"/>
</bean>
<bean name="repositoryContentFactory#default" class="org.apache.archiva.repository.RepositoryContentFactory">
*/
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
}
@Override
- public List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
+ public List<KnownRepositoryContentConsumer> getSelectedKnownConsumers() throws ConsumerException
{
return getAvailableKnownConsumers();
}
@Override
- public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
+ public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers() throws ConsumerException
{
return getAvailableInvalidConsumers();
}
archiva-repository-admin
archiva-repository-admin-api
archiva-repository-admin-default
+ archiva-scheduler
+ archiva-scheduler-api
+ archiva-scheduler-repository