From 5bfcdf011a18598e27b8dd22cf160cf0a741da95 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 21 Nov 2011 22:19:27 +0000 Subject: [PATCH] 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 --- .../archiva/proxy/AbstractProxyTestCase.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index 7ae48d384..bd51f350d 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -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() {