fix unit test

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1384207 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-13 05:39:15 +00:00
parent 53d662e5d9
commit 42b0dd3f92
1 changed files with 56 additions and 52 deletions

View File

@ -55,7 +55,7 @@ import java.io.IOException;
* all performed by this executor. Add and update artifact in index tasks are added in the indexing task queue by the
* NexusIndexerConsumer while remove artifact from index tasks are added by the LuceneCleanupRemoveIndexedConsumer.
*/
@Service ("taskExecutor#indexing")
@Service ( "taskExecutor#indexing" )
public class ArchivaIndexingTaskExecutor
implements TaskExecutor
{
@ -154,8 +154,9 @@ public class ArchivaIndexingTaskExecutor
if ( artifactFile == null )
{
log.debug( "no artifact pass in indexing task so skip it" );
return;
}
else
{
ArtifactContext ac = artifactContextProducer.getArtifactContext( context, artifactFile );
if ( ac != null )
@ -201,13 +202,7 @@ public class ArchivaIndexingTaskExecutor
context.updateTimestamp();
context.commit();
// close the context if not a repo scan request
if ( !indexingTask.isExecuteOnEntireRepo() )
{
log.debug( "Finishing indexing task on resource file : {}",
indexingTask.getResourceFile().getPath() );
finishIndexingTask( indexingTask, repository, context );
}
}
else
{
@ -216,6 +211,15 @@ public class ArchivaIndexingTaskExecutor
}
}
}
// close the context if not a repo scan request
if ( !indexingTask.isExecuteOnEntireRepo() )
{
log.debug( "Finishing indexing task on resource file : {}", indexingTask.getResourceFile() != null
? indexingTask.getResourceFile().getPath()
: " none " );
finishIndexingTask( indexingTask, repository, context );
}
}
catch ( IOException e )
{
log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage(),
@ -236,7 +240,7 @@ public class ArchivaIndexingTaskExecutor
context.optimize();
if ( repository.isSkipPackedIndexCreation() )
if ( !repository.isSkipPackedIndexCreation() )
{
File managedRepository = new File( repository.getLocation() );
String indexDirectory = repository.getIndexDirectory();