* {@link PreDownloadPolicy} to check if the requested url has failed before.
*
* @version $Id$
- * @plexus.component role="org.apache.maven.archiva.policies.PreDownloadPolicy"
+ * plexus.component role="org.apache.maven.archiva.policies.PreDownloadPolicy"
* role-hint="cache-failures"
*/
@Service("preDownloadPolicy#cache-failures")
public static final String YES = "yes";
/**
- * @plexus.requirement
+ * plexus.requirement
*/
@Inject
private UrlFailureCache urlFailureCache;
*
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.policies.PostDownloadPolicy"
+ * plexus.component role="org.apache.maven.archiva.policies.PostDownloadPolicy"
* role-hint="checksum"
*/
@Service("postDownloadPolicy#checksum")
/**
* PropagateErrorsPolicy - a policy applied on error to determine how to treat the error.
*
- * @plexus.component role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
+ * plexus.component role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
* role-hint="propagate-errors"
*/
@Service("downloadErrorPolicy#propagate-errors")
/**
* PropagateErrorsPolicy - a policy applied on error to determine how to treat the error.
*
- * @plexus.component role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
+ * plexus.component role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
* role-hint="propagate-errors-on-update"
*/
@Service("downloadErrorPolicy#propagate-errors-on-update")
*
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.policies.PreDownloadPolicy"
+ * plexus.component role="org.apache.maven.archiva.policies.PreDownloadPolicy"
* role-hint="releases"
*/
@Service("preDownloadPolicy#releases")
*
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.policies.PreDownloadPolicy"
+ * plexus.component role="org.apache.maven.archiva.policies.PreDownloadPolicy"
* role-hint="snapshots"
*/
@Service("preDownloadPolicy#snapshots")
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
- <dependency>
- <groupId>org.codehaus.redback.components</groupId>
- <artifactId>plexus-spring</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
import org.codehaus.plexus.util.DirectoryWalker;
+import org.springframework.stereotype.Service;
+import javax.inject.Inject;
import javax.swing.*;
/**
* DefaultRepositoryScanner
*
* @version $Id$
- * @plexus.component role="org.apache.archiva.repository.scanner.RepositoryScanner"
+ * plexus.component role="org.apache.archiva.repository.scanner.RepositoryScanner"
*/
+@Service("repositoryScanner#default")
public class DefaultRepositoryScanner
implements RepositoryScanner
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private FileTypes filetypes;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryContentConsumers consumerUtil;
private Set<RepositoryScannerInstance> inProgressScans = new LinkedHashSet<RepositoryScannerInstance>();
* under the License.
*/
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
- * RepositoryContentConsumerUtil
+ * RepositoryContentConsumerUtil
*
* @version $Id$
*/
-public class RepositoryContentConsumers implements ApplicationContextAware
+public class RepositoryContentConsumers
+ implements ApplicationContextAware
{
private ApplicationContext applicationContext;
-
+
private ArchivaConfiguration archivaConfiguration;
private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
- public RepositoryContentConsumers(ArchivaConfiguration archivaConfiguration)
+ public RepositoryContentConsumers( ArchivaConfiguration archivaConfiguration )
{
this.archivaConfiguration = archivaConfiguration;
}
- public void setApplicationContext(ApplicationContext applicationContext)
+ public void setApplicationContext( ApplicationContext applicationContext )
throws BeansException
{
this.applicationContext = applicationContext;
* Get the list of Ids associated with those {@link KnownRepositoryContentConsumer} that have
* been selected in the configuration to execute.
* </p>
- *
+ * <p/>
* <p>
* NOTE: This list can be larger and contain entries that might not exist or be available
* in the classpath, or as a component.
* </p>
- *
+ *
* @return the list of consumer ids that have been selected by the configuration.
*/
public List<String> getSelectedKnownConsumerIds()
* Get the list of Ids associated with those {@link InvalidRepositoryContentConsumer} that have
* been selected in the configuration to execute.
* </p>
- *
+ * <p/>
* <p>
* NOTE: This list can be larger and contain entries that might not exist or be available
* in the classpath, or as a component.
* </p>
- *
+ *
* @return the list of consumer ids that have been selected by the configuration.
*/
public List<String> getSelectedInvalidConsumerIds()
/**
* Get the map of {@link String} ids to {@link KnownRepositoryContentConsumer} implementations,
- * for those consumers that have been selected according to the active configuration.
- *
+ * for those consumers that have been selected according to the active configuration.
+ *
* @return the map of String ids to {@link KnownRepositoryContentConsumer} objects.
*/
public Map<String, KnownRepositoryContentConsumer> getSelectedKnownConsumersMap()
/**
* Get the map of {@link String} ids to {@link InvalidRepositoryContentConsumer} implementations,
- * for those consumers that have been selected according to the active configuration.
- *
+ * for those consumers that have been selected according to the active configuration.
+ *
* @return the map of String ids to {@link InvalidRepositoryContentConsumer} objects.
*/
public Map<String, InvalidRepositoryContentConsumer> getSelectedInvalidConsumersMap()
{
- Map<String, InvalidRepositoryContentConsumer> consumerMap = new HashMap<String, InvalidRepositoryContentConsumer>();
+ Map<String, InvalidRepositoryContentConsumer> consumerMap =
+ new HashMap<String, InvalidRepositoryContentConsumer>();
for ( InvalidRepositoryContentConsumer consumer : getSelectedInvalidConsumers() )
{
/**
* Get the list of {@link KnownRepositoryContentConsumer} objects that are
* selected according to the active configuration.
- *
+ *
* @return the list of {@link KnownRepositoryContentConsumer} that have been selected
* by the active configuration.
*/
/**
* Get the list of {@link InvalidRepositoryContentConsumer} objects that are
* selected according to the active configuration.
- *
+ *
* @return the list of {@link InvalidRepositoryContentConsumer} that have been selected
* by the active configuration.
*/
/**
* Get the list of {@link KnownRepositoryContentConsumer} objects that are
* available and present in the classpath and as components in the IoC.
- *
- * @return the list of all available {@link KnownRepositoryContentConsumer} present in the classpath
+ *
+ * @return the list of all available {@link KnownRepositoryContentConsumer} present in the classpath
* and as a component in the IoC.
*/
public List<KnownRepositoryContentConsumer> getAvailableKnownConsumers()
{
- return new ArrayList<KnownRepositoryContentConsumer>( applicationContext.getBeansOfType( KnownRepositoryContentConsumer.class ).values() );
+ return new ArrayList<KnownRepositoryContentConsumer>(
+ applicationContext.getBeansOfType( KnownRepositoryContentConsumer.class ).values() );
}
/**
* Get the list of {@link InvalidRepositoryContentConsumer} objects that are
* available and present in the classpath and as components in the IoC.
- *
- * @return the list of all available {@link InvalidRepositoryContentConsumer} present in the classpath
+ *
+ * @return the list of all available {@link InvalidRepositoryContentConsumer} present in the classpath
* and as a component in the IoC.
*/
public List<InvalidRepositoryContentConsumer> getAvailableInvalidConsumers()
{
- return new ArrayList<InvalidRepositoryContentConsumer>( applicationContext.getBeansOfType( InvalidRepositoryContentConsumer.class ).values() );
+ return new ArrayList<InvalidRepositoryContentConsumer>(
+ applicationContext.getBeansOfType( InvalidRepositoryContentConsumer.class ).values() );
}
/**
- * A convienence method to execute all of the active selected consumers for a
+ * A convienence method to execute all of the active selected consumers for a
* particular arbitrary file.
* 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 localFile the local file to execute the consumers against.
+ *
+ * @param repository the repository configuration to use.
+ * @param localFile the local file to execute the consumers against.
* @param updateRelatedArtifacts TODO
*/
- public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile, boolean updateRelatedArtifacts )
+ public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile,
+ boolean updateRelatedArtifacts )
{
// Run the repository consumers
try
- {
+ {
Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime(), false );
List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers();
// MRM-1212/MRM-1197
// - do not create missing/fix invalid checksums and update metadata when deploying from webdav since these are uploaded by maven
- if( updateRelatedArtifacts == false )
+ if ( updateRelatedArtifacts == false )
{
List<KnownRepositoryContentConsumer> clone = new ArrayList<KnownRepositoryContentConsumer>();
clone.addAll( selectedKnownConsumers );
- for( KnownRepositoryContentConsumer consumer : clone )
+ for ( KnownRepositoryContentConsumer consumer : clone )
{
- if( consumer.getId().equals( "create-missing-checksums" ) ||
- consumer.getId().equals( "metadata-updater" ) )
+ if ( consumer.getId().equals( "create-missing-checksums" ) || consumer.getId().equals(
+ "metadata-updater" ) )
{
selectedKnownConsumers.remove( consumer );
}
ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure();
closure.setBasefile( baseFile );
closure.setExecuteOnEntireRepo( false );
-
+
Closure processIfWanted = IfClosure.getInstance( predicate, closure );
CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted );
{
this.selectedInvalidConsumers = selectedInvalidConsumers;
}
-
+
protected Date getStartTime()
- {
+ {
return new Date( System.currentTimeMillis() );
}
-
+
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
{
this.archivaConfiguration = archivaConfiguration;
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
+
+<!--
+ ~ 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.
+ -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.repository.scanner"/>
+ <alias name="repositoryScanner#default" alias="repositoryScanner"/>
- <bean id="repositoryContentConsumers" class="org.apache.archiva.repository.scanner.RepositoryContentConsumers" scope="prototype">
- <constructor-arg>
- <ref bean="archivaConfiguration"/>
- </constructor-arg>
- </bean>
+ <bean id="repositoryContentConsumers" class="org.apache.archiva.repository.scanner.RepositoryContentConsumers" scope="prototype">
+ <constructor-arg>
+ <ref bean="archivaConfiguration"/>
+ </constructor-arg>
+ </bean>
</beans>
implements InvalidRepositoryContentConsumer
{
/**
- * @plexus.configuration default-value="unset-id"
+ * plexus.configuration default-value="unset-id"
*/
private String id = "unset-id";
{
this.processCount = processCount;
}
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
}
* under the License.
*/
-import java.io.File;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
+import junit.framework.TestCase;
import org.apache.commons.lang.SystemUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.easymock.MockControl;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.MessageSourceResolvable;
import org.springframework.context.NoSuchMessageException;
import org.springframework.core.io.Resource;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
/**
* RepositoryContentConsumersTest
*
* @version $Id$
*/
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class RepositoryContentConsumersTest
- extends PlexusInSpringTestCase
+ extends TestCase
{
- /**
- * {@inheritDoc}
- * @see org.codehaus.plexus.spring.PlexusInSpringTestCase#getSpringConfigLocation()
- */
- @Override
- protected String getSpringConfigLocation()
- {
- return "org/apache/maven/archiva/repository/spring-context.xml";
- }
+
+ @Inject
+ ApplicationContext applicationContext;
protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
{
private RepositoryContentConsumers lookupRepositoryConsumers()
throws Exception
{
- ArchivaConfiguration configuration = (ArchivaConfiguration)lookup(ArchivaConfiguration.class);
- RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub(configuration);
-
- RepositoryContentConsumers consumerUtil = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class
- .getName() );
- ApplicationContext context = new MockApplicationContext(consumerUtil.getAvailableKnownConsumers(), consumerUtil.getAvailableInvalidConsumers());
+ ArchivaConfiguration configuration =
+ applicationContext.getBean( "archivaConfiguration#test-conf", ArchivaConfiguration.class );
+
+ RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub( configuration );
- consumerUtilStub.setApplicationContext(context);
+ RepositoryContentConsumers consumerUtil =
+ (RepositoryContentConsumers) applicationContext.getBean( "repositoryContentConsumers#test",
+ RepositoryContentConsumers.class );
+ ApplicationContext context = new MockApplicationContext( consumerUtil.getAvailableKnownConsumers(),
+ consumerUtil.getAvailableInvalidConsumers() );
+
+ consumerUtilStub.setApplicationContext( context );
consumerUtilStub.setSelectedInvalidConsumers( consumerUtil.getSelectedInvalidConsumers() );
- consumerUtilStub.setSelectedKnownConsumers( consumerUtil.getSelectedKnownConsumers() );
+ consumerUtilStub.setSelectedKnownConsumers( consumerUtil.getSelectedKnownConsumers() );
consumerUtilStub.setArchivaConfiguration( configuration );
-
+
assertNotNull( "RepositoryContentConsumers should not be null.", consumerUtilStub );
-
+
return consumerUtilStub;
}
+ @Test
public void testGetSelectedKnownIds()
throws Exception
{
RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
- String expectedKnownIds[] = new String[] {
- "update-db-artifact",
- "create-missing-checksums",
- "update-db-repository-metadata",
- "validate-checksum",
- "validate-signature",
- "index-content",
- "auto-remove",
- "auto-rename" };
-
+ String expectedKnownIds[] =
+ new String[]{ "update-db-artifact", "create-missing-checksums", "update-db-repository-metadata",
+ "validate-checksum", "validate-signature", "index-content", "auto-remove", "auto-rename" };
+//update-db-artifact, create-missing-checksums, update-db-repository-metadata,
+//validate-checksum, validate-signature, index-content, auto-remove, auto-rename,
+//metadata-updater
List<String> knownConsumers = consumerutil.getSelectedKnownConsumerIds();
assertNotNull( "Known Consumer IDs should not be null", knownConsumers );
- assertEquals( "Known Consumer IDs.size", expectedKnownIds.length, knownConsumers.size() );
+ assertEquals( "Known Consumer IDs.size " + knownConsumers, expectedKnownIds.length, knownConsumers.size() );
for ( String expectedId : expectedKnownIds )
{
}
}
+ @Test
public void testGetSelectedInvalidIds()
throws Exception
{
RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
- String expectedInvalidIds[] = new String[] { "update-db-bad-content" };
+ String expectedInvalidIds[] = new String[]{ "update-db-bad-content" };
List<String> invalidConsumers = consumerutil.getSelectedInvalidConsumerIds();
assertNotNull( "Invalid Consumer IDs should not be null", invalidConsumers );
}
}
+ @Test
public void testGetSelectedKnownConsumerMap()
throws Exception
{
RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
- String expectedSelectedKnownIds[] = new String[] {
- "update-db-artifact",
- "create-missing-checksums",
- "update-db-repository-metadata",
- "validate-checksum",
- "index-content",
- "auto-remove",
- "auto-rename" };
+ String expectedSelectedKnownIds[] =
+ new String[]{ "update-db-artifact", "create-missing-checksums", "update-db-repository-metadata",
+ "validate-checksum", "index-content", "auto-remove", "auto-rename" };
Map<String, KnownRepositoryContentConsumer> knownConsumerMap = consumerutil.getSelectedKnownConsumersMap();
assertNotNull( "Known Consumer Map should not be null", knownConsumerMap );
}
}
+ @Test
public void testGetSelectedInvalidConsumerMap()
throws Exception
{
RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
- String expectedSelectedInvalidIds[] = new String[] { "update-db-bad-content" };
+ String expectedSelectedInvalidIds[] = new String[]{ "update-db-bad-content" };
- Map<String, InvalidRepositoryContentConsumer> invalidConsumerMap = consumerutil
- .getSelectedInvalidConsumersMap();
+ Map<String, InvalidRepositoryContentConsumer> invalidConsumerMap =
+ consumerutil.getSelectedInvalidConsumersMap();
assertNotNull( "Invalid Consumer Map should not be null", invalidConsumerMap );
assertEquals( "Invalid Consumer Map.size", expectedSelectedInvalidIds.length, invalidConsumerMap.size() );
}
}
+ @Test
public void testGetAvailableKnownList()
throws Exception
{
RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
- String expectedKnownIds[] = new String[] {
- "update-db-artifact",
- "create-missing-checksums",
- "update-db-repository-metadata",
- "validate-checksum",
- "index-content",
- "auto-remove",
- "auto-rename",
- "available-but-unselected" };
+ String expectedKnownIds[] =
+ new String[]{ "update-db-artifact", "create-missing-checksums", "update-db-repository-metadata",
+ "validate-checksum", "index-content", "auto-remove", "auto-rename", "available-but-unselected" };
List<KnownRepositoryContentConsumer> knownConsumers = consumerutil.getAvailableKnownConsumers();
assertNotNull( "known consumers should not be null.", knownConsumers );
}
}
+ @Test
public void testGetAvailableInvalidList()
throws Exception
{
RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
- String expectedInvalidIds[] = new String[] { "update-db-bad-content", "move-to-trash-then-notify" };
+ String expectedInvalidIds[] = new String[]{ "update-db-bad-content", "move-to-trash-then-notify" };
List<InvalidRepositoryContentConsumer> invalidConsumers = consumerutil.getAvailableInvalidConsumers();
assertNotNull( "invalid consumers should not be null.", invalidConsumers );
List<String> expectedIds = Arrays.asList( expectedInvalidIds );
for ( InvalidRepositoryContentConsumer consumer : invalidConsumers )
{
- assertTrue( "Consumer [" + consumer.getId()
- + "] returned by .getAvailableInvalidConsumers() is unexpected.", expectedIds.contains( consumer
- .getId() ) );
+ assertTrue(
+ "Consumer [" + consumer.getId() + "] returned by .getAvailableInvalidConsumers() is unexpected.",
+ expectedIds.contains( consumer.getId() ) );
}
}
+ @Test
public void testExecution()
throws Exception
{
(KnownRepositoryContentConsumer) MockControl.createNiceControl(
KnownRepositoryContentConsumer.class ).getMock();
- consumers.setApplicationContext(new MockApplicationContext(Arrays.asList( selectedKnownConsumer, unselectedKnownConsumer ), null));
+ consumers.setApplicationContext(
+ new MockApplicationContext( Arrays.asList( selectedKnownConsumer, unselectedKnownConsumer ), null ) );
consumers.setSelectedKnownConsumers( Collections.singletonList( selectedKnownConsumer ) );
(InvalidRepositoryContentConsumer) MockControl.createControl(
InvalidRepositoryContentConsumer.class ).getMock();
- consumers.setApplicationContext( new MockApplicationContext(null, Arrays.asList( selectedInvalidConsumer, unselectedInvalidConsumer )));
+ consumers.setApplicationContext(
+ new MockApplicationContext( null, Arrays.asList( selectedInvalidConsumer, unselectedInvalidConsumer ) ) );
consumers.setSelectedInvalidConsumers( Collections.singletonList( selectedInvalidConsumer ) );
- ManagedRepositoryConfiguration repo = createRepository( "id", "name", getTestFile( "target/test-repo" ) );
- File testFile = getTestFile( "target/test-repo/path/to/test-file.txt" );
+ ManagedRepositoryConfiguration repo = createRepository( "id", "name", new File( "target/test-repo" ) );
+ File testFile = new File( "target/test-repo/path/to/test-file.txt" );
Date startTime = new Date( System.currentTimeMillis() );
startTime.setTime( 12345678 );
knownControl.reset();
invalidControl.reset();
- File notIncludedTestFile = getTestFile( "target/test-repo/path/to/test-file.xml" );
+ File notIncludedTestFile = new File( "./target/test-repo/path/to/test-file.xml" );
selectedKnownConsumer.beginScan( repo, startTime, false );
selectedKnownConsumer.getExcludes();
knownControl.reset();
invalidControl.reset();
- File excludedTestFile = getTestFile( "target/test-repo/path/to/test-file.txt" );
+ File excludedTestFile = new File( "target/test-repo/path/to/test-file.txt" );
selectedKnownConsumer.beginScan( repo, startTime, false );
selectedKnownConsumer.getExcludes();
return path;
}
- private static Map convertToMap(List objects)
+ private static Map convertToMap( List objects )
{
HashMap map = new HashMap();
- for (Object o : objects)
+ for ( Object o : objects )
{
- map.put(o, o);
+ map.put( o, o );
}
return map;
}
- public class MockApplicationContext implements ApplicationContext
+ public class MockApplicationContext
+ implements ApplicationContext
{
private List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer;
private List<InvalidRepositoryContentConsumer> invalidRepositoryContentConsumers;
- public MockApplicationContext(List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer, List<InvalidRepositoryContentConsumer> invalidRepositoryContentConsumers)
+ public MockApplicationContext( List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer,
+ List<InvalidRepositoryContentConsumer> invalidRepositoryContentConsumers )
{
this.knownRepositoryContentConsumer = knownRepositoryContentConsumer;
this.invalidRepositoryContentConsumers = invalidRepositoryContentConsumers;
}
- public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public AutowireCapableBeanFactory getAutowireCapableBeanFactory()
+ throws IllegalStateException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getDisplayName() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getDisplayName()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getId() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getId()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public ApplicationContext getParent() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public ApplicationContext getParent()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public long getStartupDate() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public long getStartupDate()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean containsBeanDefinition(String beanName) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean containsBeanDefinition( String beanName )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public int getBeanDefinitionCount() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public int getBeanDefinitionCount()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String[] getBeanDefinitionNames() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String[] getBeanDefinitionNames()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String[] getBeanNamesForType(Class type) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String[] getBeanNamesForType( Class type )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean allowEagerInit) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String[] getBeanNamesForType( Class type, boolean includeNonSingletons, boolean allowEagerInit )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Map getBeansOfType(Class type) throws BeansException {
- if (type == KnownRepositoryContentConsumer.class)
+ public Map getBeansOfType( Class type )
+ throws BeansException
+ {
+ if ( type == KnownRepositoryContentConsumer.class )
{
- return convertToMap(knownRepositoryContentConsumer);
+ return convertToMap( knownRepositoryContentConsumer );
}
- if (type == InvalidRepositoryContentConsumer.class)
+ if ( type == InvalidRepositoryContentConsumer.class )
{
- return convertToMap(invalidRepositoryContentConsumers);
+ return convertToMap( invalidRepositoryContentConsumers );
}
- throw new UnsupportedOperationException("Should not have been called");
+ throw new UnsupportedOperationException( "Should not have been called" );
}
- public Map getBeansOfType(Class type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Map getBeansOfType( Class type, boolean includeNonSingletons, boolean allowEagerInit )
+ throws BeansException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean containsBean(String name) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean containsBean( String name )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String[] getAliases(String name) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String[] getAliases( String name )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Object getBean(String name) throws BeansException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Object getBean( String name )
+ throws BeansException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Object getBean(String name, Class requiredType) throws BeansException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Object getBean( String name, Class requiredType )
+ throws BeansException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Object getBean(String name, Object[] args) throws BeansException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Object getBean( String name, Object[] args )
+ throws BeansException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Class getType(String name) throws NoSuchBeanDefinitionException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Class getType( String name )
+ throws NoSuchBeanDefinitionException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isPrototype( String name )
+ throws NoSuchBeanDefinitionException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isSingleton( String name )
+ throws NoSuchBeanDefinitionException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isTypeMatch( String name, Class targetType )
+ throws NoSuchBeanDefinitionException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean containsLocalBean(String name) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean containsLocalBean( String name )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public BeanFactory getParentBeanFactory() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public BeanFactory getParentBeanFactory()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getMessage( String code, Object[] args, String defaultMessage, Locale locale )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getMessage( String code, Object[] args, Locale locale )
+ throws NoSuchMessageException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getMessage( MessageSourceResolvable resolvable, Locale locale )
+ throws NoSuchMessageException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public void publishEvent(ApplicationEvent event) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void publishEvent( ApplicationEvent event )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Resource[] getResources(String locationPattern) throws IOException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Resource[] getResources( String locationPattern )
+ throws IOException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public ClassLoader getClassLoader() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public ClassLoader getClassLoader()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Resource getResource(String location) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Resource getResource( String location )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
public <T> T getBean( Class<T> tClass )
throws BeansException
{
- throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException( "Not supported yet." );
}
public Map<String, Object> getBeansWithAnnotation( Class<? extends Annotation> aClass )
throws BeansException
{
- throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException( "Not supported yet." );
}
public <A extends Annotation> A findAnnotationOnBean( String s, Class<A> aClass )
{
- throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException( "Not supported yet." );
}
}
}
* under the License.
*/
+import junit.framework.TestCase;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.Locale;
import java.util.TimeZone;
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
-
/**
* RepositoryScannerTest
*
* @version $Id$
*/
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class RepositoryScannerTest
- extends PlexusInSpringTestCase
+ extends TestCase
{
- /**
- * {@inheritDoc}
- * @see org.codehaus.plexus.spring.PlexusInSpringTestCase#getSpringConfigLocation()
- */
- @Override
- protected String getSpringConfigLocation()
- {
- return "org/apache/maven/archiva/repository/spring-context.xml";
- }
+
+ @Inject
+ ApplicationContext applicationContext;
protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
{
}
private static final String[] ARTIFACT_PATTERNS =
- new String[]{"**/*.jar", "**/*.pom", "**/*.rar", "**/*.zip", "**/*.war", "**/*.tar.gz"};
+ new String[]{ "**/*.jar", "**/*.pom", "**/*.rar", "**/*.zip", "**/*.war", "**/*.tar.gz" };
private ManagedRepositoryConfiguration createDefaultRepository()
{
- File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );
+ File repoDir = new File( "src/test/repositories/default-repository" );
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
private ManagedRepositoryConfiguration createSimpleRepository()
throws IOException, ParseException
{
- File srcDir = new File( getBasedir(), "src/test/repositories/simple-repository" );
+ File srcDir = new File( "src/test/repositories/simple-repository" );
- File repoDir = getTestFile( "target/test-repos/simple-repository" );
+ File repoDir = new File( "target/test-repos/simple-repository" );
FileUtils.deleteDirectory( repoDir );
private ManagedRepositoryConfiguration createLegacyRepository()
{
- File repoDir = new File( getBasedir(), "src/test/repositories/legacy-repository" );
+ File repoDir = new File( "src/test/repositories/legacy-repository" );
assertTrue( "Legacy Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
{
if ( actualCount < minimumHitCount )
{
- fail( "Minimum hit count on " + msg + " not satisfied. Expected more than <" + minimumHitCount +
- ">, but actually got <" + actualCount + ">." );
+ fail( "Minimum hit count on " + msg + " not satisfied. Expected more than <" + minimumHitCount
+ + ">, but actually got <" + actualCount + ">." );
}
}
private RepositoryScanner lookupRepositoryScanner()
throws Exception
{
- return (RepositoryScanner) lookup( RepositoryScanner.class );
+ return applicationContext.getBean( RepositoryScanner.class );
}
private List<String> getIgnoreList()
return ignores;
}
+ @Test
public void testTimestampRepositoryScanner()
throws Exception
{
RepositoryScanner scanner = lookupRepositoryScanner();
RepositoryScanStatistics stats = scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(),
- getTimestampAsMillis( "20061101.000000" ) );
+ getTimestampAsMillis( "20061101.000000" ) );
assertNotNull( "Stats should not be null.", stats );
assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
}
+ @Test
public void testTimestampRepositoryScannerFreshScan()
throws Exception
{
assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
}
+ @Test
public void testTimestampRepositoryScannerProcessUnmodified()
throws Exception
{
RepositoryScanner scanner = lookupRepositoryScanner();
RepositoryScanStatistics stats = scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(),
- getTimestampAsMillis( "20061101.000000" ) );
+ getTimestampAsMillis( "20061101.000000" ) );
assertNotNull( "Stats should not be null.", stats );
assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
}
+ @Test
public void testDefaultRepositoryScanner()
throws Exception
{
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
- consumer.setIncludes( new String[]{"**/*.jar", "**/*.war", "**/*.pom", "**/maven-metadata.xml", "**/*-site.xml",
- "**/*.zip", "**/*.tar.gz", "**/*.sha1", "**/*.md5"} );
+ consumer.setIncludes(
+ new String[]{ "**/*.jar", "**/*.war", "**/*.pom", "**/maven-metadata.xml", "**/*-site.xml", "**/*.zip",
+ "**/*.tar.gz", "**/*.sha1", "**/*.md5" } );
knownConsumers.add( consumer );
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
assertEquals( "Processed Count (of invalid items)", 6, badconsumer.getProcessCount() );
}
+ @Test
public void testDefaultRepositoryArtifactScanner()
throws Exception
{
assertMinimumHits( "Processed Count", actualArtifactPaths.size(), consumer.getProcessCount() );
}
+ @Test
public void testDefaultRepositoryMetadataScanner()
throws Exception
{
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer knownConsumer = new KnownScanConsumer();
- knownConsumer.setIncludes( new String[]{"**/maven-metadata*.xml"} );
+ knownConsumer.setIncludes( new String[]{ "**/maven-metadata*.xml" } );
knownConsumers.add( knownConsumer );
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
assertMinimumHits( "Processed Count", actualMetadataPaths.size(), knownConsumer.getProcessCount() );
}
+ @Test
public void testDefaultRepositoryProjectScanner()
throws Exception
{
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
- consumer.setIncludes( new String[]{"**/*.pom"} );
+ consumer.setIncludes( new String[]{ "**/*.pom" } );
knownConsumers.add( consumer );
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
assertMinimumHits( "Processed Count", actualProjectPaths.size(), consumer.getProcessCount() );
}
+ @Test
public void testLegacyRepositoryArtifactScanner()
throws Exception
{
*
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
+ * plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
* role-hint="sample-known"
*/
public class SampleKnownConsumer
implements KnownRepositoryContentConsumer
{
/**
- * @plexus.configuration default-value="unset-id"
+ * plexus.configuration default-value="unset-id"
*/
private String id = "unset-id";
{
return false;
}
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
}
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
- <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.registry.Registry</role>
- <role-hint>configured</role-hint>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
- <field-name>prePolicies</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role>
- <field-name>postPolicies</field-name>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>org.codehaus.plexus.registry.Registry</role>
- <role-hint>configured</role-hint>
- <implementation>org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry</implementation>
- <configuration>
- <properties>
- <![CDATA[
- <configuration>
- <system/>
- <xml fileName="${basedir}/src/test/resources/scanner-archiva.xml"
- config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/>
- </configuration>
- ]]>
- </properties>
- </configuration>
- </component>
-
- <!-- Known Content Consumers -->
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>update-db-artifact</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>update-db-artifact</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>create-missing-checksums</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>create-missing-checksums</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>update-db-repository-metadata</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>update-db-repository-metadata</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>validate-checksum</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>validate-checksum</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>index-content</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>index-content</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>auto-remove</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>auto-remove</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>auto-rename</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>auto-rename</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
- <role-hint>available-but-unselected</role-hint>
- <implementation>org.apache.archiva.repository.scanner.SampleKnownConsumer</implementation>
- <configuration>
- <id>available-but-unselected</id>
- </configuration>
- </component>
-
- <!-- Invalid Content Consumers -->
- <component>
- <role>org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer</role>
- <role-hint>update-db-bad-content</role-hint>
- <implementation>org.apache.archiva.repository.scanner.InvalidScanConsumer</implementation>
- <configuration>
- <id>update-db-bad-content</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer</role>
- <role-hint>move-to-trash-then-notify</role-hint>
- <implementation>org.apache.archiva.repository.scanner.InvalidScanConsumer</implementation>
- <configuration>
- <id>move-to-trash-then-notify</id>
- </configuration>
- </component>
- <component>
- <role>org.apache.archiva.repository.scanner.RepositoryContentConsumers</role>
- <role-hint>test</role-hint>
- <implementation>org.apache.archiva.repository.scanner.RepositoryContentConsumersStub</implementation>
- </component>
- </components>
-
-</component-set>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ ~ 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.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <bean name="archivaConfiguration#test-conf" class="org.apache.maven.archiva.configuration.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#configured"/>
+ </bean>
+
+ <bean name="registry#configured" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="properties">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <xml fileName="${basedir}/src/test/resources/scanner-archiva.xml"
+ config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+ <bean name="knownRepositoryContentConsumer#update-db-artifact" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="update-db-artifact"/>
+ </bean>
+ <bean name="knownRepositoryContentConsumer#create-missing-checksums" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="create-missing-checksums"/>
+ </bean>
+
+ <bean name="knownRepositoryContentConsumer#update-db-repository-metadata" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="update-db-repository-metadata"/>
+ </bean>
+
+ <bean name="knownRepositoryContentConsumer#validate-checksum" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="validate-checksum"/>
+ </bean>
+
+ <bean name="knownRepositoryContentConsumer#index-content" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="index-content"/>
+ </bean>
+
+ <bean name="knownRepositoryContentConsumer#auto-remove" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="auto-remove"/>
+ </bean>
+
+ <bean name="knownRepositoryContentConsumer#auto-rename" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="auto-rename"/>
+ </bean>
+
+ <bean name="knownRepositoryContentConsumer#available-but-unselected" class="org.apache.archiva.repository.scanner.SampleKnownConsumer">
+ <property name="id" value="available-but-unselected"/>
+ </bean>
+
+ <bean name="invalidRepositoryContentConsumer#update-db-bad-content" class="org.apache.archiva.repository.scanner.InvalidScanConsumer">
+ <property name="id" value="update-db-bad-content"/>
+ </bean>
+
+ <bean name="invalidRepositoryContentConsumer#move-to-trash-then-notify" class="org.apache.archiva.repository.scanner.InvalidScanConsumer">
+ <property name="id" value="move-to-trash-then-notify"/>
+ </bean>
+
+ <bean name="repositoryContentConsumers#test" class="org.apache.archiva.repository.scanner.RepositoryContentConsumersStub">
+ <constructor-arg ref="archivaConfiguration#test-conf"/>
+ </bean>
+
+
+
+</beans>