summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMykola Nikishov2009-10-23 06:58:38 (EDT)
committer Shawn O. Pearce2009-11-30 20:11:29 (EST)
commitc3691f89055db6d6d5d8685621ae2b21acffe8b7 (patch)
treeb6d7072d99e2f2ddbfdcb7b4129c80ded8874f47
parent00555bf3cbf3c2072b9e31c034f39340c207fe6d (diff)
downloadegit-c3691f89055db6d6d5d8685621ae2b21acffe8b7.zip
egit-c3691f89055db6d6d5d8685621ae2b21acffe8b7.tar.gz
egit-c3691f89055db6d6d5d8685621ae2b21acffe8b7.tar.bz2
Remove a test project from workspace before creationrefs/changes/95/95/2
Creating a test project when it exists throws: org.eclipse.core.internal.resources.ResourceException: Resource '/Project-1' already exists. Change-Id: I9d8d548fa8ebc697467f33a387ad2ae8ba78f022 Signed-off-by: Mykola Nikishov <mn@mn.com.ua> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java2
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java15
2 files changed, 16 insertions, 1 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index a82c350..81845f9 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -26,7 +26,7 @@ public abstract class GitTestCase extends TestCase {
protected void setUp() throws Exception {
super.setUp();
- project = new TestProject();
+ project = new TestProject(true);
checkNotNested();
gitDir = new File(project.getProject().getWorkspace().getRoot()
.getRawLocation().toFile(), ".git");
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java
index b9ea087..6fa563a 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java
@@ -41,9 +41,24 @@ public class TestProject {
private IPackageFragmentRoot sourceFolder;
+ /**
+ * @throws CoreException
+ * If project already exists
+ */
public TestProject() throws CoreException {
+ this(false);
+ }
+
+ /**
+ * @param remove
+ * should project be removed if already exists
+ * @throws CoreException
+ */
+ public TestProject(final boolean remove) throws CoreException {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
project = root.getProject("Project-1");
+ if (remove)
+ project.delete(true, null);
project.create(null);
project.open(null);
javaProject = JavaCore.create(project);