summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-scanner
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-09-18 22:00:57 +0000
committerOlivier Lamy <olamy@apache.org>2012-09-18 22:00:57 +0000
commit2103f2d60f5b0e763a526de867afd37404a50b56 (patch)
treee345fa2ec1be80dcb847651f1ac3b4c3b2711daf /archiva-modules/archiva-base/archiva-repository-scanner
parentcfb78daaaada7ffde4d03f0c4943e51f5c1f8fdb (diff)
downloadarchiva-2103f2d60f5b0e763a526de867afd37404a50b56.tar.gz
archiva-2103f2d60f5b0e763a526de867afd37404a50b56.zip
finish unit test for getMergeConflictedArtifacts rest method
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1387384 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-scanner')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java57
1 files changed, 30 insertions, 27 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
index 25150f8b5..381ca77e9 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -22,16 +22,16 @@ package org.apache.archiva.repository.scanner;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.common.utils.BaseFile;
+import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
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.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.IfClosure;
-import org.apache.archiva.common.utils.BaseFile;
-import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
-import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -47,10 +47,8 @@ import java.util.Map;
/**
* RepositoryContentConsumerUtil
- *
- *
*/
-@Service("repositoryContentConsumers")
+@Service ("repositoryContentConsumers")
public class RepositoryContentConsumers
implements ApplicationContextAware
{
@@ -163,22 +161,23 @@ public class RepositoryContentConsumers
public synchronized List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
throws RepositoryAdminException
{
- if ( selectedKnownConsumers == null )
+ // FIXME only for testing
+ if ( selectedKnownConsumers != null )
{
- List<KnownRepositoryContentConsumer> ret = new ArrayList<KnownRepositoryContentConsumer>();
+ return selectedKnownConsumers;
+ }
+ List<KnownRepositoryContentConsumer> ret = new ArrayList<KnownRepositoryContentConsumer>();
- List<String> knownSelected = getSelectedKnownConsumerIds();
+ List<String> knownSelected = getSelectedKnownConsumerIds();
- for ( KnownRepositoryContentConsumer consumer : getAvailableKnownConsumers() )
+ for ( KnownRepositoryContentConsumer consumer : getAvailableKnownConsumers() )
+ {
+ if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
{
- if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
- {
- ret.add( consumer );
- }
+ ret.add( consumer );
}
- this.selectedKnownConsumers = ret;
}
- return selectedKnownConsumers;
+ return ret;
}
/**
@@ -191,24 +190,28 @@ public class RepositoryContentConsumers
public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
throws RepositoryAdminException
{
- if ( selectedInvalidConsumers == null )
+
+ // FIXME only for testing
+ if ( selectedInvalidConsumers != null )
{
- List<InvalidRepositoryContentConsumer> ret = new ArrayList<InvalidRepositoryContentConsumer>();
+ return selectedInvalidConsumers;
+ }
- List<String> invalidSelected = getSelectedInvalidConsumerIds();
+ List<InvalidRepositoryContentConsumer> ret = new ArrayList<InvalidRepositoryContentConsumer>();
- for ( InvalidRepositoryContentConsumer consumer : getAvailableInvalidConsumers() )
+ List<String> invalidSelected = getSelectedInvalidConsumerIds();
+
+ for ( InvalidRepositoryContentConsumer consumer : getAvailableInvalidConsumers() )
+ {
+ if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
{
- if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
- {
- ret.add( consumer );
- }
+ ret.add( consumer );
}
- selectedInvalidConsumers = ret;
}
- return selectedInvalidConsumers;
+ return ret;
}
+
/**
* Get the list of {@link KnownRepositoryContentConsumer} objects that are
* available and present in the classpath and as components in the IoC.