diff options
| author | Mykola Nikishov | 2009-10-23 10:58:38 +0000 |
|---|---|---|
| committer | Shawn O. Pearce | 2009-12-01 01:11:29 +0000 |
| commit | c3691f89055db6d6d5d8685621ae2b21acffe8b7 (patch) | |
| tree | b6d7072d99e2f2ddbfdcb7b4129c80ded8874f47 | |
| parent | 00555bf3cbf3c2072b9e31c034f39340c207fe6d (diff) | |
| download | egit-c3691f89055db6d6d5d8685621ae2b21acffe8b7.tar.gz egit-c3691f89055db6d6d5d8685621ae2b21acffe8b7.tar.xz egit-c3691f89055db6d6d5d8685621ae2b21acffe8b7.zip | |
Remove a test project from workspace before creation
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.java | 2 | ||||
| -rw-r--r-- | org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java | 15 |
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 a82c35046e..81845f9c16 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 b9ea087081..6fa563aa1f 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); |
