aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-scanner
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-09-13 12:12:39 +0000
committerOlivier Lamy <olamy@apache.org>2011-09-13 12:12:39 +0000
commit919a5ac3eb725dc676e81fcbf868f3cc165598a4 (patch)
tree9aecd4829e214ecbb256dbd0ec5f13f428016ab3 /archiva-modules/archiva-base/archiva-repository-scanner
parent5c067f2a4deaa775213a3b5c2ca44ce62f4ba914 (diff)
downloadarchiva-919a5ac3eb725dc676e81fcbf868f3cc165598a4.tar.gz
archiva-919a5ac3eb725dc676e81fcbf868f3cc165598a4.zip
[MRM-1504] Add a new module for repository administration management
split the repo admin in two modules : api and default implementation (to be able to more easily change the impl). Use the repo admin api consumers and indexing modules. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170135 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/pom.xml9
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java38
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java38
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java3
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java77
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java22
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java14
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java8
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/resources/META-INF/spring-context.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java166
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java12
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java14
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersStub.java10
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java21
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java34
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java12
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/spring-context.xml6
17 files changed, 336 insertions, 153 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
index a4d547391..92f024a79 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
@@ -34,7 +34,7 @@
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <artifactId>archiva-repository-admin-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -46,6 +46,13 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-configuration</artifactId>
+ <!-- FIXME olamy : should be scope test but it depends on FileTypes
+ <scope>test</scope>
+ -->
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
index 6185efe91..c7f950f39 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
@@ -19,28 +19,29 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
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 java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import javax.inject.Inject;
/**
* DefaultRepositoryScanner
*
* @version $Id$
*/
-@Service("repositoryScanner#default")
+@Service( "repositoryScanner#default" )
public class DefaultRepositoryScanner
implements RepositoryScanner
{
@@ -58,17 +59,24 @@ public class DefaultRepositoryScanner
private Set<RepositoryScannerInstance> inProgressScans = new LinkedHashSet<RepositoryScannerInstance>();
- public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
+ public RepositoryScanStatistics scan( ManagedRepository repository, long changesSince )
throws RepositoryScannerException
{
- List<KnownRepositoryContentConsumer> knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
- List<InvalidRepositoryContentConsumer> invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
- List<String> ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
+ try
+ {
+ List<KnownRepositoryContentConsumer> knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
+ List<InvalidRepositoryContentConsumer> invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
+ List<String> ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
- return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
+ return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new RepositoryScannerException( e.getMessage(), e );
+ }
}
- public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
+ public RepositoryScanStatistics scan( ManagedRepository repository,
List<KnownRepositoryContentConsumer> knownContentConsumers,
List<InvalidRepositoryContentConsumer> invalidContentConsumers,
List<String> ignoredContentPatterns, long changesSince )
@@ -85,14 +93,14 @@ public class DefaultRepositoryScanner
//create the repo if not existing to have an empty stats
if ( !repositoryBase.exists() && !repositoryBase.mkdirs() )
{
- throw new UnsupportedOperationException( "Unable to scan a repository, directory "
- + repositoryBase.getPath() + " does not exist." );
+ throw new UnsupportedOperationException(
+ "Unable to scan a repository, directory " + repositoryBase.getPath() + " does not exist." );
}
if ( !repositoryBase.isDirectory() )
{
- throw new UnsupportedOperationException( "Unable to scan a repository, path "
- + repositoryBase.getPath() + " is not a directory." );
+ throw new UnsupportedOperationException(
+ "Unable to scan a repository, path " + repositoryBase.getPath() + " is not a directory." );
}
// Setup Includes / Excludes.
@@ -117,8 +125,8 @@ public class DefaultRepositoryScanner
dirWalker.setExcludes( allExcludes );
// Setup the Scan Instance
- RepositoryScannerInstance scannerInstance = new RepositoryScannerInstance( repository, knownContentConsumers,
- invalidContentConsumers, changesSince );
+ RepositoryScannerInstance scannerInstance =
+ new RepositoryScannerInstance( repository, knownContentConsumers, invalidContentConsumers, changesSince );
inProgressScans.add( scannerInstance );
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 666ff0045..c95209ebd 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
@@ -19,6 +19,9 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
@@ -26,16 +29,15 @@ import org.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.IfClosure;
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Service;
+import javax.inject.Inject;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
@@ -48,20 +50,24 @@ import java.util.Map;
*
* @version $Id$
*/
+@Service("repositoryContentConsumers")
public class RepositoryContentConsumers
implements ApplicationContextAware
{
+
+ @Inject
private ApplicationContext applicationContext;
- private ArchivaConfiguration archivaConfiguration;
+ private ArchivaAdministration archivaAdministration;
private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
- public RepositoryContentConsumers( ArchivaConfiguration archivaConfiguration )
+ @Inject
+ public RepositoryContentConsumers( ArchivaAdministration archivaAdministration )
{
- this.archivaConfiguration = archivaConfiguration;
+ this.archivaAdministration = archivaAdministration;
}
public void setApplicationContext( ApplicationContext applicationContext )
@@ -84,9 +90,9 @@ public class RepositoryContentConsumers
* @return the list of consumer ids that have been selected by the configuration.
*/
public List<String> getSelectedKnownConsumerIds()
+ throws RepositoryAdminException
{
- RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
- return scanning.getKnownContentConsumers();
+ return archivaAdministration.getKnownContentConsumers();
}
/**
@@ -103,9 +109,9 @@ public class RepositoryContentConsumers
* @return the list of consumer ids that have been selected by the configuration.
*/
public List<String> getSelectedInvalidConsumerIds()
+ throws RepositoryAdminException
{
- RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
- return scanning.getInvalidContentConsumers();
+ return archivaAdministration.getInvalidContentConsumers();
}
/**
@@ -115,6 +121,7 @@ public class RepositoryContentConsumers
* @return the map of String ids to {@link KnownRepositoryContentConsumer} objects.
*/
public Map<String, KnownRepositoryContentConsumer> getSelectedKnownConsumersMap()
+ throws RepositoryAdminException
{
Map<String, KnownRepositoryContentConsumer> consumerMap = new HashMap<String, KnownRepositoryContentConsumer>();
@@ -133,6 +140,7 @@ public class RepositoryContentConsumers
* @return the map of String ids to {@link InvalidRepositoryContentConsumer} objects.
*/
public Map<String, InvalidRepositoryContentConsumer> getSelectedInvalidConsumersMap()
+ throws RepositoryAdminException
{
Map<String, InvalidRepositoryContentConsumer> consumerMap =
new HashMap<String, InvalidRepositoryContentConsumer>();
@@ -153,6 +161,7 @@ public class RepositoryContentConsumers
* by the active configuration.
*/
public synchronized List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
+ throws RepositoryAdminException
{
if ( selectedKnownConsumers == null )
{
@@ -180,6 +189,7 @@ public class RepositoryContentConsumers
* by the active configuration.
*/
public synchronized List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
+ throws RepositoryAdminException
{
if ( selectedInvalidConsumers == null )
{
@@ -236,8 +246,8 @@ public class RepositoryContentConsumers
* @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( ManagedRepository repository, File localFile, boolean updateRelatedArtifacts )
+ throws RepositoryAdminException
{
// Run the repository consumers
try
@@ -316,8 +326,8 @@ public class RepositoryContentConsumers
return new Date( System.currentTimeMillis() );
}
- public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+ public void setArchivaAdministration( ArchivaAdministration archivaAdministration )
{
- this.archivaConfiguration = archivaConfiguration;
+ this.archivaAdministration = archivaAdministration;
}
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
index e6fa22d7b..f7511b7da 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
@@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
@@ -114,7 +115,7 @@ public class RepositoryScanStatistics
invalidConsumers = consumers;
}
- public String toDump( ManagedRepositoryConfiguration repo )
+ public String toDump( ManagedRepository repo )
{
StringBuffer buf = new StringBuffer();
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
index 2ebbc443d..064826a14 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanner.java
@@ -19,23 +19,22 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import java.util.List;
+import java.util.Set;
+
/**
- * RepositoryScanner
+ * RepositoryScanner
*
* @version $Id$
*/
public interface RepositoryScanner
{
/**
- * The value to pass to {@link #scan(ManagedRepositoryConfiguration, long)} to have the scan
+ * The value to pass to {@link #scan(ManagedRepository, long)} to have the scan
* operate in a fresh fashion, with no check on changes based on timestamp.
*/
public static final long FRESH_SCAN = 0;
@@ -44,68 +43,56 @@ public interface RepositoryScanner
* <p>
* Typical Ignorable Content patterns.
* </p>
- *
+ * <p/>
* <p><strong>
* NOTE: Do not use for normal webapp or task driven repository scanning.
* </strong></p>
- *
+ * <p/>
* <p>
* These patterns are only valid for archiva-cli and archiva-converter use.
* </p>
*/
- public static final String[] IGNORABLE_CONTENT = {
- "bin/**",
- "reports/**",
- ".index",
- ".reports/**",
- ".maven/**",
- "**/.svn/**",
- "**/*snapshot-version",
- "*/website/**",
- "*/licences/**",
- "**/.htaccess",
- "**/*.html",
- "**/*.txt",
- "**/README*",
- "**/CHANGELOG*",
- "**/KEYS*" };
+ public static final String[] IGNORABLE_CONTENT =
+ { "bin/**", "reports/**", ".index", ".reports/**", ".maven/**", "**/.svn/**", "**/*snapshot-version",
+ "*/website/**", "*/licences/**", "**/.htaccess", "**/*.html", "**/*.txt", "**/README*", "**/CHANGELOG*",
+ "**/KEYS*" };
/**
* Scan the repository for content changes.
- *
+ * <p/>
* Internally, this will use the as-configured known and invalid consumer lists.
- *
- * @param repository the repository to change.
+ *
+ * @param repository the repository to change.
* @param changesSince the timestamp to use as a threshold on what is considered new or changed.
* (To have all content be taken into consideration regardless of timestamp,
- * use the {@link #FRESH_SCAN} constant)
+ * use the {@link #FRESH_SCAN} constant)
* @return the statistics for this scan.
* @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started.
*/
- public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
+ RepositoryScanStatistics scan( ManagedRepository repository, long changesSince )
throws RepositoryScannerException;
/**
* Scan the repository for content changes.
- *
+ * <p/>
* Internally, this will use the as-configured known and invalid consumer lists.
- *
- * @param repository the repository to change.
- * @param knownContentConsumers the list of consumers that follow the {@link KnownRepositoryContentConsumer}
- * interface that should be used for this scan.
- * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer}
- * interface that should be used for this scan.
- * @param ignoredContentPatterns list of patterns that should be ignored and not sent to any consumer.
- * @param changesSince the timestamp to use as a threshold on what is considered new or changed.
- * (To have all content be taken into consideration regardless of timestamp,
- * use the {@link #FRESH_SCAN} constant)
+ *
+ * @param repository the repository to change.
+ * @param knownContentConsumers the list of consumers that follow the {@link KnownRepositoryContentConsumer}
+ * interface that should be used for this scan.
+ * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer}
+ * interface that should be used for this scan.
+ * @param ignoredContentPatterns list of patterns that should be ignored and not sent to any consumer.
+ * @param changesSince the timestamp to use as a threshold on what is considered new or changed.
+ * (To have all content be taken into consideration regardless of timestamp,
+ * use the {@link #FRESH_SCAN} constant)
* @return the statistics for this scan.
* @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started.
*/
- public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
- List<KnownRepositoryContentConsumer> knownContentConsumers,
- List<InvalidRepositoryContentConsumer> invalidContentConsumers,
- List<String> ignoredContentPatterns, long changesSince )
+ RepositoryScanStatistics scan( ManagedRepository repository,
+ List<KnownRepositoryContentConsumer> knownContentConsumers,
+ List<InvalidRepositoryContentConsumer> invalidContentConsumers,
+ List<String> ignoredContentPatterns, long changesSince )
throws RepositoryScannerException;
Set<RepositoryScannerInstance> getInProgressScans();
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
index f027c2266..c75a99912 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
@@ -19,12 +19,7 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
-import java.io.File;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
@@ -33,13 +28,18 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.IfClosure;
import org.apache.commons.lang.SystemUtils;
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
import org.codehaus.plexus.util.DirectoryWalkListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* RepositoryScannerInstance
*
@@ -60,7 +60,7 @@ public class RepositoryScannerInstance
*/
private List<InvalidRepositoryContentConsumer> invalidConsumers;
- private ManagedRepositoryConfiguration repository;
+ private ManagedRepository repository;
private RepositoryScanStatistics stats;
@@ -74,7 +74,7 @@ public class RepositoryScannerInstance
private Map<String, Long> consumerCounts;
- public RepositoryScannerInstance( ManagedRepositoryConfiguration repository,
+ public RepositoryScannerInstance( ManagedRepository repository,
List<KnownRepositoryContentConsumer> knownConsumerList,
List<InvalidRepositoryContentConsumer> invalidConsumerList )
{
@@ -106,7 +106,7 @@ public class RepositoryScannerInstance
}
}
- public RepositoryScannerInstance( ManagedRepositoryConfiguration repository,
+ public RepositoryScannerInstance( ManagedRepository repository,
List<KnownRepositoryContentConsumer> knownContentConsumers,
List<InvalidRepositoryContentConsumer> invalidContentConsumers, long changesSince )
{
@@ -187,7 +187,7 @@ public class RepositoryScannerInstance
log.debug( "Repository Scanner: {}", message );
}
- public ManagedRepositoryConfiguration getRepository()
+ public ManagedRepository getRepository()
{
return repository;
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
index 2976637b8..507ccb61b 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
@@ -19,15 +19,15 @@ package org.apache.archiva.repository.scanner.functors;
* under the License.
*/
-import java.util.Date;
-
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Date;
+
/**
* TriggerBeginScanClosure
*
@@ -38,24 +38,24 @@ public class TriggerBeginScanClosure
{
private Logger log = LoggerFactory.getLogger( TriggerBeginScanClosure.class );
- private ManagedRepositoryConfiguration repository;
+ private ManagedRepository repository;
private Date whenGathered;
private boolean executeOnEntireRepo = true;
- public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository )
+ public TriggerBeginScanClosure( ManagedRepository repository )
{
this.repository = repository;
}
- public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository, Date whenGathered )
+ public TriggerBeginScanClosure( ManagedRepository repository, Date whenGathered )
{
this( repository );
this.whenGathered = whenGathered;
}
- public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ public TriggerBeginScanClosure( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
{
this( repository, whenGathered );
this.executeOnEntireRepo = executeOnEntireRepo;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
index 5d2330a98..9cbfb7400 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
@@ -19,8 +19,8 @@ package org.apache.archiva.repository.scanner.functors;
* under the License.
*/
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,16 +33,16 @@ public class TriggerScanCompletedClosure
{
private Logger log = LoggerFactory.getLogger( TriggerScanCompletedClosure.class );
- private final ManagedRepositoryConfiguration repository;
+ private final ManagedRepository repository;
private boolean executeOnEntireRepo = true;
- public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository )
+ public TriggerScanCompletedClosure( ManagedRepository repository )
{
this.repository = repository;
}
- public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository, boolean executeOnEntireRepo )
+ public TriggerScanCompletedClosure( ManagedRepository repository, boolean executeOnEntireRepo )
{
this( repository );
this.executeOnEntireRepo = executeOnEntireRepo;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/resources/META-INF/spring-context.xml
index 867eb1a27..c5e39b8e0 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/resources/META-INF/spring-context.xml
@@ -31,9 +31,4 @@
<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>
</beans>
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java
new file mode 100644
index 000000000..a64c72693
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java
@@ -0,0 +1,166 @@
+package org.apache.archiva.repository.scanner;
+/*
+ * 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.admin.ArchivaAdministration;
+import org.apache.archiva.admin.model.admin.FileType;
+import org.apache.archiva.admin.model.admin.LegacyArtifactPath;
+import org.apache.archiva.admin.model.admin.OrganisationInformation;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service
+public class ArchivaAdministrationStub
+ implements ArchivaAdministration
+{
+
+ private ArchivaConfiguration archivaConfiguration;
+
+ public ArchivaAdministrationStub()
+ {
+ // no op
+ }
+
+
+ public ArchivaAdministrationStub( ArchivaConfiguration archivaConfiguration )
+ {
+ this.archivaConfiguration = archivaConfiguration;
+ }
+
+ public List<LegacyArtifactPath> getLegacyArtifactPaths()
+ throws RepositoryAdminException
+ {
+ return null;
+ }
+
+ public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public List<FileType> getFileTypes()
+ throws RepositoryAdminException
+ {
+ return null;
+ }
+
+ public FileType getFileType( String fileTypeId )
+ throws RepositoryAdminException
+ {
+ return null;
+ }
+
+ public void addFileType( FileType fileType, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void removeFileType( String fileTypeId, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public List<String> getKnownContentConsumers()
+ throws RepositoryAdminException
+ {
+ return archivaConfiguration.getConfiguration().getRepositoryScanning().getKnownContentConsumers();
+ }
+
+ public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public List<String> getInvalidContentConsumers()
+ throws RepositoryAdminException
+ {
+ return archivaConfiguration.getConfiguration().getRepositoryScanning().getInvalidContentConsumers();
+ }
+
+ public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+
+ public OrganisationInformation getOrganisationInformation()
+ throws RepositoryAdminException
+ {
+ return null;
+ }
+
+ public void setOrganisationInformation( OrganisationInformation organisationInformation )
+ throws RepositoryAdminException
+ {
+
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
index 472848d44..91fdb1930 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
@@ -19,14 +19,14 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
-import java.util.Date;
-import java.util.List;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
+import java.util.Date;
+import java.util.List;
+
/**
* InvalidScanConsumer
*
@@ -43,13 +43,13 @@ public class InvalidScanConsumer
private int processCount = 0;
- public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+ public void beginScan( ManagedRepository repository, Date whenGathered )
throws ConsumerException
{
/* do nothing */
}
- public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
throws ConsumerException
{
beginScan( repository, whenGathered );
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
index a2cd92901..e3d98af35 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
@@ -19,16 +19,16 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-
/**
* ScanConsumer
*
@@ -70,13 +70,13 @@ public class KnownScanConsumer
return "Scan Consumer (for testing)";
}
- public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+ public void beginScan( ManagedRepository repository, Date whenGathered )
throws ConsumerException
{
/* do nothing */
}
- public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
throws ConsumerException
{
beginScan( repository, whenGathered );
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersStub.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersStub.java
index bd47bce23..4b17fe6f8 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersStub.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersStub.java
@@ -19,16 +19,16 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
-import java.util.Date;
+import org.apache.archiva.admin.model.admin.ArchivaAdministration;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import java.util.Date;
public class RepositoryContentConsumersStub
extends RepositoryContentConsumers
{
- public RepositoryContentConsumersStub(ArchivaConfiguration archivaConfiguration)
+ public RepositoryContentConsumersStub( ArchivaAdministration archivaAdministration )
{
- super(archivaConfiguration);
+ super( archivaAdministration );
}
@Override
@@ -36,7 +36,7 @@ public class RepositoryContentConsumersStub
{
Date startTimeForTest = new Date( System.currentTimeMillis() );
startTimeForTest.setTime( 12345678 );
-
+
return startTimeForTest;
}
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
index 4684618b4..81e5ba946 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
@@ -20,10 +20,10 @@ package org.apache.archiva.repository.scanner;
*/
import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
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.easymock.MockControl;
@@ -67,18 +67,18 @@ public class RepositoryContentConsumersTest
@Inject
ApplicationContext applicationContext;
- protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ protected ManagedRepository createRepository( String id, String name, File location )
{
- ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ ManagedRepository repo = new ManagedRepository();
repo.setId( id );
repo.setName( name );
repo.setLocation( location.getAbsolutePath() );
return repo;
}
- protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+ protected RemoteRepository createRemoteRepository( String id, String name, String url )
{
- RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+ RemoteRepository repo = new RemoteRepository();
repo.setId( id );
repo.setName( name );
repo.setUrl( url );
@@ -89,10 +89,13 @@ public class RepositoryContentConsumersTest
throws Exception
{
+
ArchivaConfiguration configuration =
applicationContext.getBean( "archivaConfiguration#test-conf", ArchivaConfiguration.class );
- RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub( configuration );
+ ArchivaAdministrationStub administrationStub = new ArchivaAdministrationStub( configuration );
+
+ RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub( administrationStub );
RepositoryContentConsumers consumerUtil =
(RepositoryContentConsumers) applicationContext.getBean( "repositoryContentConsumers#test",
@@ -103,7 +106,7 @@ public class RepositoryContentConsumersTest
consumerUtilStub.setApplicationContext( context );
consumerUtilStub.setSelectedInvalidConsumers( consumerUtil.getSelectedInvalidConsumers() );
consumerUtilStub.setSelectedKnownConsumers( consumerUtil.getSelectedKnownConsumers() );
- consumerUtilStub.setArchivaConfiguration( configuration );
+ consumerUtilStub.setArchivaAdministration( administrationStub );
assertNotNull( "RepositoryContentConsumers should not be null.", consumerUtilStub );
@@ -264,7 +267,7 @@ public class RepositoryContentConsumersTest
consumers.setSelectedInvalidConsumers( Collections.singletonList( selectedInvalidConsumer ) );
- ManagedRepositoryConfiguration repo = createRepository( "id", "name", new File( "target/test-repo" ) );
+ ManagedRepository 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() );
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
index 709128e60..d68988a9b 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
@@ -20,6 +20,8 @@ package org.apache.archiva.repository.scanner;
*/
import junit.framework.TestCase;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.remote.RemoteRepository;
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
@@ -56,18 +58,18 @@ public class RepositoryScannerTest
@Inject
ApplicationContext applicationContext;
- protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ protected ManagedRepository createRepository( String id, String name, File location )
{
- ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ ManagedRepository repo = new ManagedRepository();
repo.setId( id );
repo.setName( name );
repo.setLocation( location.getAbsolutePath() );
return repo;
}
- protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+ protected RemoteRepository createRemoteRepository( String id, String name, String url )
{
- RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+ RemoteRepository repo = new RemoteRepository();
repo.setId( id );
repo.setName( name );
repo.setUrl( url );
@@ -77,7 +79,7 @@ public class RepositoryScannerTest
private static final String[] ARTIFACT_PATTERNS =
new String[]{ "**/*.jar", "**/*.pom", "**/*.rar", "**/*.zip", "**/*.war", "**/*.tar.gz" };
- private ManagedRepositoryConfiguration createDefaultRepository()
+ private ManagedRepository createDefaultRepository()
{
File repoDir = new File( "src/test/repositories/default-repository" );
@@ -86,7 +88,7 @@ public class RepositoryScannerTest
return createRepository( "testDefaultRepo", "Test Default Repository", repoDir );
}
- private ManagedRepositoryConfiguration createSimpleRepository()
+ private ManagedRepository createSimpleRepository()
throws IOException, ParseException
{
File srcDir = new File( "src/test/repositories/simple-repository" );
@@ -114,13 +116,13 @@ public class RepositoryScannerTest
return fmt.parse( timestamp ).getTime();
}
- private ManagedRepositoryConfiguration createLegacyRepository()
+ private ManagedRepository createLegacyRepository()
{
File repoDir = new File( "src/test/repositories/legacy-repository" );
assertTrue( "Legacy Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
- ManagedRepositoryConfiguration repo = createRepository( "testLegacyRepo", "Test Legacy Repository", repoDir );
+ ManagedRepository repo = createRepository( "testLegacyRepo", "Test Legacy Repository", repoDir );
repo.setLayout( "legacy" );
return repo;
@@ -152,7 +154,7 @@ public class RepositoryScannerTest
public void testTimestampRepositoryScanner()
throws Exception
{
- ManagedRepositoryConfiguration repository = createSimpleRepository();
+ ManagedRepository repository = createSimpleRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -179,7 +181,7 @@ public class RepositoryScannerTest
public void testTimestampRepositoryScannerFreshScan()
throws Exception
{
- ManagedRepositoryConfiguration repository = createSimpleRepository();
+ ManagedRepository repository = createSimpleRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -205,7 +207,7 @@ public class RepositoryScannerTest
public void testTimestampRepositoryScannerProcessUnmodified()
throws Exception
{
- ManagedRepositoryConfiguration repository = createSimpleRepository();
+ ManagedRepository repository = createSimpleRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -232,7 +234,7 @@ public class RepositoryScannerTest
public void testDefaultRepositoryScanner()
throws Exception
{
- ManagedRepositoryConfiguration repository = createDefaultRepository();
+ ManagedRepository repository = createDefaultRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -293,7 +295,7 @@ public class RepositoryScannerTest
actualArtifactPaths.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
actualArtifactPaths.add( "javax/sql/jdbc/2.0/jdbc-2.0.jar" );
- ManagedRepositoryConfiguration repository = createDefaultRepository();
+ ManagedRepository repository = createDefaultRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -330,7 +332,7 @@ public class RepositoryScannerTest
actualMetadataPaths.add( "javax/sql/maven-metadata-repository.xml" );
actualMetadataPaths.add( "javax/maven-metadata.xml" );
- ManagedRepositoryConfiguration repository = createDefaultRepository();
+ ManagedRepository repository = createDefaultRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer knownConsumer = new KnownScanConsumer();
@@ -367,7 +369,7 @@ public class RepositoryScannerTest
actualProjectPaths.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" );
actualProjectPaths.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
- ManagedRepositoryConfiguration repository = createDefaultRepository();
+ ManagedRepository repository = createDefaultRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -408,7 +410,7 @@ public class RepositoryScannerTest
actualArtifactPaths.add( "org.apache.maven.update/jars/test-not-updated-1.0.jar" );
actualArtifactPaths.add( "org.apache.maven.update/jars/test-updated-1.0.jar" );
- ManagedRepositoryConfiguration repository = createLegacyRepository();
+ ManagedRepository repository = createLegacyRepository();
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
KnownScanConsumer consumer = new KnownScanConsumer();
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
index e61bcf2e8..b9603693d 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
@@ -19,14 +19,14 @@ package org.apache.archiva.repository.scanner;
* under the License.
*/
-import java.util.Date;
-import java.util.List;
-
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import java.util.Date;
+import java.util.List;
+
/**
* SampleKnownConsumer
*
@@ -41,13 +41,13 @@ public class SampleKnownConsumer
*/
private String id = "unset-id";
- public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
+ public void beginScan( ManagedRepository repository, Date whenGathered )
throws ConsumerException
{
/* nothing to do */
}
- public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
throws ConsumerException
{
beginScan( repository, whenGathered );
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/spring-context.xml
index 69c2d2875..b62fb28ef 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/spring-context.xml
@@ -31,6 +31,10 @@
<property name="registry" ref="registry#configured"/>
</bean>
+ <bean name="admin-test-conf" class="org.apache.archiva.repository.scanner.ArchivaAdministrationStub">
+ <constructor-arg ref="archivaConfiguration#test-conf"/>
+ </bean>
+
<bean name="registry#configured" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
<property name="properties">
<value>
@@ -84,7 +88,7 @@
</bean>
<bean name="repositoryContentConsumers#test" class="org.apache.archiva.repository.scanner.RepositoryContentConsumersStub">
- <constructor-arg ref="archivaConfiguration#test-conf"/>
+ <constructor-arg ref="admin-test-conf"/>
</bean>