diff options
author | Maria Odea B. Ching <oching@apache.org> | 2009-11-10 11:04:15 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2009-11-10 11:04:15 +0000 |
commit | 0b6a098ec3da4519362eadb3b09918e7fde32dc1 (patch) | |
tree | 60dcd85d2bb2a1e5bd86905d6d537af2fd82c6cc | |
parent | b4fe9fb58fc919f57d506183453caf30db9daeda (diff) | |
download | archiva-0b6a098ec3da4519362eadb3b09918e7fde32dc1.tar.gz archiva-0b6a098ec3da4519362eadb3b09918e7fde32dc1.zip |
[MRM-1275] Include other file types for the index consumer instead of just the indexable-content
o add artifacts file types so it gets processed by the consumer
o added unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@834426 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 20 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java index 775d7650a..2567d13ba 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java @@ -173,6 +173,8 @@ public class NexusIndexerConsumer includes.clear(); includes.addAll( filetypes.getFileTypePatterns( FileTypes.INDEXABLE_CONTENT ) ); + + includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) ); } public void initialize() diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index 0da5b2bf1..fc725f785 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.util.Calendar; import java.util.Date; import java.util.HashSet; +import java.util.List; import java.util.Set; import org.apache.commons.io.FileUtils; @@ -36,6 +37,7 @@ import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler; import org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask; import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.spring.PlexusInSpringTestCase; import org.codehaus.plexus.taskqueue.TaskQueueException; import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; @@ -125,6 +127,9 @@ public class NexusIndexerConsumerTest FileTypes filetypes = (FileTypes) lookup( FileTypes.class ); nexusIndexerConsumer = new NexusIndexerConsumer( scheduler, configuration, filetypes ); + + // initialize to set the file types to be processed + ( (Initializable) nexusIndexerConsumer ).initialize(); repositoryConfig = new ManagedRepositoryConfiguration(); repositoryConfig.setId( "test-repo" ); @@ -218,6 +223,19 @@ public class NexusIndexerConsumerTest assertTrue( scheduler.indexed.contains( artifactFile ) ); } + + // MRM-1275 - Include other file types for the index consumer instead of just the indexable-content + 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" ) ); + } @Override protected String getPlexusConfigLocation() |