Bug 353821 - Test failures in latest I-builds
diff --git a/org.eclipse.jdt.debug.tests/testprograms/java7/Literals17.java b/org.eclipse.jdt.debug.tests/java7/Literals17.java
similarity index 100%
rename from org.eclipse.jdt.debug.tests/testprograms/java7/Literals17.java
rename to org.eclipse.jdt.debug.tests/java7/Literals17.java
diff --git a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
index 4cdf6d0..1e155dc 100644
--- a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
+++ b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
@@ -63,8 +63,63 @@
 	 * path to the compiler error java file
 	 */
 	public static final IPath TEST_COMPILE_ERROR = new Path("testresources/CompilationError.java");	
+	
+	public static final String JRE_CONTAINER_NAME = "org.eclipse.jdt.launching.JRE_CONTAINER";
 
 	/**
+	 * Returns if the currently running VM is version compatible with Java 7
+	 * 
+	 * @return <code>true</code> if a Java 7 (or greater) VM is running <code>false</code> otherwise
+	 */
+	public static boolean isJava7Compatible() {
+		return isCompatible(7);
+	}
+	
+	/**
+	 * Returns if the currently running VM is version compatible with Java 6
+	 * 
+	 * @return <code>true</code> if a Java 6 (or greater) VM is running <code>false</code> otherwise
+	 */
+	public static boolean isJava6Compatible() {
+		return isCompatible(6);
+	}
+	
+	/**
+	 * Returns if the currently running VM is version compatible with Java 5
+	 * 
+	 * @return <code>true</code> if a Java 5 (or greater) VM is running <code>false</code> otherwise
+	 */
+	public static boolean isJava5Compatible() {
+		return isCompatible(5);
+	}
+	
+	/**
+	 * Returns if the current running system is compatible with the given Java minor version
+	 * 
+	 * @param ver the version to test - either 4, 5, 6 or 7
+	 * @return <code>true</code> if compatible <code>false</code> otherwise
+	 */
+	static boolean isCompatible(int ver) {
+		String version = System.getProperty("java.specification.version");
+		if (version != null) {
+			String[] nums = version.split("\\.");
+			if (nums.length == 2) {
+				try {
+					int major = Integer.parseInt(nums[0]);
+					int minor = Integer.parseInt(nums[1]);
+					if (major >= 1) {
+						if (minor >= ver) {
+							return true;
+						}
+					}
+				} catch (NumberFormatException e) {
+				}
+			}
+		}
+		return false;
+	}
+	
+	/**
 	 * Creates a new {@link IProject} with the given name unless the project already exists. If it already exists
 	 * the project is refreshed and opened (if closed)
 	 * 
@@ -352,16 +407,19 @@
 	 */
 	private static void addToClasspath(IJavaProject jproject, IClasspathEntry cpe) throws JavaModelException {
 		IClasspathEntry[] oldEntries= jproject.getRawClasspath();
+		ArrayList entries = new ArrayList(oldEntries.length);
 		for (int i= 0; i < oldEntries.length; i++) {
 			if (oldEntries[i].equals(cpe)) {
 				return;
 			}
+			IPath oldpath = oldEntries[i].getPath();
+			if(JRE_CONTAINER_NAME.equals(oldpath.segment(0)) && JRE_CONTAINER_NAME.equals(cpe.getPath().segment(0))) {
+				continue;
+			}
+			entries.add(oldEntries[i]);
 		}
-		int nEntries= oldEntries.length;
-		IClasspathEntry[] newEntries= new IClasspathEntry[nEntries + 1];
-		System.arraycopy(oldEntries, 0, newEntries, 0, nEntries);
-		newEntries[nEntries]= cpe;
-		jproject.setRawClasspath(newEntries, null);
+		entries.add(cpe);
+		jproject.setRawClasspath((IClasspathEntry[]) entries.toArray(new IClasspathEntry[entries.size()]), null);
 	}
 	
 			
diff --git a/org.eclipse.jdt.debug.tests/testresources/JarProject/lib/sample.jar b/org.eclipse.jdt.debug.tests/testresources/JarProject/lib/sample.jar
index 62b422d..b9b1922 100644
--- a/org.eclipse.jdt.debug.tests/testresources/JarProject/lib/sample.jar
+++ b/org.eclipse.jdt.debug.tests/testresources/JarProject/lib/sample.jar
Binary files differ
diff --git a/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.classpath b/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.classpath
index 4f4828c..0ccde47 100644
--- a/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.classpath
+++ b/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.classpath
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
 	<classpathentry kind="lib" path="/JarProject/lib/sample.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.settings/org.eclipse.jdt.core.prefs
index 681a507..cd1d373 100644
--- a/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jdt.debug.tests/testresources/JarRefProject/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,12 @@
-#Wed May 25 11:15:46 CDT 2011
+#Wed Aug 03 13:31:56 CDT 2011
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.4
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index caa20b3..b03a9e7 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -304,6 +304,76 @@
 	}
 	
 	/**
+	 * Creates a new {@link IJavaProject} with the given name and initializes the contents from the given 
+	 * resource path from the testing bundle.
+	 * <br><br>
+	 * The project has the default <code>src</code> and <code>bin</code> folders. It is also created with a default
+	 * <code>launchConfigurations</code> folder.
+	 * 
+	 * @param name the name for the project
+	 * @param contentpath the path within the jdt.debug test bundle to initialize the source from
+	 * @param ee the level of execution environment to use
+	 * @param if an existing project should be deleted
+	 * @return the new Java project
+	 * @throws Exception
+	 */
+	protected IJavaProject createJavaProjectClone(String name, String contentpath, String ee, boolean delete) throws Exception {
+		IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+        if (pro.exists() && delete) {
+        	try {
+        		pro.delete(true, true, null);
+        	}
+        	catch(Exception e) {}
+        }
+        // create project and import source
+        IJavaProject jp = JavaProjectHelper.createJavaProject(name, "bin");
+        JavaProjectHelper.addSourceContainer(jp, "src");
+        File root = JavaTestPlugin.getDefault().getFileInPlugin(new Path(contentpath));
+        JavaProjectHelper.importFilesFromDirectory(root, jp.getPath(), null);
+
+        // add the EE library
+        IVMInstall vm = JavaRuntime.getDefaultVMInstall();
+        assertNotNull("No default JRE", vm);
+        IExecutionEnvironment environment = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(ee);
+        assertNotNull("The EE ["+ee+"] does not exist", environment);
+		IPath containerPath = JavaRuntime.newJREContainerPath(environment);
+        JavaProjectHelper.addContainerEntry(jp, containerPath);
+        pro = jp.getProject();  
+        
+        // create launch configuration folder
+        IFolder folder = pro.getFolder("launchConfigurations");
+        if (!folder.exists()) {
+        	folder.create(true, true, null);
+        }
+        return jp;
+	}
+	
+	/**
+	 * Creates a new {@link IProject} with the given name and initializes the contents from the given 
+	 * resource path from the testing bundle.
+	 * 
+	 * @param name the name for the project
+	 * @param contentpath the path within the jdt.debug test bundle to initialize the source from
+	 * @param if an existing project should be deleted
+	 * @return the new project
+	 * @throws Exception
+	 */
+	protected IProject createProjectClone(String name, String contentpath, boolean delete) throws Exception {
+		IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+        if (pro.exists() && delete) {
+        	try {
+        		pro.delete(true, true, null);
+        	}
+        	catch(Exception e) {}
+        }
+        // create project and import source
+        IProject pj = JavaProjectHelper.createProject(name);
+        File root = JavaTestPlugin.getDefault().getFileInPlugin(new Path(contentpath));
+        JavaProjectHelper.importFilesFromDirectory(root, pj.getFullPath(), null);
+        return pj;
+	}
+	
+	/**
 	 * Returns the launch shortcut with the given id
 	 * @param id
 	 * @return the <code>LaunchShortcutExtension</code> with the given id, 
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index 7bdb12b..f1680f9 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -16,6 +16,7 @@
 import org.eclipse.jdt.debug.test.stepping.ForceReturnTests;
 import org.eclipse.jdt.debug.test.stepping.StepFilterTests;
 import org.eclipse.jdt.debug.test.stepping.StepIntoSelectionTests;
+import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.debug.tests.breakpoints.BreakpointListenerTests;
 import org.eclipse.jdt.debug.tests.breakpoints.BreakpointLocationVerificationTests;
 import org.eclipse.jdt.debug.tests.breakpoints.BreakpointWorkingSetTests;
@@ -170,7 +171,7 @@
 		addTest(new TestSuite(BreakpointLocationVerificationTests.class));
 		addTest(new TestSuite(RunToLineTests.class));
 		addTest(new TestSuite(TestToggleBreakpointsTarget.class));
-		if (isJ2SE15Compatible()) {
+		if (JavaProjectHelper.isJava5Compatible()) {
 			addTest(new TestSuite(MethodBreakpointTests15.class));
 			addTest(new TestSuite(TestIntegerAccessUnboxing15.class));
 		}
@@ -198,7 +199,7 @@
 		addTest(new TestSuite(TestLogicalStructures.class));
 		addTest(new TestSuite(TestInstanceRetrieval.class));
 		addTest(new TestSuite(TestAnonymousInspect.class));
-		if(isJ2SE17Compatible()) {
+		if(JavaProjectHelper.isJava7Compatible()) {
 			addTest(new TestSuite(LiteralTests17.class));
 		}
 		
@@ -206,7 +207,7 @@
 		addTest(new TestSuite(StepFilterTests.class));
 		addTest(new TestSuite(StepIntoSelectionTests.class));
 		addTest(new TestSuite(InstanceFilterTests.class));
-		if (isJ2SE16Compatible()) {
+		if (JavaProjectHelper.isJava6Compatible()) {
 			addTest(new TestSuite(ForceReturnTests.class));
 		}
 		
@@ -292,17 +293,4 @@
 		
 		//addTest(EvalTestSuite.suite());
 	}
-	
-	protected static boolean isJ2SE15Compatible() {
-		return ProjectCreationDecorator.isJ2SE15Compatible();
-	}
-	
-	protected static boolean isJ2SE16Compatible() {
-		return ProjectCreationDecorator.isJ2SE16Compatible();
-	}
-	
-	protected static boolean isJ2SE17Compatible() {
-		return ProjectCreationDecorator.isJ2SE17Compatible();
-	}
 }
-
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
index 93720bc..9fe9f03 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
@@ -22,10 +22,13 @@
 import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.internal.core.LaunchManager;
 import org.eclipse.debug.internal.ui.DebugUIPlugin;
 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
@@ -59,34 +62,14 @@
 public class ProjectCreationDecorator extends AbstractDebugTest {
 
 	public static boolean fgReady = false;
-	private static boolean fgIsJ2SE15Compatible = false;
-	private static boolean fgIsJ2SE16Compatible = false;
-	private static boolean fgIsJ2SE17Compatible = false;
 	
-	{
-		String version = System.getProperty("java.specification.version");
-		if (version != null) {
-			String[] nums = version.split("\\.");
-			if (nums.length == 2) {
-				try {
-					int major = Integer.parseInt(nums[0]);
-					int minor = Integer.parseInt(nums[1]);
-					if (major >= 1) {
-						if (minor >= 5) {
-							fgIsJ2SE15Compatible = true;
-						}
-						if (minor >= 6) {
-							fgIsJ2SE16Compatible = true;
-						}
-						if(minor >= 7) {
-							fgIsJ2SE17Compatible = true;
-						}
-					}
-				} catch (NumberFormatException e) {
-				}
-			}
-		}
-	}	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+		getSharedJavaProject();
+	}
 	
     /**
      * Constructor
@@ -124,110 +107,115 @@
      * @throws Exception
      */
     public void testProjectCreation() throws Exception {
-        // delete any pre-existing project
         IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("DebugTests");
-        if (pro.exists()) {
-            pro.delete(true, true, null);
+        try {
+	        if (!pro.exists()) {
+	        	// create project and import source
+		        fJavaProject = JavaProjectHelper.createJavaProject("DebugTests", "bin");
+		        IPackageFragmentRoot src = JavaProjectHelper.addSourceContainer(fJavaProject, "src");
+		        File root = JavaTestPlugin.getDefault().getFileInPlugin(JavaProjectHelper.TEST_SRC_DIR);
+		        JavaProjectHelper.importFilesFromDirectory(root, src.getPath(), null);
+		
+		        // add rt.jar
+		        IVMInstall vm = JavaRuntime.getDefaultVMInstall();
+		        assertNotNull("No default JRE", vm);
+		        JavaProjectHelper.addContainerEntry(fJavaProject, new Path(JavaRuntime.JRE_CONTAINER));
+		        pro = fJavaProject.getProject();
+		
+		        // add A.jar
+		        root = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testjars"));
+		        JavaProjectHelper.importFilesFromDirectory(root, src.getPath(), null);
+		        IPath path = src.getPath().append("A.jar");
+		        JavaProjectHelper.addLibrary(fJavaProject, path);
+		
+		        // create launch configuration folder
+		        IFolder folder = pro.getFolder("launchConfigurations");
+		        if(!folder.exists()) {
+		        	folder.create(true, true, null);
+		        }
+		
+		        // create launch configurations
+		        createLaunchConfiguration("LargeSourceFile");
+		        createLaunchConfiguration("LotsOfFields");
+		        createLaunchConfiguration("Breakpoints");
+		        createLaunchConfiguration("InstanceVariablesTests");
+		        createLaunchConfiguration("LocalVariablesTests");
+		        createLaunchConfiguration("StaticVariablesTests");
+		        createLaunchConfiguration("DropTests");
+		        createLaunchConfiguration("ThrowsNPE");
+		        createLaunchConfiguration("ThrowsException");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.Watchpoint");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.CallLoop");
+		        createLaunchConfiguration("A");
+		        createLaunchConfiguration("HitCountLooper");
+		        createLaunchConfiguration("CompileError");
+		        createLaunchConfiguration("MultiThreadedLoop");
+		        createLaunchConfiguration("HitCountException");
+		        createLaunchConfiguration("MultiThreadedException");
+		        createLaunchConfiguration("MultiThreadedList");
+		        createLaunchConfiguration("MethodLoop");
+		        createLaunchConfiguration("StepFilterOne");
+		        createLaunchConfiguration("StepFilterFour");
+		
+		        createLaunchConfiguration("EvalArrayTests");
+		        createLaunchConfiguration("EvalSimpleTests");
+		        createLaunchConfiguration("EvalTypeTests");
+		        createLaunchConfiguration("EvalNestedTypeTests");
+		        createLaunchConfiguration("EvalTypeHierarchyTests");
+		        createLaunchConfiguration("WorkingDirectoryTest");
+		        createLaunchConfiguration("OneToTen");
+		        createLaunchConfiguration("OneToTenPrint");
+		        createLaunchConfiguration("FloodConsole");
+		        createLaunchConfiguration("ConditionalStepReturn");
+		        createLaunchConfiguration("VariableChanges");
+		        createLaunchConfiguration("DefPkgReturnType");
+		        createLaunchConfiguration("InstanceFilterObject");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.CallStack");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.ThreadStack");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.HcrClass");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.StepIntoSelectionClass");
+		        createLaunchConfiguration("WatchItemTests");
+		        createLaunchConfiguration("ArrayTests");
+		        createLaunchConfiguration("ByteArrayTests");
+		        createLaunchConfiguration("PerfLoop");
+		        createLaunchConfiguration("Console80Chars");
+		        createLaunchConfiguration("ConsoleStackTrace");
+		        createLaunchConfiguration("ConsoleVariableLineLength");
+		        createLaunchConfiguration("StackTraces");
+		        createLaunchConfiguration("ConsoleInput");
+		        createLaunchConfiguration("PrintConcatenation");
+		        createLaunchConfiguration("VariableDetails");
+		        createLaunchConfiguration("org.eclipse.debug.tests.targets.ArrayDetailTests");
+		        createLaunchConfiguration("ArrayDetailTestsDef");
+		        createLaunchConfiguration("ForceReturnTests");
+		        createLaunchConfiguration("ForceReturnTestsTwo");
+		        createLaunchConfiguration("LogicalStructures");
+		        createLaunchConfiguration("BreakpointListenerTest");
+		        
+		        //launch history tests
+		        createLaunchConfiguration("LaunchHistoryTest");
+		        createLaunchConfiguration("LaunchHistoryTest2");
+		        
+		        //launch configuration manager tests
+		        createLaunchConfiguration("RunnableAppletImpl");
+		        
+		        // instance retrieval tests
+		        createLaunchConfiguration("java6.AllInstancesTests");
+	        }
         }
-        // create project and import source
-        fJavaProject = JavaProjectHelper.createJavaProject("DebugTests", "bin");
-        IPackageFragmentRoot src = JavaProjectHelper.addSourceContainer(fJavaProject, "src");
-        File root = JavaTestPlugin.getDefault().getFileInPlugin(JavaProjectHelper.TEST_SRC_DIR);
-        JavaProjectHelper.importFilesFromDirectory(root, src.getPath(), null);
-
-        // add rt.jar
-        IVMInstall vm = JavaRuntime.getDefaultVMInstall();
-        assertNotNull("No default JRE", vm);
-        JavaProjectHelper.addContainerEntry(fJavaProject, new Path(JavaRuntime.JRE_CONTAINER));
-        pro = fJavaProject.getProject();
-
-        // add A.jar
-        root = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testjars"));
-        JavaProjectHelper.importFilesFromDirectory(root, src.getPath(), null);
-        IPath path = src.getPath().append("A.jar");
-        JavaProjectHelper.addLibrary(fJavaProject, path);
-
-        // create launch configuration folder
-
-        IFolder folder = pro.getFolder("launchConfigurations");
-        if (folder.exists()) {
-            folder.delete(true, null);
+        catch(Exception e) {
+        	try {
+	        	pro.delete(true,  true, null);
+	        	LaunchManager mgr = (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
+	        	ILaunchConfiguration[] configs = mgr.getLaunchConfigurations();
+	        	for (int i = 0; i < configs.length; i++) {
+					configs[i].delete();
+				}
+        	}
+        	catch (CoreException ce) {
+        		//ignore
+			}
         }
-        folder.create(true, true, null);
-
-        // delete any existing launch configs
-        ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
-        for (int i = 0; i < configs.length; i++) {
-            configs[i].delete();
-        }
-
-        // create launch configurations
-        createLaunchConfiguration("LargeSourceFile");
-        createLaunchConfiguration("LotsOfFields");
-        createLaunchConfiguration("Breakpoints");
-        createLaunchConfiguration("InstanceVariablesTests");
-        createLaunchConfiguration("LocalVariablesTests");
-        createLaunchConfiguration("StaticVariablesTests");
-        createLaunchConfiguration("DropTests");
-        createLaunchConfiguration("ThrowsNPE");
-        createLaunchConfiguration("ThrowsException");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.Watchpoint");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.CallLoop");
-        createLaunchConfiguration("A");
-        createLaunchConfiguration("HitCountLooper");
-        createLaunchConfiguration("CompileError");
-        createLaunchConfiguration("MultiThreadedLoop");
-        createLaunchConfiguration("HitCountException");
-        createLaunchConfiguration("MultiThreadedException");
-        createLaunchConfiguration("MultiThreadedList");
-        createLaunchConfiguration("MethodLoop");
-        createLaunchConfiguration("StepFilterOne");
-        createLaunchConfiguration("StepFilterFour");
-
-        createLaunchConfiguration("EvalArrayTests");
-        createLaunchConfiguration("EvalSimpleTests");
-        createLaunchConfiguration("EvalTypeTests");
-        createLaunchConfiguration("EvalNestedTypeTests");
-        createLaunchConfiguration("EvalTypeHierarchyTests");
-        createLaunchConfiguration("WorkingDirectoryTest");
-        createLaunchConfiguration("OneToTen");
-        createLaunchConfiguration("OneToTenPrint");
-        createLaunchConfiguration("FloodConsole");
-        createLaunchConfiguration("ConditionalStepReturn");
-        createLaunchConfiguration("VariableChanges");
-        createLaunchConfiguration("DefPkgReturnType");
-        createLaunchConfiguration("InstanceFilterObject");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.CallStack");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.ThreadStack");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.HcrClass");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.StepIntoSelectionClass");
-        createLaunchConfiguration("WatchItemTests");
-        createLaunchConfiguration("ArrayTests");
-        createLaunchConfiguration("ByteArrayTests");
-        createLaunchConfiguration("PerfLoop");
-        createLaunchConfiguration("Console80Chars");
-        createLaunchConfiguration("ConsoleStackTrace");
-        createLaunchConfiguration("ConsoleVariableLineLength");
-        createLaunchConfiguration("StackTraces");
-        createLaunchConfiguration("ConsoleInput");
-        createLaunchConfiguration("PrintConcatenation");
-        createLaunchConfiguration("VariableDetails");
-        createLaunchConfiguration("org.eclipse.debug.tests.targets.ArrayDetailTests");
-        createLaunchConfiguration("ArrayDetailTestsDef");
-        createLaunchConfiguration("ForceReturnTests");
-        createLaunchConfiguration("ForceReturnTestsTwo");
-        createLaunchConfiguration("LogicalStructures");
-        createLaunchConfiguration("BreakpointListenerTest");
-        
-        //launch history tests
-        createLaunchConfiguration("LaunchHistoryTest");
-        createLaunchConfiguration("LaunchHistoryTest2");
-        
-        //launch configuration manager tests
-        createLaunchConfiguration("RunnableAppletImpl");
-        
-        // instance retrieval tests
-        createLaunchConfiguration("java6.AllInstancesTests");
     }
 
     /**
@@ -254,7 +242,7 @@
     
     public void testJ2SE15ProjectCreation() throws Exception {
     	// create 1.5 project if there is a 1.5 runtime to compile against
-    	if (isJ2SE15Compatible()) {
+    	if (JavaProjectHelper.isJava5Compatible()) {
             IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("OneFive");
             if (pro.exists()) {
                 pro.delete(true, true, null);
@@ -423,7 +411,7 @@
             }
     	}
         assertTrue("Unexpected compile errors in project. Expected 1, found " + markers.length, errors == 1);
-        }
+    }
 
     /**
      * @throws Exception
@@ -448,16 +436,4 @@
         }
         assertTrue("No class files exist", (classFiles > 0));
     }
-    
-	protected static boolean isJ2SE15Compatible() {
-		return fgIsJ2SE15Compatible;
-	}
-	
-	protected static boolean isJ2SE16Compatible() {
-		return fgIsJ2SE16Compatible;
-	}
-	
-	protected static boolean isJ2SE17Compatible() {
-		return fgIsJ2SE17Compatible;
-	}
 }
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java
index 0f9876e..5a7c1c7 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java
@@ -10,8 +10,6 @@
  *******************************************************************************/
 package org.eclipse.jdt.debug.tests.core;
 
-import java.io.File;
-
 import org.eclipse.debug.core.model.ILineBreakpoint;
 import org.eclipse.debug.core.model.IValue;
 import org.eclipse.jdt.core.IJavaProject;
@@ -41,7 +39,7 @@
 	 * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#setUp()
 	 */
 	protected void setUp() throws Exception {
-		project = createProject("OneSeven", "testprograms"+File.separator+"java7", "JavaSE-1.7", false);
+		project = createProject("OneSeven", "java7", "JavaSE-1.7", false);
 		createLaunchConfiguration(project, typename);
 	}
 	
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
index d10d470..2d10635 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
@@ -10,11 +10,8 @@
  *******************************************************************************/
 package org.eclipse.jdt.debug.tests.sourcelookup;
 
-import java.io.File;
-
 import org.eclipse.core.internal.resources.ResourceException;
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
@@ -29,8 +26,6 @@
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.debug.core.IJavaStackFrame;
 import org.eclipse.jdt.debug.core.IJavaThread;
-import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
-import org.eclipse.jdt.debug.testplugin.JavaTestPlugin;
 import org.eclipse.jdt.debug.tests.AbstractDebugTest;
 import org.eclipse.jdt.internal.core.ClassFile;
 import org.eclipse.jdt.internal.launching.JavaSourceLookupUtil;
@@ -44,9 +39,9 @@
 public class JarSourceLookupTests extends AbstractDebugTest {
 
 	public static final String A_RUN_JAR = "a.RunJar";
-	public static final String LAUNCHES_CONTAINER_NAME = "launches";
+	static IJavaProject fgJarProject = null;
 	
-	String fJarRefProject = "JarRefProject";
+	String RefPjName = "JarRefProject";
 	String fJarProject = "JarProject";
 	
 	/**
@@ -67,7 +62,7 @@
 	        if (pro.exists()) {
 	            pro.delete(true, true, null);
 	        }
-	        pro = ResourcesPlugin.getWorkspace().getRoot().getProject(fJarRefProject);
+	        pro = ResourcesPlugin.getWorkspace().getRoot().getProject(RefPjName);
 	        if (pro.exists()) {
 	            pro.delete(true, true, null);
 	        }
@@ -92,24 +87,16 @@
 	 * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#getJavaProject()
 	 */
 	protected IJavaProject getJavaProject() {
-		return fJavaProject;
+		return fgJarProject;
 	}
 	
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#setUp()
 	 */
 	protected void setUp() throws Exception {
-		fJavaProject = JavaProjectHelper.createJavaProject(fJarRefProject);
-		IFolder folder = fJavaProject.getProject().getFolder(LAUNCHES_CONTAINER_NAME);
-        if (!folder.exists()) {
-        	folder.create(true, true, null);
-        }
 		IPath testrpath = new Path("testresources");
-		File root = JavaTestPlugin.getDefault().getFileInPlugin(testrpath.append(fJarRefProject));
-		JavaProjectHelper.importFilesFromDirectory(root, fJavaProject.getPath(), null);
-		IProject pj = JavaProjectHelper.createProject(fJarProject);
-		root = JavaTestPlugin.getDefault().getFileInPlugin(testrpath.append(fJarProject));
-		JavaProjectHelper.importFilesFromDirectory(root, pj.getFullPath(), null);
+		IProject pj = createProjectClone(fJarProject, testrpath.append(fJarProject).toString(), false);
+		fgJarProject = createJavaProjectClone(RefPjName, testrpath.append(RefPjName).toString(), "J2SE-1.4", false);
 	}
 	
 	/* (non-Javadoc)
@@ -129,8 +116,8 @@
 	 * @throws Exception
 	 */
 	public void testTranslateContainers() throws Exception {
-		createLaunchConfiguration(fJavaProject, LAUNCHES_CONTAINER_NAME, A_RUN_JAR);
-		ILaunchConfiguration config = getLaunchConfiguration(fJavaProject, LAUNCHES_CONTAINER_NAME, A_RUN_JAR);
+		createLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
+		ILaunchConfiguration config = getLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedSourceLookupPath(config);
 		IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries, config);
 		ISourceContainer[] containers = JavaSourceLookupUtil.translate(resolved);
@@ -162,9 +149,9 @@
 	 * @throws Exception
 	 */
 	public void testInspectClassFileFromJar() throws Exception {
-		createLaunchConfiguration(fJavaProject, LAUNCHES_CONTAINER_NAME, A_RUN_JAR);
+		createLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		createLineBreakpoint(6, A_RUN_JAR);
-		ILaunchConfiguration config = getLaunchConfiguration(fJavaProject, LAUNCHES_CONTAINER_NAME, A_RUN_JAR);
+		ILaunchConfiguration config = getLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		IJavaThread thread = null;
 		try {
 			 thread = launchToBreakpoint(config);
@@ -189,9 +176,9 @@
 	 * @throws Exception
 	 */
 	public void testShowClassFileFromJar() throws Exception {
-		createLaunchConfiguration(fJavaProject, LAUNCHES_CONTAINER_NAME, A_RUN_JAR);
+		createLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		createLineBreakpoint(6, A_RUN_JAR);
-		ILaunchConfiguration config = getLaunchConfiguration(fJavaProject, LAUNCHES_CONTAINER_NAME, A_RUN_JAR);
+		ILaunchConfiguration config = getLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		IJavaThread thread = null;
 		try {
 			 thread = launchToBreakpoint(config);