aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-02-02 00:08:37 +0100
committerMartin Stockhammer <martin_s@apache.org>2020-02-02 00:09:02 +0100
commit61c39c4f42333c53f5f0e2dfcce7a2b9fa0c7284 (patch)
treee91d31bfd7214c270ccb752254602f1cce6186bb
parent92fbcf3decb633f85aaa738345995f79a9b50462 (diff)
downloadarchiva-61c39c4f42333c53f5f0e2dfcce7a2b9fa0c7284.tar.gz
archiva-61c39c4f42333c53f5f0e2dfcce7a2b9fa0c7284.zip
Renaming lucene-consumer to indexer-consumer
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/pom.xml145
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java246
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/resources/META-INF/spring-context.xml35
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/conf/repository-manager.xml129
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java237
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java472
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRoleManager.java137
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/log4j2-test.xml41
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/spring-context.xml74
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jarbin0 -> 4460 bytes
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml18
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar0
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/pom.xml2
-rwxr-xr-xsrc/ci/scripts/prepareWorkspace.sh1
14 files changed, 1536 insertions, 1 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/pom.xml
new file mode 100644
index 000000000..012e3f293
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/pom.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-consumers</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>archiva-indexer-consumers</artifactId>
+ <name>Archiva Base :: Consumers :: Indexer</name>
+
+ <properties>
+ <site.staging.base>${project.parent.parent.parent.basedir}</site.staging.base>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-consumer-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-scheduler-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-scheduler-indexing</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components.registry</groupId>
+ <artifactId>archiva-components-spring-registry-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components</groupId>
+ <artifactId>archiva-components-spring-taskqueue</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-layer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.redback</groupId>
+ <artifactId>redback-rbac-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.redback</groupId>
+ <artifactId>redback-rbac-role-manager</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <!-- Test scope -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-test-utils</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>metadata-store-jcr</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.maven</groupId>
+ <artifactId>archiva-maven-indexer</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/test/resources/test-repo/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <appserver.base>${project.build.directory}/appserver-base</appserver.base>
+ <plexus.home>${project.build.directory}/appserver-base</plexus.home>
+ <openjpa.Log>${openjpa.Log}</openjpa.Log>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
new file mode 100644
index 000000000..e03557ebf
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
@@ -0,0 +1,246 @@
+package org.apache.archiva.consumers.lucene;
+
+/*
+ * 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.common.utils.PathUtil;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.ConfigurationNames;
+import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.consumers.AbstractMonitoredConsumer;
+import org.apache.archiva.consumers.ConsumerException;
+import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.components.registry.Registry;
+import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.archiva.components.taskqueue.TaskQueueException;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.scheduler.ArchivaTaskScheduler;
+import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Consumer for indexing the repository to provide search and IDE integration features.
+ */
+@Service( "knownRepositoryContentConsumer#index-content" )
+@Scope( "prototype" )
+public class NexusIndexerConsumer
+ extends AbstractMonitoredConsumer
+ implements KnownRepositoryContentConsumer, RegistryListener
+{
+
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ private ArchivaConfiguration configuration;
+
+ private FileTypes filetypes;
+
+ private Path managedRepository;
+
+ private ArchivaTaskScheduler<ArtifactIndexingTask> scheduler;
+
+ private List<String> includes = new ArrayList<>( 0 );
+
+ private ManagedRepository repository;
+
+ @Inject
+ public NexusIndexerConsumer(
+ @Named( value = "archivaTaskScheduler#indexing" ) ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
+ @Named( value = "archivaConfiguration" ) ArchivaConfiguration configuration, FileTypes filetypes)
+ {
+ this.configuration = configuration;
+ this.filetypes = filetypes;
+ this.scheduler = scheduler;
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return "Indexes the repository to provide search and IDE integration features";
+ }
+
+ @Override
+ public String getId()
+ {
+ return "index-content";
+ }
+
+ @Override
+ public void beginScan( ManagedRepository repository, Date whenGathered )
+ throws ConsumerException
+ {
+ this.repository = repository;
+ managedRepository = PathUtil.getPathFromUri( repository.getLocation() );
+
+ }
+
+ @Override
+ public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ if ( executeOnEntireRepo )
+ {
+ beginScan( repository, whenGathered );
+ }
+ else
+ {
+ this.repository = repository;
+ managedRepository = Paths.get( repository.getLocation() );
+ }
+ }
+
+ @Override
+ public void processFile( String path )
+ throws ConsumerException
+ {
+ Path artifactFile = managedRepository.resolve(path);
+
+ ArtifactIndexingTask task =
+ new ArtifactIndexingTask( repository, artifactFile, ArtifactIndexingTask.Action.ADD, repository.getIndexingContext() );
+ try
+ {
+ log.debug( "Queueing indexing task '{}' to add or update the artifact in the index.", task );
+ scheduler.queueTask( task );
+ }
+ catch ( TaskQueueException e )
+ {
+ throw new ConsumerException( e.getMessage(), e );
+ }
+ }
+
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ if ( executeOnEntireRepo )
+ {
+ processFile( path );
+ }
+ else
+ {
+ Path artifactFile = managedRepository.resolve(path);
+
+ // specify in indexing task that this is not a repo scan request!
+ ArtifactIndexingTask task =
+ new ArtifactIndexingTask( repository, artifactFile, ArtifactIndexingTask.Action.ADD,
+ repository.getIndexingContext(), false );
+ // only update index we don't need to scan the full repo here
+ task.setOnlyUpdate( true );
+ try
+ {
+ log.debug( "Queueing indexing task '{}' to add or update the artifact in the index.", task );
+ scheduler.queueTask( task );
+ }
+ catch ( TaskQueueException e )
+ {
+ throw new ConsumerException( e.getMessage(), e );
+ }
+ }
+ }
+
+ @Override
+ public void completeScan()
+ {
+ ArtifactIndexingTask task =
+ new ArtifactIndexingTask( repository, null, ArtifactIndexingTask.Action.FINISH, repository.getIndexingContext());
+ try
+ {
+ log.debug( "Queueing indexing task '{}' to finish indexing.", task );
+ scheduler.queueTask( task );
+ }
+ catch ( TaskQueueException e )
+ {
+ log.error( "Error queueing task: {}: {}", task, e.getMessage(), e );
+ }
+ }
+
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ if ( executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
+ // else, do nothing as the context will be closed when indexing task is executed if not a repo scan request!
+ }
+
+ @Override
+ public List<String> getExcludes()
+ {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+ {
+ if ( ConfigurationNames.isRepositoryScanning( propertyName ) )
+ {
+ initIncludes();
+ }
+ }
+
+ @Override
+ public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+ {
+ /* do nothing */
+ }
+
+ private void initIncludes()
+ {
+ List<String> indexable = filetypes.getFileTypePatterns( FileTypes.INDEXABLE_CONTENT );
+ List<String> artifacts = filetypes.getFileTypePatterns( FileTypes.ARTIFACTS );
+
+ includes = new ArrayList<>( indexable.size() + artifacts.size() );
+
+ includes.addAll( indexable );
+
+ includes.addAll( artifacts );
+ }
+
+ @PostConstruct
+ public void initialize()
+ {
+ configuration.addChangeListener( this );
+
+ initIncludes();
+ }
+
+ @Override
+ public List<String> getIncludes()
+ {
+ return includes;
+ }
+
+
+
+}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 000000000..0609595ac
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.consumers.lucene"/>
+
+ <alias name="knownRepositoryContentConsumer#index-content" alias="indexerConsumer"/>
+
+</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/conf/repository-manager.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/conf/repository-manager.xml
new file mode 100644
index 000000000..106fcea10
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/conf/repository-manager.xml
@@ -0,0 +1,129 @@
+<?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.
+ -->
+
+<configuration>
+ <version>1</version>
+ <repositories>
+ <repository>
+ <id>test-repo</id>
+ <name>Test Repository</name>
+ <url>file://src/test/resources/test-repo</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>true</snapshots>
+ <indexed>true</indexed>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ <retentionPeriod>0</retentionPeriod>
+ <retentionCount>2</retentionCount>
+ </repository>
+ </repositories>
+
+ <proxyConnectors/>
+
+ <networkProxies>
+ <networkProxy>
+ <id>example</id>
+ <protocol>http</protocol>
+ <host>proxy.mycompany.com</host>
+ <port>8080</port>
+ <username>myself</username>
+ <password>mypass</password>
+ </networkProxy>
+ </networkProxies>
+
+ <repositoryScanning>
+ <fileTypes>
+ <fileType>
+ <id>artifacts</id>
+ <patterns>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.jar</pattern>
+ <pattern>**/*.ear</pattern>
+ <pattern>**/*.war</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>indexable-content</id>
+ <patterns>
+ <pattern>**/*.txt</pattern>
+ <pattern>**/*.TXT</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>auto-remove</id>
+ <patterns>
+ <pattern>**/*.bak</pattern>
+ <pattern>**/*~</pattern>
+ <pattern>**/*-</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>ignored</id>
+ <patterns>
+ <pattern>**/.htaccess</pattern>
+ <pattern>**/KEYS</pattern>
+ <pattern>**/*.rb</pattern>
+ <pattern>**/*.sh</pattern>
+ <pattern>**/.svn/**</pattern>
+ <pattern>**/.DAV/**</pattern>
+ </patterns>
+ </fileType>
+ </fileTypes>
+ <knownContentConsumers>
+ <knownContentConsumer>update-db-artifact</knownContentConsumer>
+ <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+ <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+ <knownContentConsumer>validate-checksum</knownContentConsumer>
+ <knownContentConsumer>validate-signature</knownContentConsumer>
+ <knownContentConsumer>index-content</knownContentConsumer>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ <knownContentConsumer>auto-rename</knownContentConsumer>
+ <knownContentConsumer>repository-purge</knownContentConsumer>
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+
+ <databaseScanning>
+ <cronExpression>0 0 * * * ?</cronExpression>
+ <unprocessedConsumers>
+ <unprocessedConsumer>index-artifact</unprocessedConsumer>
+ <unprocessedConsumer>update-db-project</unprocessedConsumer>
+ <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+ <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>true</showFindArtifacts>
+ <appletFindEnabled>true</appletFindEnabled>
+ </ui>
+ </webapp>
+
+</configuration>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
new file mode 100644
index 000000000..85ee9426d
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
@@ -0,0 +1,237 @@
+package org.apache.archiva.consumers.lucene;
+
+/*
+ * 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 junit.framework.TestCase;
+import org.apache.archiva.common.utils.PathUtil;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.components.taskqueue.TaskQueueException;
+import org.apache.archiva.repository.base.ArchivaRepositoryRegistry;
+import org.apache.archiva.repository.base.BasicManagedRepository;
+import org.apache.archiva.repository.ReleaseScheme;
+import org.apache.archiva.scheduler.ArchivaTaskScheduler;
+import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+
+/**
+ * NexusIndexerConsumerTest
+ */
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+public class NexusIndexerConsumerTest
+ extends TestCase
+{
+ private final class ArchivaTaskSchedulerStub
+ implements ArchivaTaskScheduler<ArtifactIndexingTask>
+ {
+ Set<Path> indexed = new HashSet<>();
+
+ @Override
+ public void queueTask( ArtifactIndexingTask task )
+ throws TaskQueueException
+ {
+ switch ( task.getAction() )
+ {
+ case ADD:
+ indexed.add( task.getResourceFile() );
+ break;
+ case DELETE:
+ indexed.remove( task.getResourceFile() );
+ break;
+ case FINISH:
+ try
+ {
+ task.getContext().close( false );
+ }
+ catch ( IOException e )
+ {
+ throw new TaskQueueException( e.getMessage() );
+ }
+ break;
+ }
+ }
+ }
+
+ private NexusIndexerConsumer nexusIndexerConsumer;
+
+ private BasicManagedRepository repositoryConfig;
+
+ private ArchivaTaskSchedulerStub scheduler;
+
+ @Inject
+ private ApplicationContext applicationContext;
+
+ @Inject
+ ArchivaRepositoryRegistry repositoryRegistry;
+
+
+ @Override
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ scheduler = new ArchivaTaskSchedulerStub();
+
+ ArchivaConfiguration configuration = applicationContext.getBean( ArchivaConfiguration.class );
+
+ FileTypes filetypes = applicationContext.getBean( FileTypes.class );
+
+ nexusIndexerConsumer =
+ new NexusIndexerConsumer( scheduler, configuration, filetypes);
+
+ // initialize to set the file types to be processed
+ nexusIndexerConsumer.initialize();
+
+ repositoryConfig = BasicManagedRepository.newFilesystemInstance( "test-repo", "Test Repository", Paths.get("target/test-classes").resolve("test-repo") );
+ repositoryConfig.setLocation( new URI("target/test-classes/test-repo") );
+ repositoryConfig.setLayout( "default" );
+ repositoryConfig.setScanned( true );
+ repositoryConfig.addActiveReleaseScheme( ReleaseScheme.RELEASE );
+ repositoryConfig.removeActiveReleaseScheme( ReleaseScheme.SNAPSHOT );
+ repositoryRegistry.putRepository(repositoryConfig);
+ }
+
+
+ @Override
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ // delete created index in the repository
+ Path basePath = PathUtil.getPathFromUri( repositoryConfig.getLocation() );
+ Path indexDir = basePath.resolve( ".indexer" );
+ org.apache.archiva.common.utils.FileUtils.deleteDirectory( indexDir );
+ assertFalse( Files.exists(indexDir) );
+
+ indexDir = basePath.resolve( ".index" );
+ org.apache.archiva.common.utils.FileUtils.deleteDirectory( indexDir );
+ assertFalse( Files.exists(indexDir) );
+
+ repositoryRegistry.destroy();
+
+ super.tearDown();
+ }
+
+ @Test
+ public void testIndexerIndexArtifact()
+ throws Exception
+ {
+ Path basePath = PathUtil.getPathFromUri( repositoryConfig.getLocation() );
+ Path artifactFile = basePath.resolve(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+
+ // begin scan
+ Date now = Calendar.getInstance().getTime();
+ nexusIndexerConsumer.beginScan( repositoryConfig, now );
+ nexusIndexerConsumer.processFile(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+ nexusIndexerConsumer.completeScan();
+
+ assertTrue( scheduler.indexed.contains( artifactFile ) );
+ }
+
+ @Test
+ public void testIndexerArtifactAlreadyIndexed()
+ throws Exception
+ {
+ Path basePath = PathUtil.getPathFromUri( repositoryConfig.getLocation() );
+ Path artifactFile = basePath.resolve(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+
+ // begin scan
+ Date now = Calendar.getInstance().getTime();
+ nexusIndexerConsumer.beginScan( repositoryConfig, now );
+ nexusIndexerConsumer.processFile(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+ nexusIndexerConsumer.completeScan();
+
+ assertTrue( scheduler.indexed.contains( artifactFile ) );
+
+ // scan and index again
+ now = Calendar.getInstance().getTime();
+ nexusIndexerConsumer.beginScan( repositoryConfig, now );
+ nexusIndexerConsumer.processFile(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+ nexusIndexerConsumer.completeScan();
+
+ assertTrue( scheduler.indexed.contains( artifactFile ) );
+ }
+
+ @Test
+ public void testIndexerIndexArtifactThenPom()
+ throws Exception
+ {
+ Path basePath = PathUtil.getPathFromUri( repositoryConfig.getLocation( ) );
+ Path artifactFile = basePath.resolve(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+
+ // begin scan
+ Date now = Calendar.getInstance().getTime();
+ nexusIndexerConsumer.beginScan( repositoryConfig, now );
+ nexusIndexerConsumer.processFile(
+ "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+ nexusIndexerConsumer.completeScan();
+
+ assertTrue( scheduler.indexed.contains( artifactFile ) );
+
+ artifactFile =
+ basePath.resolve( "org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml" );
+
+ // scan and index again
+ now = Calendar.getInstance().getTime();
+ nexusIndexerConsumer.beginScan( repositoryConfig, now );
+ nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml" );
+ nexusIndexerConsumer.completeScan();
+
+ assertTrue( scheduler.indexed.contains( artifactFile ) );
+ }
+
+ // MRM-1275 - Include other file types for the index consumer instead of just the indexable-content
+ @Test
+ public void testIncludedFileTypes()
+ throws Exception
+ {
+ List<String> includes = nexusIndexerConsumer.getIncludes();
+ assertTrue( ".pom artifacts should be processed.", includes.contains( "**/*.pom" ) );
+ assertTrue( ".xml artifacts should be processed.", includes.contains( "**/*.xml" ) );
+ assertTrue( ".txt artifacts should be processed.", includes.contains( "**/*.txt" ) );
+ assertTrue( ".jar artifacts should be processed.", includes.contains( "**/*.jar" ) );
+ assertTrue( ".war artifacts should be processed.", includes.contains( "**/*.war" ) );
+ assertTrue( ".zip artifacts should be processed.", includes.contains( "**/*.zip" ) );
+ }
+
+}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java
new file mode 100644
index 000000000..adcc42550
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java
@@ -0,0 +1,472 @@
+package org.apache.archiva.consumers.lucene.test;
+/*
+ * 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.redback.rbac.Operation;
+import org.apache.archiva.redback.rbac.Permission;
+import org.apache.archiva.redback.rbac.RBACManager;
+import org.apache.archiva.redback.rbac.RBACManagerListener;
+import org.apache.archiva.redback.rbac.RbacManagerException;
+import org.apache.archiva.redback.rbac.RbacObjectInvalidException;
+import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
+import org.apache.archiva.redback.rbac.Resource;
+import org.apache.archiva.redback.rbac.Role;
+import org.apache.archiva.redback.rbac.UserAssignment;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service("rbacManager#cached")
+public class TestRBACManager implements RBACManager
+{
+
+ @Override
+ public void initialize()
+ {
+
+ }
+
+ @Override
+ public boolean isFinalImplementation()
+ {
+ return false;
+ }
+
+ @Override
+ public String getDescriptionKey()
+ {
+ return "archiva.redback.rbacmanager.test";
+ }
+
+ @Override
+ public void addListener( RBACManagerListener listener )
+ {
+
+ }
+
+ @Override
+ public void removeListener( RBACManagerListener listener )
+ {
+
+ }
+
+ @Override
+ public Role createRole( String name )
+ {
+ return null;
+ }
+
+ @Override
+ public boolean roleExists( String name )
+ {
+ return false;
+ }
+
+ @Override
+ public boolean roleExists( Role role )
+ {
+ return false;
+ }
+
+ @Override
+ public Role saveRole( Role role )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+ return null;
+ }
+
+ @Override
+ public void saveRoles( Collection<Role> roles )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+
+ }
+
+ @Override
+ public Role getRole( String roleName )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null;
+ }
+
+ @Override
+ public Map<String, Role> getRoles( Collection<String> roleNames )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void addChildRole( Role role, Role childRole )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Map<String, Role> getChildRoles( Role role )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Map<String, Role> getParentRoles( Role role )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<Role> getAllRoles()
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Set<Role> getEffectiveRoles( Role role )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeRole( Role role )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeRole( String roleName )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Permission createPermission( String name )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Permission createPermission( String name, String operationName, String resourceIdentifier )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean permissionExists( String name )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean permissionExists( Permission permission )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Permission savePermission( Permission permission )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Permission getPermission( String permissionName )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<Permission> getAllPermissions()
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removePermission( Permission permission )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removePermission( String permissionName )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Operation createOperation( String name )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean operationExists( String name )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean operationExists( Operation operation )
+ {
+ return false;
+ }
+
+ @Override
+ public Operation saveOperation( Operation operation )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+ return null;
+ }
+
+ @Override
+ public Operation getOperation( String operationName )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null;
+ }
+
+ @Override
+ public List<Operation> getAllOperations()
+ throws RbacManagerException
+ {
+ return null;
+ }
+
+ @Override
+ public void removeOperation( Operation operation )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ }
+
+ @Override
+ public void removeOperation( String operationName )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ }
+
+ @Override
+ public Resource createResource( String identifier )
+ throws RbacManagerException
+ {
+ return null;
+ }
+
+ @Override
+ public boolean resourceExists( String identifier )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean resourceExists( Resource resource )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Resource saveResource( Resource resource )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Resource getResource( String resourceIdentifier )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<Resource> getAllResources()
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeResource( Resource resource )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeResource( String resourceIdentifier )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public UserAssignment createUserAssignment( String principal )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean userAssignmentExists( String principal )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean userAssignmentExists( UserAssignment assignment )
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public UserAssignment saveUserAssignment( UserAssignment userAssignment )
+ throws RbacObjectInvalidException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public UserAssignment getUserAssignment( String principal )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<UserAssignment> getAllUserAssignments()
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<UserAssignment> getUserAssignmentsForRoles( Collection<String> roleNames )
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeUserAssignment( UserAssignment userAssignment )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeUserAssignment( String principal )
+ throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Collection<Role> getAssignedRoles( String principal )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Collection<Role> getAssignedRoles( UserAssignment userAssignment )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Collection<Role> getEffectivelyUnassignedRoles( String principal )
+ throws RbacManagerException, RbacObjectNotFoundException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Collection<Role> getEffectivelyAssignedRoles( String principal )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Collection<Role> getUnassignedRoles( String principal )
+ throws RbacManagerException, RbacObjectNotFoundException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Set<Permission> getAssignedPermissions( String principal )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Map<String, List<? extends Permission>> getAssignedPermissionMap( String principal )
+ throws RbacObjectNotFoundException, RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<Role> getAllAssignableRoles()
+ throws RbacManagerException, RbacObjectNotFoundException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Resource getGlobalResource()
+ throws RbacManagerException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void eraseDatabase()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean isReadOnly()
+ {
+ return false;
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRoleManager.java b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRoleManager.java
new file mode 100644
index 000000000..8f3bb644f
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRoleManager.java
@@ -0,0 +1,137 @@
+package org.apache.archiva.consumers.lucene.test;
+/*
+ * 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.redback.role.RoleManager;
+import org.apache.archiva.redback.role.RoleManagerException;
+import org.apache.archiva.redback.role.model.RedbackRoleModel;
+import org.springframework.stereotype.Service;
+
+import java.net.URL;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "roleManager#test" )
+public class TestRoleManager
+ implements RoleManager
+{
+ @Override
+ public void loadRoleModel( URL resourceLocation )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void loadRoleModel( RedbackRoleModel model )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void createTemplatedRole( String templateId, String resource )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void removeTemplatedRole( String templateId, String resource )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void updateRole( String templateId, String oldResource, String newResource )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void assignRole( String roleId, String principal )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void assignRoleByName( String roleName, String principal )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void assignTemplatedRole( String templateId, String resource, String principal )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void unassignRole( String roleId, String principal )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void unassignRoleByName( String roleName, String principal )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean roleExists( String roleId )
+ throws RoleManagerException
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean templatedRoleExists( String templateId, String resource )
+ throws RoleManagerException
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public RedbackRoleModel getModel()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void verifyTemplatedRole( String templateID, String resource )
+ throws RoleManagerException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void initialize()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/log4j2-test.xml
new file mode 100644
index 000000000..03547df43
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/log4j2-test.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ 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.
+ -->
+<configuration>
+ <Properties>
+
+ </Properties>
+ <appenders>
+ <Console name="console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{ISO8601_PERIOD} [%L] [%t] %-5level %logger{3} - %msg%n"/>
+ </Console>
+ <!--
+ <RandomAccessFile name="LogFile" fileName="target/test.log">
+ <PatternLayout pattern="%d{ISO8601_PERIOD} [%L] [%t] %-5level %logger{3} - %msg%n"/>
+ </RandomAccessFile>
+ -->
+ </appenders>
+ <loggers>
+ <logger name="org.apache.archiva" level="info"/>
+ <logger name="org.apache.archiva.repository.scanner" level="info"/>
+ <root level="error" includeLocation="true">
+ <appender-ref ref="console"/>
+ </root>
+ </loggers>
+</configuration>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/spring-context.xml
new file mode 100644
index 000000000..8fb55e1b1
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/spring-context.xml
@@ -0,0 +1,74 @@
+<?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">
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.consumers.lucene.test,org.apache.maven.index"/>
+
+ <bean name="commons-configuration" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
+ config-optional="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="scheduler" class="org.apache.archiva.components.scheduler.DefaultScheduler">
+ <property name="properties">
+ <props>
+ <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
+ <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+ <prop key="org.quartz.threadPool.threadCount">2</prop>
+ <prop key="org.quartz.threadPool.threadPriority">4</prop>
+ <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
+ </props>
+ </property>
+ </bean>
+
+ <alias name="roleManager#test" alias="roleManager"/>
+
+ <!--
+ <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
+ <constructor-arg value="${appserver.base}/conf/repository.xml"/>
+ <constructor-arg value="${appserver.base}/data/jcr"/>
+ </bean>
+
+ <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
+ <constructor-arg ref="jcr-config"/>
+ </bean>
+ -->
+
+
+</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar
new file mode 100644
index 000000000..cc03dacc1
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar
Binary files differ
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml
new file mode 100644
index 000000000..e7bf54bda
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-index-methods-jar-test</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+ <name>archiva-index-methods-jar-test</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-indexer-consumers/src/test/resources/test-repo/org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar
diff --git a/archiva-modules/archiva-base/archiva-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/pom.xml
index 9ac6aef0c..30f8ad71c 100644
--- a/archiva-modules/archiva-base/archiva-consumers/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/pom.xml
@@ -37,7 +37,7 @@
<modules>
<module>archiva-consumer-api</module>
<module>archiva-core-consumers</module>
- <module>archiva-lucene-consumers</module>
+ <module>archiva-indexer-consumers</module>
<module>archiva-signature-consumers</module>
<module>archiva-metadata-consumer</module>
<module>archiva-consumer-archetype</module>
diff --git a/src/ci/scripts/prepareWorkspace.sh b/src/ci/scripts/prepareWorkspace.sh
index 1732be83a..548cec51a 100755
--- a/src/ci/scripts/prepareWorkspace.sh
+++ b/src/ci/scripts/prepareWorkspace.sh
@@ -33,6 +33,7 @@ ATTIC_DIRS="archiva-modules/archiva-base/archiva-indexer\
archiva-modules/metadata/metadata-model-maven2\
archiva-modules/plugins/maven2-repository\
archiva-modules/archiva-base/archiva-converter\
+ archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumer\
"
REMOVE_DIRS=".indexer"
TMP_DIRECTORY=".tmp"