Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladt2010-12-21 12:36:41 -0500
committervladt2010-12-21 12:38:07 -0500
commitac8459a9cf47de74604f6604a37fc752af4659b0 (patch)
tree4251f0ad6cb17107af508d7306acaab68ba760b6
parentafebdc190b069187840b3d19386ea11cbfb94700 (diff)
downloadm2e-core-ac8459a9cf47de74604f6604a37fc752af4659b0.tar.gz
m2e-core-ac8459a9cf47de74604f6604a37fc752af4659b0.tar.xz
m2e-core-ac8459a9cf47de74604f6604a37fc752af4659b0.zip
Restore the user settings file in tearDown
-rw-r--r--org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java
index 53445ff9..f3686ef5 100644
--- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java
+++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java
@@ -87,9 +87,14 @@ public abstract class AbstractMavenProjectTestCase extends TestCase {
protected IMavenConfiguration mavenConfiguration;
+ private String oldUserSettingsFile;
+
@SuppressWarnings("unchecked")
protected void setUp() throws Exception {
+ System.out.println("TEST-SETUP: " + getName());
+
super.setUp();
+
workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
description.setAutoBuilding(false);
@@ -110,9 +115,12 @@ public abstract class AbstractMavenProjectTestCase extends TestCase {
mavenConfiguration = MavenPlugin.getDefault().getMavenConfiguration();
+ oldUserSettingsFile = mavenConfiguration.getUserSettingsFile();
File settings = new File("settings.xml").getCanonicalFile();
if (settings.canRead()) {
- mavenConfiguration.setUserSettingsFile(settings.getAbsolutePath());
+ String userSettingsFile = settings.getAbsolutePath();
+ System.out.println("Setting user settings file: " + userSettingsFile);
+ mavenConfiguration.setUserSettingsFile(userSettingsFile);
}
ArtifactRepository localRepository = MavenPlugin.getDefault().getMaven().getLocalRepository();
@@ -130,6 +138,10 @@ public abstract class AbstractMavenProjectTestCase extends TestCase {
waitForJobsToComplete();
WorkspaceHelpers.cleanWorkspace();
+ // Restore the user settings file location
+ System.out.println("Restoring user settings file: " + oldUserSettingsFile);
+ mavenConfiguration.setUserSettingsFile(oldUserSettingsFile);
+
projectRefreshJob.wakeUp();
IWorkspaceDescription description = workspace.getDescription();
description.setAutoBuilding(true);

Back to the top