mirror of https://github.com/apache/archiva.git
fix unit tests by using NexusIndexer facade to manipulate index datas : adding/removing artifacts
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1140232 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f9e6e70e9
commit
f124a475e9
|
@ -22,6 +22,10 @@
|
|||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
|
@ -39,5 +43,6 @@
|
|||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -21,20 +21,20 @@ package org.apache.archiva.scheduler.indexing;
|
|||
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.search.TopDocs;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.index.ArtifactContext;
|
||||
import org.apache.maven.index.ArtifactContextProducer;
|
||||
import org.apache.maven.index.ArtifactInfo;
|
||||
import org.apache.maven.index.DefaultArtifactContextProducer;
|
||||
import org.apache.maven.index.IndexerEngine;
|
||||
import org.apache.maven.index.FlatSearchRequest;
|
||||
import org.apache.maven.index.FlatSearchResponse;
|
||||
import org.apache.maven.index.MAVEN;
|
||||
import org.apache.maven.index.NexusIndexer;
|
||||
import org.apache.maven.index.artifact.IllegalArtifactCoordinateException;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
|
||||
import org.apache.maven.index.expr.SourcedSearchExpression;
|
||||
import org.apache.maven.index.packer.IndexPacker;
|
||||
import org.apache.maven.index.packer.IndexPackingRequest;
|
||||
import org.codehaus.plexus.taskqueue.Task;
|
||||
|
@ -63,11 +63,6 @@ public class ArchivaIndexingTaskExecutor
|
|||
{
|
||||
private Logger log = LoggerFactory.getLogger( ArchivaIndexingTaskExecutor.class );
|
||||
|
||||
/**
|
||||
* plexus.requirement
|
||||
*/
|
||||
private IndexerEngine indexerEngine;
|
||||
|
||||
/**
|
||||
* plexus.requirement
|
||||
*/
|
||||
|
@ -88,15 +83,15 @@ public class ArchivaIndexingTaskExecutor
|
|||
|
||||
artifactContextProducer = new DefaultArtifactContextProducer();
|
||||
|
||||
indexerEngine = plexusSisuBridge.lookup( IndexerEngine.class, "default" );
|
||||
|
||||
indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
|
||||
|
||||
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
}
|
||||
|
||||
public void executeTask( Task task )
|
||||
throws TaskExecutionException
|
||||
{
|
||||
synchronized ( indexerEngine )
|
||||
synchronized ( nexusIndexer )
|
||||
{
|
||||
ArtifactIndexingTask indexingTask = (ArtifactIndexingTask) task;
|
||||
|
||||
|
@ -116,8 +111,8 @@ public class ArchivaIndexingTaskExecutor
|
|||
{
|
||||
try
|
||||
{
|
||||
log.debug(
|
||||
"Creating indexing context on resource: {}", indexingTask.getResourceFile().getPath() );
|
||||
log.debug( "Creating indexing context on resource: {}",
|
||||
indexingTask.getResourceFile().getPath() );
|
||||
context = ArtifactIndexingTask.createContext( repository, nexusIndexer );
|
||||
}
|
||||
catch ( IOException e )
|
||||
|
@ -146,35 +141,61 @@ public class ArchivaIndexingTaskExecutor
|
|||
{
|
||||
if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
|
||||
{
|
||||
IndexSearcher s = context.getIndexSearcher();
|
||||
String uinfo = ac.getArtifactInfo().getUinfo();
|
||||
TopDocs d = s.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), 1 );
|
||||
if ( d.totalHits == 0 )
|
||||
//IndexSearcher s = context.getIndexSearcher();
|
||||
//String uinfo = ac.getArtifactInfo().getUinfo();
|
||||
//TopDocs d = s.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), 1 );
|
||||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().groupId ) ), BooleanClause.Occur.MUST );
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().artifactId ) ), BooleanClause.Occur.MUST );
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().version ) ), BooleanClause.Occur.MUST );
|
||||
if (ac.getArtifactInfo().classifier != null)
|
||||
{
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().classifier ) ), BooleanClause.Occur.MUST );
|
||||
}
|
||||
if (ac.getArtifactInfo().packaging != null)
|
||||
{
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
|
||||
}
|
||||
FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
|
||||
FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
|
||||
if ( flatSearchResponse.getResults().isEmpty() )
|
||||
//if ( d.totalHits == 0 )
|
||||
{
|
||||
log.debug( "Adding artifact '{}' to index..", ac.getArtifactInfo() );
|
||||
indexerEngine.index( context, ac );
|
||||
context.getIndexWriter().commit();
|
||||
//indexerEngine.index( context, ac );
|
||||
//context.getIndexWriter().commit();
|
||||
nexusIndexer.addArtifactToIndex( ac, context );
|
||||
}
|
||||
else
|
||||
{
|
||||
log.debug( "Updating artifact '{}' in index..", ac.getArtifactInfo() );
|
||||
indexerEngine.update( context, ac );
|
||||
context.getIndexWriter().commit();
|
||||
// TODO check if update exists !!
|
||||
nexusIndexer.deleteArtifactFromIndex( ac, context );
|
||||
nexusIndexer.addArtifactToIndex( ac, context );
|
||||
}
|
||||
|
||||
//nexusIndexer.scan( context, true );
|
||||
|
||||
context.updateTimestamp();
|
||||
|
||||
// close the context if not a repo scan request
|
||||
if ( !indexingTask.isExecuteOnEntireRepo() )
|
||||
{
|
||||
log.debug( "Finishing indexing task on resource file : {}",
|
||||
indexingTask.getResourceFile().getPath() );
|
||||
indexingTask.getResourceFile().getPath() );
|
||||
finishIndexingTask( indexingTask, repository, context );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log.debug( "Removing artifact '{}' from index..", ac.getArtifactInfo() );
|
||||
indexerEngine.remove( context, ac );
|
||||
context.getIndexWriter().commit();
|
||||
nexusIndexer.deleteArtifactFromIndex( ac, context );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,6 +238,8 @@ public class ArchivaIndexingTaskExecutor
|
|||
}
|
||||
finally
|
||||
{
|
||||
/*
|
||||
olamy don't close it anymore as it nullify IndexSearcher
|
||||
if ( context != null )
|
||||
{
|
||||
try
|
||||
|
@ -229,16 +252,10 @@ public class ArchivaIndexingTaskExecutor
|
|||
throw new TaskExecutionException( "Error occurred while closing context: " + e.getMessage() );
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setIndexerEngine( IndexerEngine indexerEngine )
|
||||
{
|
||||
this.indexerEngine = indexerEngine;
|
||||
}
|
||||
|
||||
public void setIndexPacker( IndexPacker indexPacker )
|
||||
{
|
||||
this.indexPacker = indexPacker;
|
||||
|
|
|
@ -184,9 +184,6 @@ public class ArtifactIndexingTask
|
|||
managedRepository.toURI().toURL().toString(),
|
||||
indexDirectory.toURI().toURL().toString(), ArchivaNexusIndexerUtil.FULL_INDEX );
|
||||
|
||||
//IndexingContext context =
|
||||
// new DefaultIndexingContext( repository.getId(), repository.getId(), managedRepository, indexDirectory,
|
||||
// null, null, ArchivaNexusIndexerUtil.FULL_INDEX, false );
|
||||
context.setSearchable( repository.isScanned() );
|
||||
return context;
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
<?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.
|
||||
-->
|
||||
|
||||
<component-set>
|
||||
<components>
|
||||
<!--
|
||||
|
|
||||
| Indexing Task Queue / Executor
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.codehaus.plexus.taskqueue.TaskQueue</role>
|
||||
<role-hint>indexing</role-hint>
|
||||
<implementation>org.codehaus.plexus.taskqueue.DefaultTaskQueue</implementation>
|
||||
<lifecycle-handler>plexus-configurable</lifecycle-handler>
|
||||
<configuration>
|
||||
<task-entry-evaluators>
|
||||
</task-entry-evaluators>
|
||||
<task-exit-evaluators>
|
||||
</task-exit-evaluators>
|
||||
<task-viability-evaluators>
|
||||
</task-viability-evaluators>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor</role>
|
||||
<role-hint>indexing</role-hint>
|
||||
<implementation>org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor</implementation>
|
||||
<instantiation-strategy>singleton</instantiation-strategy>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.taskqueue.execution.TaskExecutor</role>
|
||||
<role-hint>indexing</role-hint>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.taskqueue.TaskQueue</role>
|
||||
<role-hint>indexing</role-hint>
|
||||
</requirement>
|
||||
</requirements>
|
||||
<configuration>
|
||||
<name>indexing</name>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
|
@ -32,12 +32,11 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
|||
import org.apache.maven.index.ArtifactInfo;
|
||||
import org.apache.maven.index.FlatSearchRequest;
|
||||
import org.apache.maven.index.FlatSearchResponse;
|
||||
import org.apache.maven.index.IndexerEngine;
|
||||
import org.apache.maven.index.MAVEN;
|
||||
import org.apache.maven.index.NexusIndexer;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.apache.maven.index.expr.SourcedSearchExpression;
|
||||
import org.apache.maven.index.expr.StringSearchExpression;
|
||||
import org.apache.maven.index.packer.IndexPacker;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -68,18 +67,12 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
@Inject
|
||||
private ArchivaIndexingTaskExecutor indexingExecutor;
|
||||
|
||||
private IndexerEngine indexerEngine;
|
||||
|
||||
private IndexPacker indexPacker;
|
||||
|
||||
private ManagedRepositoryConfiguration repositoryConfig;
|
||||
|
||||
private Configuration configuration;
|
||||
|
||||
private NexusIndexer indexer;
|
||||
|
||||
private IndexingContext context;
|
||||
|
||||
@Inject
|
||||
PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
|
@ -89,10 +82,6 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
//indexingExecutor = new ArchivaIndexingTaskExecutor();
|
||||
//indexingExecutor.setPlexusSisuBridge( plexusSisuBridge );
|
||||
indexingExecutor.initialize();
|
||||
|
||||
repositoryConfig = new ManagedRepositoryConfiguration();
|
||||
repositoryConfig.setId( "test-repo" );
|
||||
repositoryConfig.setLocation( "target/test-classes/test-repo" );
|
||||
|
@ -106,25 +95,16 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
configuration.addManagedRepository( repositoryConfig );
|
||||
|
||||
indexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
indexerEngine = plexusSisuBridge.lookup( IndexerEngine.class );
|
||||
indexPacker = plexusSisuBridge.lookup( IndexPacker.class );
|
||||
|
||||
indexingExecutor.setIndexerEngine( indexerEngine );
|
||||
indexingExecutor.setIndexPacker( indexPacker );
|
||||
|
||||
context = ArtifactIndexingTask.createContext( repositoryConfig, indexer );
|
||||
|
||||
|
||||
ArtifactIndexingTask.createContext( repositoryConfig, indexer );
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
//context.close( true );
|
||||
//indexer.removeIndexingContext( context, true );
|
||||
|
||||
for (IndexingContext indexingContext : indexer.getIndexingContexts().values())
|
||||
for ( IndexingContext indexingContext : indexer.getIndexingContexts().values() )
|
||||
{
|
||||
indexer.removeIndexingContext( indexingContext, true );
|
||||
}
|
||||
|
@ -141,6 +121,11 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
super.tearDown();
|
||||
}
|
||||
|
||||
protected IndexingContext getIndexingContext()
|
||||
{
|
||||
return indexer.getIndexingContexts().get( repositoryConfig.getId() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddArtifactToIndex()
|
||||
throws Exception
|
||||
|
@ -149,7 +134,8 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
|
||||
|
||||
ArtifactIndexingTask task =
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD,
|
||||
getIndexingContext() );
|
||||
|
||||
indexingExecutor.executeTask( task );
|
||||
|
||||
|
@ -160,16 +146,16 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
|
||||
if (!indexer.getIndexingContexts().containsKey( 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 );
|
||||
new File( repositoryConfig.getLocation() ),
|
||||
new File( repositoryConfig.getLocation(),
|
||||
".indexer" ), null, null,
|
||||
ArchivaNexusIndexerUtil.FULL_INDEX );
|
||||
context.setSearchable( true );
|
||||
}
|
||||
|
||||
|
||||
FlatSearchRequest request = new FlatSearchRequest( q );
|
||||
FlatSearchResponse response = indexer.searchFlat( request );
|
||||
|
||||
|
@ -194,7 +180,8 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
|
||||
|
||||
ArtifactIndexingTask task =
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD,
|
||||
getIndexingContext() );
|
||||
|
||||
indexingExecutor.executeTask( task );
|
||||
indexingExecutor.executeTask( task );
|
||||
|
@ -226,60 +213,55 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
|
||||
|
||||
ArtifactIndexingTask task =
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD,
|
||||
getIndexingContext() );
|
||||
|
||||
// remove artifact from index
|
||||
// add artifact to index
|
||||
indexingExecutor.executeTask( task );
|
||||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
q.add(
|
||||
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
//q.add(
|
||||
// indexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
// Occur.SHOULD );
|
||||
|
||||
IndexSearcher searcher = indexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
|
||||
FlatSearchRequest flatSearchRequest =
|
||||
new FlatSearchRequest( q, indexer.getIndexingContexts().get( repositoryConfig.getId() ) );
|
||||
|
||||
TopDocs topDocs = searcher.search( q, null, 10 );
|
||||
|
||||
searcher.close();
|
||||
FlatSearchResponse response = indexer.searchFlat( flatSearchRequest );
|
||||
|
||||
assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
|
||||
assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() );
|
||||
|
||||
// should return 1 hit
|
||||
assertEquals( 1, topDocs.totalHits );
|
||||
|
||||
searcher.close();
|
||||
|
||||
context = ArtifactIndexingTask.createContext( repositoryConfig, indexer );
|
||||
assertEquals( 1, response.getTotalHitsCount() );
|
||||
|
||||
// remove added artifact from index
|
||||
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.DELETE, context );
|
||||
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.DELETE,
|
||||
getIndexingContext() );
|
||||
indexingExecutor.executeTask( task );
|
||||
|
||||
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.FINISH, context );
|
||||
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.FINISH,
|
||||
getIndexingContext() );
|
||||
indexingExecutor.executeTask( task );
|
||||
|
||||
q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
|
||||
new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
q.add(
|
||||
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
|
||||
searcher = indexer.getIndexingContexts().get( repositoryConfig.getId() ).getIndexSearcher();
|
||||
|
||||
topDocs = searcher.search( q, null, 10 );
|
||||
|
||||
assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
|
||||
assertTrue( new File( repositoryConfig.getLocation(), ".index" ).exists() );
|
||||
|
||||
// artifact should have been removed from the index!
|
||||
assertEquals( 0, topDocs.totalHits );
|
||||
flatSearchRequest = new FlatSearchRequest( q, getIndexingContext() );
|
||||
|
||||
response = indexer.searchFlat( flatSearchRequest );
|
||||
// artifact should have been removed from the index!
|
||||
assertEquals( 0, response.getTotalHitsCount() );//.totalHits );
|
||||
|
||||
context.close( true );
|
||||
searcher.close();
|
||||
// TODO: test it was removed from the packaged index also
|
||||
}
|
||||
|
||||
|
@ -291,11 +273,13 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
|
||||
|
||||
ArtifactIndexingTask task =
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );
|
||||
new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD,
|
||||
getIndexingContext() );
|
||||
|
||||
indexingExecutor.executeTask( task );
|
||||
|
||||
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.FINISH, context );
|
||||
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.FINISH,
|
||||
getIndexingContext() );
|
||||
|
||||
indexingExecutor.executeTask( task );
|
||||
|
||||
|
|
Loading…
Reference in New Issue