additional clean up code to prevent the tests from running out of memory

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@822794 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-10-07 16:29:27 +00:00
parent eb9383c0a4
commit 8142e83c50
2 changed files with 34 additions and 10 deletions

View File

@ -49,6 +49,7 @@ import org.codehaus.plexus.spring.PlexusToSpringUtils;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
@ -99,8 +100,8 @@ public class RepositoryServlet
// DeltaV requires 'Cache-Control' header for all methods except 'VERSION-CONTROL' and 'REPORT'.
int methodCode = DavMethods.getMethodCode( request.getMethod() );
boolean noCache =
DavMethods.isDeltaVMethod( webdavRequest ) &&
!( DavMethods.DAV_VERSION_CONTROL == methodCode || DavMethods.DAV_REPORT == methodCode );
DavMethods.isDeltaVMethod( webdavRequest )
&& !( DavMethods.DAV_VERSION_CONTROL == methodCode || DavMethods.DAV_REPORT == methodCode );
WebdavResponse webdavResponse = new WebdavResponseImpl( response, noCache );
DavResource resource = null;
@ -279,4 +280,25 @@ public class RepositoryServlet
{
return "Basic realm=\"Repository Archiva Managed " + repository + " Repository\"";
}
@Override
public void destroy()
{
configuration.removeListener( this );
resourceFactory = null;
configuration = null;
locatorFactory = null;
sessionProvider = null;
repositoryMap.clear();
repositoryMap = null;
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( getServletContext() );
if ( wac instanceof ConfigurableApplicationContext )
{
( (ConfigurableApplicationContext) wac ).close();
}
super.destroy();
}
}

View File

@ -212,6 +212,8 @@ public abstract class AbstractRepositoryServletTestCase
FileUtils.deleteDirectory(repoRootInternal);
}
release( archivaConfiguration );
super.tearDown();
}