From de46f2a5faf8ddd6a529d72471876c63293de8bd Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Wed, 13 May 2009 20:27:13 +0000 Subject: [PATCH] o bunch more patches from Igor to keep the heap down. junit is just not letting go. git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@774515 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 4 +++- .../manager/DefaultWagonManagerTest.java | 7 ++++++ .../resolver/ArtifactResolverTest.java | 7 ++++++ .../DefaultArtifactCollectorTest.java | 7 ++++++ .../AbstractCoreMavenComponentTestCase.java | 7 ++++++ .../test/java/org/apache/maven/MavenTest.java | 8 +++++++ .../lifecycle/LifecycleExecutorTest.java | 6 +++++ .../maven/plugin/PluginManagerTest.java | 6 +++++ ...luginParameterExpressionEvaluatorTest.java | 6 +++++ .../project/AbstractMavenProjectTestCase.java | 7 ++++++ .../maven/project/PomConstructionTest.java | 7 ++++++ .../artifact/MavenMetadataSourceTest.java | 22 +++++-------------- .../PomConstructionWithSettingsTest.java | 7 ++++++ ...ultMavenExecutionRequestPopulatorTest.java | 6 +++++ .../maven/repository/MirrorProcessorTest.java | 6 +++++ 15 files changed, 96 insertions(+), 17 deletions(-) diff --git a/build.xml b/build.xml index 8ebd735baa..219f9bc6d6 100644 --- a/build.xml +++ b/build.xml @@ -65,7 +65,7 @@ END SNIPPET: ant-bootstrap --> - + maven.home = ${maven.home.effective} maven.repo.local = ${maven.repo.local} @@ -199,6 +199,8 @@ END SNIPPET: ant-bootstrap --> + + diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java index 9d79dab729..3efdd208d4 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java @@ -73,6 +73,13 @@ public class DefaultWagonManagerTest artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); } + @Override + protected void tearDown() throws Exception { + wagonManager = null; + artifactFactory = null; + super.tearDown(); + } + public void testAvailableProtocols() throws Exception { diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java index 9f4eb02e0c..7241055aab 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java @@ -61,6 +61,13 @@ public class ArtifactResolverTest projectArtifact = createLocalArtifact( "project", "3.0" ); } + + @Override + protected void tearDown() throws Exception { + artifactFactory = null; + projectArtifact = null; + super.tearDown(); + } @Override protected String component() diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java index 0b9b312754..2d5ad74c3b 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java @@ -78,6 +78,13 @@ public class DefaultArtifactCollectorTest projectArtifact = createArtifactSpec( "project", "1.0", null ); } + @Override + protected void tearDown() throws Exception { + artifactCollector = null; + artifactFactory = null; + super.tearDown(); + } + // works, but we don't fail on cycles presently public void disabledtestCircularDependencyNotIncludingCurrentProject() throws ArtifactResolutionException, InvalidVersionSpecificationException diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java index a74ee24753..0ce6b476b8 100644 --- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java +++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java @@ -37,6 +37,13 @@ public abstract class AbstractCoreMavenComponentTestCase projectBuilder = lookup( MavenProjectBuilder.class ); } + @Override + protected void tearDown() throws Exception { + repositorySystem = null; + projectBuilder = null; + super.tearDown(); + } + abstract protected String getProjectsDirectory(); protected File getProject( String name ) diff --git a/maven-core/src/test/java/org/apache/maven/MavenTest.java b/maven-core/src/test/java/org/apache/maven/MavenTest.java index 97e1820c24..fff904a4f4 100644 --- a/maven-core/src/test/java/org/apache/maven/MavenTest.java +++ b/maven-core/src/test/java/org/apache/maven/MavenTest.java @@ -25,6 +25,14 @@ public class MavenTest maven = lookup( Maven.class ); exceptionHandler = lookup( ExceptionHandler.class ); } + + @Override + protected void tearDown() throws Exception { + maven = null; + exceptionHandler = null; + + super.tearDown(); + } protected String getProjectsDirectory() { diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java index 38c1fc3c32..fa2625f032 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java @@ -27,6 +27,12 @@ public class LifecycleExecutorTest lifecycleExecutor = (DefaultLifecycleExecutor) lookup( LifecycleExecutor.class ); lookup( ExceptionHandler.class ); } + + @Override + protected void tearDown() throws Exception { + lifecycleExecutor = null; + super.tearDown(); + } protected String getProjectsDirectory() { diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java index 8a5db7ecc9..4d955ae8ec 100644 --- a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java +++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java @@ -22,6 +22,12 @@ public class PluginManagerTest super.setUp(); pluginManager = lookup( PluginManager.class ); } + + @Override + protected void tearDown() throws Exception { + pluginManager = null; + super.tearDown(); + } protected String getProjectsDirectory() { diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java index 5b6e075f95..7ded6f12d0 100644 --- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java +++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java @@ -70,6 +70,12 @@ public class PluginParameterExpressionEvaluatorTest factory = lookup( ArtifactFactory.class ); } + @Override + protected void tearDown() throws Exception { + factory = null; + super.tearDown(); + } + public void testPluginDescriptorExpressionReference() throws Exception { diff --git a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java index c417d52bfc..cd79d5e6db 100644 --- a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java +++ b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java @@ -55,6 +55,13 @@ public abstract class AbstractMavenProjectTestCase projectBuilder = lookup( MavenProjectBuilder.class ); } } + + @Override + protected void tearDown() throws Exception { + projectBuilder = null; + + super.tearDown(); + } @Override protected void tearDown() diff --git a/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java b/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java index be48a4530f..58ecce8c4c 100644 --- a/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java @@ -68,6 +68,13 @@ public class PomConstructionTest super.tearDown(); } + + @Override + protected void tearDown() throws Exception { + mavenProjectBuilder = null; + + super.tearDown(); + } /** * Will throw exception if url is empty. MNG-4050 diff --git a/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java b/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java index 9be234a920..dc7d1ca933 100644 --- a/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java @@ -19,22 +19,6 @@ package org.apache.maven.project.artifact; * under the License. */ -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.Exclusion; -import org.apache.maven.model.Model; -import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.PlexusTestCase; @@ -50,6 +34,12 @@ public class MavenMetadataSourceTest repositorySystem = lookup( RepositorySystem.class ); } + @Override + protected void tearDown() throws Exception { + repositorySystem = null; + super.tearDown(); + } + public void testShouldNotCarryExclusionsOverFromDependencyToDependency() throws Exception { diff --git a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java index 77a80a85f3..8051a09f67 100644 --- a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java +++ b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java @@ -39,6 +39,13 @@ public class PomConstructionWithSettingsTest testDirectory = new File( getBasedir(), BASE_POM_DIR ); mavenProjectBuilder = (DefaultMavenProjectBuilder) lookup( MavenProjectBuilder.class ); } + + @Override + protected void tearDown() throws Exception { + mavenProjectBuilder = null; + + super.tearDown(); + } public void testSettingsNoPom() throws Exception { diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java index dad2163710..9db04b9f3e 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java @@ -18,6 +18,12 @@ public class DefaultMavenExecutionRequestPopulatorTest populator = (MavenExecutionRequestPopulator) lookup( MavenExecutionRequestPopulator.class ); } + + @Override + protected void tearDown() throws Exception { + populator = null; + super.tearDown(); + } public void testWagonManagerOfflineFlagIsPopulatedFromSettings() throws MavenEmbedderException diff --git a/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java b/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java index 98468f6067..211fc180d0 100644 --- a/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java +++ b/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java @@ -17,6 +17,12 @@ public class MirrorProcessorTest mirrorBuilder.clearMirrors(); } + @Override + protected void tearDown() throws Exception { + mirrorBuilder = null; + super.tearDown(); + } + public void testAddMirrorWithNullRepositoryId() { mirrorBuilder.addMirror( null, "test", "http://www.nowhere.com/" );