]> source.dussan.org Git - archiva.git/commitdiff
MRM-1015 - Move consumers and related API's to Spring
authorJames William Dumay <jdumay@apache.org>
Thu, 20 Nov 2008 04:13:50 +0000 (04:13 +0000)
committerJames William Dumay <jdumay@apache.org>
Thu, 20 Nov 2008 04:13:50 +0000 (04:13 +0000)
RepositoryContentConsumers needed to be ported over as a spring component so that we can use the ApplicationContextAware interface.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@719157 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/resources/META-INF/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java
archiva-modules/archiva-base/archiva-repository-layer/pom.xml
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersStub.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/StubRepositoryContentConsumers.java
archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml

index 5513cf3cca953b1edd6952dc76843552133d9f9d..9befcbf5fb8bfabdf9c907ced5b54da308cc9124 100644 (file)
@@ -19,8 +19,6 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
@@ -46,47 +44,23 @@ import java.util.List;
  * ArtifactMissingChecksumsConsumer - Create missing checksums for the artifact.
  *
  * @version $Id$
- * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- * role-hint="create-missing-checksums"
- * instantiation-strategy="per-lookup"
  */
 public class ArtifactMissingChecksumsConsumer
     extends AbstractMonitoredConsumer
     implements KnownRepositoryContentConsumer, RegistryListener, Initializable
 {
-    /**
-     * @plexus.configuration default-value="create-missing-checksums"
-     */
     private String id;
 
-    /**
-     * @plexus.configuration default-value="Create Missing Checksums (.sha1 & .md5)"
-     */
     private String description;
 
-    /**
-     * @plexus.requirement
-     */
     private ArchivaConfiguration configuration;
 
-    /**
-     * @plexus.requirement
-     */
     private FileTypes filetypes;
 
-    /**
-     * @plexus.requirement role-hint="sha1"
-     */
     private Digester digestSha1;
 
-    /**
-     * @plexus.requirement role-hint="md5";
-     */
     private Digester digestMd5;
 
-    /**
-     * @plexus.requirement
-     */
     private ChecksumFile checksum;
 
     private static final String TYPE_CHECKSUM_NOT_FILE = "checksum-bad-not-file";
@@ -99,6 +73,22 @@ public class ArtifactMissingChecksumsConsumer
     
     private List<String> includes = new ArrayList<String>();
 
+    public ArtifactMissingChecksumsConsumer(String id,
+            String description,
+            ArchivaConfiguration configuration,
+            FileTypes filetypes,
+            Digester digestSha1,
+            Digester digestMd5,
+            ChecksumFile checksum) {
+        this.id = id;
+        this.description = description;
+        this.configuration = configuration;
+        this.filetypes = filetypes;
+        this.digestSha1 = digestSha1;
+        this.digestMd5 = digestMd5;
+        this.checksum = checksum;
+    }
+
     public String getId()
     {
         return this.id;
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..70d8519
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+       <bean id="artifactMissingChecksumsConsumer" class="org.apache.maven.archiva.consumers.core.ArtifactMissingChecksumsConsumer" scope="prototype">
+         <constructor-arg>
+           <value>create-missing-checksums</value>
+         </constructor-arg>
+         <constructor-arg>
+           <value>Create Missing Checksums (.sha1, .md5)</value>
+         </constructor-arg>
+         <constructor-arg>
+           <ref bean="archivaConfiguration"/>
+         </constructor-arg>
+         <constructor-arg>
+           <ref bean="fileTypes"/>
+         </constructor-arg>
+         <constructor-arg>
+           <ref bean="digester#sha1"/>
+         </constructor-arg>
+         <constructor-arg>
+           <ref bean="digester#md5"/>
+         </constructor-arg>
+         <constructor-arg>
+           <ref bean="checksumFile"/>
+         </constructor-arg>
+       </bean>
+</beans>
\ No newline at end of file
index 42f84d39ec5e4a8bbf882194a6d96ca7440657a7..d97e0b0b6183625997a721484feaee4a5bdc064e 100644 (file)
@@ -19,17 +19,15 @@ package org.apache.maven.archiva.consumers.core;
  * under the License.
  */
 
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-
 public class ArtifactMissingChecksumsConsumerTest
     extends AbstractArtifactConsumerTest
 {
+    @Override
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
-        consumer = (ArtifactMissingChecksumsConsumer) lookup( KnownRepositoryContentConsumer.class.getName(),
-                                                              "create-missing-checksums" );
+        consumer = (ArtifactMissingChecksumsConsumer) lookup( "artifactMissingChecksumsConsumer" );
     }
 }
index 9988633134cd57d9b7b1ad383a4208e4bdce7e22..15411bd4c21b9947f8c09d938a360cf5d7f3bec4 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-xml-tools</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+    </dependency>
     <dependency>
       <groupId>xmlunit</groupId>
       <artifactId>xmlunit</artifactId>
index c62612d8502428297d64695ca33dbbbc11869ebd..83042e2874974ab2ec21270254966b426fa8372b 100644 (file)
@@ -38,39 +38,36 @@ import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
 import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
 import org.apache.maven.archiva.repository.scanner.functors.TriggerBeginScanClosure;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 
 /**
  * RepositoryContentConsumerUtil 
  *
  * @version $Id$
- * 
- * @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers"
  */
-public class RepositoryContentConsumers
+public class RepositoryContentConsumers implements ApplicationContextAware
 {
-    private Logger log = LoggerFactory.getLogger( RepositoryContentConsumers.class );
+    private ApplicationContext applicationContext;
     
-    /**
-     * @plexus.requirement
-     */
     private ArchivaConfiguration archivaConfiguration;
 
-    /**
-     * @plexus.requirement role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
-     */
-    private List<KnownRepositoryContentConsumer> availableKnownConsumers;
-
-    /**
-     * @plexus.requirement role="org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer"
-     */
-    private List<InvalidRepositoryContentConsumer> availableInvalidConsumers;
-
     private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
 
     private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
-    
+
+    public RepositoryContentConsumers(ArchivaConfiguration archivaConfiguration)
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext)
+        throws BeansException
+    {
+        this.applicationContext = applicationContext;
+    }
+
     /**
      * <p>
      * Get the list of Ids associated with those {@link KnownRepositoryContentConsumer} that have
@@ -160,7 +157,7 @@ public class RepositoryContentConsumers
 
             List<String> knownSelected = getSelectedKnownConsumerIds();
 
-            for ( KnownRepositoryContentConsumer consumer : availableKnownConsumers )
+            for ( KnownRepositoryContentConsumer consumer : getAvailableKnownConsumers() )
             {
                 if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
                 {
@@ -187,7 +184,7 @@ public class RepositoryContentConsumers
 
             List<String> invalidSelected = getSelectedInvalidConsumerIds();
 
-            for ( InvalidRepositoryContentConsumer consumer : availableInvalidConsumers )
+            for ( InvalidRepositoryContentConsumer consumer : getAvailableInvalidConsumers() )
             {
                 if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
                 {
@@ -208,7 +205,7 @@ public class RepositoryContentConsumers
      */
     public List<KnownRepositoryContentConsumer> getAvailableKnownConsumers()
     {
-        return availableKnownConsumers;
+        return new ArrayList(applicationContext.getBeansOfType(KnownRepositoryContentConsumer.class).values());
     }
 
     /**
@@ -220,35 +217,7 @@ public class RepositoryContentConsumers
      */
     public List<InvalidRepositoryContentConsumer> getAvailableInvalidConsumers()
     {
-        return availableInvalidConsumers;
-    }
-
-    /**
-     * Set the list of {@link KnownRepositoryContentConsumer} objects that are
-     * available.
-     * 
-     * NOTE: This is an override for the base functionality as a component, this
-     * is used by archiva-cli and the unit testing framework.
-     * 
-     * @return the list of available {@link KnownRepositoryContentConsumer}.
-     */
-    public void setAvailableKnownConsumers( List<KnownRepositoryContentConsumer> availableKnownConsumers )
-    {
-        this.availableKnownConsumers = availableKnownConsumers;
-    }
-
-    /**
-     * Set the list of {@link InvalidRepositoryContentConsumer} objects that are
-     * available.
-     * 
-     * NOTE: This is an override for the base functionality as a component, this
-     * is used by archiva-cli and the unit testing framework.
-     * 
-     * @return the list of available {@link InvalidRepositoryContentConsumer}.
-     */
-    public void setAvailableInvalidConsumers( List<InvalidRepositoryContentConsumer> availableInvalidConsumers )
-    {
-        this.availableInvalidConsumers = availableInvalidConsumers;
+        return new ArrayList(applicationContext.getBeansOfType(InvalidRepositoryContentConsumer.class).values());
     }
 
     /**
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-layer/src/main/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..994559f
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+    <bean id="repositoryContentConsumers" class="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers" scope="prototype">
+      <constructor-arg>
+        <ref bean="archivaConfiguration"/>
+      </constructor-arg>
+    </bean>
+</beans>
\ No newline at end of file
index 8d3780c2612f740228e371452681076b8ca07861..73ef2ca1afdb9f5d1aaf5d77a1ada6474b45ac55 100644 (file)
@@ -1,10 +1,17 @@
 package org.apache.maven.archiva.repository.scanner;
 
 import java.util.Date;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 
 public class RepositoryContentConsumersStub
     extends RepositoryContentConsumers
-{       
+{
+    public RepositoryContentConsumersStub(ArchivaConfiguration archivaConfiguration)
+    {
+        super(archivaConfiguration);
+    }
+
+    @Override
     public Date getStartTime()
     {
         Date startTimeForTest = new Date( System.currentTimeMillis() );
index 22e596abbf95bb9da5767e3f3d235f31db959094..5717b2de71973aedc0dda934d65877ac8645ce13 100644 (file)
@@ -19,6 +19,8 @@ package org.apache.maven.archiva.repository.scanner;
  * under the License.
  */
 
+import java.io.IOException;
+import java.util.Locale;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
@@ -31,8 +33,18 @@ import java.io.File;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.MessageSourceResolvable;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.core.io.Resource;
 
 /**
  * RepositoryContentConsumersTest
@@ -45,17 +57,18 @@ public class RepositoryContentConsumersTest
     private RepositoryContentConsumers lookupRepositoryConsumers()
         throws Exception
     {
-        RepositoryContentConsumers consumerUtilStub = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class
-            .getName(), "test" );
-        ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.ROLE );        
+        ArchivaConfiguration configuration = (ArchivaConfiguration)lookup(ArchivaConfiguration.class);
+
+        RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub(configuration);
+               
         RepositoryContentConsumers consumerUtil = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class
                                                                                            .getName() );
-        
-        consumerUtilStub.setAvailableKnownConsumers( consumerUtil.getAvailableKnownConsumers() );
-        consumerUtilStub.setAvailableInvalidConsumers( consumerUtil.getAvailableInvalidConsumers() );
+        ApplicationContext context = new MockApplicationContext(consumerUtil.getAvailableKnownConsumers(), consumerUtil.getAvailableInvalidConsumers());
+
+        consumerUtilStub.setApplicationContext(context);
         consumerUtilStub.setSelectedInvalidConsumers( consumerUtil.getSelectedInvalidConsumers() );
         consumerUtilStub.setSelectedKnownConsumers( consumerUtil.getSelectedKnownConsumers() );        
-        consumerUtilStub.setArchivaConfiguration( archivaConfiguration );
+        consumerUtilStub.setArchivaConfiguration( configuration );
         
         assertNotNull( "RepositoryContentConsumers should not be null.", consumerUtilStub );
         
@@ -206,7 +219,9 @@ public class RepositoryContentConsumersTest
         KnownRepositoryContentConsumer unselectedKnownConsumer =
             (KnownRepositoryContentConsumer) MockControl.createNiceControl(
                 KnownRepositoryContentConsumer.class ).getMock();
-        consumers.setAvailableKnownConsumers( Arrays.asList( selectedKnownConsumer, unselectedKnownConsumer ) );
+
+        consumers.setApplicationContext(new MockApplicationContext(Arrays.asList( selectedKnownConsumer, unselectedKnownConsumer ), null));
+
         consumers.setSelectedKnownConsumers( Collections.singletonList( selectedKnownConsumer ) );
 
         MockControl invalidControl = MockControl.createControl( InvalidRepositoryContentConsumer.class );
@@ -215,7 +230,9 @@ public class RepositoryContentConsumersTest
         InvalidRepositoryContentConsumer unselectedInvalidConsumer =
             (InvalidRepositoryContentConsumer) MockControl.createControl(
                 InvalidRepositoryContentConsumer.class ).getMock();
-        consumers.setAvailableInvalidConsumers( 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" ) );
@@ -223,7 +240,7 @@ public class RepositoryContentConsumersTest
 
         Date startTime = new Date( System.currentTimeMillis() );
         startTime.setTime( 12345678 );
-        
+
         selectedKnownConsumer.beginScan( repo, startTime );
         selectedKnownConsumer.getExcludes();
         knownControl.setReturnValue( Collections.EMPTY_LIST );
@@ -236,7 +253,7 @@ public class RepositoryContentConsumersTest
         selectedInvalidConsumer.beginScan( repo, startTime );
         //        invalidConsumer.completeScan();
         invalidControl.replay();
-        
+
         consumers.executeConsumers( repo, testFile );
 
         knownControl.verify();
@@ -303,4 +320,155 @@ public class RepositoryContentConsumersTest
         }
         return path;
     }
+
+    private static Map convertToMap(List objects)
+    {
+        HashMap map = new HashMap();
+        for (Object o : objects)
+        {
+            map.put(o, o);
+        }
+        return map;
+    }
+
+    public class MockApplicationContext implements ApplicationContext
+    {
+        private List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer;
+
+        private 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 String getDisplayName() {
+            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 long getStartupDate() {
+            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 String[] getBeanDefinitionNames() {
+            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 Map getBeansOfType(Class type) throws BeansException {
+            if (type == KnownRepositoryContentConsumer.class)
+            {
+                return convertToMap(knownRepositoryContentConsumer);
+            }
+            if (type == InvalidRepositoryContentConsumer.class)
+            {
+                return convertToMap(invalidRepositoryContentConsumers);
+            }
+            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 boolean containsBean(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, 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 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 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 containsLocalBean(String name) {
+            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, 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 Resource[] getResources(String locationPattern) throws IOException {
+            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.");
+        }
+    }
 }
index b53007004cce0826335257e3e048e952e08b7531..28fb955884b0edfba1754a9e6917ed1f88756b47 100644 (file)
@@ -86,7 +86,7 @@ public class DavResourceTest extends PlexusInSpringTestCase
         resource = getDavResource(resourceLocator.getHref(false), myResource);
         lockManager = new SimpleLockManager();
         resource.addLockManager(lockManager);
-        consumers = new RepositoryContentConsumers();
+        consumers = (RepositoryContentConsumers)getApplicationContext().getBean("repositoryContentConsumers");
         archivaXworkUser = (ArchivaXworkUser) getApplicationContext().getBean( PlexusToSpringUtils.buildSpringId( ArchivaXworkUser.class ) );
     }
 
index ff9dbd237c7b29e0454da094e72063ce115cc339..573895c588dd945d7a6359a6eb2b3433e7f4a2d9 100644 (file)
@@ -5,15 +5,23 @@ import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
 
 import java.util.List;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 
 public class StubRepositoryContentConsumers
     extends RepositoryContentConsumers
 {
+    public StubRepositoryContentConsumers(ArchivaConfiguration configuration)
+    {
+        super(configuration);
+    }
+
+    @Override
     public List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
     {
         return getAvailableKnownConsumers();
     }
 
+    @Override
     public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
     {
         return getAvailableInvalidConsumers();
index 53e79073f4b30694cee00ae9d9fc01bed1c4935e..2dbdc4889bbfcf6534e08381282b353a6cba90ff 100644 (file)
         <!-- 30 minutes = 1800 seconds  -->
         <time-to-live-seconds>1800</time-to-live-seconds>
       </configuration>
-    </component>    
-    
-    
-    <!-- Don't drag in the world just to test this -->
-    <component>
-      <role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
-      <role-hint>default</role-hint>
-      <implementation>org.apache.maven.archiva.webdav.StubRepositoryContentConsumers</implementation>
     </component>
     
     <component>
index fd67257efad24f09a31ab474842dbc6ad99f622d..a175b1abc46e9785ff69460e27d70526f220868a 100644 (file)
         <!-- 30 minutes = 1800 seconds  -->
         <time-to-live-seconds>1800</time-to-live-seconds>
       </configuration>
-    </component>    
-    
-    
-    <!-- Don't drag in the world just to test this -->
-    <component>
-      <role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
-      <role-hint>default</role-hint>
-      <implementation>org.apache.maven.archiva.webdav.StubRepositoryContentConsumers</implementation>
     </component>
     
     <component>