cleanup indexingContext on shutdown to try avoid file leaking on windows

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1204729 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-11-21 22:19:27 +00:00
parent 259f8e7840
commit 5bfcdf011a
1 changed files with 17 additions and 1 deletions

View File

@ -24,7 +24,6 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.commons.lang.ArrayUtils;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
@ -36,10 +35,14 @@ import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
import org.apache.archiva.policies.ReleasesPolicy;
import org.apache.archiva.policies.SnapshotsPolicy;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.commons.lang.ArrayUtils;
import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.util.FileUtils;
import org.easymock.ArgumentsMatcher;
import org.easymock.MockControl;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@ -212,6 +215,19 @@ public abstract class AbstractProxyTestCase
log.info( "\n.\\ " + name + "() \\._________________________________________\n" );
}
@After
public void shutdown()
throws Exception
{
NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( indexingContext, false );
}
}
protected static final ArgumentsMatcher customWagonGetIfNewerMatcher = new ArgumentsMatcher()
{