aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-27 07:53:59 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-27 07:53:59 +0000
commit7f9e6e70e9212b34feca40edc49533b753e1fb9d (patch)
tree19e4bc8ca457e7d571aa052c21021ec0f829bea2
parent8233856ae41fe614e527773a278e6bd4e8a19f83 (diff)
downloadarchiva-7f9e6e70e9212b34feca40edc49533b753e1fb9d.tar.gz
archiva-7f9e6e70e9212b34feca40edc49533b753e1fb9d.zip
take of already existing context to prevent lucene locks
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1140038 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java32
1 files changed, 18 insertions, 14 deletions
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 bdbc23feb..9a2831169 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
@@ -80,8 +80,6 @@ public class ArchivaIndexingTaskExecutorTest
private IndexingContext context;
- private NexusIndexer nexusIndexer;
-
@Inject
PlexusSisuBridge plexusSisuBridge;
@@ -114,9 +112,7 @@ public class ArchivaIndexingTaskExecutorTest
indexingExecutor.setIndexerEngine( indexerEngine );
indexingExecutor.setIndexPacker( indexPacker );
- nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- context = ArtifactIndexingTask.createContext( repositoryConfig, nexusIndexer );
+ context = ArtifactIndexingTask.createContext( repositoryConfig, indexer );
}
@@ -125,8 +121,13 @@ public class ArchivaIndexingTaskExecutorTest
public void tearDown()
throws Exception
{
- context.close( true );
- indexer.removeIndexingContext( context, true );
+ //context.close( true );
+ //indexer.removeIndexingContext( context, true );
+
+ for (IndexingContext indexingContext : indexer.getIndexingContexts().values())
+ {
+ indexer.removeIndexingContext( indexingContext, true );
+ }
// delete created index in the repository
File indexDir = new File( repositoryConfig.getLocation(), ".indexer" );
@@ -159,11 +160,15 @@ public class ArchivaIndexingTaskExecutorTest
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
Occur.SHOULD );
- IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(),
+ if (!indexer.getIndexingContexts().containsKey( repositoryConfig.getId() ))
+ {
+ IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(),
new File( repositoryConfig.getLocation() ),
new File( repositoryConfig.getLocation(), ".indexer" ),
null, null, ArchivaNexusIndexerUtil.FULL_INDEX );
- context.setSearchable( true );
+ context.setSearchable( true );
+ }
+
FlatSearchRequest request = new FlatSearchRequest( q );
FlatSearchResponse response = indexer.searchFlat( request );
@@ -179,7 +184,6 @@ public class ArchivaIndexingTaskExecutorTest
assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId );
assertEquals( "test-repo", artifactInfo.repository );
- context.close( true );
}
@Test
@@ -202,7 +206,7 @@ public class ArchivaIndexingTaskExecutorTest
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
Occur.SHOULD );
- IndexSearcher searcher = nexusIndexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
+ IndexSearcher searcher = indexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
TopDocs topDocs = searcher.search( q, null, 10 );
searcher.close();
@@ -234,7 +238,7 @@ public class ArchivaIndexingTaskExecutorTest
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
Occur.SHOULD );
- IndexSearcher searcher = nexusIndexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
+ IndexSearcher searcher = indexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
TopDocs topDocs = searcher.search( q, null, 10 );
@@ -248,7 +252,7 @@ public class ArchivaIndexingTaskExecutorTest
searcher.close();
- context = ArtifactIndexingTask.createContext( repositoryConfig, nexusIndexer );
+ context = ArtifactIndexingTask.createContext( repositoryConfig, indexer );
// remove added artifact from index
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.DELETE, context );
@@ -264,7 +268,7 @@ public class ArchivaIndexingTaskExecutorTest
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
Occur.SHOULD );
- searcher = nexusIndexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
+ searcher = indexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
topDocs = searcher.search( q, null, 10 );