Bug 438584 - p2 unit tests not cleaning up after themselves

Change-Id: I651c22e089d17929f00ee086e3de6910ef901266
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java
index 147c8c5..f66e38a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java
@@ -47,6 +47,7 @@
 	@Override
 	protected void tearDown() throws Exception {
 		System.setProperty(Activator.ENABLE_ARTIFACT_LOCKING, "" + lockingValue);
+		targetLocation.delete();
 		super.tearDown();
 	}
 
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
index 158f66e..9fd7393 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
@@ -64,6 +64,9 @@
 
 		expectedExecutablesContents = new String[] {"Info.plist", "MacOS/" + EXECUTABLE_NAME, "MacOS/" + EXECUTABLE_NAME + ".ini", "Resources/" + icon.getName()};
 		testExecutableAction("macCocoa", "macosx", macConfigCocoa, MAC_EXEC, icon); //$NON-NLS-1$//$NON-NLS-2$
+
+		// cleanup
+		icon.delete();
 	}
 
 	public void testWin() throws Exception {
@@ -73,6 +76,9 @@
 		// FIXME: is there any way to test that the .ico has been replaced?
 		expectedExecutablesContents = new String[] {EXECUTABLE_NAME + ".exe"};
 		testExecutableAction("win", "win32", winConfig, WIN_EXEC, icon); //$NON-NLS-1$//$NON-NLS-2$
+
+		// cleanup
+		icon.delete();
 	}
 
 	public void testLinux() throws Exception {
@@ -81,6 +87,9 @@
 
 		expectedExecutablesContents = new String[] {EXECUTABLE_NAME, "icon.xpm"};
 		testExecutableAction("linux", "linux", linuxConfig, LINUX_EXEC, icon); //$NON-NLS-1$//$NON-NLS-2$
+
+		// cleanup
+		icon.delete();
 	}
 
 	private void testExecutableAction(String idBase, final String osArg, String config, File exec, File icon) {
@@ -198,6 +207,9 @@
 		} finally {
 			zip.close();
 		}
+
+		// cleanup
+		file.delete();
 	}
 
 	/** 
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
index 1fdfb23..ca63319 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
@@ -85,6 +85,7 @@
 
 	private URI createRepistory() throws IOException {
 		File repository = File.createTempFile("remoteFile", ""); //$NON-NLS-1$//$NON-NLS-2$
+		repository.deleteOnExit();
 		assertTrue(repository.delete());
 		assertTrue(repository.mkdirs());
 		IPath contentXmlPath = new Path(repository.getAbsolutePath()).append("content.xml"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/RmdirActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/RmdirActionTest.java
index 35c6df7..f629943 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/RmdirActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/RmdirActionTest.java
@@ -64,5 +64,8 @@
 		assertTrue(testFolder.exists());
 		if (store != null)
 			store.discard();
+
+		// cleanup
+		testFolder.delete();
 	}
-}
\ No newline at end of file
+}