Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2002-12-17 15:21:50 +0000
committerDarin Wright2002-12-17 15:21:50 +0000
commitbcbd0646b1ebe954cf6e1d6655022f0b10a4960d (patch)
tree589459e0d86c0b34e5a8b986dd23d1009d53b6be
parent70533ca6cdcbf7a0dcc19583918fe23552a06a69 (diff)
downloadeclipse.jdt.debug-bcbd0646b1ebe954cf6e1d6655022f0b10a4960d.tar.gz
eclipse.jdt.debug-bcbd0646b1ebe954cf6e1d6655022f0b10a4960d.tar.xz
eclipse.jdt.debug-bcbd0646b1ebe954cf6e1d6655022f0b10a4960d.zip
debug test failure - turn off autobuildv20021217
-rw-r--r--org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java16
-rw-r--r--org.eclipse.jdt.debug.tests/testresources/CompilationError.java (renamed from org.eclipse.jdt.debug.tests/testprograms/CompileError.java)11
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java14
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/MiscBreakpointsTests.java26
4 files changed, 39 insertions, 28 deletions
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 f0f477c50..1e84babbe 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
@@ -50,7 +50,8 @@ import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
*/
public class JavaProjectHelper {
- public static final IPath TEST_SRC_DIR= new Path("testprograms");
+ public static final IPath TEST_SRC_DIR= new Path("testprograms");
+ public static final IPath TEST_COMPILE_ERROR = new Path("testresources/CompilationError.java");
/**
* Creates a IJavaProject.
@@ -261,6 +262,19 @@ public class JavaProjectHelper {
}
}
+ public static void importFile(File file, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException, IOException {
+ IImportStructureProvider structureProvider = FileSystemStructureProvider.INSTANCE;
+ List files = new ArrayList(1);
+ files.add(file);
+ try {
+ ImportOperation op= new ImportOperation(destPath, file.getParentFile(), structureProvider, new ImportOverwriteQuery(), files);
+ op.setCreateContainerStructure(false);
+ op.run(monitor);
+ } catch (InterruptedException e) {
+ // should not happen
+ }
+ }
+
private static void addJavaFiles(File dir, List collection) throws IOException {
File[] files = dir.listFiles();
List subDirs = new ArrayList(2);
diff --git a/org.eclipse.jdt.debug.tests/testprograms/CompileError.java b/org.eclipse.jdt.debug.tests/testresources/CompilationError.java
index 0c7b80d8c..e32484d60 100644
--- a/org.eclipse.jdt.debug.tests/testprograms/CompileError.java
+++ b/org.eclipse.jdt.debug.tests/testresources/CompilationError.java
@@ -6,13 +6,14 @@ which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v05.html
Contributors:
- IBM Corporation - Initial implementation
+ IBM Corporation - Initial implementation
**********************************************************************/
-public class CompileError {
+public class CompilationError {
- // This is a place-holder file. The tests will programmatically change the
- // content of this file to contain a compilation error
+ // this class contains a compilation error, so it is stored in a resources
+ // folder off of the classpath, and is imported into the tests project
public static void main(String[] args) {
+ String foo = "foo" + bar;
}
-}
+} \ No newline at end of file
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 97c700070..a876aa493 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
@@ -15,6 +15,7 @@ import java.io.File;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -39,6 +40,9 @@ public class ProjectCreationDecorator extends AbstractDebugTest {
}
public void testProjectCreation() throws Exception {
+ // turn off auto-build
+ ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false);
+
// delete any pre-existing project
IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("DebugTests");
if (pro.exists()) {
@@ -50,6 +54,10 @@ public class ProjectCreationDecorator extends AbstractDebugTest {
File root = JavaTestPlugin.getDefault().getFileInPlugin(JavaProjectHelper.TEST_SRC_DIR);
JavaProjectHelper.importFilesFromDirectory(root, src.getPath(), null);
+ // import the compilation error file
+ File file = JavaTestPlugin.getDefault().getFileInPlugin(JavaProjectHelper.TEST_COMPILE_ERROR);
+ JavaProjectHelper.importFile(file, src.getPath(), null);
+
// add rt.jar
IVMInstall vm = JavaRuntime.getDefaultVMInstall();
assertNotNull("No default JRE", vm);
@@ -80,6 +88,9 @@ public class ProjectCreationDecorator extends AbstractDebugTest {
// turn of suspend on uncaught exceptions
setSuspendOnUncaughtExceptionsPreference(false);
+ // build the workspace
+ ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
+
// create launch configurations
createLaunchConfiguration("Breakpoints");
createLaunchConfiguration("InstanceVariablesTests");
@@ -104,7 +115,8 @@ public class ProjectCreationDecorator extends AbstractDebugTest {
createLaunchConfiguration("EvalNestedTypeTests");
createLaunchConfiguration("EvalTypeHierarchyTests");
createLaunchConfiguration("WorkingDirectoryTest");
- createLaunchConfiguration("OneToTen");
+ createLaunchConfiguration("OneToTen");
+ createLaunchConfiguration("CompilationError");
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/MiscBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/MiscBreakpointsTests.java
index f84ef1c36..c43dc466d 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/MiscBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/MiscBreakpointsTests.java
@@ -11,10 +11,6 @@ Contributors:
IBM Corporation - Initial implementation
*********************************************************************/
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IBuffer;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.debug.core.IJavaDebugTarget;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
@@ -62,16 +58,10 @@ public class MiscBreakpointsTests extends AbstractDebugTest {
* preference being TRUE.
*/
public void testSuspendOnCompilationErrors() throws Exception {
- String typeName = "CompileError";
+ String typeName = "CompilationError";
getPrefStore().setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_UNCAUGHT_EXCEPTIONS, false);
getPrefStore().setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_COMPILATION_ERRORS, true);
-
- IType type = fJavaProject.findType(typeName);
- ICompilationUnit cu = type.getCompilationUnit();
- IBuffer buffer = cu.getBuffer();
- buffer.setContents(COMPILE_ERROR_CONTENTS);
- cu.save(new NullProgressMonitor(), true);
-
+
IJavaThread thread = null;
try {
thread= launchAndSuspend(typeName);
@@ -79,7 +69,7 @@ public class MiscBreakpointsTests extends AbstractDebugTest {
assertTrue("suspendee was not an IJavaThread", thread instanceof IJavaThread);
IJavaThread javaThread = (IJavaThread) thread;
int stackLine = javaThread.getTopStackFrame().getLineNumber();
- assertTrue("line number should be '3', but was " + stackLine, stackLine == 3);
+ assertTrue("line number should be '17', but was " + stackLine, stackLine == 17);
} finally {
terminateAndRemove(thread);
@@ -88,16 +78,10 @@ public class MiscBreakpointsTests extends AbstractDebugTest {
}
public void testDontSuspendOnCompilationErrors() throws Exception {
- String typeName = "CompileError";
+ String typeName = "CompilationError";
getPrefStore().setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_UNCAUGHT_EXCEPTIONS, false);
getPrefStore().setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_COMPILATION_ERRORS, false);
-
- IType type = fJavaProject.findType(typeName);
- ICompilationUnit cu = type.getCompilationUnit();
- IBuffer buffer = cu.getBuffer();
- buffer.setContents(COMPILE_ERROR_CONTENTS);
- cu.save(new NullProgressMonitor(), true);
-
+
IJavaDebugTarget debugTarget = null;
try {
debugTarget= launchAndTerminate(typeName);

Back to the top