summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-01 17:49:01 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-01 17:49:01 +0000
commit0cc1e8563ec365827dc6fed921f7a3549554636b (patch)
tree505f36983f202c3327727d5d6da1745b19958661 /archiva-modules
parentb84ecb96f78a1c1a62ffc1757f2f2ad19c473577 (diff)
downloadarchiva-0cc1e8563ec365827dc6fed921f7a3549554636b.tar.gz
archiva-0cc1e8563ec365827dc6fed921f7a3549554636b.zip
remove of plexus-spring : fix more tests and lucene consumers module
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1130245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java40
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java13
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java9
3 files changed, 48 insertions, 14 deletions
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 7d6953ddd..6d4f73c61 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
@@ -27,6 +27,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import junit.framework.TestCase;
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
import org.apache.commons.io.FileUtils;
@@ -35,14 +36,24 @@ import org.apache.maven.archiva.configuration.FileTypes;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.plexus.taskqueue.TaskQueueException;
+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 org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
/**
* NexusIndexerConsumerTest
*/
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath*:/spring-context.xml"} )
public class NexusIndexerConsumerTest
- extends PlexusInSpringTestCase
+ extends TestCase
{
private final class ArchivaTaskSchedulerStub
implements ArchivaTaskScheduler<ArtifactIndexingTask>
@@ -80,17 +91,22 @@ public class NexusIndexerConsumerTest
private ArchivaTaskSchedulerStub scheduler;
+ @Inject
+ private ApplicationContext applicationContext;
+
+
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
scheduler = new ArchivaTaskSchedulerStub();
- ArchivaConfiguration configuration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
+ ArchivaConfiguration configuration = applicationContext.getBean( ArchivaConfiguration.class );
- FileTypes filetypes = (FileTypes) lookup( FileTypes.class );
+ FileTypes filetypes = applicationContext.getBean( FileTypes.class );
nexusIndexerConsumer = new NexusIndexerConsumer( scheduler, configuration, filetypes );
@@ -99,7 +115,7 @@ public class NexusIndexerConsumerTest
repositoryConfig = new ManagedRepositoryConfiguration();
repositoryConfig.setId( "test-repo" );
- repositoryConfig.setLocation( getBasedir() + "/target/test-classes/test-repo" );
+ repositoryConfig.setLocation( "target/test-classes/test-repo" );
repositoryConfig.setLayout( "default" );
repositoryConfig.setName( "Test Repository" );
repositoryConfig.setScanned( true );
@@ -108,7 +124,8 @@ public class NexusIndexerConsumerTest
}
@Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
// delete created index in the repository
@@ -123,6 +140,7 @@ public class NexusIndexerConsumerTest
super.tearDown();
}
+ @Test
public void testIndexerIndexArtifact()
throws Exception
{
@@ -139,6 +157,7 @@ public class NexusIndexerConsumerTest
assertTrue( scheduler.indexed.contains( artifactFile ) );
}
+ @Test
public void testIndexerArtifactAlreadyIndexed()
throws Exception
{
@@ -163,6 +182,7 @@ public class NexusIndexerConsumerTest
assertTrue( scheduler.indexed.contains( artifactFile ) );
}
+ @Test
public void testIndexerIndexArtifactThenPom()
throws Exception
{
@@ -191,6 +211,7 @@ public class NexusIndexerConsumerTest
}
// MRM-1275 - Include other file types for the index consumer instead of just the indexable-content
+ @Test
public void testIncludedFileTypes()
throws Exception
{
@@ -203,9 +224,4 @@ public class NexusIndexerConsumerTest
assertTrue( ".zip artifacts should be processed.", includes.contains( "**/*.zip" ) );
}
- @Override
- protected String getPlexusConfigLocation()
- {
- return "/org/apache/archiva/consumers/lucene/LuceneConsumersTest.xml";
- }
}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
index 011c7cc3d..891444e31 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
@@ -44,6 +44,7 @@ import org.sonatype.nexus.index.packer.IndexPackingRequest;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
@@ -73,8 +74,10 @@ public class ArchivaIndexingTaskExecutor
private ArtifactContextProducer artifactContextProducer;
+ @Inject
private PlexusSisuBridge plexusSisuBridge;
+ @PostConstruct
public void initialize()
throws PlexusSisuBridgeException
{
@@ -237,4 +240,14 @@ public class ArchivaIndexingTaskExecutor
{
this.indexPacker = indexPacker;
}
+
+ public PlexusSisuBridge getPlexusSisuBridge()
+ {
+ return plexusSisuBridge;
+ }
+
+ public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
+ {
+ this.plexusSisuBridge = plexusSisuBridge;
+ }
}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
index 55cfaabfd..199b4198e 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
@@ -32,6 +32,7 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.sonatype.nexus.index.ArtifactInfo;
import org.sonatype.nexus.index.FlatSearchRequest;
import org.sonatype.nexus.index.FlatSearchResponse;
@@ -40,6 +41,7 @@ import org.sonatype.nexus.index.NexusIndexer;
import org.sonatype.nexus.index.context.IndexingContext;
import org.sonatype.nexus.index.packer.IndexPacker;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.BufferedInputStream;
@@ -56,10 +58,12 @@ import java.util.zip.ZipInputStream;
/**
* ArchivaIndexingTaskExecutorTest
*/
+@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath*:/spring-context.xml"} )
public class ArchivaIndexingTaskExecutorTest
extends TestCase
{
+ @Inject
private ArchivaIndexingTaskExecutor indexingExecutor;
private IndexerEngine indexerEngine;
@@ -83,12 +87,13 @@ public class ArchivaIndexingTaskExecutorTest
{
super.setUp();
- indexingExecutor = new ArchivaIndexingTaskExecutor();
+ //indexingExecutor = new ArchivaIndexingTaskExecutor();
+ //indexingExecutor.setPlexusSisuBridge( plexusSisuBridge );
indexingExecutor.initialize();
repositoryConfig = new ManagedRepositoryConfiguration();
repositoryConfig.setId( "test-repo" );
- repositoryConfig.setLocation( "/target/test-classes/test-repo" );
+ repositoryConfig.setLocation( "target/test-classes/test-repo" );
repositoryConfig.setLayout( "default" );
repositoryConfig.setName( "Test Repository" );
repositoryConfig.setScanned( true );