This commit was manufactured by cvs2svn to create tag 'v20040322'.
Sprout from master 2004-03-22 09:48:07 UTC dbaeumer 'More refactoring API work'
Cherrypick from master 2004-03-23 00:39:02 UTC Jared Burns <jburns> '*** empty log message ***':
org.eclipse.jdt.debug/buildnotes_jdt-debug.html
Delete:
org.eclipse.jdt.debug.jdi.tests/.classpath
org.eclipse.jdt.debug.jdi.tests/.cvsignore
org.eclipse.jdt.debug.jdi.tests/.project
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AutomatedSuite.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BreakpointRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassLoaderReferenceTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventWaiter.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassesByNameTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventListener.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestManagerTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventWaiter.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FileConsoleReader.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestCase.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestSuite.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MirrorTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ModificationWatchpointEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NotYetImplementedException.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NullConsoleReader.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/PrimitiveValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StringReferenceTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TestAll.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TextTestResult.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadDeathEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadGroupReferenceTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadStartEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventWaiter.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMInformation.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ValueTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointRequestTest.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/MainClass.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/OtherClass.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/Printable.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass1.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass2.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass3.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass4.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass5.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass6.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass7.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz10.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz8.java
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz9.java
org.eclipse.jdt.launching.macosx/.classpath
org.eclipse.jdt.launching.macosx/.cvsignore
org.eclipse.jdt.launching.macosx/.project
org.eclipse.jdt.launching.macosx/about.html
org.eclipse.jdt.launching.macosx/build.properties
org.eclipse.jdt.launching.macosx/icons/full/ctool16/exportappbundle_wiz.gif
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXDebugVMRunner.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLauncherMessages.properties
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLaunchingPlugin.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstall.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMRunner.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleAttributes.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleDescription.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleMessages.properties
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardBasePage.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage1.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage2.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage3.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/MacBundleWizard.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/ResourceInfo.java
org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/Util.java
org.eclipse.jdt.launching.macosx/plugin.properties
org.eclipse.jdt.launching.macosx/plugin.xml
org.eclipse.jdt.launching.macosx/scripts/exportplugin.xml
diff --git a/org.eclipse.jdt.debug.jdi.tests/.classpath b/org.eclipse.jdt.debug.jdi.tests/.classpath
deleted file mode 100644
index 3467cbe..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="tests"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.debug"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.junit_3.8.1/junit.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.debug.jdi.tests/.cvsignore b/org.eclipse.jdt.debug.jdi.tests/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.jdt.debug.jdi.tests/.project b/org.eclipse.jdt.debug.jdi.tests/.project
deleted file mode 100644
index 3f27311..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.debug.jdi.tests</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.jdt.debug</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java
deleted file mode 100644
index 5e9b005..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java
+++ /dev/null
@@ -1,1433 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.jdi.tests;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import org.eclipse.jdi.Bootstrap;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ArrayReference;
-import com.sun.jdi.ArrayType;
-import com.sun.jdi.ClassLoaderReference;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Field;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.LocalVariable;
-import com.sun.jdi.Location;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.StackFrame;
-import com.sun.jdi.StringReference;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.VMDisconnectedException;
-import com.sun.jdi.Value;
-import com.sun.jdi.VirtualMachineManager;
-import com.sun.jdi.connect.AttachingConnector;
-import com.sun.jdi.connect.Connector;
-import com.sun.jdi.connect.IllegalConnectorArgumentsException;
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.ExceptionEvent;
-import com.sun.jdi.event.StepEvent;
-import com.sun.jdi.request.AccessWatchpointRequest;
-import com.sun.jdi.request.BreakpointRequest;
-import com.sun.jdi.request.EventRequest;
-import com.sun.jdi.request.ExceptionRequest;
-import com.sun.jdi.request.ModificationWatchpointRequest;
-import com.sun.jdi.request.StepRequest;
-
-/**
- * Tests for com.sun.jdi.* and JDWP commands.
- * These tests assume that the target program is
- * "org.eclipse.debug.jdi.tests.program.MainClass".
- *
- * Examples of arguments:
- * -launcher SunVMLauncher -address c:\jdk1.2.2\ -cp d:\target
- * -launcher J9VMLauncher -address d:\ive\ -cp d:\target
- */
-public abstract class AbstractJDITest extends TestCase {
- static int TIMEOUT = 10000; //ms
- static protected int fBackEndPort = 9900;
- // We want subsequent connections to use different ports.
- protected static String fVMLauncherName;
- protected static String fTargetAddress;
- protected static String fClassPath;
- protected static String fBootPath;
- protected static String fVMType;
- protected com.sun.jdi.VirtualMachine fVM;
- protected Process fLaunchedProxy;
- protected Process fLaunchedVM;
- protected static int fVMTraceFlags = com.sun.jdi.VirtualMachine.TRACE_NONE;
- protected EventReader fEventReader;
- protected AbstractReader fConsoleReader;
- protected AbstractReader fConsoleErrorReader;
- protected AbstractReader fProxyReader;
- protected AbstractReader fProxyErrorReader;
- protected boolean fInControl = true;
- // Whether this test should control the VM (ie. starting it and shutting it down)
- protected static boolean fVerbose;
- protected static String fStdoutFile;
- protected static String fStderrFile;
- protected static String fProxyoutFile;
- protected static String fProxyerrFile;
- protected static String fVmCmd;
- protected static String fProxyCmd;
-
- // Stack offset to the MainClass.run() method
- protected static final int RUN_FRAME_OFFSET = 1;
-
- /**
- * Constructs a test case with a default name.
- */
- public AbstractJDITest() {
- super("JDI Test");
- }
- /**
- * Returns the names of the tests that are known to not work
- * By default, none are excluded.
- */
- protected String[] excludedTests() {
- return new String[] {
- };
- }
- /**
- * Creates and returns an access watchpoint request
- * for the field "fBool" in
- * org.eclipse.debug.jdi.tests.program.MainClass
- * NOTE: This assumes that the VM can watch field access.
- */
- protected AccessWatchpointRequest getAccessWatchpointRequest() {
- // Get the field
- Field field = getField("fBool");
-
- // Create an access watchpoint for this field
- return fVM.eventRequestManager().createAccessWatchpointRequest(field);
- }
- /**
- * Returns all tests that start with the given string.
- * Returns a vector of String.
- */
- protected Vector getAllMatchingTests(String match) {
- Class theClass = this.getClass();
- java.lang.reflect.Method[] methods = theClass.getDeclaredMethods();
- Vector result = new Vector();
- for (int i = 0; i < methods.length; i++) {
- java.lang.reflect.Method m = methods[i];
- String name = m.getName();
- Class[] parameters = m.getParameterTypes();
- if (parameters.length == 0 && name.startsWith(match)) {
- if (!isExcludedTest(name)) {
- result.add(name);
- } else
- System.out.println(name + " is excluded.");
- }
- }
- return result;
- }
-
- /**
- * Returns an array reference.
- */
- protected ArrayReference getObjectArrayReference() {
- // Get static field "fArray"
- Field field = getField("fArray");
-
- // Get value of "fArray"
- return (ArrayReference) getMainClass().getValue(field);
- }
-
- /**
- * Returns another array reference.
- */
- protected ArrayReference getNonEmptyDoubleArrayReference() {
- // Get static field "fDoubleArray"
- Field field = getField("fDoubleArray");
-
- // Get value of "fDoubleArray"
- return (ArrayReference) getMainClass().getValue(field);
- }
-
- /**
- * One-dimensional empty array reference getters
- */
- protected ArrayReference getByteArrayReference() {
- Field field = getField("byteArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getShortArrayReference() {
- Field field = getField("shortArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getIntArrayReference() {
- Field field = getField("intArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getLongArrayReference() {
- Field field = getField("longArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getDoubleArrayReference() {
- Field field = getField("doubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getFloatArrayReference() {
- Field field = getField("floatArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getCharArrayReference() {
- Field field = getField("charArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getBooleanArrayReference() {
- Field field = getField("booleanArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- /**
- * Two-dimensional array reference getters
- */
- protected ArrayReference getByteDoubleArrayReference() {
- Field field = getField("byteDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getShortDoubleArrayReference() {
- Field field = getField("shortDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getIntDoubleArrayReference() {
- Field field = getField("intDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getLongDoubleArrayReference() {
- Field field = getField("longDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getFloatDoubleArrayReference() {
- Field field = getField("floatDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getDoubleDoubleArrayReference() {
- Field field = getField("doubleDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getCharDoubleArrayReference() {
- Field field = getField("charDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
- protected ArrayReference getBooleanDoubleArrayReference() {
- Field field = getField("booleanDoubleArray");
- return (ArrayReference) getMainClass().getValue(field);
- }
-
- /**
- * Returns the array type.
- */
- protected ArrayType getArrayType() {
- // Get array reference
- ArrayReference value = getObjectArrayReference();
-
- // Get reference type of "fArray"
- return (ArrayType) value.referenceType();
- }
- /**
- * One-dimensional primitive array getters
- */
- protected ArrayType getByteArrayType() {
- ArrayReference value = getByteArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getShortArrayType() {
- ArrayReference value = getShortArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getIntArrayType() {
- ArrayReference value = getIntArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getLongArrayType() {
- ArrayReference value = getLongArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getFloatArrayType() {
- ArrayReference value = getFloatArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getDoubleArrayType() {
- ArrayReference value = getDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getCharArrayType() {
- ArrayReference value = getCharArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getBooleanArrayType() {
- ArrayReference value = getBooleanArrayReference();
- return (ArrayType) value.referenceType();
- }
- /**
- * Two-dimensional primitive array getters
- */
- protected ArrayType getByteDoubleArrayType() {
- ArrayReference value = getByteDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getShortDoubleArrayType() {
- ArrayReference value = getShortDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getIntDoubleArrayType() {
- ArrayReference value = getIntDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getLongDoubleArrayType() {
- ArrayReference value = getLongDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getFloatDoubleArrayType() {
- ArrayReference value = getFloatDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getDoubleDoubleArrayType() {
- ArrayReference value = getDoubleDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getCharDoubleArrayType() {
- ArrayReference value = getCharDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
- protected ArrayType getBooleanDoubleArrayType() {
- ArrayReference value = getBooleanDoubleArrayReference();
- return (ArrayType) value.referenceType();
- }
-
- /**
- * Creates and returns a breakpoint request in the first
- * instruction of the MainClass.triggerBreakpointEvent() method.
- */
- protected BreakpointRequest getBreakpointRequest() {
- // Create a breakpoint request
- return fVM.eventRequestManager().createBreakpointRequest(getLocation());
- }
- /**
- * Returns the class with the given name or null if not loaded.
- */
- protected ClassType getClass(String name) {
- List classes = fVM.classesByName(name);
- if (classes.size() == 0)
- return null;
- else
- return (ClassType) classes.get(0);
- }
- /**
- * Returns the class loader of
- * org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected ClassLoaderReference getClassLoaderReference() {
- // Get main class
- ClassType type = getMainClass();
-
- // Get its class loader
- return type.classLoader();
- }
- /**
- * Creates and returns an exception request for uncaught exceptions.
- */
- protected ExceptionRequest getExceptionRequest() {
- return fVM.eventRequestManager().createExceptionRequest(null, false, true);
- }
- /**
- * Returns the static field "fObject" in
- * org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected Field getField() {
- return getField("fObject");
- }
- /**
- * Returns the field with the given name in
- * org.eclipse.debug.jdi.tests.program.MainClass.
- */
- protected Field getField(String fieldName) {
- // Get main class
- ClassType type = getMainClass();
-
- // Get field
- Field result = type.fieldByName(fieldName);
- if (result == null)
- throw new Error("Unknown field: " + fieldName);
- else
- return result;
- }
- /**
- * Returns the n frame (starting at the top of the stack) of the thread
- * contained in the static field "fThread" of org.eclipse.debug.jdi.tests.program.MainClass.
- */
- protected StackFrame getFrame(int n) {
- // Make sure the thread is suspended
- ThreadReference thread = getThread();
- assertTrue(thread.isSuspended());
-
- // Get the frame
- StackFrame frame = null;
- try {
- List frames = thread.frames();
- frame = (StackFrame) frames.get(n);
- } catch (IncompatibleThreadStateException e) {
- throw new Error("Thread was not suspended");
- }
-
- return frame;
- }
- /**
- * Returns the interface type org.eclipse.debug.jdi.tests.program.Printable.
- */
- protected InterfaceType getInterfaceType() {
- List types = fVM.classesByName("org.eclipse.debug.jdi.tests.program.Printable");
- return (InterfaceType) types.get(0);
- }
- /**
- * Returns the variable "t" in the frame running MainClass.run().
- */
- protected LocalVariable getLocalVariable() {
- try {
- return getFrame(RUN_FRAME_OFFSET).visibleVariableByName("t");
- } catch (AbsentInformationException e) {
- return null;
- }
- }
- /**
- * Returns the firt location in MainClass.print(OutputStream).
- */
- protected Location getLocation() {
- return getMethod().location();
- }
- /**
- * Returns the class org.eclipse.debug.jdi.tests.program.MainClass.
- */
- protected ClassType getMainClass() {
- return getClass("org.eclipse.debug.jdi.tests.program.MainClass");
- }
- /**
- * Returns the method "print(Ljava/io/OutputStream;)V"
- * in org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected Method getMethod() {
- return getMethod("print", "(Ljava/io/OutputStream;)V");
- }
- /**
- * Returns the method with the given name and signature
- * in org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected Method getMethod(String name, String signature) {
- return getMethod(
- "org.eclipse.debug.jdi.tests.program.MainClass",
- name,
- signature);
- }
- /**
- * Returns the method with the given name and signature
- * in the given class.
- */
- protected Method getMethod(String className, String name, String signature) {
- // Get main class
- ClassType type = getClass(className);
-
- // Get method print(OutputStream)
- Method method = null;
- List methods = type.methods();
- ListIterator iterator = methods.listIterator();
- while (iterator.hasNext()) {
- Method m = (Method) iterator.next();
- if ((m.name().equals(name)) && (m.signature().equals(signature))) {
- method = m;
- break;
- }
- }
- if (method == null)
- throw new Error("Unknown method: " + name + signature);
- else
- return method;
- }
- /**
- * Creates and returns a modification watchpoint request
- * for the field "fBool" in
- * org.eclipse.debug.jdi.tests.program.MainClass.
- * NOTE: This assumes that the VM can watch field modification.
- */
- protected ModificationWatchpointRequest getModificationWatchpointRequest() {
- // Get the field
- Field field = getField("fBool");
-
- // Create a modification watchpoint for this field
- return fVM.eventRequestManager().createModificationWatchpointRequest(field);
- }
- /**
- * Returns the value of the static field "fObject" in
- * org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected ObjectReference getObjectReference() {
- // Get main class
- ClassType type = getMainClass();
-
- // Get field "fObject"
- Field field = getField();
-
- // Get value of "fObject"
- return (ObjectReference) type.getValue(field);
- }
- /**
- * Creates and returns an access watchpoint request
- * for the static field "fString" in
- * org.eclipse.debug.jdi.tests.program.MainClass
- * NOTE: This assumes that the VM can watch field access.
- */
- protected AccessWatchpointRequest getStaticAccessWatchpointRequest() {
- // Get the static field
- Field field = getField("fString");
-
- // Create an access watchpoint for this field
- return fVM.eventRequestManager().createAccessWatchpointRequest(field);
- }
- /**
- * Creates and returns a modification watchpoint request
- * for the static field "fString" in
- * org.eclipse.debug.jdi.tests.program.MainClass.
- * NOTE: This assumes that the VM can watch field modification.
- */
- protected ModificationWatchpointRequest getStaticModificationWatchpointRequest() {
- // Get the field
- Field field = getField("fString");
-
- // Create a modification watchpoint for this field
- return fVM.eventRequestManager().createModificationWatchpointRequest(field);
- }
- /**
- * Returns the value of the static field "fString" in
- * org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected StringReference getStringReference() {
- // Get field "fString"
- Field field = getField("fString");
-
- // Get value of "fString"
- return (StringReference) getMainClass().getValue(field);
- }
- /**
- * Returns the class java.lang.Object.
- */
- protected ClassType getSystemType() {
- List classes = fVM.classesByName("java.lang.Object");
- if (classes.size() == 0)
- return null;
- else
- return (ClassType) classes.get(0);
- }
- /**
- * Returns the thread contained in the static field "fThread" in
- * org.eclipse.debug.jdi.tests.program.MainClass
- */
- protected ThreadReference getThread() {
- return getThread("fThread");
- }
-
- protected ThreadReference getMainThread() {
- return getThread("fMainThread");
- }
-
- private ThreadReference getThread(String fieldName) {
- ClassType type = getMainClass();
- if (type == null)
- return null;
-
- // Get static field "fThread"
- List fields = type.fields();
- ListIterator iterator = fields.listIterator();
- Field field = null;
- while (iterator.hasNext()) {
- field = (Field) iterator.next();
- if (field.name().equals(fieldName))
- break;
- }
-
- // Get value of "fThread"
- Value value = type.getValue(field);
- if (value == null)
- return null;
- else
- return (ThreadReference) value;
- }
- /**
- * Returns the VM info for this test.
- */
- VMInformation getVMInfo() {
- return new VMInformation(
- fVM,
- fVMType,
- fLaunchedVM,
- fEventReader,
- fConsoleReader);
- }
- /**
- * Returns whether the given test is excluded for the VM we are testing.
- */
- private boolean isExcludedTest(String testName) {
- String[] excludedTests = excludedTests();
- if (excludedTests == null)
- return false;
- for (int i = 0; i < excludedTests.length; i++)
- if (testName.equals(excludedTests[i]))
- return true;
- return false;
- }
-
- /**
- * Launches the target VM and connects to VM.
- */
- protected void launchTargetAndConnectToVM() {
- launchTarget();
- connectToVM();
- }
-
- protected boolean vmIsRunning() {
- boolean isRunning = false;
- try {
- if (fLaunchedVM != null)
- fLaunchedVM.exitValue();
- } catch (IllegalThreadStateException e) {
- isRunning = true;
- }
- return isRunning;
- }
-
- protected void launchTarget() {
- if (fVmCmd != null)
- launchCommandLineTarget();
- else if (fVMLauncherName.equals("SunVMLauncher"))
- launchSunTarget();
- else if (fVMLauncherName.equals("IBMVMLauncher"))
- launchIBMTarget();
- else
- launchJ9Target();
- }
-
- /**
- * Launches the target VM specified on the command line.
- */
- private void launchCommandLineTarget() {
- try {
- if (fProxyCmd != null) {
- fLaunchedProxy = Runtime.getRuntime().exec(fProxyCmd);
- }
- fLaunchedVM = Runtime.getRuntime().exec(fVmCmd);
- } catch (IOException e) {
- throw new Error("Could not launch the VM because " + e.getMessage());
- }
- }
-
- /**
- * Launches the target J9 VM.
- */
- private void launchJ9Target() {
- try {
- // Launch proxy
- String proxyString[] = new String[3];
- int index = 0;
- String binDirectory =
- fTargetAddress
- + System.getProperty("file.separator")
- + "bin"
- + System.getProperty("file.separator");
- proxyString[index++] = binDirectory + "j9proxy";
- proxyString[index++] = "localhost:" + (fBackEndPort - 1);
- proxyString[index++] = "" + fBackEndPort;
- fLaunchedProxy = Runtime.getRuntime().exec(proxyString);
-
- // Launch target VM
- String[] vmString;
- if (fBootPath.length() > 0)
- vmString = new String[5];
- else
- vmString = new String[4];
-
- index = 0;
- vmString[index++] = binDirectory + "j9w";
- File vm= new File(vmString[index - 1] + ".exe");
- if (!vm.exists()) {
- vmString[index - 1] = binDirectory + "j9";
- }
- if (fBootPath.length() > 0)
- vmString[index++] = "-bp:" + fBootPath;
- vmString[index++] = "-cp:" + fClassPath;
- vmString[index++] = "-debug:" + (fBackEndPort - 1);
- vmString[index++] = "org.eclipse.debug.jdi.tests.program.MainClass";
- fLaunchedVM = Runtime.getRuntime().exec(vmString);
-
- } catch (IOException e) {
- throw new Error("Could not launch the VM because " + e.getMessage());
- }
- }
-
- /**
- * Launches the target Sun VM.
- */
- private void launchSunTarget() {
- try {
- // Launch target VM
- StringBuffer binDirectory= new StringBuffer();
- if (fTargetAddress.endsWith("jre")) {
- binDirectory.append(fTargetAddress.substring(0, fTargetAddress.length() - 4));
- } else {
- binDirectory.append(fTargetAddress);
- }
- binDirectory.append(System.getProperty("file.separator"));
- binDirectory.append("bin").append(System.getProperty("file.separator"));
- String[] vmString;
- if (fBootPath.length() > 0)
- vmString = new String[10];
- else
- vmString = new String[8];
-
- int index = 0;
- vmString[index++] = binDirectory.toString() + "javaw";
- File vm= new File(vmString[index - 1] + ".exe");
- if (!vm.exists()) {
- vmString[index - 1] = binDirectory + "java";
- }
- if (fBootPath.length() > 0) {
- vmString[index++] = "-bootpath";
- vmString[index++] = fBootPath;
- }
- vmString[index++] = "-classpath";
- vmString[index++] = fClassPath;
- vmString[index++] = "-Xdebug";
- vmString[index++] = "-Xnoagent";
- vmString[index++] = "-Djava.compiler=NONE";
- vmString[index++] =
- "-Xrunjdwp:transport=dt_socket,address=" + fBackEndPort + ",suspend=y,server=y";
- vmString[index++] = "org.eclipse.debug.jdi.tests.program.MainClass";
- fLaunchedVM = Runtime.getRuntime().exec(vmString);
-
- } catch (IOException e) {
- throw new Error("Could not launch the VM because " + e.getMessage());
- }
- }
- /**
- * Launches the target IBM VM.
- */
- private void launchIBMTarget() {
- try {
- // Launch target VM
- String binDirectory =
- fTargetAddress
- + System.getProperty("file.separator")
- + "bin"
- + System.getProperty("file.separator");
- String[] vmString;
- if (fBootPath.length() > 0)
- vmString = new String[10];
- else
- vmString = new String[8];
-
- int index = 0;
- vmString[index++] = binDirectory + "javaw";
- if (fBootPath.length() > 0) {
- vmString[index++] = "-bootpath";
- vmString[index++] = fBootPath;
- }
- vmString[index++] = "-classpath";
- vmString[index++] = fClassPath;
- vmString[index++] = "-Xdebug";
- vmString[index++] = "-Xnoagent";
- vmString[index++] = "-Djava.compiler=NONE";
- vmString[index++] =
- "-Xrunjdwp:transport=dt_socket,address=" + fBackEndPort + ",suspend=y,server=y";
- vmString[index++] = "org.eclipse.debug.jdi.tests.program.MainClass";
- fLaunchedVM = Runtime.getRuntime().exec(vmString);
-
- } catch (IOException e) {
- throw new Error("Could not launch the VM because " + e.getMessage());
- }
- }
-
- /**
- * Conects to the target vm.
- */
- protected void connectToVM() {
- // Start the console reader if possible so that the VM doesn't block when the stdout is full
- startConsoleReaders();
-
-
- // Contact the VM (try 10 times)
- for (int i = 0; i < 10; i++) {
- try {
- VirtualMachineManager manager = Bootstrap.virtualMachineManager();
- List connectors = manager.attachingConnectors();
- if (connectors.size() == 0)
- break;
- AttachingConnector connector = (AttachingConnector) connectors.get(0);
- Map args = connector.defaultArguments();
- ((Connector.Argument) args.get("port")).setValue(String.valueOf(fBackEndPort));
- ((Connector.Argument) args.get("hostname")).setValue("localhost");
-
- fVM = connector.attach(args);
- if (fVMTraceFlags != com.sun.jdi.VirtualMachine.TRACE_NONE)
- fVM.setDebugTraceMode(fVMTraceFlags);
- break;
- } catch (IllegalConnectorArgumentsException e) {
- } catch (IOException e) {
-// System.out.println("Got exception: " + e.getMessage());
- try {
- if (i == 9) {
- System.out.println(
- "Could not contact the VM at localhost" + ":" + fBackEndPort + ".");
- }
- Thread.sleep(200);
- } catch (InterruptedException e2) {
- }
- }
- }
- if (fVM == null) {
- if (fLaunchedVM != null) {
- // If the VM is not running, output error stream
- try {
- if (!vmIsRunning()) {
- InputStream in = fLaunchedVM.getErrorStream();
- int read;
- do {
- read = in.read();
- if (read != -1)
- System.out.print((char) read);
- } while (read != -1);
- }
- } catch (IOException e) {
- }
-
- // Shut it down
- killVM();
- }
- throw new Error("Could not contact the VM");
- }
- startEventReader();
- }
- /**
- * Initializes the fields that are used by this test only.
- */
- public abstract void localSetUp();
- /**
- * Makes sure the test leaves the VM in the same state it found it.
- * Default is to do nothing.
- */
- public void localTearDown() {
- }
- /**
- * Parses the given arguments and store them in this tests
- * fields.
- * Returns whether the parsing was successfull.
- */
- protected static boolean parseArgs(String[] args) {
- // Default values
- String vmVendor = System.getProperty("java.vm.vendor");
- String vmVersion = System.getProperty("java.vm.version");
- String targetAddress = System.getProperty("java.home");
- String vmLauncherName;
- if (vmVendor != null
- && vmVendor.equals("Sun Microsystems Inc.")
- && vmVersion != null) {
- vmLauncherName = "SunVMLauncher";
- } else if (
- vmVendor != null && vmVendor.equals("IBM Corporation") && vmVersion != null) {
- vmLauncherName = "IBMVMLauncher";
- } else {
- vmLauncherName = "J9VMLauncher";
- }
- String classPath = System.getProperty("java.class.path");
- String bootPath = "";
- String vmType = "?";
- boolean verbose = false;
-
- // Parse arguments
- for (int i = 0; i < args.length; ++i) {
- String arg = args[i];
- if (arg.startsWith("-")) {
- if (arg.equals("-verbose") || arg.equals("-v")) {
- verbose = true;
- } else {
- String next = (i < args.length - 1) ? args[++i] : null;
- // If specified, passed values overide default values
- if (arg.equals("-launcher")) {
- vmLauncherName = next;
- } else if (arg.equals("-address")) {
- targetAddress = next;
- } else if (arg.equals("-port")) {
- fBackEndPort = Integer.parseInt(next);
- } else if (arg.equals("-cp")) {
- classPath = next;
- } else if (arg.equals("-bp")) {
- bootPath = next;
- } else if (arg.equals("-vmtype")) {
- vmType = next;
- } else if (arg.equals("-stdout")) {
- fStdoutFile = next;
- } else if (arg.equals("-stderr")) {
- fStderrFile = next;
- } else if (arg.equals("-proxyout")) {
- fProxyoutFile = next;
- } else if (arg.equals("-proxyerr")) {
- fProxyerrFile = next;
- } else if (arg.equals("-vmcmd")) {
- fVmCmd = next;
- } else if (arg.equals("-proxycmd")) {
- fProxyCmd = next;
- } else if (arg.equals("-trace")) {
- if (next.equals("all")) {
- fVMTraceFlags = com.sun.jdi.VirtualMachine.TRACE_ALL;
- } else {
- fVMTraceFlags = Integer.decode(next).intValue();
- }
- } else {
- System.out.println("Invalid option: " + arg);
- printUsage();
- return false;
- }
- }
- }
- }
- fVMLauncherName = vmLauncherName;
- fTargetAddress = targetAddress;
- fClassPath = classPath;
- fBootPath = bootPath;
- fVMType = vmType;
- fVerbose = verbose;
- return true;
- }
- /**
- * Prints the various options to pass to the constructor.
- */
- protected static void printUsage() {
- System.out.println("Possible options:");
- System.out.println("-launcher <Name of the launcher class>");
- System.out.println("-address <Address of the target VM>");
- System.out.println("-port <Debug port number>");
- System.out.println("-cp <Path to the test program>");
- System.out.println("-bp <Boot classpath for the system class library>");
- System.out.println("-vmtype <The type of VM: JDK, J9, ...>");
- System.out.println("-verbose | -v");
- System.out.println("-stdout <file where VM output is written to>");
- System.out.println("-stderr <file where VM error output is written to>");
- System.out.println("-proxyout <file where proxy output is written to>");
- System.out.println("-proxyerr <file where proxy error output is written to>");
- System.out.println("-vmcmd <exec string to start VM>");
- System.out.println("-proxycmd <exec string to start proxy>");
- }
- /**
- * Set the value of the "fBool" field back to its original value
- */
- protected void resetField() {
- Field field = getField("fBool");
- Value value = null;
- value = fVM.mirrorOf(false);
- try {
- getObjectReference().setValue(field, value);
- } catch (ClassNotLoadedException e) {
- assertTrue("resetField.2", false);
- } catch (InvalidTypeException e) {
- assertTrue("resetField.3", false);
- }
- }
- /**
- * Set the value of the "fString" field back to its original value
- */
- protected void resetStaticField() {
- Field field = getField("fString");
- Value value = null;
- value = fVM.mirrorOf("Hello World");
- try {
- getMainClass().setValue(field, value);
- } catch (ClassNotLoadedException e) {
- assertTrue("resetField.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("resetField.2", false);
- }
- }
- /**
- * Runs this test's suite with the given arguments.
- */
- protected void runSuite(String[] args) {
- // Check args
- if (!parseArgs(args))
- return;
-
- // Run test
- System.out.println(new java.util.Date());
- System.out.println("Begin testing " + getName() + "...");
- junit.textui.TestRunner.run(suite());
- System.out.println("Done testing " + getName() + ".");
- }
- /**
- * Sets the 'in control of the VM' flag for this test.
- */
- void setInControl(boolean inControl) {
- fInControl = inControl;
- }
- /**
- * Launch target VM and start program in target VM.
- */
- protected void launchTargetAndStartProgram() {
- launchTargetAndConnectToVM();
- startProgram();
- }
- /**
- * Init tests
- */
- protected void setUp() {
- if (fVM == null || fInControl) {
- launchTargetAndStartProgram();
- }
- try {
- verbose("Setting up the test");
- localSetUp();
- } catch (RuntimeException e) {
- System.out.println("Runtime exception during set up:");
- e.printStackTrace();
- } catch (Error e) {
- System.out.println("Error during set up:");
- e.printStackTrace();
- }
- }
- /**
- * Sets the VM info for this test.
- */
- void setVMInfo(VMInformation info) {
- if (info != null) {
- fVM = info.fVM;
- fLaunchedVM = info.fLaunchedVM;
- fEventReader = info.fEventReader;
- fConsoleReader = info.fConsoleReader;
- }
- }
- /**
- * Stop console and event readers.
- */
- protected void stopReaders() {
- stopEventReader();
- stopConsoleReaders();
- }
- /**
- * Shut down the target.
- */
- protected void shutDownTarget() {
- stopReaders();
- if (fVM != null) {
- try {
- fVM.exit(0);
- } catch (VMDisconnectedException e) {
- }
- }
-
- fVM = null;
- fLaunchedVM = null;
-
- // We want subsequent connections to use different ports, unless a
- // VM exec sting is given.
- if (fVmCmd == null)
- fBackEndPort += 2;
- }
- /**
- * Starts the threads that reads from the VM and proxy input and error streams
- */
- private void startConsoleReaders() {
- if (fStdoutFile != null) {
- fConsoleReader =
- new FileConsoleReader(
- "JDI Tests Console Reader",
- fStdoutFile,
- fLaunchedVM.getInputStream());
- } else {
- fConsoleReader =
- new NullConsoleReader("JDI Tests Console Reader", fLaunchedVM.getInputStream());
- }
- fConsoleReader.start();
-
- if (fStderrFile != null) {
- fConsoleErrorReader =
- new FileConsoleReader(
- "JDI Tests Console Error Reader",
- fStderrFile,
- fLaunchedVM.getErrorStream());
- } else {
- fConsoleErrorReader =
- new NullConsoleReader(
- "JDI Tests Console Error Reader",
- fLaunchedVM.getErrorStream());
- }
- fConsoleErrorReader.start();
-
- if (fLaunchedProxy == null)
- return;
-
- if (fProxyoutFile != null) {
- fProxyReader =
- new FileConsoleReader(
- "JDI Tests Proxy Reader",
- fProxyoutFile,
- fLaunchedProxy.getInputStream());
- } else {
- fProxyReader =
- new NullConsoleReader(
- "JDI Tests Proxy Reader",
- fLaunchedProxy.getInputStream());
- }
- fProxyReader.start();
-
- if (fProxyerrFile != null) {
- fProxyErrorReader =
- new FileConsoleReader(
- "JDI Tests Proxy Error Reader",
- fProxyerrFile,
- fLaunchedProxy.getErrorStream());
- } else {
- fProxyErrorReader =
- new NullConsoleReader(
- "JDI Tests Proxy Error Reader",
- fLaunchedProxy.getErrorStream());
- }
- fProxyErrorReader.start();
- }
- /**
- * Stops the console reader.
- */
- private void stopConsoleReaders() {
- if (fConsoleReader != null)
- fConsoleReader.stop();
- if (fConsoleErrorReader != null)
- fConsoleErrorReader.stop();
- if (fProxyReader != null)
- fProxyReader.stop();
- if (fProxyErrorReader != null)
- fProxyErrorReader.stop();
- }
- /**
- * Starts event reader.
- */
- private void startEventReader() {
- // Create the VM event reader.
- fEventReader = new EventReader("JDI Tests Event Reader", fVM.eventQueue());
- }
- /**
- * Stops the event reader.
- */
- private void stopEventReader() {
- fEventReader.stop();
- }
- protected void killVM() {
- if (fLaunchedVM != null)
- fLaunchedVM.destroy();
- if (fLaunchedProxy != null)
- fLaunchedProxy.destroy();
- }
- /**
- * Starts the target program.
- */
- protected void startProgram() {
- verbose("Starting target program");
-
- // Request class prepare events
- EventRequest classPrepareRequest =
- fVM.eventRequestManager().createClassPrepareRequest();
- classPrepareRequest.enable();
-
- // Prepare to receive the token class prepare event
- ClassPrepareEventWaiter waiter =
- new ClassPrepareEventWaiter(
- classPrepareRequest,
- true,
- "org.eclipse.debug.jdi.tests.program.MainClass");
- fEventReader.addEventListener(waiter);
-
- // Start the event reader (this will start the VM when the VMStartEvent is picked up)
- fEventReader.start();
-
- // Wait until the program has started
- Event event = (ClassPrepareEvent) waitForEvent(waiter, 3 * TIMEOUT);
- fEventReader.removeEventListener(waiter);
- if (event == null) {
-// try {
- System.out.println(
- "\nThe program doesn't seem to have started after " + (3 * TIMEOUT) + "ms");
-// InputStream errorStream = fLaunchedVM.getErrorStream();
-// int read;
-// do {
-// read = errorStream.read();
-// if (read != -1)
-// System.out.print((char) read);
-// } while (read != -1);
-// } catch (IOException e) {
-// }
- }
-
- // Stop class prepare events
- fVM.eventRequestManager().deleteEventRequest(classPrepareRequest);
-
- // Wait for the program to be ready to be tested
- waitUntilReady();
- }
- /**
- * Returns all tests
- */
- protected Test suite() {
- JDITestSuite suite = new JDITestSuite(this);
- Vector testNames = getAllMatchingTests("testJDI");
- Iterator iterator = testNames.iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
- suite.addTest(new JDITestCase(this, name));
- }
- return suite;
- }
- /**
- * Undo the initialization of the test.
- */
- protected void tearDown() {
- try {
- super.tearDown();
- } catch (Exception e) {
- System.out.println("Exception during tear down:");
- e.printStackTrace();
- }
- try {
- verbose("Tearing down the test");
- localTearDown();
-
- // Ensure that the test didn't leave a modification watchpoint that could change the expected state of the program
- if (fVM != null) {
- assertTrue(fVM.eventRequestManager().modificationWatchpointRequests().size() == 0);
- if (fInControl) {
- shutDownTarget();
- }
- }
-
- } catch (RuntimeException e) {
- System.out.println("Runtime exception during tear down:");
- e.printStackTrace();
- } catch (Error e) {
- System.out.println("Error during tear down:");
- e.printStackTrace();
- }
-
- }
- /**
- * Triggers and waits for the given event to come in.
- * Let the thread go if asked.
- * Throws an Error if the event didn't come in after TIMEOUT ms
- */
- protected Event triggerAndWait(
- EventRequest request,
- String eventType,
- boolean shouldGo) {
- Event event = triggerAndWait(request, eventType, shouldGo, TIMEOUT);
- if (event == null)
- throw new Error(
- "Event for " + request + " didn't come in after " + TIMEOUT + "ms");
- else
- return event;
- }
- /**
- * Triggers and waits for the given event to come in.
- * Let the thread go if asked.
- * Returns null if the event didn't come in after the given amount of time (in ms)
- */
- protected Event triggerAndWait(
- EventRequest request,
- String eventType,
- boolean shouldGo,
- long time) {
- // Suspend only if asked
- if (shouldGo)
- request.setSuspendPolicy(EventRequest.SUSPEND_NONE);
- else
- request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
-
- // Enable request
- request.enable();
-
- // Prepare to receive the event
- EventWaiter waiter = new EventWaiter(request, shouldGo);
- fEventReader.addEventListener(waiter);
-
- // Trigger the event
- triggerEvent(eventType);
-
- // Wait for the event to come in
- Event event = waitForEvent(waiter, TIMEOUT);
- fEventReader.removeEventListener(waiter);
-
- if (shouldGo) {
- // Wait for the program to be ready
- waitUntilReady();
- }
-
- // Clear request
- fVM.eventRequestManager().deleteEventRequest(request);
-
- return event;
- }
- /**
- * Triggers the given type of event. See the MainClass for details on types of event.
- */
- protected void triggerEvent(String eventType) {
- // Set the "fEventType" field to the given eventType
- ClassType type = getMainClass();
- Field field = type.fieldByName("fEventType");
- assertTrue("1", field != null);
-
- Value value = null;
- value = fVM.mirrorOf(eventType);
- try {
- type.setValue(field, value);
- } catch (ClassNotLoadedException e) {
- assertTrue("2", false);
- } catch (InvalidTypeException e) {
- assertTrue("3", false);
- }
-
- // Resume the test thread
- ThreadReference thread = getThread();
- int suspendCount = thread.suspendCount();
- for (int i = 0; i < suspendCount; i++)
- thread.resume();
- }
- /**
- * Triggers a step event and waits for it to come in.
- */
- protected StepEvent triggerStepAndWait() {
- return triggerStepAndWait(
- getThread(),
- StepRequest.STEP_MIN,
- StepRequest.STEP_OVER);
- }
-
- protected StepEvent triggerStepAndWait(
- ThreadReference thread,
- int gran,
- int depth) {
- // Request for step events
- EventRequest eventRequest =
- fVM.eventRequestManager().createStepRequest(thread, gran, depth);
- eventRequest.addCountFilter(1);
- eventRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
- eventRequest.enable();
-
- return triggerStepAndWait(thread, eventRequest, TIMEOUT);
- }
-
- protected StepEvent triggerStepAndWait(
- ThreadReference thread,
- EventRequest eventRequest,
- int timeout) {
- // Prepare to receive the event
- EventWaiter waiter = new EventWaiter(eventRequest, true);
- fEventReader.addEventListener(waiter);
-
- // Trigger step event
- int suspendCount = thread.suspendCount();
- for (int i = 0; i < suspendCount; i++)
- thread.resume();
-
- // Wait for the event to come in
- StepEvent event = (StepEvent) waitForEvent(waiter, timeout);
- fEventReader.removeEventListener(waiter);
- if (event == null)
- throw new Error("StepEvent didn't come in after " + timeout + "ms");
-
- // Stop getting step events
- fVM.eventRequestManager().deleteEventRequest(eventRequest);
-
- // Wait for the program to be ready
- waitUntilReady();
-
- return event;
- }
- /**
- * Output verbose string if asked for.
- */
- protected void verbose(String verboseString) {
- if (fVerbose)
- System.out.println(verboseString);
- }
- /**
- * Waits for an event to come in using the given waiter.
- * Waits for the given time. If it times out, returns null.
- */
- protected Event waitForEvent(EventWaiter waiter, long time) {
- Event event;
- try {
- event = waiter.waitEvent(time);
- } catch (InterruptedException e) {
- event = null;
- }
- return event;
- }
- /**
- * Waits until the program is ready to be tested.
- * The default behaviour is to wait until the "Test Thread" throws and catches
- * an exception.
- */
- protected void waitUntilReady() {
- // Make sure the program is running
- ThreadReference thread = getThread();
- while (thread == null || thread.suspendCount() > 0) {
- fVM.resume();
- thread = getThread();
- }
-
- // Create exception request
- EventRequest request =
- fVM.eventRequestManager().createExceptionRequest(null, true, false);
- request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
-
- // Prepare to receive the event
- EventWaiter waiter = new EventWaiter(request, false);
- fEventReader.addEventListener(waiter);
-
- request.enable();
-
- while (true) {
- // Wait for the event to come in
- ExceptionEvent event = (ExceptionEvent) waitForEvent(waiter, TIMEOUT);
-
- // Throw error if event is null
- if (event == null)
- throw new Error("Target program was not ready after " + TIMEOUT + "ms");
-
- // Get the method where the exception was thrown
- Method meth = event.location().method();
- if (meth == null || !meth.name().equals("printAndSignal"))
- fVM.resume();
- else
- break;
- }
-
- // Disable request
- fEventReader.removeEventListener(waiter);
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java
deleted file mode 100644
index 8142e5b..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java
deleted file mode 100644
index 6d9b638..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.Accessible;
-
-/**
- * Tests for JDI com.sun.jdi.Accessible.
- */
-public class AccessibleTest extends AbstractJDITest {
-
- private Accessible fArrayType, fClassType, fInterfaceType, fField, fMethod;
- /**
- * Creates a new test.
- */
- public AccessibleTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get the all kinds of accessible
-
- // ReferenceType
- fArrayType = getArrayType();
- fClassType = getMainClass();
- fInterfaceType = getInterfaceType();
-
- // TypeComponent
- fField = getField();
- fMethod = getMethod();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new AccessibleTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Accessible";
- }
- /**
- * Test JDI isPackagePrivate().
- */
- public void testJDIIsPackagePrivate() {
- assertTrue("1", !fArrayType.isPackagePrivate());
- assertTrue("2", !fClassType.isPackagePrivate());
- assertTrue("3", !fInterfaceType.isPackagePrivate());
- assertTrue("4", !fField.isPackagePrivate());
- assertTrue("5", !fMethod.isPackagePrivate());
- }
- /**
- * Test JDI isPrivate().
- */
- public void testJDIIsPrivate() {
- assertTrue("1", !fField.isPrivate());
- assertTrue("2", !fMethod.isPrivate());
-
- // NB: isPrivate() is undefined for a type
- }
- /**
- * Test JDI isProtected().
- */
- public void testJDIIsProtected() {
- assertTrue("1", !fField.isProtected());
- assertTrue("2", !fMethod.isProtected());
-
- // NB: isProtected() is undefined for a type
- }
- /**
- * Test JDI isPublic().
- */
- public void testJDIIsPublic() {
- assertTrue("1", fArrayType.isPublic());
- assertTrue("2", fClassType.isPublic());
- assertTrue("3", fInterfaceType.isPublic());
- assertTrue("4", fField.isPublic());
- assertTrue("5", fMethod.isPublic());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java
deleted file mode 100644
index c20b890..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.List;
-import java.util.ListIterator;
-
-import com.sun.jdi.ArrayReference;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.DoubleValue;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.StringReference;
-
-/**
- * Tests for JDI com.sun.jdi.ArrayReference
- * and JDWP Array command set.
- */
-public class ArrayReferenceTest extends AbstractJDITest {
-
- private ArrayReference fArray;
- private ArrayReference fDoubleArray;
-
- /**
- * Creates a new test.
- */
- public ArrayReferenceTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get array references
- fArray = getObjectArrayReference();
- fDoubleArray = getNonEmptyDoubleArrayReference();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ArrayReferenceTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ArrayReference";
- }
- /**
- * Test JDI getValue(int), getValues(), getValues(int,int)
- * setValue(Value,int), setValues(List) and setValues(int,List,int,int),
- * and JDWP 'Array - Get values' and 'Array - Set values'.
- */
- public void testJDIGetSetDoubleValue() {
- double one = 1.0;
- double pi = 3.1415926535;
- double twos = 2.2;
- double threes = 3.33;
- double cnt = 12345;
- double zero = 0.0;
- double delta = 0.0;
-
- DoubleValue dbl = (DoubleValue) fDoubleArray.getValue(0);
- assertEquals("testJDIGetSetDoubleValue.1", one, dbl.value(), delta);
-
- DoubleValue piValue = fVM.mirrorOf(pi);
- DoubleValue cntValue = fVM.mirrorOf(cnt);
- DoubleValue zeroValue = fVM.mirrorOf(zero);
- try {
- fDoubleArray.setValue(0, piValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("testJDIGetSetDoubleValue.3.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("testJDIGetSetDoubleValue.3.2", false);
- }
- DoubleValue value = (DoubleValue) fDoubleArray.getValue(0);
- assertEquals("testJDIGetSetDoubleValue.4.1", value, piValue);
- assertEquals("testJDIGetSetDoubleValue.4.2", pi, value.value(), delta);
-
- // getValues()
- List values = fDoubleArray.getValues();
- double[] expected = new double[] { pi, twos, threes };
- ListIterator iterator = values.listIterator();
- while (iterator.hasNext()) {
- DoubleValue dv = (DoubleValue) iterator.next();
- boolean included = false;
- for (int i = 0; i < expected.length; i++) {
- if (dv.value() == expected[i]) {
- included = true;
- break;
- }
- }
- assertTrue("testJDIGetSetDoubleValue.5." + dv.value(), included);
- }
-
- // setValues(List)
- List newValues = values;
- newValues.set(1, cntValue);
- try {
- fDoubleArray.setValues(newValues);
- } catch (ClassNotLoadedException e) {
- assertTrue("testJDIGetSetDoubleValue.7.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("testJDIGetSetDoubleValue.7.2", false);
- }
- values = fDoubleArray.getValues();
- assertEquals("testJDIGetSetDoubleValue.8", values, newValues);
-
- // getValues(int,int)
- values = fDoubleArray.getValues(1, 2);
- expected = new double[] { cnt, threes };
- iterator = values.listIterator();
- while (iterator.hasNext()) {
- DoubleValue dv = (DoubleValue) iterator.next();
- boolean included = false;
- for (int i = 0; i < expected.length; i++) {
- if (dv.value() == expected[i]) {
- included = true;
- break;
- }
- }
- assertTrue("testJDIGetSetDoubleValue.9." + dv.value(), included);
- }
-
- // setValues(int,List,int,int)
- newValues = fDoubleArray.getValues(0, 2);
- newValues.set(0, zeroValue);
- try {
- fDoubleArray.setValues(0, newValues, 0, 2);
- } catch (ClassNotLoadedException e) {
- assertTrue("testJDIGetSetDoubleValue.11.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("testJDIGetSetDoubleValue.11.2", false);
- }
- values = fDoubleArray.getValues(0, 2);
- assertEquals("testJDIGetSetDoubleValue.12", values, newValues);
- }
- /**
- * Test JDI getValue(int), getValues(), getValues(int,int)
- * setValue(Value,int), setValues(List) and setValues(int,List,int,int),
- * and JDWP 'Array - Get values' and 'Array - Set values'.
- */
- public void testJDIGetSetValue() {
- // getValue(int)
- StringReference string = (StringReference) fArray.getValue(0);
- assertEquals("1", "foo", string.value());
-
- // setValue(int,Value)
- StringReference newValue = null;
- newValue = fVM.mirrorOf("biz");
- try {
- fArray.setValue(0, newValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("2.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("2.2", false);
- }
- StringReference value = (StringReference) fArray.getValue(0);
- assertEquals("3", value, newValue);
-
- // getValues()
- List values = fArray.getValues();
- String[] expected = new String[] { "biz", "bar", "hop" };
- ListIterator iterator = values.listIterator();
- while (iterator.hasNext()) {
- StringReference ref = (StringReference) iterator.next();
- boolean included = false;
- for (int i = 0; i < expected.length; i++) {
- if (ref.value().equals(expected[i])) {
- included = true;
- break;
- }
- }
- assertTrue("4." + ref.value(), included);
- }
-
- // setValues(List)
- List newValues = values;
- newValue = fVM.mirrorOf("hip");
- newValues.set(1, newValue);
- try {
- fArray.setValues(newValues);
- } catch (ClassNotLoadedException e) {
- assertTrue("5.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("6.2", false);
- }
- values = fArray.getValues();
- assertEquals("7", values, newValues);
-
- // getValues(int,int)
- values = fArray.getValues(1, 2);
- expected = new String[] { "hip", "hop" };
- iterator = values.listIterator();
- while (iterator.hasNext()) {
- StringReference ref = (StringReference) iterator.next();
- boolean included = false;
- for (int i = 0; i < expected.length; i++) {
- if (ref.value().equals(expected[i])) {
- included = true;
- break;
- }
- }
- assertTrue("8." + ref.value(), included);
- }
-
- // setValues(int,List,int,int)
- newValues = fArray.getValues(0, 2);
- newValue = fVM.mirrorOf("rap");
- newValues.set(0, newValue);
- try {
- fArray.setValues(0, newValues, 0, 2);
- } catch (ClassNotLoadedException e) {
- assertTrue("9.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("9.2", false);
- }
- values = fArray.getValues(0, 2);
- assertEquals("10", values, newValues);
-
- // test null value
- newValues.set(0, null);
- try {
- fArray.setValues(0, newValues, 0, 2);
- } catch (ClassNotLoadedException e) {
- assertTrue("11.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("11.2", false);
- }
- values = fArray.getValues(0, 2);
- assertEquals("12", values.get(0), null);
- }
- /**
- * Test JDI length() and JDWP 'Array - Get length'.
- */
- public void testJDILength() {
- int length = fArray.length();
- assertEquals("1", 3, length);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java
deleted file mode 100644
index 27bda01..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ArrayReference;
-import com.sun.jdi.ArrayType;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.StringReference;
-import com.sun.jdi.Type;
-
-/**
- * Tests for JDI com.sun.jdi.ArrayType
- * and JDWP Array command set.
- */
-public class ArrayTypeTest extends AbstractJDITest {
-
- private ArrayType fType;
- /**
- * Creates a new test.
- */
- public ArrayTypeTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get array type
- fType = getArrayType();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ArrayTypeTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ArrayType";
- }
- /**
- * Test JDI componentSignature().
- */
- public void testJDIComponentSignature() {
- String signature = fType.componentSignature();
- assertEquals("1", "Ljava/lang/String;", signature);
- }
- /**
- * Test JDI componentType().
- */
- public void testJDIComponentType() {
- Type expected = (Type) fVM.classesByName("java.lang.String").get(0);
- Type type = null;
- try {
- type = fType.componentType();
- } catch (ClassNotLoadedException e) {
- assertTrue("1", false);
- }
- assertEquals("2", expected, type);
- }
- /**
- * Test JDI componentTypeName().
- */
- public void testJDIComponentTypeName() {
- String typeName = fType.componentTypeName();
- assertEquals("1", "java.lang.String", typeName);
- }
- /**
- * Test JDI newInstance(long).
- */
- public void testJDINewInstance() {
- ArrayReference instance = fType.newInstance(1);
- assertTrue("1", instance.type().equals(fType));
- assertEquals("2", 1, instance.length());
- assertTrue("3", null == instance.getValue(0));
-
- ArrayReference instance2 = fType.newInstance(5);
- try {
- instance2.setValue(3, fVM.mirrorOf("Yo"));
- } catch (InvalidTypeException exc) {
- } catch (ClassNotLoadedException exc) {
- }
- assertTrue("4", instance2.getValue(2) == null);
- assertEquals(
- "5",
- ((StringReference) (instance2.getValue(3))).value(),
- "Yo");
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AutomatedSuite.java
deleted file mode 100644
index fe5d683..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AutomatedSuite.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.jdi.tests;
-
-import junit.framework.TestSuite;
-
-/**
- */
-public class AutomatedSuite extends TestSuite {
-
- public static TestSuite suite() {
- return new AutomatedSuite();
- }
-
- public AutomatedSuite() {
- AbstractJDITest.parseArgs(new String[0]);
-
- addTest(new TestSuite(AccessibleTest.class));
- addTest(new TestSuite(ArrayReferenceTest.class));
- addTest(new TestSuite(ArrayTypeTest.class));
- addTest(new TestSuite(BooleanValueTest.class));
- addTest(new TestSuite(BreakpointRequestTest.class));
- addTest(new TestSuite(ByteValueTest.class));
- addTest(new TestSuite(CharValueTest.class));
- addTest(new TestSuite(ClassLoaderReferenceTest.class));
- addTest(new TestSuite(ClassPrepareEventTest.class));
- addTest(new TestSuite(ClassPrepareRequestTest.class));
- addTest(new TestSuite(ClassTypeTest.class));
- addTest(new TestSuite(DoubleValueTest.class));
- addTest(new TestSuite(EventRequestManagerTest.class));
- addTest(new TestSuite(EventRequestTest.class));
- addTest(new TestSuite(EventTest.class));
- addTest(new TestSuite(ExceptionEventTest.class));
- addTest(new TestSuite(ExceptionRequestTest.class));
- addTest(new TestSuite(FieldTest.class));
- addTest(new TestSuite(FloatValueTest.class));
- addTest(new TestSuite(HotCodeReplacementTest.class));
- addTest(new TestSuite(IntegerValueTest.class));
- addTest(new TestSuite(InterfaceTypeTest.class));
- addTest(new TestSuite(LocalVariableTest.class));
- addTest(new TestSuite(LocatableTest.class));
- addTest(new TestSuite(LocationTest.class));
- addTest(new TestSuite(LongValueTest.class));
- addTest(new TestSuite(MethodTest.class));
- addTest(new TestSuite(MethodEntryRequestTest.class));
- addTest(new TestSuite(MethodExitRequestTest.class));
- addTest(new TestSuite(MirrorTest.class));
-
- addTest(new TestSuite(ModificationWatchpointEventTest.class));
-
- addTest(new TestSuite(ObjectReferenceTest.class));
- addTest(new TestSuite(PrimitiveValueTest.class));
- addTest(new TestSuite(ReferenceTypeTest.class));
- addTest(new TestSuite(ShortValueTest.class));
- addTest(new TestSuite(StackFrameTest.class));
- addTest(new TestSuite(StepEventTest.class));
- addTest(new TestSuite(StringReferenceTest.class));
- addTest(new TestSuite(ThreadDeathEventTest.class));
- addTest(new TestSuite(ThreadGroupReferenceTest.class));
- addTest(new TestSuite(ThreadReferenceTest.class));
- addTest(new TestSuite(ThreadStartEventTest.class));
- addTest(new TestSuite(TypeComponentTest.class));
- addTest(new TestSuite(TypeTest.class));
- addTest(new TestSuite(ValueTest.class));
-
- addTest(new TestSuite(WatchpointEventTest.class));
- addTest(new TestSuite(WatchpointRequestTest.class));
-
- addTest(new TestSuite(VirtualMachineExitTest.class));
- addTest(new TestSuite(VMDisconnectEventTest.class));
- addTest(new TestSuite(VMDisposeTest.class));
-
- }
-
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java
deleted file mode 100644
index 5610e42..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.BooleanValue;
-
-/**
- * Tests for JDI com.sun.jdi.BooleanValue.
- */
-public class BooleanValueTest extends AbstractJDITest {
-
- private BooleanValue fValue;
- /**
- * Creates a new test.
- */
- public BooleanValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get boolean value for "true"
- fValue = fVM.mirrorOf(true);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new BooleanValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.BooleanValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf(true)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(false)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals("5", fValue.hashCode(), fVM.mirrorOf(true).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(false).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", true == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BreakpointRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BreakpointRequestTest.java
deleted file mode 100644
index 7a1d0ba..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BreakpointRequestTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.request.BreakpointRequest;
-
-/**
- * Tests for JDI com.sun.jdi.request.BreakpointRequest.
- */
-public class BreakpointRequestTest extends AbstractJDITest {
-
- private BreakpointRequest fRequest;
- /**
- * Creates a new test .
- */
- public BreakpointRequestTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get the breakpoint request
- fRequest = getBreakpointRequest();
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Delete the breakpoint request we created in this test
- fVM.eventRequestManager().deleteEventRequest(fRequest);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new BreakpointRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.request.BreakpointRequest";
- }
- /**
- * Test JDI location().
- */
- public void testJDILocation() {
- assertEquals("1", getLocation(), fRequest.location());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java
deleted file mode 100644
index 3efe5ec..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ByteValue;
-
-/**
- * Tests for JDI com.sun.jdi.ByteValue.
- */
-public class ByteValueTest extends AbstractJDITest {
-
- private ByteValue fValue;
- /**
- * Creates a new test.
- */
- public ByteValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get byte value for 1
- fValue = fVM.mirrorOf((byte) 1);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ByteValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ByteValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf((byte) 1)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf((byte) 2)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals("5", fValue.hashCode(), fVM.mirrorOf((byte) 1).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf((byte) 2).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", 1 == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java
deleted file mode 100644
index 21d4f1b..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.CharValue;
-
-/**
- * Tests for JDI com.sun.jdi.CharValue.
- */
-public class CharValueTest extends AbstractJDITest {
-
- private CharValue fValue;
- /**
- * Creates a new test.
- */
- public CharValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get char value for 'a'
- fValue = fVM.mirrorOf('a');
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new CharValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.CharValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf('a')));
- assertTrue("2", !fValue.equals(fVM.mirrorOf('b')));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals("5", fValue.hashCode(), fVM.mirrorOf('a').hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf('b').hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", 'a' == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassLoaderReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassLoaderReferenceTest.java
deleted file mode 100644
index 0567605..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassLoaderReferenceTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.Iterator;
-import java.util.List;
-
-import com.sun.jdi.ClassLoaderReference;
-import com.sun.jdi.ReferenceType;
-
-/**
- * Tests for JDI com.sun.jdi.ClassLoaderReference.
- */
-public class ClassLoaderReferenceTest extends AbstractJDITest {
-
- private ClassLoaderReference fClassLoader;
- /**
- * Creates a new test.
- */
- public ClassLoaderReferenceTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get the class loader of org.eclipse.debug.jdi.tests.program.MainClass
- fClassLoader = getClassLoaderReference();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ClassLoaderReferenceTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ClassLoaderReference";
- }
- /**
- * Test JDI definedClasses().
- */
- public void testJDIDefinedClasses() {
- Iterator defined = fClassLoader.definedClasses().iterator();
- int i = 0;
- while (defined.hasNext())
- assertTrue(
- Integer.toString(i++),
- defined.next() instanceof ReferenceType);
- }
- /**
- * Test JDI visibleClasses().
- */
- public void testJDIVisibleClasses() {
- List visible = fClassLoader.visibleClasses();
- Iterator defined = fClassLoader.definedClasses().iterator();
- while (defined.hasNext()) {
- ReferenceType next = (ReferenceType) defined.next();
- assertTrue(next.name(), visible.contains(next));
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventTest.java
deleted file mode 100644
index 4c7b330..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.request.ClassPrepareRequest;
-
-/**
- * Tests for JDI com.sun.jdi.event.ClassPrepareEvent.
- */
-public class ClassPrepareEventTest extends AbstractJDITest {
- private ClassPrepareRequest fRequest;
- private ClassPrepareEvent fEvent;
- /**
- * Creates a new test.
- */
- public ClassPrepareEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Trigger a class prepare event
- fRequest = fVM.eventRequestManager().createClassPrepareRequest();
- fEvent =
- (ClassPrepareEvent) triggerAndWait(fRequest,
- "ClassPrepareEvent",
- true);
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has resumed the test thread, so suspend it
- waitUntilReady();
-
- // Delete the class prepare request
- fVM.eventRequestManager().deleteEventRequest(fRequest);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ClassPrepareEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.ClassPrepareEvent";
- }
- /**
- * Test JDI referenceType().
- */
- public void testJDIReferenceType() {
- assertEquals(
- "1",
- "org.eclipse.debug.jdi.tests.program.TestClass",
- fEvent.referenceType().name());
- }
- /**
- * Test JDI thread().
- */
- public void testJDIThread() {
- assertEquals("1", "Test Thread", fEvent.thread().name());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventWaiter.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventWaiter.java
deleted file mode 100644
index 3c61d10..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareEventWaiter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.request.EventRequest;
-/**
- * Listen for ClassPrepareEvent for a specific class.
- */
-public class ClassPrepareEventWaiter extends EventWaiter {
- protected String fClassName;
- /**
- * Creates a new ClassPrepareEventWaiter that waits for the given class to be loaded.
- */
- public ClassPrepareEventWaiter(EventRequest request, boolean shouldGo, String className) {
- super(request, shouldGo);
- fClassName = className;
- }
- public boolean classPrepare(ClassPrepareEvent event) {
- if (event.referenceType().name().equals(fClassName)) {
- notifyEvent(event);
- return fShouldGo;
- } else
- return true;
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java
deleted file mode 100644
index d4098d3..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.request.ClassPrepareRequest;
-import com.sun.jdi.request.EventRequestManager;
-
-/**
- * Tests for JDI com.sun.jdi.request.ClassPrepareRequest.
- */
-public class ClassPrepareRequestTest extends AbstractJDITest {
- /**
- * Creates a new test.
- */
- public ClassPrepareRequestTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(String[] args) {
- new ClassPrepareRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.request.ClassPrepareRequest";
- }
- /**
- * Test JDI addClassFilter(String).
- */
- public void testJDIAddClassFilterString() {
- EventRequestManager requestManager = fVM.eventRequestManager();
-
- // Filter is "org.eclipse.debug.jdi.tests.program.*" and loads org.eclipse.debug.jdi.tests.program.TestClass1
- ClassPrepareRequest request =
- requestManager.createClassPrepareRequest();
- request.addClassFilter("org.eclipse.debug.jdi.tests.program.*");
- ClassPrepareEvent event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent1",
- true,
- 5000);
- assertTrue("1", event != null);
- assertEquals(
- "2",
- "org.eclipse.debug.jdi.tests.program.TestClass1",
- event.referenceType().name());
- requestManager.deleteEventRequest(request);
-
- // Filter is "bogus.*" and loads org.eclipse.debug.jdi.tests.program.TestClass2
- request = requestManager.createClassPrepareRequest();
- request.addClassFilter("bogus.*");
- event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent2",
- true,
- 5000);
- assertTrue("3", event == null);
- requestManager.deleteEventRequest(request);
-
- // Filter is "*.TestClass3" and loads org.eclipse.debug.jdi.tests.program.TestClass3
- request = requestManager.createClassPrepareRequest();
- request.addClassFilter("*.TestClass3");
- event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent3",
- true,
- 5000);
- assertTrue("4", event != null);
- assertEquals(
- "5",
- "org.eclipse.debug.jdi.tests.program.TestClass3",
- event.referenceType().name());
- requestManager.deleteEventRequest(request);
-
- // Filter is "*.eclipse.*.jdi.tests.*4" and loads org.eclipse.debug.jdi.tests.program.TestClass4
- request = requestManager.createClassPrepareRequest();
- request.addClassFilter("*.eclipse.*.jdi.tests.program.*4");
- event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent4",
- true,
- 5000);
- assertTrue("6", event == null);
- requestManager.deleteEventRequest(request);
-
- // Filter is "*.eclipse.debug.jdi.tests.program.*" and loads org.eclipse.debug.jdi.tests.program.TestClass5
- request = requestManager.createClassPrepareRequest();
- request.addClassFilter("*.eclipse.debug.jdi.tests.program.*");
- event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent5",
- true,
- 5000);
- assertTrue("7", event == null);
- requestManager.deleteEventRequest(request);
-
- // Filter is "org.eclipse.debug.jdi.tests.program.TestClass6" and loads org.eclipse.debug.jdi.tests.program.TestClass6
- request = requestManager.createClassPrepareRequest();
- request.addClassFilter(
- "org.eclipse.debug.jdi.tests.program.TestClass6");
- event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent6",
- true,
- 5000);
- assertTrue("8", event != null);
- assertEquals(
- "9",
- "org.eclipse.debug.jdi.tests.program.TestClass6",
- event.referenceType().name());
- requestManager.deleteEventRequest(request);
- }
- /**
- * Test JDI addClassExclusionFilter(String).
- */
- public void testJDIAddClassExclusionFilterString() {
- EventRequestManager requestManager = fVM.eventRequestManager();
-
- // Filter is "org.eclipse.debug.jdi.tests.program.TestClass*" and loads org.eclipse.debug.jdi.tests.program.TestClass7 and org.eclipse.debug.jdi.tests.program.TestClazz8.
- ClassPrepareRequest request =
- requestManager.createClassPrepareRequest();
- request.addClassExclusionFilter(
- "org.eclipse.debug.jdi.tests.program.TestClass*");
- ClassPrepareEvent event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent7",
- true,
- 5000);
- assertTrue("1", event != null);
- assertEquals(
- "2",
- "org.eclipse.debug.jdi.tests.program.TestClazz8",
- event.referenceType().name());
- requestManager.deleteEventRequest(request);
-
- // Filter is "org.eclipse.debug.jdi.tests.program.TestClazz9" and loads org.eclipse.debug.jdi.tests.program.TestClazz9 and org.eclipse.debug.jdi.tests.program.TestClazz10.
- request = requestManager.createClassPrepareRequest();
- request.addClassExclusionFilter(
- "org.eclipse.debug.jdi.tests.program.TestClazz9");
- event =
- (ClassPrepareEvent) triggerAndWait(request,
- "ClassPrepareEvent8",
- true,
- 5000);
- assertTrue("3", event != null);
- assertEquals(
- "4",
- "org.eclipse.debug.jdi.tests.program.TestClazz10",
- event.referenceType().name());
- requestManager.deleteEventRequest(request);
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java
deleted file mode 100644
index d616d5c..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java
+++ /dev/null
@@ -1,360 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Field;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.StringReference;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.Value;
-import com.sun.jdi.event.ThreadStartEvent;
-
-/**
- * Tests for JDI com.sun.jdi.ClassType
- * and JDWP Class command set.
- */
-public class ClassTypeTest extends AbstractJDITest {
-
- private ClassType fType;
- /**
- * Creates a new test.
- */
- public ClassTypeTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get the type org.eclipse.debug.jdi.tests.program.MainClass
- fType = getMainClass();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ClassTypeTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ClassType";
- }
- /**
- * Test JDI allFields().
- */
- public void testJDIAllFields() {
- boolean found = false;
- Iterator it = fType.allFields().iterator();
- while (it.hasNext()) {
- Field fld = (Field) it.next();
- if (fld.name().equals("fString")) {
- found = true;
- }
- }
- assertTrue("1", found);
- }
- /**
- * Test JDI allInterfaces().
- */
- public void testJDIAllInterfaces() {
- List all = fType.allInterfaces();
- boolean found = false;
- Iterator interfaces = fType.allInterfaces().iterator();
- while (interfaces.hasNext()) {
- InterfaceType next = (InterfaceType) interfaces.next();
- assertTrue(next.name(), all.contains(next));
- if (next.name().equals("java.lang.Comparable"))
- found = true;
- }
- assertTrue("1", found);
- }
- /**
- * Test JDI allMethods().
- */
- public void testJDIAllMethods() {
- boolean found = false;
- Iterator it = fType.allMethods().iterator();
- while (it.hasNext()) {
- Method mth = (Method) it.next();
- if (mth.name().equals("after")) { // in Date
- found = true;
- }
- }
- assertTrue("1", found);
- }
- /**
- * Test JDI concreteMethodByName().
- */
- public void testJDIConcreteMethodByName() {
- Method method = fType.concreteMethodByName("run", "()V");
- assertTrue("1", method != null);
- assertEquals("2", fType, method.declaringType());
- assertTrue("3", fType.concreteMethodByName("xxx", "(I)Z") == null);
- }
- /**
- * Test JDI interfaces().
- */
- public void testJDIInterfaces() {
- boolean found = false;
- boolean extra = false;
- List interfaces = fType.interfaces();
- assertEquals("1", 2, interfaces.size());
- Iterator iterator = interfaces.iterator();
- int i = 0;
- while (iterator.hasNext()) {
- Object next = iterator.next();
- assertTrue("2." + i++, next instanceof InterfaceType);
- InterfaceType ift = (InterfaceType) next;
- if (ift.name().equals("java.lang.Runnable"))
- found = true;
- if (ift.name().equals("java.lang.Comparable"))
- extra = true;
- }
- assertTrue("1", found);
- assertTrue("2", !extra);
- }
- /**
- * Test JDI invokeMethod(ThreadReference, Method, Value[]).
- */
- public void testJDIInvokeMethod() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
-
- ThreadStartEvent event =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- false);
- ThreadReference thread = event.thread();
- Method inv1 =
- fType.concreteMethodByName(
- "invoke1",
- "(ILjava/lang/Object;)Ljava/lang/String;");
- List args = new ArrayList();
- args.add(fVM.mirrorOf(41));
- args.add(null);
- Exception oops = null;
- Value val = null;
- try {
- val = fType.invokeMethod(thread, inv1, args, 0);
- } catch (Exception exc) {
- oops = exc;
- }
- assertTrue("1", oops == null);
- assertEquals("2", val == null ? null : ((StringReference) val).value(), "41");
- }
- /**
- * Test JDI invokeMethod - failure.
- */
- public void testJDIInvokeMethodFail() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
-
- ThreadStartEvent event =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- false);
- ThreadReference thread = event.thread();
- Method inv2 = fType.concreteMethodByName("invoke2", "()V");
- Exception good = null;
- Exception oops = null;
- try {
- fType.invokeMethod(thread, inv2, new ArrayList(), 0);
- } catch (InvocationException exc) {
- good = exc;
- } catch (Exception exc) {
- oops = exc;
- }
- assertTrue("1", oops == null);
- assertTrue("2", good != null);
- }
- /**
- * Test JDI locationsOfLine(int).
- */
- public void testJDILocationsOfLine() {
- int lineNumber = getLocation().lineNumber();
- List locations = null;
- try {
- locations = fType.locationsOfLine(lineNumber);
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 1, locations.size());
- }
- /**
- * Test JDI methodByName
- */
- public void testJDIMethodByName() {
- assertTrue("1", fType.methodsByName("main").size() == 1);
- }
- /**
- * Test JDI methodByNameAndSignature
- */
- public void testJDIMethodByNameAndSignature() {
- assertTrue("1", fType.methodsByName("printAndSignal", "()V").size() == 1);
- }
- /**
- * Test JDI methods().
- */
- public void testJDIMethods() {
- boolean found = false;
- Iterator it = fType.methods().iterator();
- while (it.hasNext()) {
- Method mth = (Method) it.next();
- if (mth.name().equals("printAndSignal"))
- found = true;
- }
- assertTrue("1", found);
- }
- /**
- * Test JDI newInstance(ThreadReference, Method, Value[]).
- */
- public void testJDINewInstance() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
-
- ThreadStartEvent event =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- false);
- ThreadReference thread = event.thread();
- Method constructor =
- (Method) fType
- .methodsByName("<init>", "(ILjava/lang/Object;Ljava/lang/Object;)V")
- .get(0);
- ObjectReference result = null;
- ArrayList arguments = new ArrayList();
- arguments.add(fVM.mirrorOf(0));
- arguments.add(fVM.allThreads().get(0));
- arguments.add(null);
-
- try {
- result = fType.newInstance(thread, constructor, arguments, 0);
- } catch (IncompatibleThreadStateException e) {
- assertTrue("1", false);
- } catch (InvalidTypeException e) {
- assertTrue("2", false);
- } catch (ClassNotLoadedException e) {
- assertTrue("3", false);
- } catch (InvocationException e) {
- assertTrue("4", false);
- }
- assertTrue("5", result != null);
- assertTrue("6", result.referenceType().equals(fType));
- waitUntilReady();
- }
- /**
- * Test JDI setValue(Field,Value) and JDWP 'Class - Set Fields Values'.
- */
- public void testJDISetValue() {
-
- // Get static field "fInt"
- Field field = fType.fieldByName("fInt");
- assertTrue("1", field != null);
- assertTrue("2", field.isStatic());
-
- // Remember old value
- Value oldValue = fType.getValue(field);
-
- // Set to new value
- Value newValue = fVM.mirrorOf(1234);
- try {
- fType.setValue(field, newValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("3.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("3.2", false);
- }
-
- // Ensure the value as been set
- assertEquals("4", fType.getValue(field), newValue);
-
- // Cleanup
- try {
- fType.setValue(field, oldValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("5.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("5.2", false);
- }
-
- // Get static field "fString" to test if it can be set to null.
- field = fType.fieldByName("fString");
- assertTrue("6", field != null);
- assertTrue("7", field.isStatic());
-
- // Remember old value
- oldValue = fType.getValue(field);
-
- // Set to new value
- newValue = null;
- try {
- fType.setValue(field, newValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("8.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("8.2", false);
- }
-
- // Ensure the value as been set
- assertEquals("9", fType.getValue(field), newValue);
-
- // Cleanup
- try {
- fType.setValue(field, oldValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("10.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("10.2", false);
- }
- }
- /**
- * Test JDI subclasses().
- */
- public void testJDISubclasses() {
- List subclasses = fType.subclasses();
- assertEquals("1", 1, subclasses.size());
- Iterator iterator = subclasses.iterator();
- while (iterator.hasNext()) {
- ClassType sub = (ClassType) iterator.next();
- assertEquals("2 " + sub.name(), fType, sub.superclass());
- }
- }
- /**
- * Test JDI superclass() and JDWP 'Class - Get superclass'.
- */
- public void testJDISuperclass() {
- ClassType superclass = fType.superclass();
- assertEquals("1", "java.util.Date", superclass.name());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassesByNameTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassesByNameTest.java
deleted file mode 100644
index 830e67c..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassesByNameTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.List;
-
-import com.sun.jdi.Type;
-
-/**
- * Tests for JDI com.sun.jdi.VirtualMachine.classesByName
- */
-public class ClassesByNameTest extends AbstractJDITest {
-
- /**
- * Creates a new test.
- */
- public ClassesByNameTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
-
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ClassesByNameTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.VirtualMachine.classesByName";
- }
- /**
- * Test that there is a class object for 'int[]'
- */
- public void testJDIIntArray() {
- List classes = fVM.classesByName("int[]");
- assertTrue(
- "Should be a class for int[]",
- classes.size() == 1
- && ((Type) classes.get(0)).signature().equals("[I"));
- }
- /**
- * Test that there is a class object for 'int[][]'
- */
- public void testJDIIntDoubleArray() {
- List classes = fVM.classesByName("int[][]");
- assertTrue(
- "Should be a class for int[][]",
- classes.size() == 1
- && ((Type) classes.get(0)).signature().equals("[[I"));
- }
- public void testJDILongArray() {
- List classes = fVM.classesByName("long[]");
- assertTrue(
- "Should be a class for long[]",
- classes.size() == 1
- && ((Type) classes.get(0)).signature().equals("[J"));
- }
- public void testJDILongDoubleArray() {
- List classes = fVM.classesByName("long[][]");
- assertTrue(
- "Should be a class for long[][]",
- classes.size() == 1
- && ((Type) classes.get(0)).signature().equals("[[J"));
- }
- /**
- * Test that there is a class object for 'java.lang.String[]'
- */
- public void testJDIStringArray() {
- List classes = fVM.classesByName("java.lang.String[]");
- assertTrue(
- "Should be a class for java.lang.String[]",
- classes.size() == 1
- && ((Type) classes.get(0)).signature().equals(
- "[Ljava/lang/String;"));
- }
- /**
- * Test that there is a class object for 'java.lang.String'
- */
- public void testJDIString() {
- List classes = fVM.classesByName("java.lang.String");
- assertTrue(
- "Should be a class for java.lang.String",
- classes.size() == 1
- && ((Type) classes.get(0)).signature().equals(
- "Ljava/lang/String;"));
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java
deleted file mode 100644
index 67414f2..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.DoubleValue;
-
-/**
- * Tests for JDI com.sun.jdi.DoubleValue.
- */
-public class DoubleValueTest extends AbstractJDITest {
-
- private DoubleValue fValue;
- /**
- * Creates a new test.
- */
- public DoubleValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get double value for 12345.6789
- fValue = fVM.mirrorOf(12345.6789);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new DoubleValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.DoubleValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf(12345.6789)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(98765.4321)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals(
- "5",
- fValue.hashCode(),
- fVM.mirrorOf(12345.6789).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(98765.4321).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", 12345.6789 == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventListener.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventListener.java
deleted file mode 100644
index b043816..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventListener.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.AccessWatchpointEvent;
-import com.sun.jdi.event.BreakpointEvent;
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.event.ClassUnloadEvent;
-import com.sun.jdi.event.ExceptionEvent;
-import com.sun.jdi.event.MethodEntryEvent;
-import com.sun.jdi.event.MethodExitEvent;
-import com.sun.jdi.event.ModificationWatchpointEvent;
-import com.sun.jdi.event.StepEvent;
-import com.sun.jdi.event.ThreadDeathEvent;
-import com.sun.jdi.event.ThreadStartEvent;
-import com.sun.jdi.event.VMDeathEvent;
-import com.sun.jdi.event.VMDisconnectEvent;
-
-/**
- * An event listener that handles all kinds of event coming from the VM.
- */
-
-public interface EventListener {
- /**
- * Handles an access watchpoint event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean accessWatchpoint(AccessWatchpointEvent event);
- /**
- * Handles a breakpoint event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean breakpoint(BreakpointEvent event);
- /**
- * Handles a class prepare event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean classPrepare(ClassPrepareEvent event);
- /**
- * Handles a class unload event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean classUnload(ClassUnloadEvent event);
- /**
- * Handles an exception event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean exception(ExceptionEvent event);
- public boolean methodEntry(MethodEntryEvent event);
- public boolean methodExit(MethodExitEvent event);
- /**
- * Handles a modification watchpoint event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean modificationWatchpoint(ModificationWatchpointEvent event);
- /**
- * Handles a step event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean step(StepEvent event);
- /**
- * Handles a thread death event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean threadDeath(ThreadDeathEvent event);
- /**
- * Handles a thread start event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean threadStart(ThreadStartEvent event);
- /**
- * Handles a vm death event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean vmDeath(VMDeathEvent event);
- /**
- * Handles a vm disconnect event.
- * Returns whether the VM should be resumed if it was interrupted.
- */
- public boolean vmDisconnect(VMDisconnectEvent event);
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java
deleted file mode 100644
index d1b5ee3..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.Vector;
-
-import com.sun.jdi.VMDisconnectedException;
-import com.sun.jdi.event.AccessWatchpointEvent;
-import com.sun.jdi.event.BreakpointEvent;
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.event.ClassUnloadEvent;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.EventIterator;
-import com.sun.jdi.event.EventQueue;
-import com.sun.jdi.event.EventSet;
-import com.sun.jdi.event.ExceptionEvent;
-import com.sun.jdi.event.MethodEntryEvent;
-import com.sun.jdi.event.MethodExitEvent;
-import com.sun.jdi.event.ModificationWatchpointEvent;
-import com.sun.jdi.event.StepEvent;
-import com.sun.jdi.event.ThreadDeathEvent;
-import com.sun.jdi.event.ThreadStartEvent;
-import com.sun.jdi.event.VMDeathEvent;
-import com.sun.jdi.event.VMDisconnectEvent;
-import com.sun.jdi.request.EventRequest;
-
-/**
- * An event reader that continuously reads events coming from the VM
- * and dispatch them to the registered listeners.
- */
-
-public class EventReader extends AbstractReader {
- private EventQueue fEventQueue;
- private Vector fEventListeners = new Vector(); // A Vector of EventListener
- /*
- * Creates a new event reader that will read from the given event queue.
- */
- public EventReader(String name, EventQueue queue) {
- super(name);
- fEventQueue = queue;
- }
- /*
- * Registers the given event listener.
- */
- public synchronized void addEventListener(EventListener listener) {
- fEventListeners.addElement(listener);
- }
- /**
- * Dispatches the given event to the given listener.
- * Returns whether the VM should be resumed.
- */
- private boolean dispath(Event event, EventListener listener) {
- if (event instanceof AccessWatchpointEvent)
- return listener.accessWatchpoint((AccessWatchpointEvent) event);
- if (event instanceof BreakpointEvent)
- return listener.breakpoint((BreakpointEvent) event);
- if (event instanceof ClassPrepareEvent)
- return listener.classPrepare((ClassPrepareEvent) event);
- if (event instanceof ClassUnloadEvent)
- return listener.classUnload((ClassUnloadEvent) event);
- if (event instanceof ExceptionEvent)
- return listener.exception((ExceptionEvent) event);
- if (event instanceof MethodEntryEvent)
- return listener.methodEntry((MethodEntryEvent) event);
- if (event instanceof MethodExitEvent)
- return listener.methodExit((MethodExitEvent) event);
- if (event instanceof ModificationWatchpointEvent)
- return listener.modificationWatchpoint(
- (ModificationWatchpointEvent) event);
- if (event instanceof StepEvent)
- return listener.step((StepEvent) event);
- if (event instanceof ThreadDeathEvent)
- return listener.threadDeath((ThreadDeathEvent) event);
- if (event instanceof ThreadStartEvent)
- return listener.threadStart((ThreadStartEvent) event);
- if (event instanceof VMDisconnectEvent)
- return listener.vmDisconnect((VMDisconnectEvent) event);
- if (event instanceof VMDeathEvent)
- return listener.vmDeath((VMDeathEvent) event);
- return true;
- }
- /**
- * Continuously reads events that are coming from the event queue.
- */
- protected void readerLoop() {
- while (!fIsStopping) {
- try {
- if (!fIsStopping) {
- // Get the next event
- EventSet eventSet = fEventQueue.remove();
-
- // Dispatch the events
- boolean shouldGo = true;
- EventIterator iterator = eventSet.eventIterator();
- while (iterator.hasNext()) {
- Event event = iterator.nextEvent();
- for (int i = 0; i < fEventListeners.size(); i++) {
- EventListener listener =
- (EventListener) fEventListeners.elementAt(i);
- shouldGo = shouldGo & dispath(event, listener);
- }
- if (event instanceof VMDeathEvent)
- stop();
- }
-
- // Let the VM go if it was interrupted
- if ((!fIsStopping)
- && (eventSet != null)
- && (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL)
- && shouldGo)
- synchronized (this) {
- fEventQueue.virtualMachine().resume();
- }
- }
- } catch (InterruptedException e) {
- if (!fIsStopping) {
- System.out.println("Event reader loop was interrupted");
- return;
- }
- } catch (VMDisconnectedException e) {
- return;
- }
- }
- }
- /*
- * De-registers the given event listener.
- */
- public synchronized void removeEventListener(EventListener listener) {
- fEventListeners.removeElement(listener);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestManagerTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestManagerTest.java
deleted file mode 100644
index f88ea1f..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestManagerTest.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java
deleted file mode 100644
index d94dadb..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.LinkedList;
-import java.util.List;
-
-import com.sun.jdi.request.EventRequest;
-import com.sun.jdi.request.StepRequest;
-
-/**
- * Tests for JDI com.sun.jdi.request.EventRequest.
- */
-public class EventRequestTest extends AbstractJDITest {
-
- private List fRequests = new LinkedList();
- /**
- * Creates a new test.
- */
- public EventRequestTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get all kinds of request
- if (fVM.canWatchFieldAccess())
- fRequests.add(getAccessWatchpointRequest());
- fRequests.add(getBreakpointRequest());
- fRequests.add(fVM.eventRequestManager().createClassPrepareRequest());
- fRequests.add(fVM.eventRequestManager().createClassUnloadRequest());
- fRequests.add(getExceptionRequest());
- if (fVM.canWatchFieldModification())
- fRequests.add(getModificationWatchpointRequest());
- fRequests.add(
- fVM.eventRequestManager().createStepRequest(
- getThread(),
- StepRequest.STEP_LINE,
- StepRequest.STEP_OVER));
- fRequests.add(fVM.eventRequestManager().createThreadDeathRequest());
- fRequests.add(fVM.eventRequestManager().createThreadStartRequest());
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Delete the requests we created in this test
- fVM.eventRequestManager().deleteEventRequests(fRequests);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new EventRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.request.EventRequest";
- }
- /**
- * Test JDI disable(), enable(), isEnable() and setEnable(boolean).
- */
- public void testJDIEnable() {
- for (int i = 0; i < fRequests.size(); i++) {
- EventRequest request = (EventRequest) fRequests.get(i);
- assertTrue("1." + i, !request.isEnabled());
- request.setEnabled(true);
- assertTrue("2." + i, request.isEnabled());
- request.setEnabled(false);
- assertTrue("3." + i, !request.isEnabled());
- request.enable();
- assertTrue("4." + i, request.isEnabled());
- request.disable();
- assertTrue("5." + i, !request.isEnabled());
- }
- }
- /**
- * Test JDI setSuspendPolicy(int) and suspendPolicy().
- */
- public void testJDISuspendPolicy() {
- int policy = EventRequest.SUSPEND_EVENT_THREAD;
- for (int i = 0; i < fRequests.size(); i++) {
- EventRequest request = (EventRequest) fRequests.get(i);
- request.setSuspendPolicy(policy);
- }
- for (int i = 0; i < fRequests.size(); i++) {
- EventRequest request = (EventRequest) fRequests.get(i);
- assertTrue(String.valueOf(i), request.suspendPolicy() == policy);
- }
- }
- /**
- * Test JDI putProperty and getProperty.
- */
- public void testJDIProperties() {
- EventRequest request = (EventRequest) fRequests.get(0);
- request.putProperty(new Integer(0), "prop1");
- String prop = (String) request.getProperty(new Integer(0));
- assertTrue("1", prop.equals("prop1"));
-
- request.putProperty(new Integer(0), null);
- prop = (String) request.getProperty(new Integer(0));
- assertTrue("2", prop == null);
-
- request.putProperty(new Integer(0), "prop2");
- request.putProperty(new Integer(0), "prop3");
- prop = (String) request.getProperty(new Integer(0));
- assertTrue("3", prop.equals("prop3"));
-
- request.putProperty(new Integer(0), null);
- prop = (String) request.getProperty(new Integer(0));
- assertTrue("4", prop == null);
-
- request.putProperty(new Integer(1), null);
- prop = (String) request.getProperty(new Integer(1));
- assertTrue("5", prop == null);
-
- request.putProperty(new Integer(1), "prop1");
- prop = (String) request.getProperty(new Integer(1));
- assertTrue("6", prop.equals("prop1"));
-
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventTest.java
deleted file mode 100644
index b64b88b..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import com.sun.jdi.event.Event;
-import com.sun.jdi.request.EventRequest;
-
-/**
- * Tests for JDI com.sun.jdi.event.Event.
- */
-public class EventTest extends AbstractJDITest {
- private HashMap fAllEvents = new HashMap();
- /**
- * Creates a new test.
- */
- public EventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // All events...
-
- EventRequest request;
-
- // AccessWatchpointEvent
- if (fVM.canWatchFieldAccess()) {
- request = getAccessWatchpointRequest();
- fAllEvents.put(
- request,
- triggerAndWait(request, "AccessWatchpointEvent", true));
- }
-
- // BreakpointEvent
- request = getBreakpointRequest();
- fAllEvents.put(
- request,
- triggerAndWait(request, "BreakpointEvent", true));
-
- // ClassPrepareEvent
- // TO DO
-
- // ClassUnloadEvent
- // TO DO
-
- // ExceptionEvent
- // TO DO
-
- // ModificationWatchpointEvent
- if (fVM.canWatchFieldModification()) {
- request = getModificationWatchpointRequest();
- fAllEvents.put(
- request,
- triggerAndWait(request, "ModificationWatchpointEvent", true));
- }
-
- // StepEvent
- // TO DO
-
- // ThreadEndEvent
- // TO DO
-
- // ThreadStartEvent
- // TO DO
-
- // VMDeathEvent
- // TO DO?
-
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Ensure that the modification of the "fBool" field has completed
- fVM.resume();
- waitUntilReady();
-
- // Remove the requests
- fVM.eventRequestManager().deleteEventRequests(
- new LinkedList(fAllEvents.keySet()));
-
- // Set the value of the "fBool" field back to its original value
- resetField();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new EventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.Event";
- }
- /**
- * Test JDI request().
- */
- public void testJDIRequest() {
- Iterator iterator = fAllEvents.keySet().iterator();
- while (iterator.hasNext()) {
- EventRequest request = (EventRequest) iterator.next();
- Event event = (Event) fAllEvents.get(request);
-
- assertEquals(event.toString(), request, event.request());
- }
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventWaiter.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventWaiter.java
deleted file mode 100644
index 8a0d691..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventWaiter.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.AccessWatchpointEvent;
-import com.sun.jdi.event.BreakpointEvent;
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.event.ClassUnloadEvent;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.ExceptionEvent;
-import com.sun.jdi.event.MethodEntryEvent;
-import com.sun.jdi.event.MethodExitEvent;
-import com.sun.jdi.event.ModificationWatchpointEvent;
-import com.sun.jdi.event.StepEvent;
-import com.sun.jdi.event.ThreadDeathEvent;
-import com.sun.jdi.event.ThreadStartEvent;
-import com.sun.jdi.event.VMDeathEvent;
-import com.sun.jdi.event.VMDisconnectEvent;
-import com.sun.jdi.request.EventRequest;
-
-/**
- * Listen for a specific kind of event.
- */
-public class EventWaiter implements EventListener {
- protected EventRequest fRequest;
- protected boolean fShouldGo;
- protected Event fEvent;
- /**
- * Creates a new EventWaiter for the given request. Sets whether it
- * should let the VM go after it got the event.
- */
- public EventWaiter(EventRequest request, boolean shouldGo) {
- fRequest = request;
- fShouldGo = shouldGo;
- }
- public boolean accessWatchpoint(AccessWatchpointEvent event) {
- return handleEvent(event);
- }
- public boolean methodEntry(MethodEntryEvent event) {
- return handleEvent(event);
- }
- public boolean methodExit(MethodExitEvent event) {
- return handleEvent(event);
- }
- public boolean breakpoint(BreakpointEvent event) {
- return handleEvent(event);
- }
- public boolean classPrepare(ClassPrepareEvent event) {
- return handleEvent(event);
- }
- public boolean classUnload(ClassUnloadEvent event) {
- return handleEvent(event);
- }
- public boolean exception(ExceptionEvent event) {
- return handleEvent(event);
- }
- /**
- * Handles an incoming event.
- * Returns whether the VM should be resumed if it was suspended.
- */
- protected boolean handleEvent(Event event) {
- if ((event.request() != null) && (event.request().equals(fRequest))) {
- notifyEvent(event);
- return fShouldGo;
- } else
- return true;
- }
- public boolean modificationWatchpoint(ModificationWatchpointEvent event) {
- return handleEvent(event);
- }
- /**
- * Notify any object that is waiting for an event.
- */
- synchronized protected void notifyEvent(Event event) {
- notify();
- fEvent = event;
- }
- public boolean step(StepEvent event) {
- return handleEvent(event);
- }
- public boolean threadDeath(ThreadDeathEvent event) {
- return handleEvent(event);
- }
- public boolean threadStart(ThreadStartEvent event) {
- return handleEvent(event);
- }
- public boolean vmDeath(VMDeathEvent event) {
- if (fEvent == null) {
- // This is the last event we can ever get an this was not the one we expected
- notifyEvent(null);
- return true;
- }
- return handleEvent(event);
- }
- public boolean vmDisconnect(VMDisconnectEvent event) {
- return handleEvent(event);
- }
- /**
- * Waits for the first event corresponding to this waiter's request.
- */
- synchronized public Event waitEvent() throws InterruptedException {
- if (fEvent == null) // If event didn't already come in
- wait();
- Event result = fEvent;
- fEvent = null;
- return result;
- }
- /**
- * Waits for the first event corresponding to this waiter's request
- * for the given time (in ms). If it times out, return null.
- */
- synchronized public Event waitEvent(long time)
- throws InterruptedException {
- if (fEvent == null) // If event didn't already come in
- wait(time);
- Event result = fEvent;
- fEvent = null;
- return result;
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java
deleted file mode 100644
index 89a667a..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.event.ExceptionEvent;
-
-/**
- * Tests for JDI com.sun.jdi.event.ExceptionEvent.
- */
-public class ExceptionEventTest extends AbstractJDITest {
-
- private ExceptionEvent fEvent;
- /**
- * Creates a new test.
- */
- public ExceptionEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Trigger an exception event
- fEvent =
- (ExceptionEvent) triggerAndWait(getExceptionRequest(),
- "ExceptionEvent",
- false);
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has interrupted the VM, so let it go
- fVM.resume();
-
- // The test has resumed the test thread, so suspend it
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ExceptionEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.ExceptionEvent";
- }
- /**
- * Test JDI catchLocation().
- */
- public void testJDICatchLocation() {
- // Uncaught exception
- assertTrue("1", fEvent.catchLocation() == null);
-
- // TO DO: Caught exception
- }
- /**
- * Test JDI exception().
- */
- public void testJDIException() {
- ReferenceType expected =
- (ReferenceType) fVM.classesByName("java.lang.Error").get(0);
- assertEquals("1", expected, fEvent.exception().referenceType());
- }
- /**
- * Test JDI thread().
- */
- public void testJDIThread() {
- assertEquals("1", "Test Exception Event", fEvent.thread().name());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java
deleted file mode 100644
index 4244f4b..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.request.ExceptionRequest;
-
-/**
- * Tests for JDI com.sun.jdi.request.ExceptionRequest.
- */
-public class ExceptionRequestTest extends AbstractJDITest {
-
- private ExceptionRequest fRequest;
- /**
- * Creates a new test .
- */
- public ExceptionRequestTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get the exception request
- fRequest = getExceptionRequest();
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Delete the exception request we created in this test
- fVM.eventRequestManager().deleteEventRequest(fRequest);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ExceptionRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.request.ExceptionRequest";
- }
- /**
- * Test JDI exception().
- */
- public void testJDIException() {
- assertTrue("1", fRequest.exception() == null);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java
deleted file mode 100644
index a3e9edd..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.Field;
-
-/**
- * Tests for JDI com.sun.jdi.Field.
- */
-public class FieldTest extends AbstractJDITest {
-
- private Field fField;
- /**
- * Creates a new test.
- */
- public FieldTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get static field "fObject"
- fField = getField();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new FieldTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Field";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fField.equals(fField));
- Field other = getField("fString");
- assertTrue("2", !fField.equals(other));
- assertTrue("3", !fField.equals(new Object()));
- assertTrue("4", !fField.equals(null));
- }
- /**
- * Test JDI isTransient().
- */
- public void testJDIIsTransient() {
- assertTrue("1", !fField.isTransient());
- }
- /**
- * Test JDI isVolatile().
- */
- public void testJDIIsVolatile() {
- assertTrue("1", !fField.isVolatile());
- }
- /**
- * Test JDI type().
- */
- public void testJDIType() {
- try {
- assertEquals("1", getMainClass(), fField.type());
- } catch (ClassNotLoadedException e) {
- assertTrue("2", false);
- }
- }
- /**
- * Test JDI typeName().
- */
- public void testJDITypeName() {
- assertEquals(
- "1",
- "org.eclipse.debug.jdi.tests.program.MainClass",
- fField.typeName());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FileConsoleReader.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FileConsoleReader.java
deleted file mode 100644
index b44382e..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FileConsoleReader.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class FileConsoleReader extends AbstractReader {
- private InputStream fInput;
- private FileOutputStream fFileOutputStream;
- /*
- * Creates a new console reader that will read from the given input stream.
- */
- public FileConsoleReader(String name, String fileName, InputStream input) {
- super(name);
- fInput = input;
- try {
- fFileOutputStream = new FileOutputStream(new File(fileName));
- } catch (IOException e) {
- System.out.println("Got exception: " + e.getMessage());
- }
- }
- /**
- * Continuously reads events that are coming from the event queue.
- */
- protected void readerLoop() {
- BufferedReader input = new BufferedReader(new InputStreamReader(fInput));
- try {
- int read = 0;
- while (!fIsStopping && read != -1) {
- read = input.read();
- if (read != -1) {
- fFileOutputStream.write(read);
- }
- fFileOutputStream.flush();
- }
- } catch (IOException e) {
- }
- }
-
- public void stop() {
- try {
- fFileOutputStream.close();
- } catch (IOException e) {
- System.out.println("Got exception: " + e.getMessage());
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java
deleted file mode 100644
index d535922..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.FloatValue;
-
-/**
- * Tests for JDI com.sun.jdi.FloatValue.
- */
-public class FloatValueTest extends AbstractJDITest {
-
- private FloatValue fValue;
- /**
- * Creates a new test.
- */
- public FloatValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get float value for 123.45f
- fValue = fVM.mirrorOf(123.45f);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new FloatValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.FloatType";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf(123.45f)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(54.321f)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals("5", fValue.hashCode(), fVM.mirrorOf(123.45f).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(54.321f).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", 123.45f == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java
deleted file mode 100644
index 419f9de..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.Location;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.StackFrame;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.event.ClassPrepareEvent;
-import com.sun.jdi.event.ClassUnloadEvent;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.StepEvent;
-import com.sun.jdi.request.ClassPrepareRequest;
-import com.sun.jdi.request.ClassUnloadRequest;
-import com.sun.jdi.request.EventRequest;
-import com.sun.jdi.request.StepRequest;
-
-/**
- * Tests for the hot code replacement JDI extension.
- */
-public class HotCodeReplacementTest extends AbstractJDITest {
- /**
- * Creates a new test.
- */
- public HotCodeReplacementTest() {
- super();
- }
- private void dropTopFrame(
- ThreadReference thread,
- org.eclipse.jdi.hcr.ThreadReference hcrThread) {
- // Get stack size
- int stackSize = 0;
- try {
- stackSize = thread.frames().size();
- } catch (IncompatibleThreadStateException e) {
- assertTrue("dropTopFrame.1", false);
- }
-
- // Create and install step out request
- StepRequest request =
- fVM.eventRequestManager().createStepRequest(
- thread,
- StepRequest.STEP_MIN,
- StepRequest.STEP_OUT);
- request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
- request.enable();
-
- // Prepare to receive the event
- EventWaiter waiter = new EventWaiter(request, false);
- fEventReader.addEventListener(waiter);
-
- // Do return
- boolean finallyBlocksSkipped = hcrThread.doReturn(null, true);
- assertTrue("dropTopFrame.2", !finallyBlocksSkipped);
-
- // Wait for the event to come in
- Event event = waitForEvent(waiter, 10000); // Wait 10s max
- assertTrue("dropTopFrame.3", event != null);
- fEventReader.removeEventListener(waiter);
- fVM.eventRequestManager().deleteEventRequest(request);
-
- // Check thread has dropped top frame
- assertTrue("dropTopFrame.4", thread.isSuspended());
- int newStackSize = 0;
- try {
- newStackSize = thread.frames().size();
- } catch (IncompatibleThreadStateException e) {
- assertTrue("dropTopFrame.5", false);
- }
- assertEquals("dropTopFrame.6", stackSize - 1, newStackSize);
- }
-
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(String[] args) {
- new HotCodeReplacementTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "Hot code replacement extension to JDI (org.eclipse.jdi.hcr) tests";
- }
- private void reenterOnExit(ThreadReference thread) {
- // Get top frame's location
- Location location = null;
- try {
- StackFrame frame = (StackFrame) thread.frames(0, 1).get(0);
- location = frame.location();
- } catch (IncompatibleThreadStateException e) {
- assertTrue("reenterOnExit.1", false);
- }
-
- // Create and install reenter step request
- org.eclipse.jdi.hcr.EventRequestManager eventRequestManager =
- (org.eclipse.jdi.hcr.EventRequestManager) fVM.eventRequestManager();
- org.eclipse.jdi.hcr.ReenterStepRequest request =
- eventRequestManager.createReenterStepRequest(thread);
- request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
- request.enable();
-
- // Prepare to receive the step event
- EventWaiter waiter = new EventWaiter(request, false);
- fEventReader.addEventListener(waiter);
-
- // Resume thread with a doReturn so that the frame is reentered right away
- ((org.eclipse.jdi.hcr.ThreadReference) thread).doReturn(null, false);
-
- // Wait for the step event to come in
- StepEvent event = (StepEvent) waitForEvent(waiter, 10000); // Wait 10s max
- assertTrue("reenterOnExit.2", event != null);
- fEventReader.removeEventListener(waiter);
- fVM.eventRequestManager().deleteEventRequest(request);
-
- // Check that the top frame location is as expected
- Location newLocation = null;
- try {
- StackFrame frame = (StackFrame) thread.frames(0, 1).get(0);
- newLocation = frame.location();
- } catch (IncompatibleThreadStateException e) {
- assertTrue("reenterOnExit.3", false);
- }
- assertTrue("reenterOnExit.4", !newLocation.equals(location));
- assertTrue("reenterOnExit.5", newLocation.codeIndex() <= location.codeIndex());
-
- }
- private void reloadClasses() {
- // Gets the old class
- ReferenceType oldType = getMainClass();
-
- // Create and install class unload and class prepare event requests
- ClassUnloadRequest unloadRequest =
- fVM.eventRequestManager().createClassUnloadRequest();
- unloadRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
- unloadRequest.enable();
- ClassPrepareRequest loadRequest =
- fVM.eventRequestManager().createClassPrepareRequest();
- loadRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
- loadRequest.enable();
-
- // Prepare to receive the class unload event
- EventWaiter unloadEventWaiter = new EventWaiter(unloadRequest, true);
- fEventReader.addEventListener(unloadEventWaiter);
-
- // Prepare to receive the class prepare event
- EventWaiter loadEventWaiter = new EventWaiter(loadRequest, true);
- fEventReader.addEventListener(loadEventWaiter);
-
- // Reload classes
- org.eclipse.jdi.hcr.VirtualMachine vm =
- (org.eclipse.jdi.hcr.VirtualMachine) fVM;
- int result =
- vm.classesHaveChanged(
- new String[] { "org.eclipse.debug.jdi.tests.program.MainClass" });
- assertEquals("reloadClasses.1", org.eclipse.jdi.hcr.VirtualMachine.RELOAD_SUCCESS, result);
-
- // Wait for the class unload event to come in
- ClassUnloadEvent unloadEvent =
- (ClassUnloadEvent) waitForEvent(unloadEventWaiter, 10000);
- // Wait 10s max
- assertTrue("reloadClasses.2", unloadEvent != null);
- fEventReader.removeEventListener(unloadEventWaiter);
- fVM.eventRequestManager().deleteEventRequest(unloadRequest);
- assertEquals(
- "reloadClasses.3",
- "org.eclipse.debug.jdi.tests.program.MainClass",
- unloadEvent.className());
-
- // Wait for the class prepare event to come in
- ClassPrepareEvent loadEvent =
- (ClassPrepareEvent) waitForEvent(loadEventWaiter, 10000);
- // Wait 10s max
- assertTrue("reloadClasses.4", loadEvent != null);
- fEventReader.removeEventListener(loadEventWaiter);
- fVM.eventRequestManager().deleteEventRequest(loadRequest);
- ReferenceType newType = loadEvent.referenceType();
- assertEquals(
- "reloadClasses.5",
- "org.eclipse.debug.jdi.tests.program.MainClass",
- newType.name());
- assertTrue("reloadClasses.6", !oldType.equals(newType));
- }
- /**
- * Use case 1:
- * . get a thread and suspend it
- * . get hot code replacement capabilities
- * . drop the top a frame
- * . reload some classes
- * . request reeenter on exit
- * . resume thread
- * . get step event
- * . get class file version for some classes
- */
- public void testJDIUseCase1() {
- // Get the suspended thread
- ThreadReference thread = getThread();
- assertTrue("1", thread.isSuspended());
- assertEquals("2", 1, thread.suspendCount());
- org.eclipse.jdi.hcr.ThreadReference hcrThread =
- (org.eclipse.jdi.hcr.ThreadReference) thread;
-
- org.eclipse.jdi.hcr.VirtualMachine vm =
- (org.eclipse.jdi.hcr.VirtualMachine) fVM;
-
-
- // Drop the top a frame
- try {
- if (vm.canDoReturn()) {
- dropTopFrame(thread, hcrThread);
- }
- } catch (UnsupportedOperationException e) {
- //not using a VM that supports the extension
- return;
- }
-
- // Reload classes
- if (vm.canReloadClasses())
- reloadClasses();
-
- // Reenter on exit
- if (vm.canReenterOnExit())
- reenterOnExit(thread);
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- waitUntilReady();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java
deleted file mode 100644
index 580564a..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.IntegerValue;
-
-/**
- * Tests for JDI com.sun.jdi.IntegerValue.
- */
-public class IntegerValueTest extends AbstractJDITest {
-
- private IntegerValue fValue;
- /**
- * Creates a new test.
- */
- public IntegerValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get int value for 12345
- fValue = fVM.mirrorOf(12345);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new IntegerValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.IntegerValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf(12345)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(54321)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals("5", fValue.hashCode(), fVM.mirrorOf(12345).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(54321).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", 12345 == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java
deleted file mode 100644
index 9608a64..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.Iterator;
-import java.util.List;
-
-import com.sun.jdi.ClassType;
-import com.sun.jdi.InterfaceType;
-import com.sun.jdi.Method;
-
-/**
- * Tests for JDI com.sun.jdi.InterfaceType
- * and JDWP Interface command set.
- */
-public class InterfaceTypeTest extends AbstractJDITest {
-
- private InterfaceType fType;
- /**
- * Creates a new test.
- */
- public InterfaceTypeTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get interface type "org.eclipse.debug.jdi.tests.program.Printable"
- fType = getInterfaceType();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new InterfaceTypeTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.InterfaceType";
- }
- /**
- * Test JDI allFields().
- */
- public void testJDIAllFields() {
- assertEquals("1", 1, fType.allFields().size());
- }
- /**
- * Test JDI allMethods().
- */
- public void testJDIAllMethods() {
- boolean found = false;
- Iterator it = fType.allMethods().iterator();
- while (it.hasNext()) {
- Method mth = (Method) it.next();
- if (mth.name().equals("print")) {
- found = true;
- }
- }
- assertTrue("1", fType.allMethods().size() == 1);
- assertTrue("2", found);
- }
- /**
- * Test JDI implementors().
- */
- public void testJDIImplementors() {
- List implementors = fType.implementors();
- assertEquals("1", 1, implementors.size());
- ClassType implementor = (ClassType) implementors.get(0);
- assertEquals("2", getMainClass(), implementor);
- }
- /**
- * Test JDI subinterfaces().
- */
- public void testJDISubinterfaces() {
- List subinterfaces = fType.subinterfaces();
- assertEquals("1", 0, subinterfaces.size());
- }
- /**
- * Test JDI superinterfaces().
- */
- public void testJDISuperinterfaces() {
- List superinterfaces = fType.superinterfaces();
- assertEquals("1", 1, superinterfaces.size());
- InterfaceType superinterface = (InterfaceType) superinterfaces.get(0);
- InterfaceType expected =
- (InterfaceType) fVM.classesByName("java.lang.Cloneable").get(0);
- assertEquals("2", expected, superinterface);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestCase.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestCase.java
deleted file mode 100644
index dc29b4b..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestCase.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.lang.reflect.Method;
-import junit.framework.TestCase;
-
-/**
- * Wrapper to be able to use the JDI tests in a test suite without
- * starting and shuting down the VM after each test.
- */
-public class JDITestCase extends TestCase {
- private AbstractJDITest fTest;
- /**
- * Creates a new test for the given JDI test.
- */
- public JDITestCase(AbstractJDITest test, String name) {
- super(name);
- fTest = test;
- }
- /**
- * Override to run the test and assert its state.
- * @exception Throwable if any exception is thrown
- */
- protected void runTest() throws Throwable {
- Method runMethod = null;
- try {
- runMethod = fTest.getClass().getMethod(getName(), new Class[0]);
- } catch (NoSuchMethodException e) {
- e.fillInStackTrace();
- throw e;
- }
- try {
- fTest.verbose("Running " + getName());
- runMethod.invoke(fTest, new Class[0]);
- } catch (java.lang.reflect.InvocationTargetException e) {
- if (e.getTargetException() instanceof NotYetImplementedException)
- System.out.println("\n" + getName() + " is not yet implemented.");
- else {
- e.fillInStackTrace();
- throw e.getTargetException();
- }
- } catch (IllegalAccessException e) {
- e.fillInStackTrace();
- throw e;
- }
- }
- /**
- * Init tests
- */
- protected void setUp() {
- // Ignore setUp since it is done once for all tests in the test suite
- }
- /**
- * Tears down the fixture.
- */
- protected void tearDown() {
- // Ignore tearDown since it is done once for all tests in the test suite
- }
- /**
- * Returns a string representation of the test case
- */
- public String toString() {
- return fTest.getClass().getName() + "." + getName() + "()";
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestSuite.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestSuite.java
deleted file mode 100644
index 245d8b8..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/JDITestSuite.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-/**
- * A JDI test suite runs all tests defined in a JDI test case class.
- * It runs the setUp method once before running the tests and the
- * tearDown method once after.
- */
-public class JDITestSuite extends TestSuite {
- private AbstractJDITest fTest;
- /**
- * Creates a new test suite for the given JDI test.
- */
- public JDITestSuite(AbstractJDITest test) {
- super();
- fTest = test;
- }
- /**
- * Runs the tests and collects their result in a TestResult.
- */
- public void run(TestResult result) {
- fTest.setUp();
- super.run(result);
- fTest.tearDown();
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java
deleted file mode 100644
index 72d5701..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.LocalVariable;
-
-/**
- * Tests for JDI com.sun.jdi.LocalVariable.
- */
-public class LocalVariableTest extends AbstractJDITest {
-
- private LocalVariable fVar;
- /**
- * Creates a new test.
- */
- public LocalVariableTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Wait for the program to be ready
- waitUntilReady();
-
- // Get local variable "t" in the frame running MainClass.run()
- fVar = getLocalVariable();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new LocalVariableTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.LocalVariable";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fVar.equals(fVar));
- LocalVariable other = null;
- try {
- other = getFrame(RUN_FRAME_OFFSET).visibleVariableByName("o");
- } catch (AbsentInformationException e) {
- assertTrue("2", false);
- }
- assertTrue("3", !fVar.equals(other));
- assertTrue("4", !fVar.equals(new Object()));
- assertTrue("5", !fVar.equals(null));
- assertTrue("6", fVar.hashCode() != other.hashCode());
- }
- /**
- * Test JDI isArgument().
- */
- public void testJDIIsArgument() {
- assertTrue("1", !fVar.isArgument());
- }
- /**
- * Test JDI isVisible(StackFrame).
- */
- public void testJDIIsVisible() {
- assertTrue("1", fVar.isVisible(getFrame(RUN_FRAME_OFFSET)));
-
- boolean gotException = false;
- try {
- fVar.isVisible(getFrame(0));
- } catch (IllegalArgumentException e) {
- gotException = true;
- }
- assertTrue("2", gotException);
- }
- /**
- * Test JDI name().
- */
- public void testJDIName() {
- assertEquals("1", "t", fVar.name());
- }
- /**
- * Test JDI signature().
- */
- public void testJDISignature() {
- assertEquals("1", "Ljava/lang/Thread;", fVar.signature());
- }
- /**
- * Test JDI type().
- */
- public void testJDIType() {
- try {
- assertEquals(
- "1",
- fVM.classesByName("java.lang.Thread").get(0),
- fVar.type());
- } catch (ClassNotLoadedException e) {
- assertTrue("2", false);
- }
- }
- /**
- * Test JDI typeName().
- */
- public void testJDITypeName() {
- assertEquals("1", "java.lang.Thread", fVar.typeName());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java
deleted file mode 100644
index 9cc5390..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.Locatable;
-import com.sun.jdi.Location;
-import com.sun.jdi.request.AccessWatchpointRequest;
-import com.sun.jdi.request.BreakpointRequest;
-import com.sun.jdi.request.ModificationWatchpointRequest;
-
-/**
- * Tests for JDI com.sun.jdi.Locatable.
- */
-public class LocatableTest extends AbstractJDITest {
-
- private List fLocatables = new LinkedList();
- private List fRequests = new LinkedList();
- /**
- * Creates a new test.
- */
- public LocatableTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get all kinds of locatable
-
- BreakpointRequest bp = getBreakpointRequest();
- fLocatables.add(bp); // BreakpointRequest
-
- //ExceptionRequest er = getExceptionRequest();
- //fLocatables.add(triggerAndWait(er, 'e')); // ExceptionEvent
-
- fLocatables.add(getMethod()); // Method
-
- fLocatables.add(triggerStepAndWait()); // StepEvent
-
- fRequests.add(bp);
- fLocatables.add(triggerAndWait(bp, "BreakpointEvent", true));
- // BreakpointEvent
-
- if (fVM.canWatchFieldAccess()) {
- AccessWatchpointRequest ap = getAccessWatchpointRequest();
- fRequests.add(ap);
- fLocatables.add(triggerAndWait(ap, "AccessWatchpointEvent", true));
- // AccessWatchpointEvent
- }
-
- if (fVM.canWatchFieldModification()) {
- ModificationWatchpointRequest mp =
- getModificationWatchpointRequest();
- fRequests.add(mp);
- fLocatables.add(
- triggerAndWait(mp, "ModificationWatchpointEvent", false));
- // ModificationWatchpointEvent
- }
-
- // Note we can use the stack frame only if the thread is suspended,
- // that's why the previoue triggerAndWait doesn't resume the thread
- // and this Locatable is added last in the list
- fLocatables.add(getFrame(RUN_FRAME_OFFSET)); // StackFrame
-
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Ensure that the modification of the "fBool" field has completed
- fVM.resume();
- waitUntilReady();
-
- // Delete the event requests we created in this test
- fVM.eventRequestManager().deleteEventRequests(fRequests);
-
- // Set the value of the "fBool" field back to its original value
- resetField();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new LocatableTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Locatable";
- }
- /**
- * Test JDI location()
- */
- public void testJDILocation() {
- ListIterator iterator = fLocatables.listIterator();
- while (iterator.hasNext()) {
- Locatable locatable = (Locatable) iterator.next();
- Location location = locatable.location();
- assertTrue("1." + locatable, location != null);
- assertTrue(
- "2." + locatable,
- (location.codeIndex()) >= 0 || (location.codeIndex() == -1));
- assertTrue("3." + locatable, location.declaringType() != null);
- assertTrue(
- "4." + locatable,
- (location.lineNumber() > 0) || (location.lineNumber() == -1));
- assertNotNull("5", location.method());
- try {
- location.sourceName();
- } catch (AbsentInformationException e) {
- assertTrue("7", false);
- }
- }
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java
deleted file mode 100644
index 82e6d34..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.jdi.tests;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.Location;
-import com.sun.jdi.Method;
-import com.sun.jdi.ReferenceType;
-
-/**
- * Tests for JDI com.sun.jdi.Location.
- */
-public class LocationTest extends AbstractJDITest {
-
- private Location fLocation;
- /**
- * Creates a new test.
- */
- public LocationTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Ensure we're in a good state
- fVM.resume();
- waitUntilReady();
-
- // Get the location of the stack frame running the method MainClass.run()
- fLocation = getLocation();
-
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new LocationTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Location";
- }
- /**
- * Test JDI codeIndex().
- */
- public void testJDICodeIndex() {
- fLocation.codeIndex();
- }
- /**
- * Test JDI declaringType().
- */
- public void testJDIDeclaringType() {
- ReferenceType expected = getMainClass();
- ReferenceType declaringType = fLocation.declaringType();
- assertEquals("1", expected.name(), declaringType.name());
- // Use name to work around a pb in Sun's VM
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fLocation.equals(fLocation));
- Location other = getFrame(0).location();
- assertTrue("2", !fLocation.equals(other));
- assertTrue("3", !fLocation.equals(new Object()));
- assertTrue("4", !fLocation.equals(null));
- assertTrue("5", fLocation.hashCode() != other.hashCode());
- }
- /**
- * Test JDI lineNumber().
- */
- public void testJDILineNumber() {
- assertEquals("1", 117, fLocation.lineNumber());
- }
- /**
- * Test JDI method().
- */
- public void testJDIMethod() {
- Method method = fLocation.method();
- assertEquals("1", "print", method.name());
- }
- /**
- * Test JDI sourceName().
- */
- public void testJDISourceName() {
- String sourceName = null;
- try {
- sourceName = fLocation.sourceName();
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", "MainClass.java", sourceName);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java
deleted file mode 100644
index ec3e443..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.LongValue;
-
-/**
- * Tests for JDI com.sun.jdi.LongValue.
- */
-public class LongValueTest extends AbstractJDITest {
-
- private LongValue fValue;
- /**
- * Creates a new test.
- */
- public LongValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get long value for 123456789l
- fValue = fVM.mirrorOf(123456789l);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new LongValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.LongValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf(123456789l)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(987654321l)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals(
- "5",
- fValue.hashCode(),
- fVM.mirrorOf(123456789l).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(987654321l).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", 123456789l == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java
deleted file mode 100644
index 1b07dfe..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Method;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.MethodEntryEvent;
-import com.sun.jdi.request.MethodEntryRequest;
-
-public class MethodEntryRequestTest extends AbstractJDITest {
-
- public void localSetUp() {
- }
-
- public void localTearDown() {
- fVM.resume();
- waitUntilReady();
- }
-
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new MethodEntryRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.MethodEntryRequest";
- }
-
- protected MethodEntryRequest getMethodEntryRequest() {
- return fVM.eventRequestManager().createMethodEntryRequest();
- }
-
- public void testJDIWithoutFilter() {
- MethodEntryRequest request = getMethodEntryRequest();
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodEntryEvent event = (MethodEntryEvent) e;
- assertEquals(getThread(), event.thread());
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithClassExclusionFilter() {
- MethodEntryRequest request = getMethodEntryRequest();
- request.addClassExclusionFilter("org.eclipse.debug.jdi.tests.program.*");
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodEntryEvent event = (MethodEntryEvent) e;
- Method m = event.method();
- ReferenceType r = m.location().declaringType();
- assertTrue("1", !r.name().startsWith("org.eclipse.debug.jdi.tests.program."));
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithClassFilter1() {
- MethodEntryRequest request = getMethodEntryRequest();
- ClassType clazz = getClass("java.io.PrintStream");
- request.addClassFilter(clazz);
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodEntryEvent event = (MethodEntryEvent) e;
- Method m = event.method();
- ReferenceType r = m.location().declaringType();
- assertEquals(clazz, r);
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithClassFilter2() {
- MethodEntryRequest request = getMethodEntryRequest();
- request.addClassFilter("java.io.PrintStream");
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodEntryEvent event = (MethodEntryEvent) e;
- Method m = event.method();
- ReferenceType r = m.location().declaringType();
- assertEquals("java.io.PrintStream", r.name());
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithThreadFilter() {
- MethodEntryRequest request = getMethodEntryRequest();
- ThreadReference thr = getMainThread();
- request.addThreadFilter(thr);
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodEntryEvent event = (MethodEntryEvent) e;
- assertEquals(thr, event.thread());
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java
deleted file mode 100644
index 7a5293d..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Method;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.MethodExitEvent;
-import com.sun.jdi.request.MethodExitRequest;
-
-public class MethodExitRequestTest extends AbstractJDITest {
-
- public void localSetUp() {
- }
- public void localTearDown() {
- fVM.resume();
- waitUntilReady();
- }
-
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new MethodExitRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.MethodExitRequest";
- }
-
- protected MethodExitRequest getMethodExitRequest() {
- return fVM.eventRequestManager().createMethodExitRequest();
- }
- public void testJDIWithoutFilter() {
- MethodExitRequest request = getMethodExitRequest();
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodExitEvent event = (MethodExitEvent) e;
- assertEquals(getThread(), event.thread());
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithClassExclusionFilter() {
- MethodExitRequest request = getMethodExitRequest();
- request.addClassExclusionFilter("org.eclipse.debug.jdi.tests.program.*");
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodExitEvent event = (MethodExitEvent) e;
- Method m = event.method();
- ReferenceType r = m.location().declaringType();
- assertTrue("1", !r.name().startsWith("org.eclipse.debug.jdi.tests.program."));
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithClassFilter1() {
- MethodExitRequest request = getMethodExitRequest();
- ClassType clazz = getClass("java.io.PrintStream");
- request.addClassFilter(clazz);
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodExitEvent event = (MethodExitEvent) e;
- Method m = event.method();
- ReferenceType r = m.location().declaringType();
- assertEquals(clazz, r);
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithClassFilter2() {
- MethodExitRequest request = getMethodExitRequest();
- request.addClassFilter("java.io.PrintStream");
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodExitEvent event = (MethodExitEvent) e;
- Method m = event.method();
- ReferenceType r = m.location().declaringType();
- assertEquals("java.io.PrintStream", r.name());
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIWithThreadFilter() {
- MethodExitRequest request = getMethodExitRequest();
- ThreadReference thr = getMainThread();
- request.addThreadFilter(thr);
-
- Event e = triggerAndWait(request, "BreakpointEvent", true);
- assertEquals(request, e.request());
-
- MethodExitEvent event = (MethodExitEvent) e;
- assertEquals(thr, event.thread());
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java
deleted file mode 100644
index ca9d308..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.jdi.tests;
-
-import java.util.List;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.LocalVariable;
-import com.sun.jdi.Location;
-import com.sun.jdi.Method;
-import com.sun.jdi.NativeMethodException;
-import com.sun.jdi.VoidType;
-
-/**
- * Tests for JDI com.sun.jdi.Method
- * and JDWP Method command set.
- */
-public class MethodTest extends AbstractJDITest {
-
- private Method fMethod1;
- /**
- * Creates a new test.
- */
- public MethodTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get method useLocalVars(Thread, MainClass)
- fMethod1 =
- getMethod(
- "useLocalVars",
- "(Ljava/lang/Thread;Lorg/eclipse/debug/jdi/tests/program/MainClass;)V");
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new MethodTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Method";
- }
- /**
- * Test JDI arguments() and JDWP 'Method - Get variable table'.
- */
- public void testJDIArguments() {
- List arguments = null;
- try {
- arguments = fMethod1.arguments();
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 2, arguments.size());
- assertEquals("3", "t", ((LocalVariable) arguments.get(0)).name());
- assertEquals("4", "o", ((LocalVariable) arguments.get(1)).name());
- }
- /**
- * Test JDI argumentTypeNames().
- */
- public void testJDIArgumentTypeNames() {
- List names = fMethod1.argumentTypeNames();
- assertEquals("1", 2, names.size());
- assertEquals("2", "java.lang.Thread", names.get(0));
- assertEquals(
- "3",
- "org.eclipse.debug.jdi.tests.program.MainClass",
- names.get(1));
- }
- /**
- * Test JDI argumentTypes().
- */
- public void testJDIArgumentTypes() {
- List types = null;
- try {
- types = fMethod1.argumentTypes();
- } catch (ClassNotLoadedException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 2, types.size());
- assertEquals("3", fVM.classesByName("java.lang.Thread").get(0), types.get(0));
- assertEquals(
- "4",
- fVM.classesByName("org.eclipse.debug.jdi.tests.program.MainClass").get(0),
- types.get(1));
- }
- /**
- * Test JDI bytecodes().
- */
- public void testJDIBytecodes() {
- if (!fVM.canGetBytecodes())
- return;
-
- byte[] bytecodes = fMethod1.bytecodes();
- assertEquals("1", 27, bytecodes.length);
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fMethod1.equals(fMethod1));
- Method other = getMethod("run", "()V");
- assertTrue("2", !fMethod1.equals(other));
- assertTrue("3", !fMethod1.equals(new Object()));
- assertTrue("4", !fMethod1.equals(null));
- assertTrue("5", fMethod1.hashCode() != other.hashCode());
- }
- /**
- * Test JDI isAbstract().
- */
- public void testJDIIsAbstract() {
- assertTrue("1", !fMethod1.isAbstract());
- }
- /**
- * Test JDI isConstructor().
- */
- public void testJDIIsConstructor() {
- assertTrue("1", !fMethod1.isConstructor());
- }
- /**
- * Test JDI isNative().
- */
- public void testJDIIsNative() {
- assertTrue("1", !fMethod1.isNative());
- }
- /**
- * Test JDI isStaticInitializer().
- */
- public void testJDIIsStaticInitializer() {
- assertTrue("1", !fMethod1.isStaticInitializer());
- }
- /**
- * Test JDI isSynchronized().
- */
- public void testJDIIsSynchronized() {
- assertTrue("1", !fMethod1.isSynchronized());
- }
- /**
- * Test JDI locationOfCodeIndex(long).
- */
- public void testJDILocationOfCodeIndex() {
- Location expected = fMethod1.location();
- Location result = fMethod1.locationOfCodeIndex(expected.codeIndex());
- assertEquals("1", expected, result);
- }
- /**
- * Test JDI locationsOfLine(int) and JDWP 'Method - Get line table'.
- */
- public void testJDILocationsOfLine() {
- int expected = fMethod1.location().lineNumber();
- List locations = null;
- try {
- locations = fMethod1.locationsOfLine(expected);
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 1, locations.size());
- assertEquals("3", expected, ((Location) locations.get(0)).lineNumber());
- }
- /**
- * Test JDI returnType().
- */
- public void testJDIReturnType() {
- try {
- assertTrue("1", fMethod1.returnType() instanceof VoidType);
- } catch (ClassNotLoadedException e) {
- assertTrue("2", false);
- }
- }
- /**
- * Test JDI returnTypeName().
- */
- public void testJDIReturnTypeName() {
- assertEquals("1", "void", fMethod1.returnTypeName());
- }
- /**
- * Test JDI variables() and JDWP 'Method - Get variable table'.
- */
- public void testJDIVariables() {
- List variables = null;
- try {
- variables = fMethod1.variables();
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 2, variables.size());
- assertEquals("3", "t", ((LocalVariable) variables.get(0)).name());
- assertEquals("4", "o", ((LocalVariable) variables.get(1)).name());
- }
-
- /**
- * Test JDI variables() and JDWP 'Method - Get variable table'
- * for native method.
- */
- public void testJDINativeMethodVariables() {
- Method method = getMethod("java.lang.Thread", "sleep", "(J)V");
-
- try {
- method.variables();
- } catch (AbsentInformationException e) {
- // since 1.4, returns an AbsentInformationException for native methods
- assertFalse("1", "1.3".equals(fVM.version()));
- return;
- } catch (NativeMethodException nme) {
- assertTrue("1", "1.3".equals(fVM.version()));
- return;
- }
- assertTrue("Should have thrown native method exception", false);
- }
-
- /**
- * Test JDI variables() and JDWP 'Method - Get variable table'
- * for non-native method with a long argument.
- */
- public void testJDIMethodVariablesWithLong() {
- List variables = null;
- Method method = getMethod("variablesTest", "(J)V");
-
- try {
- variables = method.variables();
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("1", 1, variables.size());
- }
-
- /**
- * Test JDI variablesByName(String) and JDWP 'Method - Get variable table'.
- */
- public void testJDIVariablesByName() {
- String varName = "t";
- List variables = null;
- try {
- variables = fMethod1.variablesByName(varName);
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 1, variables.size());
- assertEquals("3", varName, ((LocalVariable) variables.get(0)).name());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MirrorTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MirrorTest.java
deleted file mode 100644
index b659104..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MirrorTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-
-import com.sun.jdi.Mirror;
-import com.sun.jdi.request.AccessWatchpointRequest;
-import com.sun.jdi.request.BreakpointRequest;
-import com.sun.jdi.request.ModificationWatchpointRequest;
-
-/**
- * Tests for JDI com.sun.jdi.Mirror.
- */
-public class MirrorTest extends AbstractJDITest {
- List fMirrors = new LinkedList();
- /**
- * Creates a new test.
- */
- public MirrorTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get all kinds of concrete mirror that can be found in the VM
- // in alphabetical order.
-
- //TO DO: Add events too
-
- fMirrors = new LinkedList();
-
- if (fVM.canWatchFieldAccess())
- fMirrors.add(getAccessWatchpointRequest());
- // AccessWatchpointRequest
-
- fMirrors.add(getObjectArrayReference()); // ArrayReference
- fMirrors.add(getArrayType()); // ArrayType
- fMirrors.add(fVM.mirrorOf(true)); // BooleanValue
- fMirrors.add(getBreakpointRequest()); // BreakpointRequest
- fMirrors.add(fVM.mirrorOf((byte) 1)); // ByteValue
- fMirrors.add(fVM.mirrorOf('1')); // CharValue
- fMirrors.add(getClassLoaderReference()); // ClassLoaderReference
- fMirrors.add(getMainClass()); // ClassType
- fMirrors.add(fVM.mirrorOf(12345.6789)); // DoubleValue
- fMirrors.add(fVM.eventRequestManager()); // EventRequestManager
- fMirrors.add(fVM.eventQueue()); // EventQueue
- fMirrors.add(getField()); // Field
- fMirrors.add(fVM.mirrorOf(123.45f)); // FieldValue
- fMirrors.add(fVM.mirrorOf(12345)); // IntegerValue
- fMirrors.add(getInterfaceType()); // InterfaceType
- fMirrors.add(getLocalVariable()); // LocalVariable
- fMirrors.add(getLocation()); // Location
- fMirrors.add(fVM.mirrorOf(123456789l)); // LongValue
- fMirrors.add(getMethod()); // Method
-
- if (fVM.canWatchFieldModification())
- fMirrors.add(getModificationWatchpointRequest());
- // ModificationWatchpointRequest
-
- fMirrors.add(getObjectReference()); // ObjectReference
- fMirrors.add(fVM.mirrorOf((short) 12345)); // ShortValue
- fMirrors.add(getFrame(RUN_FRAME_OFFSET)); // StackFrame
- fMirrors.add(getStringReference()); // StringReference
- fMirrors.add(getThread().threadGroup()); // ThreadGroupReference
- fMirrors.add(getThread()); // ThreadReference
- fMirrors.add(fVM); // VirtualMachine
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- ListIterator iterator = fMirrors.listIterator();
- while (iterator.hasNext()) {
- Object mirror = iterator.next();
-
- // Delete the access watchpoint request we created in this test
- if (mirror instanceof AccessWatchpointRequest)
- fVM.eventRequestManager().deleteEventRequest(
- (AccessWatchpointRequest) mirror);
-
- // Delete the breakpoint request we created in this test
- if (mirror instanceof BreakpointRequest)
- fVM.eventRequestManager().deleteEventRequest(
- (BreakpointRequest) mirror);
-
- // Delete the modification watchpoint request we created in this test
- if (mirror instanceof ModificationWatchpointRequest)
- fVM.eventRequestManager().deleteEventRequest(
- (ModificationWatchpointRequest) mirror);
- }
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new MirrorTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Mirror";
- }
- /**
- * Test JDI toString().
- */
- public void testJDIToString() {
- for (int i = 0; i < fMirrors.size(); i++) {
- Mirror mirror = (Mirror) fMirrors.get(i);
- assertNotNull(Integer.toString(i), mirror.toString());
- }
- }
- /**
- * Test JDI virtualMachine().
- */
- public void testJDIVirtualMachine() {
- for (int i = 0; i < fMirrors.size(); i++) {
- Mirror mirror = (Mirror) fMirrors.get(i);
- assertEquals(Integer.toString(i), fVM, mirror.virtualMachine());
- }
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ModificationWatchpointEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ModificationWatchpointEventTest.java
deleted file mode 100644
index 8a04c0c..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ModificationWatchpointEventTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.StringReference;
-import com.sun.jdi.event.ModificationWatchpointEvent;
-import com.sun.jdi.request.WatchpointRequest;
-
-/**
- * Tests for JDI com.sun.jdi.ModificationWatchpointEvent.
- */
-public class ModificationWatchpointEventTest extends AbstractJDITest {
-
- private ModificationWatchpointEvent fWatchpointEvent;
- private WatchpointRequest fWatchpointRequest;
- /**
- * Creates a new test.
- */
- public ModificationWatchpointEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Trigger a static modification watchpoint event
- fWatchpointRequest = getStaticModificationWatchpointRequest();
- fWatchpointEvent =
- (ModificationWatchpointEvent) triggerAndWait(fWatchpointRequest,
- "StaticModificationWatchpointEvent",
- false);
- // Interrupt the VM so that we can test valueToBe()
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Ensure that the modification of the "fString" field has completed
- fVM.resume();
- waitUntilReady();
-
- // Remove the modification watchpoint request
- fVM.eventRequestManager().deleteEventRequest(fWatchpointRequest);
-
- // Set the value of the "fString" field back to its original value
- resetStaticField();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ModificationWatchpointEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.ModificationWatchpointEvent";
- }
- /**
- * Test JDI valueToBe().
- */
- public void testJDIValueToBe() {
- assertEquals(
- "1",
- "Hello Universe",
- ((StringReference) fWatchpointEvent.valueToBe()).value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NotYetImplementedException.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NotYetImplementedException.java
deleted file mode 100644
index 65cba62..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NotYetImplementedException.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-public class NotYetImplementedException extends RuntimeException {
- /**
- * NotYetImplemented constructor comment.
- */
- public NotYetImplementedException() {
- super();
- }
- /**
- * NotYetImplemented constructor comment.
- * @param s java.lang.String
- */
- public NotYetImplementedException(String s) {
- super(s);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NullConsoleReader.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NullConsoleReader.java
deleted file mode 100644
index 9067ea2..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/NullConsoleReader.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-/**
- * A null console reader that continuously reads from the VM input stream
- * so that the VM doesn't block when the program writes to the stout.
- */
-
-public class NullConsoleReader extends AbstractReader {
- private InputStream fInput;
- /*
- * Creates a new console reader that will read from the given input stream.
- */
- public NullConsoleReader(String name, InputStream input) {
- super(name);
- fInput = input;
- }
- /**
- * Continuously reads events that are coming from the event queue.
- */
- protected void readerLoop() {
- java.io.BufferedReader input =
- new BufferedReader(new InputStreamReader(fInput));
- try {
- int read = 0;
- while (!fIsStopping && read != -1) {
- read = input.read();
- }
- } catch (IOException e) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java
deleted file mode 100644
index 3206d76..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-
-import junit.framework.Test;
-
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Field;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.IntegerValue;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.Value;
-import com.sun.jdi.event.ThreadStartEvent;
-
-/**
- * Tests for JDI com.sun.jdi.ObjectReference
- * and JDWP Object command set.
- */
-public class ObjectReferenceTest extends AbstractJDITest {
-
- private ObjectReference fObject;
-
- /**
- * Creates a new test.
- */
- public ObjectReferenceTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Make sure the object is in expected state (eg. it has not entered a monitor)
- waitUntilReady();
-
- // Get static field "fObject"
- fObject = getObjectReference();
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has resumed and suspended the Test Thread. Make sure this
- // thread is suspended at the right location
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ObjectReferenceTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ObjectReference";
- }
- /**
- * Returns all tests
- */
- protected Test suite() {
- JDITestSuite suite = (JDITestSuite) super.suite();
- Vector testNames = getAllMatchingTests("testLast");
- Iterator iterator = testNames.iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
- suite.addTest(new JDITestCase(this, name));
- }
- return suite;
- }
- /**
- * Test JDI disableCollection(). enableCollection() and isCollected().
- */
- public void testJDIDisableEnableCollection() {
- assertTrue("1", !fObject.isCollected());
- fObject.disableCollection();
- fObject.enableCollection();
- }
- /**
- * Test JDI entryCount().
- */
- public void testJDIEntryCount() {
- if (fVM.canGetMonitorInfo()) {
- // Ensure we're in a good state
- fVM.resume();
- waitUntilReady();
-
- try {
- assertEquals("1", 1, fObject.entryCount());
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fObject.equals(fObject));
- ObjectReference other = getThread();
- assertTrue("2", !fObject.equals(other));
- assertTrue("3", !fObject.equals(new Object()));
- assertTrue("4", !fObject.equals(null));
- assertTrue("5", fObject.hashCode() != other.hashCode());
- }
- /**
- * Test JDI getValue(Field), getValues(List) and setValue(Field,Value)
- * and JDWP 'Object - Get Fields Values' and 'Object - Set Fields Values'.
- */
- public void testJDIGetSetValues() {
- // setup
- ReferenceType type = fObject.referenceType();
- List fields = type.fields();
- ListIterator iterator = fields.listIterator();
- List instanceFields = new LinkedList();
- while (iterator.hasNext()) {
- Field field = (Field) iterator.next();
- if (!field.isStatic())
- instanceFields.add(field);
- }
- Field field = (Field) instanceFields.get(4);
- assertEquals("1", "fChar", field.name());
-
- // getValues(List)
- Map values = fObject.getValues(instanceFields);
- assertTrue("2", values.size() == 7);
- Value value = (Value) values.get(field);
- assertEquals("3", value, fVM.mirrorOf('a'));
-
- // setValue(Field,Value)
- Value newValue = fVM.mirrorOf('b');
- try {
- fObject.setValue(field, newValue);
- } catch (ClassNotLoadedException e) {
- assertTrue("4.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("4.2", false);
- }
-
- // getValue(Field)
- assertEquals("5", fObject.getValue(field), newValue);
-
- // test set and get null value.
- field = (Field) instanceFields.get(5);
-
- assertEquals("6", "fString2", field.name());
- try {
- fObject.setValue(field, null);
- } catch (ClassNotLoadedException e) {
- assertTrue("7.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("7.2", false);
- }
-
- // getValue(Field)
- assertEquals("8", fObject.getValue(field), null);
-
- // test get final value.
- field = (Field) instanceFields.get(6);
- assertEquals("9", "fString3", field.name());
-
- // The value is null and should be because it's final
- //assertEquals("10", fVM.mirrorOf("HEY"), fObject.getValue(field));
-
- }
- /**
- * Test JDI invokeMethod.
- */
- public void testJDIInvokeMethod() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
- waitUntilReady();
-
- ThreadStartEvent event =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- false);
- ThreadReference thread = event.thread();
- ClassType ct = (ClassType) fObject.referenceType();
- Method inv =
- ct.concreteMethodByName("invoke3", "(Ljava/lang/String;Ljava/lang/Object;)I");
- List args = new ArrayList();
- args.add(fVM.mirrorOf("888"));
- args.add(null);
- Exception oops = null;
- Value val = null;
- try {
- val = fObject.invokeMethod(thread, inv, args, 0);
- } catch (ClassNotLoadedException exc) {
- oops = exc;
- } catch (IncompatibleThreadStateException exc) {
- oops = exc;
- } catch (InvalidTypeException exc) {
- oops = exc;
- } catch (InvocationException exc) {
- oops = exc;
- }
- assertTrue("1", oops == null);
- assertEquals("2", val == null ? 0 : ((IntegerValue) val).value(), 888);
- }
- /**
- * Test JDI invokeMethod - failure.
- */
- public void testJDIInvokeMethodFail() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
- waitUntilReady();
-
- ThreadStartEvent event =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- false);
- ThreadReference thread = event.thread();
- ClassType ct = (ClassType) fObject.referenceType();
- Method inv = ct.concreteMethodByName("invoke4", "()J");
- Exception good = null, oops = null;
- try {
- fObject.invokeMethod(thread, inv, new ArrayList(), 0);
- } catch (ClassNotLoadedException exc) {
- oops = exc;
- } catch (IncompatibleThreadStateException exc) {
- oops = exc;
- } catch (InvalidTypeException exc) {
- oops = exc;
- } catch (InvocationException exc) {
- good = exc;
- }
- assertTrue("1", oops == null);
- assertTrue("2", good != null);
- }
- /**
- * Test JDI owningThread().
- */
- public void testJDIOwningThread() {
- if (fVM.canGetMonitorInfo()) {
- // Ensure we're in a good state
- fVM.resume();
- waitUntilReady();
-
- try {
- assertEquals("1", getThread(), fObject.owningThread());
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- }
- /**
- * Test JDI referenceType() and JDWP 'Type - Get type'.
- */
- public void testJDIReferenceType() {
- ReferenceType type = fObject.referenceType();
- assertEquals("1", type.name(), "org.eclipse.debug.jdi.tests.program.MainClass");
- }
- /**
- * Test JDI uniqueID().
- */
- public void testJDIUniqueID() {
- fObject.uniqueID();
- }
- /**
- * Test JDI waitingThreads().
- */
- public void testJDIWaitingThreads() {
- if (fVM.canGetMonitorInfo()) {
- try {
- assertEquals("1", 0, fObject.waitingThreads().size());
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/PrimitiveValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/PrimitiveValueTest.java
deleted file mode 100644
index 6784cbd..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/PrimitiveValueTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.PrimitiveValue;
-
-/**
- * Tests for JDI com.sun.jdi.PrimitiveValue.
- */
-public class PrimitiveValueTest extends AbstractJDITest {
-
- private PrimitiveValue fBoolean,
- fByte,
- fChar,
- fDouble,
- fFloat,
- fInt,
- fLong,
- fShort;
- /**
- * Creates a new test.
- */
- public PrimitiveValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get all kinds of prinitive values
- fBoolean = fVM.mirrorOf(true);
- fByte = fVM.mirrorOf((byte) 1);
- fChar = fVM.mirrorOf('a');
- fDouble = fVM.mirrorOf(12345.6789);
- fFloat = fVM.mirrorOf(12345.6789f);
- fInt = fVM.mirrorOf(12345);
- fLong = fVM.mirrorOf(123456789l);
- fShort = fVM.mirrorOf((short) 12345);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new PrimitiveValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.PrimitiveValue";
- }
- /**
- * Test JDI booleanValue().
- */
- public void testJDIBooleanValue() {
- assertTrue("1", fBoolean.booleanValue());
- assertTrue("2", fByte.booleanValue());
- assertTrue("3", fChar.booleanValue());
- assertTrue("4", fDouble.booleanValue());
- assertTrue("5", fFloat.booleanValue());
- assertTrue("6", fInt.booleanValue());
- assertTrue("7", fLong.booleanValue());
- assertTrue("8", fShort.booleanValue());
- }
- /**
- * Test JDI byteValue().
- */
- public void testJDIByteValue() {
- assertEquals("1", (byte) 1, fBoolean.byteValue());
- assertEquals("2", (byte) 1, fByte.byteValue());
- assertEquals("3", (byte) 97, fChar.byteValue());
- assertEquals("4", (byte) 57, fDouble.byteValue());
- assertEquals("5", (byte) 57, fFloat.byteValue());
- assertEquals("6", (byte) 57, fInt.byteValue());
- assertEquals("7", (byte) 21, fLong.byteValue());
- assertEquals("8", (byte) 57, fShort.byteValue());
- }
- /**
- * Test JDI charValue().
- */
- public void testJDICharValue() {
- assertEquals("1", (char) 1, fBoolean.charValue());
- assertEquals("2", (char) 1, fByte.charValue());
- assertEquals("3", 'a', fChar.charValue());
- assertEquals("4", (char) 12345, fDouble.charValue());
- assertEquals("5", (char) 12345, fFloat.charValue());
- assertEquals("6", (char) 12345, fInt.charValue());
- assertEquals("7", (char) 52501, fLong.charValue());
- assertEquals("8", (char) 12345, fShort.charValue());
- }
- /**
- * Test JDI doubleValue().
- */
- public void testJDIDoubleValue() {
- assertEquals("1", 1, fBoolean.doubleValue(), 0);
- assertEquals("2", 1, fByte.doubleValue(), 0);
- assertEquals("3", 97, fChar.doubleValue(), 0);
- assertEquals("4", 12345.6789, fDouble.doubleValue(), 0);
- assertEquals("5", 12345.6789, fFloat.doubleValue(), 0.001);
- assertEquals("6", 12345, fInt.doubleValue(), 0);
- assertEquals("7", 123456789, fLong.doubleValue(), 0);
- assertEquals("8", 12345, fShort.doubleValue(), 0);
- }
- /**
- * Test JDI floatValue().
- */
- public void testJDIFloatValue() {
- assertEquals("1", 1, fBoolean.floatValue(), 0);
- assertEquals("2", 1, fByte.floatValue(), 0);
- assertEquals("3", 97, fChar.floatValue(), 0);
- assertEquals("4", 12345.6789f, fDouble.floatValue(), 0);
- assertEquals("5", 12345.6789f, fFloat.floatValue(), 0.001);
- assertEquals("6", 12345, fInt.floatValue(), 0);
- assertEquals("7", 123456789, fLong.floatValue(), 100);
- assertEquals("8", 12345, fShort.floatValue(), 0);
- }
- /**
- * Test JDI intValue().
- */
- public void testJDIIntValue() {
- assertEquals("1", 1, fBoolean.intValue());
- assertEquals("2", 1, fByte.intValue());
- assertEquals("3", 97, fChar.intValue());
- assertEquals("4", 12345, fDouble.intValue());
- assertEquals("5", 12345, fFloat.intValue());
- assertEquals("6", 12345, fInt.intValue());
- assertEquals("7", 123456789, fLong.intValue());
- assertEquals("8", 12345, fShort.intValue());
- }
- /**
- * Test JDI longValue().
- */
- public void testJDILongValue() {
- assertEquals("1", 1l, fBoolean.longValue());
- assertEquals("2", 1l, fByte.longValue());
- assertEquals("3", 97l, fChar.longValue());
- assertEquals("4", 12345l, fDouble.longValue());
- assertEquals("5", 12345l, fFloat.longValue());
- assertEquals("6", 12345l, fInt.longValue());
- assertEquals("7", 123456789l, fLong.longValue());
- assertEquals("8", 12345l, fShort.longValue());
- }
- /**
- * Test JDI shortValue().
- */
- public void testJDIShortValue() {
- assertEquals("1", 1, fBoolean.shortValue());
- assertEquals("2", 1, fByte.shortValue());
- assertEquals("3", 97, fChar.shortValue());
- assertEquals("4", 12345, fDouble.shortValue());
- assertEquals("5", 12345, fFloat.shortValue());
- assertEquals("6", 12345, fInt.shortValue());
- assertEquals("7", -13035, fLong.shortValue());
- assertEquals("8", 12345, fShort.shortValue());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java
deleted file mode 100644
index 01a6a95..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.jdi.tests;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import com.sun.jdi.Field;
-import com.sun.jdi.IntegerValue;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-
-/**
- * Tests for JDI com.sun.jdi.ReferenceType
- * and JDWP Type command set.
- */
-public class ReferenceTypeTest extends AbstractJDITest {
-
- private List fTypes = new LinkedList();
-
- // These must match what is done in localSetUp
- private boolean[] fSystemClassLoader = { true, true, false, false };
- private boolean[] fHasMethods = { true, false, true, true };
- private boolean[] fIsAbstract = { false, false, false, true };
- private boolean[] fIsFinal = { false, true, false, false };
- private boolean[] fIsStatic = { false, false, false, false };
- private String[] fTypeName =
- {
- "java.lang.Object",
- "java.lang.String[]",
- "org.eclipse.debug.jdi.tests.program.MainClass",
- "org.eclipse.debug.jdi.tests.program.Printable" };
- private int fObjectIndex = 0;
- private int fMainClassIndex = 2;
-
- /**
- * Creates a new test.
- */
- public ReferenceTypeTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get all kinds of reference type
- fTypes.add(getSystemType());
- fTypes.add(getArrayType());
- fTypes.add(getMainClass());
- fTypes.add(getInterfaceType());
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ReferenceTypeTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ReferenceType";
- }
- /**
- * Test JDI allFields().
- */
- public void testJDIAllFields() {
- Iterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- Iterator all = type.allFields().iterator();
- int i = 0;
- while (all.hasNext())
- assertTrue("1." + type.name() + "." + i++, all.next() instanceof Field);
- }
- }
- /**
- * Test JDI allMethods().
- */
- public void testJDIAllMethods() {
- Iterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- Iterator all = type.allMethods().iterator();
- int i = 0;
- while (all.hasNext())
- assertTrue("1." + type.name() + "." + i++, all.next() instanceof Method);
- }
- }
- /**
- * Test JDI classLoader() and JDWP 'Type - Get class loader'.
- */
- public void testJDIClassLoader() {
- for (int i = 0; i < fTypes.size(); ++i) {
- ReferenceType type = (ReferenceType) fTypes.get(i);
- ObjectReference classLoader = type.classLoader();
- assertTrue("1." + i, (classLoader == null) == fSystemClassLoader[i]);
- }
- }
- /**
- * Test JDI classObject().
- */
- public void testJDIClassObject() {
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- assertTrue(type.name(), type.classObject() instanceof ObjectReference);
- }
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- ReferenceType other =
- (ReferenceType) fVM.classesByName("java.lang.String").get(0);
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- assertTrue("1." + type.name() + ".1", type.equals(type));
- assertTrue("1." + type.name() + ".2", !type.equals(other));
- assertTrue("1." + type.name() + ".3", !type.equals(fVM));
- assertTrue("1." + type.name() + ".4", !type.equals(new Object()));
- assertTrue("1." + type.name() + ".5", !type.equals(null));
- assertTrue("1." + type.name() + ".6", type.hashCode() != other.hashCode());
- }
- }
- /**
- * Test JDI failedToInitialize().
- */
- public void testJDIFailedToInitialize() {
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- assertTrue("1." + type.name(), !type.failedToInitialize());
- }
- }
- /**
- * Test JDI fieldByName(String).
- */
- public void testJDIFieldByName() {
- // NB: This tests the class type only, it should test the others too
- ReferenceType type = (ReferenceType) fTypes.get(fMainClassIndex);
- Field field = type.fieldByName("fObject");
- assertTrue("1." + type.name(), field != null);
- }
- /**
- * Test JDI fields() and JDWP 'Type - Get Fields'.
- */
- public void testJDIFields() {
- Iterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- Iterator fields = type.fields().iterator();
- int i = 0;
- while (fields.hasNext())
- assertTrue("1." + i++ +"." + type.name(), fields.next() instanceof Field);
- }
- }
- /**
- * Test JDI getValue(Field) and JDWP 'Type - Get Fields Values'.
- */
- public void testJDIGetValue() {
- // NB: This tests the class type only, it should test the others too
- ReferenceType type = (ReferenceType) fTypes.get(fMainClassIndex);
- Field field = type.fieldByName("fInt");
- assertTrue("1." + type.name(), field != null);
- assertTrue("2." + type.name(), type.getValue(field) instanceof IntegerValue);
- }
- /**
- * Test JDI getValues(List) and JDWP 'Type - Get Fields Values'.
- */
- public void testJDIGetValues() {
- // NB: This tests the class type only, it should test the others too
- ReferenceType type = (ReferenceType) fTypes.get(fMainClassIndex);
-
- // Get field values
- List fields = type.fields();
- ListIterator iterator = fields.listIterator();
- List staticFields = new LinkedList();
- while (iterator.hasNext()) {
- Field field = (Field) iterator.next();
- if (field.isStatic())
- staticFields.add(field);
- }
- Map values = type.getValues(staticFields);
- assertEquals("1." + type.name(), 24, values.size());
-
- // Get value of field fInt in MainClass
- Field field = (Field) staticFields.get(0);
- int i = 0;
- while (!field.name().equals("fInt"))
- field = (Field) staticFields.get(++i);
-
- // Ensure it is an integer value
- assertTrue("2." + type.name(), values.get(field) instanceof IntegerValue);
- }
- /**
- * Test JDI isAbstract().
- */
- public void testJDIIsAbstract() {
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- if (type.name().equals("org.eclipse.debug.jdi.tests.program.Printable"))
- assertTrue("1." + type.name(), type.isAbstract());
- else
- assertTrue("2." + type.name(), !type.isAbstract());
- }
- }
- /**
- * Test JDI isFinal().
- */
- public void testJDIIsFinal() {
- for (int i = 0; i < fTypes.size(); ++i) {
- ReferenceType type = (ReferenceType) fTypes.get(i);
- assertTrue("1." + i, type.isFinal() == fIsFinal[i]);
- }
- }
- /**
- * Test JDI isInitialized().
- */
- public void testJDIIsInitialized() {
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- assertTrue("1." + type.name(), type.isInitialized());
- }
- }
- /**
- * Test JDI isPrepared().
- */
- public void testJDIIsPrepared() {
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- assertTrue("1." + type.name(), type.isPrepared());
- }
- }
- /**
- * Test JDI isStatic().
- */
- public void testJDIIsStatic() {
- ListIterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- assertTrue("1." + type.name(), !type.isStatic());
- }
- }
- /**
- * Test JDI isVerified().
- */
- public void testJDIIsVerified() {
- for (int i = 0; i < fTypes.size(); ++i) {
- if (i != fObjectIndex) {
- ReferenceType type = (ReferenceType) fTypes.get(i);
- assertTrue("1." + type.name(), type.isVerified());
- }
- }
- }
- /**
- * Test JDI methods() and JDWP 'Type - Get Methods'.
- */
- public void testJDIMethods() {
- for (int i = 0; i < fTypes.size(); ++i) {
- ReferenceType type = (ReferenceType) fTypes.get(i);
- List methods = type.methods();
- assertTrue("" + i, (methods.size() != 0) == fHasMethods[i]);
- }
- }
- /**
- * Test JDI methodsByName(String) and methodsByName(String, String).
- */
- public void testJDIMethodsByName() {
- Iterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
-
- // methodsByName(String)
- Iterator methods = type.methodsByName("run").iterator();
- while (methods.hasNext())
- assertTrue("1." + type.name(), methods.next() instanceof Method);
- assertEquals("2", 0, type.methodsByName("fraz").size());
-
- // methodsByName(String, String)
- methods = type.methodsByName("run", "()V").iterator();
- while (methods.hasNext())
- assertTrue("3." + type.name(), methods.next() instanceof Method);
- assertEquals("4", 0, type.methodsByName("fraz", "()Z").size());
- }
- }
- /**
- * Test JDI isAbstract(), isFinal() and isStatic()
- * and JDWP 'Type - Get modifiers'.
- */
- public void testJDIModifiers() {
- for (int i = 0; i < fTypes.size(); ++i) {
- ReferenceType type = (ReferenceType) fTypes.get(i);
- if (i != 2) {
- // i == 2 corresponds to an ArrayType, isAbstract() is undefined
- assertTrue("1." + i, type.isAbstract() == fIsAbstract[i]);
- }
- assertTrue("2." + i, type.isFinal() == fIsFinal[i]);
- assertTrue("3." + i, type.isStatic() == fIsStatic[i]);
- }
- }
- /**
- * Test JDI name() and JDWP 'Type - Get signature'.
- */
- public void testJDIName() {
- for (int i = 0; i < fTypes.size(); ++i) {
- ReferenceType type = (ReferenceType) fTypes.get(i);
- assertEquals("" + i, type.name(), fTypeName[i]);
- }
- }
- /**
- * Test JDI nestedTypes().
- */
- public void testJDINestedTypes() {
- // NB: This tests the class type only, it should test the others too
- ReferenceType type = getClass("org.eclipse.debug.jdi.tests.program.OtherClass");
- assertTrue("1." + type.name(), type != null);
- List nestedTypes = type.nestedTypes();
- assertEquals("2." + type.name(), 1, nestedTypes.size());
- assertTrue("3." + type.name(), nestedTypes.get(0) instanceof ReferenceType);
- }
- /**
- * Test JDI visibleFields().
- */
- public void testJDIVisibleFields() {
- Iterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- List all = type.allFields();
- Iterator visible = type.visibleFields().iterator();
- while (visible.hasNext()) {
- Field next = (Field) visible.next();
- assertTrue("1." + type.name() + "." + next.name(), all.contains(next));
- }
- }
- }
- /**
- * Test JDI visibleMethods().
- */
- public void testJDIVisibleMethods() {
- Iterator iterator = fTypes.listIterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- List all = type.allMethods();
- Iterator visible = type.visibleMethods().iterator();
- while (visible.hasNext()) {
- Method next = (Method) visible.next();
- assertTrue("1." + type.name() + "." + next.name(), all.contains(next));
- }
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java
deleted file mode 100644
index 2184e66..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ShortValue;
-
-/**
- * Tests for JDI com.sun.jdi.ShortValue.
- */
-public class ShortValueTest extends AbstractJDITest {
-
- private ShortValue fValue;
- /**
- * Creates a new test.
- */
- public ShortValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get short value for 12345
- fValue = fVM.mirrorOf((short) 12345);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ShortValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ShortValue";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- assertTrue("1", fValue.equals(fVM.mirrorOf((short) 12345)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf((short) 54321)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
- assertEquals(
- "5",
- fValue.hashCode(),
- fVM.mirrorOf((short) 12345).hashCode());
- assertTrue(
- "6",
- fValue.hashCode() != fVM.mirrorOf((short) 54321).hashCode());
- }
- /**
- * Test JDI value().
- */
- public void testJDIValue() {
- assertTrue("1", (short) 12345 == fValue.value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java
deleted file mode 100644
index 13d0133..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.LocalVariable;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.StackFrame;
-import com.sun.jdi.ThreadReference;
-
-/**
- * Tests for JDI com.sun.jdi.StackFrame.
- */
-public class StackFrameTest extends AbstractJDITest {
-
- private StackFrame fFrame;
- /**
- * Creates a new test.
- */
- public StackFrameTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get the frame running MainClass.run()
- fFrame = getFrame(RUN_FRAME_OFFSET);
-
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new StackFrameTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.StackFrame";
- }
- /**
- * Test JDI equals() and hashCode().
- */
- public void testJDIEquality() {
- StackFrame sameFrame = getFrame(RUN_FRAME_OFFSET);
- StackFrame otherFrame = getFrame(0);
-
- // Not identical
- assertTrue("1", fFrame != sameFrame);
- // But equal
- assertTrue("2", fFrame.equals(sameFrame));
- assertTrue("3", fFrame.hashCode() == sameFrame.hashCode());
-
- assertTrue("4", fFrame.equals(fFrame));
- assertTrue("5", fFrame.hashCode() == fFrame.hashCode());
-
- assertTrue("6", !fFrame.equals(otherFrame));
-
- assertTrue("7", !fFrame.equals(new Object()));
- assertTrue("8", !fFrame.equals(null));
- }
- /**
- * Test JDI location().
- */
- public void testJDILocation() {
- assertNotNull("1", fFrame.location());
- }
- /**
- * Test JDI setValue(LocalVariable, Value), getValue(LocalVariable) and
- * getValues(List).
- */
- public void testJDISetGetValue() {
- // setValue
- ThreadReference thread = (ThreadReference) fVM.allThreads().get(0);
- LocalVariable var = getLocalVariable();
- try {
- fFrame.setValue(var, thread);
- } catch (ClassNotLoadedException e) {
- assertTrue("1.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("1.2", false);
- }
-
- // getValue(LocalVariable)
- ThreadReference value =
- (ThreadReference) fFrame.getValue(getLocalVariable());
- assertEquals("2", thread, value);
-
- // getValues(List)
- List vars = new LinkedList();
- vars.add(var);
- Map values = fFrame.getValues(vars);
- value = (ThreadReference) values.get(var);
- assertEquals("3", thread, value);
-
- // test null value
- var = getLocalVariable();
- try {
- fFrame.setValue(var, null);
- } catch (ClassNotLoadedException e) {
- assertTrue("4.1", false);
- } catch (InvalidTypeException e) {
- assertTrue("4.2", false);
- }
-
- value = (ThreadReference) fFrame.getValue(getLocalVariable());
- assertEquals("5", null, value);
-
- }
- /**
- * Test JDI thisObject().
- */
- public void testJDIThisObject() {
- ObjectReference object = fFrame.thisObject();
- ReferenceType expected = getMainClass();
- ReferenceType referenceType = object.referenceType();
- assertEquals("1", expected, referenceType);
- }
- /**
- * Test JDI thread().
- */
- public void testJDIThread() {
- assertEquals("1", getThread(), fFrame.thread());
- }
- /**
- * Test JDI visibleVariableByName(String).
- */
- public void testJDIVisibleVariableByName() {
- LocalVariable var = null;
- try {
- var = fFrame.visibleVariableByName("t");
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", getLocalVariable(), var);
- try {
- var = fFrame.visibleVariableByName("bogus");
- } catch (AbsentInformationException e) {
- assertTrue("3", false);
- }
- assertTrue("4", null == var);
- }
- /**
- * Test JDI visibleVariables().
- */
- public void testJDIVisibleVariables() {
- List vars = null;
- try {
- vars = fFrame.visibleVariables();
- } catch (AbsentInformationException e) {
- assertTrue("1", false);
- }
- assertEquals("2", 2, vars.size());
-
- LocalVariable var;
- int i = 0;
- do {
- var = (LocalVariable) vars.get(i++);
- } while (!var.name().equals("t"));
- assertEquals("3", getLocalVariable(), var);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java
deleted file mode 100644
index 78ea55a..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ClassType;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.event.StepEvent;
-import com.sun.jdi.request.EventRequest;
-import com.sun.jdi.request.StepRequest;
-
-/**
- * Tests for JDI com.sun.jdi.event.StepEvent.
- */
-public class StepEventTest extends AbstractJDITest {
-
- private StepEvent fStepEvent;
- /**
- * Creates a new test.
- */
- public StepEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Trigger a step event
- fStepEvent = triggerStepAndWait();
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has resumed the test thread, so suspend it
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new StepEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.StepEvent";
- }
- /**
- * Test JDI thread().
- */
- public void testJDIThread() {
- assertEquals("1", "Test Thread", fStepEvent.thread().name());
- }
- /**
- * Test all possible steps.
- */
- public void testJDIVariousSteps() {
- ThreadReference thread = getThread();
- triggerStepAndWait(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO);
- waitUntilReady();
- triggerStepAndWait(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER);
- waitUntilReady();
- triggerStepAndWait(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO);
- waitUntilReady();
- triggerStepAndWait(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);
- waitUntilReady();
- triggerStepAndWait(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT);
- waitUntilReady();
- }
-
- public void testJDIClassFilter1() {
- // Request for step events
- StepRequest request = getRequest();
- request.addClassFilter("java.lang.NegativeArraySizeException");
- request.enable();
- StepEvent event = null;
- try {
- event = triggerStepAndWait(getThread(), request, 1000);
- } catch (Error e) {
- }
- if (event != null) {
- assertTrue("1", false);
- }
- waitUntilReady();
- fVM.eventRequestManager().deleteEventRequest(request);
-
- request = getRequest();
- request.addClassFilter("java.lang.*");
- request.enable();
- event = null;
- try {
- event = triggerStepAndWait(getThread(), request, 1000);
- } catch (Error e) {
- }
- if (event != null) {
- assertTrue("1", false);
- }
- waitUntilReady();
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIClassFilter2() {
- // Request for step events
- StepRequest request = getRequest();
- ClassType clazz = getClass("java.lang.NegativeArraySizeException");
- request.addClassFilter(clazz);
- request.enable();
- StepEvent event = null;
- try {
- event = triggerStepAndWait(getThread(), request, 1000);
- } catch (Error e) {
- }
- if (event != null) {
- assertTrue("1", false);
- }
- waitUntilReady();
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIClassExclusionFilter1() {
- // Request for step events
- StepRequest request = getRequest();
- request.addClassExclusionFilter(
- "org.eclipse.debug.jdi.tests.program.MainClass");
- request.enable();
- StepEvent event = null;
- try {
- event = triggerStepAndWait(getThread(), request, 1000);
- } catch (Error e) {
- }
- if (event != null) {
- assertTrue("1", false);
- }
- waitUntilReady();
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public void testJDIClassExclusionFilter2() {
- StepRequest request = getRequest();
- request.addClassExclusionFilter("org.eclipse.*");
- request.addClassExclusionFilter("java.lang.*");
- request.enable();
- StepEvent event = null;
- try {
- event = triggerStepAndWait(getThread(), request, 1000);
- } catch (Error e) {
- }
- if (event != null) {
- System.out.println(event.location().declaringType());
- assertTrue("1", false);
- }
- waitUntilReady();
- fVM.eventRequestManager().deleteEventRequest(request);
- }
-
- public StepRequest getRequest() {
- StepRequest eventRequest =
- fVM.eventRequestManager().createStepRequest(
- getThread(),
- StepRequest.STEP_LINE,
- StepRequest.STEP_OVER);
- eventRequest.addCountFilter(1);
- eventRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
- return eventRequest;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StringReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StringReferenceTest.java
deleted file mode 100644
index e245a22..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StringReferenceTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.StringReference;
-
-/**
- * Tests for JDI com.sun.jdi.StringReference
- * and JDWP String command set.
- */
-public class StringReferenceTest extends AbstractJDITest {
-
- private StringReference fString;
- /**
- * Creates a new test.
- */
- public StringReferenceTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get static field "fString"
- fString = getStringReference();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new StringReferenceTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.StringReference";
- }
- /**
- * Test JDI value() and JDWP 'String - Get value'.
- */
- public void testJDIValue() {
- String value = fString.value();
- assertEquals("1", "Hello World", value);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TestAll.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TestAll.java
deleted file mode 100644
index 4584c4d..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TestAll.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * Run all tests
- */
-public class TestAll {
-/**
- * Returns all the test case classes (a Vector of Class) that are
- * relevant for the given VM information.
- * NB1: This doesn't include the VirtualMachineTest class.
- * NB2: The last element must be the VMDeathEventTest class since
- * it shuts the VM down.
- */
-protected static Vector getAllTestCases(VMInformation info) {
- Vector classes = new Vector();
- classes.addElement(AccessibleTest.class);
- classes.addElement(ArrayReferenceTest.class);
- classes.addElement(ArrayTypeTest.class);
- classes.addElement(BooleanValueTest.class);
- classes.addElement(BreakpointRequestTest.class);
- classes.addElement(ByteValueTest.class);
- classes.addElement(CharValueTest.class);
- classes.addElement(ClassLoaderReferenceTest.class);
- classes.addElement(ClassPrepareEventTest.class);
- classes.addElement(ClassPrepareRequestTest.class);
- classes.addElement(ClassTypeTest.class);
- classes.addElement(DoubleValueTest.class);
- classes.addElement(EventRequestManagerTest.class);
- classes.addElement(EventRequestTest.class);
- classes.addElement(EventTest.class);
- classes.addElement(ExceptionEventTest.class);
- classes.addElement(ExceptionRequestTest.class);
- classes.addElement(FieldTest.class);
- classes.addElement(FloatValueTest.class);
- classes.addElement(HotCodeReplacementTest.class);
- classes.addElement(IntegerValueTest.class);
- classes.addElement(InterfaceTypeTest.class);
- classes.addElement(LocalVariableTest.class);
- classes.addElement(LocatableTest.class);
- classes.addElement(LocationTest.class);
- classes.addElement(LongValueTest.class);
- classes.addElement(MethodTest.class);
- classes.addElement(MethodEntryRequestTest.class);
- classes.addElement(MethodExitRequestTest.class);
- classes.addElement(MirrorTest.class);
-
- if (info.fVM.canWatchFieldModification())
- classes.addElement(ModificationWatchpointEventTest.class);
-
- classes.addElement(ObjectReferenceTest.class);
- classes.addElement(PrimitiveValueTest.class);
- classes.addElement(ReferenceTypeTest.class);
- classes.addElement(ShortValueTest.class);
- classes.addElement(StackFrameTest.class);
- classes.addElement(StepEventTest.class);
- classes.addElement(StringReferenceTest.class);
- classes.addElement(ThreadDeathEventTest.class);
- classes.addElement(ThreadGroupReferenceTest.class);
- classes.addElement(ThreadReferenceTest.class);
- classes.addElement(ThreadStartEventTest.class);
- classes.addElement(TypeComponentTest.class);
- classes.addElement(TypeTest.class);
- classes.addElement(ValueTest.class);
-
- if (info.fVM.canWatchFieldAccess() && info.fVM.canWatchFieldModification()) {
- classes.addElement(WatchpointEventTest.class);
- classes.addElement(WatchpointRequestTest.class);
- }
-
- classes.addElement(VirtualMachineExitTest.class);
- classes.addElement(VMDisconnectEventTest.class);
- classes.addElement(VMDisposeTest.class); // note that this test does not restore the state properly.
- return classes;
-}
-/**
- * Run all tests with the given arguments.
- * @see AbstractJDITest.parseArgs(String[]) for details on the arguments.
- */
-public static void main(String[] arguments) throws Throwable {
- // Create test result
- TextTestResult result= new TextTestResult();
-
- // Run the VirtualMachineTest
- AbstractJDITest test= run(result, VirtualMachineTest.class, arguments, null);
-
- // Was it possible to run the first test?
- if (test == null)
- return;
-
- // Get the VM info
- VMInformation info = test.getVMInfo();
-
- // Get all test cases
- Vector classes= getAllTestCases(info);
-
- // Run the other tests
- Enumeration enumeration= classes.elements();
- while (enumeration.hasMoreElements()) {
- Class testClass= (Class)enumeration.nextElement();
- test= run(result, testClass, arguments, info);
- info= test.getVMInfo(); // In case the test has changed this info
- }
-
- // Shut down the VM
- test.shutDownTarget();
-
- // Show the result
- result.print();
-}
-/**
- * Runs the given test with the given arguments.
- * Returns the instance that was created.
- * Returns null if there was a problem with the arguments.
- * @see AbstractJDITest(String[]) for details on the arguments.
- */
-private static AbstractJDITest run(junit.framework.TestResult result, Class testClass, String[] arguments, VMInformation info) throws Throwable {
- // Create test
- Class[] argTypes= {};
- Constructor construct = null;
- try {
- construct = testClass.getConstructor(argTypes);
- } catch (NoSuchMethodException e) {
- }
- AbstractJDITest test = null;
- try {
- test = (AbstractJDITest) construct.newInstance(new Object[]{});
- } catch (InstantiationException e) {
- } catch (IllegalAccessException e) {
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- if (!AbstractJDITest.parseArgs(arguments))
- return null;
- test.setVMInfo(info);
- test.setInControl(false);
-
- // Run test
- System.out.println("\n" + new java.util.Date());
- System.out.println("Begin testing " + test.getName() + "...");
- long startTime= System.currentTimeMillis();
- test.suite().run(result);
- long endTime= System.currentTimeMillis();
- long runTime= endTime-startTime;
- System.out.println("\nTime: "+runTime/1000+"."+runTime%1000);
- System.out.println("Done testing " + test.getName() + ".");
-
- return test;
-}
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TextTestResult.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TextTestResult.java
deleted file mode 100644
index efa2dbb..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TextTestResult.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.Enumeration;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestFailure;
-import junit.framework.TestResult;
-
-class TextTestResult extends TestResult {
-
- public synchronized void addError(Test test, Throwable t) {
- super.addError(test, t);
- System.out.println("E");
- }
- public synchronized void addFailure(Test test, AssertionFailedError t) {
- super.addFailure(test, t);
- System.out.print("F");
- }
- /**
- * Prints failures to the standard output
- */
- public synchronized void print() {
- printHeader();
- printErrors();
- printFailures();
- }
- /**
- * Prints the errors to the standard output
- */
- public void printErrors() {
- if (errorCount() != 0) {
- if (errorCount() == 1)
- System.out.println("There was " + errorCount() + " error:");
- else
- System.out.println("There were " + errorCount() + " errors:");
-
- int i = 1;
- for (Enumeration e = errors(); e.hasMoreElements(); i++) {
- TestFailure failure = (TestFailure) e.nextElement();
- System.out.println(i + ") " + failure.failedTest());
- failure.thrownException().printStackTrace();
- System.out.println();
- }
- }
- }
- /**
- * Prints failures to the standard output
- */
- public void printFailures() {
- if (failureCount() != 0) {
- if (failureCount() == 1)
- System.out.println("There was " + failureCount() + " failure:");
- else
- System.out.println(
- "There were " + failureCount() + " failures:");
-
- int i = 1;
- for (Enumeration e = failures(); e.hasMoreElements(); i++) {
- TestFailure failure = (TestFailure) e.nextElement();
- System.out.print(i + ") " + failure.failedTest());
- Throwable t = failure.thrownException();
- if (t.getMessage() != null)
- System.out.println(" \"" + t.getMessage() + "\"");
- else {
- System.out.println();
- failure.thrownException().printStackTrace();
- }
- }
- }
- }
- /**
- * Prints the header of the report
- */
- public void printHeader() {
- if (wasSuccessful()) {
- System.out.println();
- System.out.print("OK");
- System.out.println(" (" + runCount() + " tests)");
-
- } else {
- System.out.println();
- System.out.println("!!!FAILURES!!!");
- System.out.println("Test Results:");
- System.out.println(
- "Run: "
- + runCount()
- + " Failures: "
- + failureCount()
- + " Errors: "
- + errorCount());
- }
- }
- public synchronized void startTest(Test test) {
- super.startTest(test);
- System.out.print(".");
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadDeathEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadDeathEventTest.java
deleted file mode 100644
index 6bb1e07..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadDeathEventTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ObjectCollectedException;
-import com.sun.jdi.event.ThreadDeathEvent;
-
-/**
- * Tests for JDI com.sun.jdi.event.ThreadDeathEvent.
- */
-public class ThreadDeathEventTest extends AbstractJDITest {
-
- private ThreadDeathEvent fEvent;
- /**
- * Creates a new test.
- */
- public ThreadDeathEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadDeath event)
- fVM.resume();
-
- // Trigger a thread end event
- fEvent =
- (ThreadDeathEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadDeathRequest(),
- "ThreadDeathEvent",
- true);
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has resumed the test thread, so suspend it
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ThreadDeathEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.ThreadDeathEvent";
- }
- /**
- * Test JDI thread().
- */
- public void testJDIThread() {
- try {
- assertEquals(
- "1",
- "Test Thread Death Event",
- fEvent.thread().name());
- } catch (ObjectCollectedException e) {
- // Workaround known problem in Sun's VM
- }
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadGroupReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadGroupReferenceTest.java
deleted file mode 100644
index 27017fa..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadGroupReferenceTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.List;
-import java.util.ListIterator;
-
-import com.sun.jdi.ThreadGroupReference;
-import com.sun.jdi.ThreadReference;
-
-/**
- * Tests for JDI com.sun.jdi.ThreadGroupReference
- * and JDWP ThreadGroup command set.
- */
-public class ThreadGroupReferenceTest extends AbstractJDITest {
-
- private ThreadGroupReference fThreadGroup;
- /**
- * Creates a new test.
- */
- public ThreadGroupReferenceTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get value of "fThread"
- ThreadReference thread = getThread();
-
- // Get its threadgroup
- fThreadGroup = thread.threadGroup();
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has resumed the thread group, and so the test thread, so suspend it
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ThreadGroupReferenceTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ThreadGroupReference";
- }
- /**
- * Test JDI name() and JDWP 'ThreadGroup - Get name'.
- */
- public void testJDIName() {
- assertEquals("1", "Test ThreadGroup", fThreadGroup.name());
- }
- /**
- * Test JDI parent() and JDWP 'ThreadGroup - Get parent'.
- */
- public void testJDIParent() {
- ThreadGroupReference systemThreadGroup = fThreadGroup.parent();
- assertNotNull("1", systemThreadGroup);
- assertEquals("2", "main", systemThreadGroup.name());
- // assertTrue("3", systemThreadGroup.parent() == null);
- }
- /**
- * Test JDI suspend() and resume().
- */
- public void testJDISuspendResume() {
- fThreadGroup.suspend();
- fThreadGroup.resume();
- }
- /**
- * Test JDI threadGroups().
- */
- public void testJDIThreadGroups() {
- List threadGroups = fThreadGroup.threadGroups();
- assertEquals("1", 0, threadGroups.size());
- }
- /**
- * Test JDI threads() and JDWP 'ThreadGroup - Get children'.
- */
- public void testJDIThreads() {
- List threads = fThreadGroup.threads();
- ListIterator iterator = threads.listIterator();
- boolean isIncluded = false;
- while (iterator.hasNext()) {
- ThreadReference thread = (ThreadReference) iterator.next();
- if (thread.name().equals("Test Thread")) {
- isIncluded = true;
- break;
- }
- }
- assertTrue("1", isIncluded);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java
deleted file mode 100644
index 237c95d..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.jdi.tests;
-
-import java.util.List;
-
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.StackFrame;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.event.ThreadStartEvent;
-
-/**
- * Tests for JDI com.sun.jdi.ThreadReference
- * and JDWP Thread command set.
- */
-public class ThreadReferenceTest extends AbstractJDITest {
-
- private ThreadReference fThread;
- /**
- * Creates a new test .
- */
- public ThreadReferenceTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get thread
- fThread = getThread();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ThreadReferenceTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.ThreadReference";
- }
- /**
- * Test JDI currentContendedMonitor().
- */
- public void testJDICurrentContendedMonitor() {
- if (fVM.canGetCurrentContendedMonitor()) {
- try {
- assertTrue("1", fThread.currentContendedMonitor() == null);
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- }
- /**
- * Test JDI frame(int).
- */
- public void testJDIFrame() {
- try {
- StackFrame frame = fThread.frame(0);
- assertTrue("1", fThread.frames().contains(frame));
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- /**
- * Test JDI frameCount.
- */
- public void testJDIFrameCount() {
- try {
- int count = fThread.frameCount();
- assertTrue("1", count <= 4);
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- /**
- * Test JDI frames() and JDWP 'Thread - Get frames'.
- */
- public void testJDIFrames() {
- List frames = null;
- try {
- frames = fThread.frames();
- } catch (IncompatibleThreadStateException e) {
- assertTrue("1", false);
- }
- assertTrue("2", frames.size() > 0);
- }
- /**
- * Test JDI interrupt()().
- */
- public void testJDIInterrupt() {
- assertEquals("1", 1, fThread.suspendCount());
- fThread.interrupt();
- assertEquals("2", 1, fThread.suspendCount());
- }
- /**
- * Test JDI isAtBreakpoint().
- */
- public void testJDIIsAtBreakpoint() {
- assertTrue("1", !fThread.isAtBreakpoint());
- }
- /**
- * Test JDI isSuspended().
- */
- public void testJDIIsSuspended() {
- assertTrue("1", fThread.isSuspended());
- }
- /**
- * Test JDI name() and JDWP 'Thread - Get name'.
- */
- public void testJDIName() {
- assertEquals("1", "Test Thread", fThread.name());
- }
- /**
- * Test JDI ownedMonitors().
- */
- public void testJDIOwnedMonitors() {
- if (fVM.canGetOwnedMonitorInfo()) {
- waitUntilReady();
- try {
- assertEquals("1", 1, fThread.ownedMonitors().size());
- } catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
- }
- }
- }
- /**
- * Test JDI status() and JDWP 'Thread - Get status'.
- */
- public void testJDIStatus() {
- int status = fThread.status();
- assertTrue(
- "1",
- ((status == ThreadReference.THREAD_STATUS_RUNNING)
- || (status == ThreadReference.THREAD_STATUS_SLEEPING)
- || (status == ThreadReference.THREAD_STATUS_WAIT)));
- }
- /**
- * Test JDI stop(ObjectReference).
- */
- public void testJDIStop() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
-
- // Trigger a thread start event to get a new thread
- ThreadStartEvent event =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- false);
- ThreadReference thread = event.thread();
-
- // Create a java.lang.Throwable instance in
- java.util.List classes = fVM.classesByName("java.lang.Throwable");
- assertTrue("1", classes.size() != 0);
- ClassType threadDeathClass = (ClassType) classes.get(0);
- Method constructor =
- threadDeathClass.concreteMethodByName("<init>", "()V");
- ObjectReference threadDeath = null;
- try {
- threadDeath =
- threadDeathClass.newInstance(
- thread,
- constructor,
- new java.util.LinkedList(),
- ClassType.INVOKE_SINGLE_THREADED);
- threadDeath.disableCollection();
- // This object is going to be used for the lifetime of the VM.
- } catch (ClassNotLoadedException e) {
- assertTrue("2", false);
- } catch (InvalidTypeException e) {
- assertTrue("3", false);
- } catch (InvocationException e) {
- assertTrue("4", false);
- } catch (IncompatibleThreadStateException e) {
- assertTrue("5", false);
- }
-
- // Stop the thread
- try {
- thread.stop(threadDeath);
- } catch (InvalidTypeException e) {
- assertTrue("6", false);
- }
-
- waitUntilReady();
-
- }
- /**
- * Test JDI suspend() and resume()
- * and JDWP 'Thread - Suspend' and 'Thread - Resume'.
- */
- public void testJDISuspendResume() {
- assertEquals("1", 1, fThread.suspendCount());
- fThread.resume();
- assertTrue("2", !fThread.isSuspended());
- fThread.suspend();
- assertTrue("3", fThread.isSuspended());
-
- waitUntilReady();
- }
- /**
- * Test JDI threadGroup() and JDWP 'Thread - Get threadGroup'.
- */
- public void testJDIThreadGroup() {
- assertNotNull("1", fThread.threadGroup());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadStartEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadStartEventTest.java
deleted file mode 100644
index c8cd575..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadStartEventTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.ThreadStartEvent;
-
-/**
- * Tests for JDI com.sun.jdi.event.ThreadStartEvent.
- */
-public class ThreadStartEventTest extends AbstractJDITest {
-
- private ThreadStartEvent fEvent;
- /**
- * Creates a new test.
- */
- public ThreadStartEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Make sure the entire VM is not suspended before we start a new thread
- // (otherwise this new thread will start suspended and we will never get the
- // ThreadStart event)
- fVM.resume();
-
- // Trigger a thread start event
- fEvent =
- (ThreadStartEvent) triggerAndWait(fVM
- .eventRequestManager()
- .createThreadStartRequest(),
- "ThreadStartEvent",
- true);
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // The test has resumed the test thread, so suspend it
- waitUntilReady();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ThreadStartEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.ThreadStartEvent";
- }
- /**
- * Test JDI thread().
- */
- public void testJDIThread() {
- assertEquals("1", "Test Thread Start Event", fEvent.thread().name());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java
deleted file mode 100644
index 992a18f..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.TypeComponent;
-
-/**
- * Tests for JDI com.sun.jdi.TypeComponent.
- */
-public class TypeComponentTest extends AbstractJDITest {
-
- private TypeComponent fField, fMethod;
- /**
- * Creates a new test.
- */
- public TypeComponentTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get field fObject in org.eclipse.debug.jdi.tests.program.MainClass
- fField = getField();
-
- // Get method print(OutputStream)
- fMethod = getMethod();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new TypeComponentTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.TypeComponent";
- }
- /**
- * Test JDI declaringType().
- */
- public void testJDIDeclaringType() {
- ReferenceType mainClass = getMainClass();
-
- ReferenceType declaringType = fField.declaringType();
- assertEquals("1", mainClass, declaringType);
-
- declaringType = fMethod.declaringType();
- assertEquals("2", mainClass, declaringType);
- }
- /**
- * Test JDI isFinal().
- */
- public void testJDIIsFinal() {
- assertTrue("1", !fField.isFinal());
- assertTrue("2", !fMethod.isFinal());
- }
- /**
- * Test JDI isStatic().
- */
- public void testJDIIsStatic() {
- assertTrue("1", fField.isStatic());
- assertTrue("2", !fMethod.isStatic());
- }
- /**
- * Test JDI isSynthetic().
- */
- public void testJDIIsSynthetic() {
- if (!fVM.canGetSyntheticAttribute()) {
- return;
- }
-
- assertTrue("1", !fField.isSynthetic());
- assertTrue("2", !fMethod.isSynthetic());
- }
- /**
- * Test JDI name().
- */
- public void testJDIName() {
- assertEquals("1", "fObject", fField.name());
- assertEquals("2", "print", fMethod.name());
- }
- /**
- * Test JDI signature().
- */
- public void testJDISignature() {
- assertEquals(
- "1",
- "Lorg/eclipse/debug/jdi/tests/program/MainClass;",
- fField.signature());
- assertEquals("2", "(Ljava/io/OutputStream;)V", fMethod.signature());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeTest.java
deleted file mode 100644
index 19e4336..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.BooleanType;
-import com.sun.jdi.ByteType;
-import com.sun.jdi.CharType;
-import com.sun.jdi.DoubleType;
-import com.sun.jdi.FloatType;
-import com.sun.jdi.IntegerType;
-import com.sun.jdi.LongType;
-import com.sun.jdi.ShortType;
-import com.sun.jdi.Type;
-
-/**
- * Tests for JDI com.sun.jdi.Type.
- */
-public class TypeTest extends AbstractJDITest {
- private Type
- fArrayType,
- fClassType,
- fInterfaceType,
- // primitive types
- fShortType,
- fByteType,
- fIntegerType,
- fLongType,
- fFloatType,
- fDoubleType,
- fCharType,
- fBooleanType,
- // One-dimensional primitive arrays
- fByteArrayType,
- fShortArrayType,
- fIntArrayType,
- fLongArrayType,
- fFloatArrayType,
- fDoubleArrayType,
- fCharArrayType,
- fBooleanArrayType,
- // Two-dimensional primitive arrays
- fByteDoubleArrayType,
- fShortDoubleArrayType,
- fIntDoubleArrayType,
- fLongDoubleArrayType,
- fFloatDoubleArrayType,
- fDoubleDoubleArrayType,
- fCharDoubleArrayType,
- fBooleanDoubleArrayType;
-
- /**
- * Creates a new test.
- */
- public TypeTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get reference types
- fArrayType = getArrayType();
- fClassType = getMainClass();
- fInterfaceType = getInterfaceType();
- // Get primitive types
- fBooleanType = (BooleanType) (fVM.mirrorOf(true).type());
- fByteType = (ByteType) (fVM.mirrorOf((byte) 1).type());
- fCharType = (CharType) (fVM.mirrorOf('a').type());
- fDoubleType = (DoubleType) (fVM.mirrorOf(12345.6789).type());
- fFloatType = (FloatType) (fVM.mirrorOf(12345.6789f).type());
- fIntegerType = (IntegerType) (fVM.mirrorOf(12345).type());
- fLongType = (LongType) (fVM.mirrorOf(123456789l).type());
- fShortType = (ShortType) (fVM.mirrorOf((short) 12345).type());
- // Get one-dimensional primitive arrays
- fByteArrayType = getByteArrayType();
- fShortArrayType = getShortArrayType();
- fIntArrayType = getIntArrayType();
- fLongArrayType = getLongArrayType();
- fFloatArrayType = getFloatArrayType();
- fDoubleArrayType = getDoubleArrayType();
- fCharArrayType = getCharArrayType();
- fBooleanArrayType = getBooleanArrayType();
- // Get two-dimensional primitive arrays
- fByteDoubleArrayType = getByteDoubleArrayType();
- fShortDoubleArrayType = getShortDoubleArrayType();
- fIntDoubleArrayType = getIntDoubleArrayType();
- fLongDoubleArrayType = getLongDoubleArrayType();
- fFloatDoubleArrayType = getFloatDoubleArrayType();
- fDoubleDoubleArrayType = getDoubleDoubleArrayType();
- fCharDoubleArrayType = getCharDoubleArrayType();
- fBooleanDoubleArrayType = getBooleanDoubleArrayType();
-
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new TypeTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Type";
- }
- /**
- * Test JDI signature().
- */
- public void testJDISignature() {
- assertEquals("1", "[Ljava/lang/String;", fArrayType.signature());
- assertEquals("2", "Lorg/eclipse/debug/jdi/tests/program/MainClass;", fClassType.signature());
- assertEquals("3", "Lorg/eclipse/debug/jdi/tests/program/Printable;", fInterfaceType.signature());
- // Primitive types
- assertEquals("4", "S", fShortType.signature());
- assertEquals("5", "B", fByteType.signature());
- assertEquals("6", "I", fIntegerType.signature());
- assertEquals("7", "J", fLongType.signature());
- assertEquals("8", "F", fFloatType.signature());
- assertEquals("9", "D", fDoubleType.signature());
- assertEquals("10", "C", fCharType.signature());
- assertEquals("11", "Z", fBooleanType.signature());
- // One-dimensional primitive arrays
- assertEquals("12", "[B", fByteArrayType.signature());
- assertEquals("13", "[S", fShortArrayType.signature());
- assertEquals("14", "[I", fIntArrayType.signature());
- assertEquals("15", "[J", fLongArrayType.signature());
- assertEquals("16", "[F", fFloatArrayType.signature());
- assertEquals("17", "[D", fDoubleArrayType.signature());
- assertEquals("18", "[C", fCharArrayType.signature());
- assertEquals("19", "[Z", fBooleanArrayType.signature());
- // Two-dimensional primitive arrays
- assertEquals("20", "[[B", fByteDoubleArrayType.signature());
- assertEquals("21", "[[S", fShortDoubleArrayType.signature());
- assertEquals("22", "[[I", fIntDoubleArrayType.signature());
- assertEquals("23", "[[J", fLongDoubleArrayType.signature());
- assertEquals("24", "[[F", fFloatDoubleArrayType.signature());
- assertEquals("25", "[[D", fDoubleDoubleArrayType.signature());
- assertEquals("26", "[[C", fCharDoubleArrayType.signature());
- assertEquals("27", "[[Z", fBooleanDoubleArrayType.signature());
- }
- /**
- * Test JDI typeName().
- */
- public void testJDITypeName() {
- assertEquals("1", "java.lang.String[]", fArrayType.name());
- assertEquals("2", "org.eclipse.debug.jdi.tests.program.MainClass", fClassType.name());
- assertEquals("3", "org.eclipse.debug.jdi.tests.program.Printable", fInterfaceType.name());
- // Primitive types
- assertEquals("4", "byte", fByteType.name());
- assertEquals("5", "short", fShortType.name());
- assertEquals("6", "int", fIntegerType.name());
- assertEquals("7", "long", fLongType.name());
- assertEquals("8", "float", fFloatType.name());
- assertEquals("9", "double", fDoubleType.name());
- assertEquals("10", "char", fCharType.name());
- assertEquals("11", "boolean", fBooleanType.name());
- // One-dimensional primitive arrays
- assertEquals("12", "byte[]", fByteArrayType.name());
- assertEquals("13", "short[]", fShortArrayType.name());
- assertEquals("14", "int[]", fIntArrayType.name());
- assertEquals("15", "long[]", fLongArrayType.name());
- assertEquals("16", "float[]", fFloatArrayType.name());
- assertEquals("17", "double[]", fDoubleArrayType.name());
- assertEquals("18", "char[]", fCharArrayType.name());
- assertEquals("19", "boolean[]", fBooleanArrayType.name());
- // Two-dimensional primitive arrays
- assertEquals("20", "byte[][]", fByteDoubleArrayType.name());
- assertEquals("21", "short[][]", fShortDoubleArrayType.name());
- assertEquals("22", "int[][]", fIntDoubleArrayType.name());
- assertEquals("23", "long[][]", fLongDoubleArrayType.name());
- assertEquals("24", "float[][]", fFloatDoubleArrayType.name());
- assertEquals("25", "double[][]", fDoubleDoubleArrayType.name());
- assertEquals("26", "char[][]", fCharDoubleArrayType.name());
- assertEquals("27", "boolean[][]", fBooleanDoubleArrayType.name());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java
deleted file mode 100644
index 42eb921..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.VMDisconnectEvent;
-
-/**
- * Tests for JDI com.sun.jdi.event.VMDisconnectEvent.
- */
-public class VMDisconnectEventTest extends AbstractJDITest {
-
- private VMDisconnectEvent fVMDisconnectEvent;
- /**
- * Creates a new test.
- */
- public VMDisconnectEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Prepare to receive the event
- VMDisconnectEventWaiter waiter =
- new VMDisconnectEventWaiter(null, true);
- fEventReader.addEventListener(waiter);
-
- // Trigger a vm death event by shutting down the VM
- killVM();
-
- // Wait for the event to come in
- fVMDisconnectEvent = (VMDisconnectEvent) waitForEvent(waiter, 10000);
- // Wait 10s max
- fEventReader.removeEventListener(waiter);
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Finish the shut down
- shutDownTarget();
-
- // Start up again
- launchTargetAndStartProgram();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new VMDisconnectEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.VMDeathEvent";
- }
- /**
- * Test that we received the event.
- */
- public void testJDIVMDeath() {
- assertTrue("1", fVMDisconnectEvent != null);
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventWaiter.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventWaiter.java
deleted file mode 100644
index 6384f8b..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventWaiter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.event.VMDisconnectEvent;
-/**
- * Listen for VMDisconnectEvent.
- */
-public class VMDisconnectEventWaiter extends EventWaiter {
- /**
- * Creates a VMDisconnectEventWaiter.
- */
- public VMDisconnectEventWaiter(
- com.sun.jdi.request.EventRequest request,
- boolean shouldGo) {
- super(request, shouldGo);
- }
- public boolean vmDisconnect(VMDisconnectEvent event) {
- notifyEvent(event);
- return fShouldGo;
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java
deleted file mode 100644
index d6cc021..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.VMDisconnectedException;
-
-/**
- * Tests for JDI com.sun.jdi.event.VMDisconnectEvent.
- */
-public class VMDisposeTest extends AbstractJDITest {
- /**
- * Creates a new test.
- */
- public VMDisposeTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new VMDisposeTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.VirtualMachine.dispose";
- }
- /**
- * Test that we received the event.
- */
- public void testJDIVMDispose() {
- fVM.dispose();
- try {
- fVM.allThreads();
- assertTrue("1", false);
- } catch (VMDisconnectedException e) {
- }
-
- try {
- // Reconnect to running VM.
- connectToVM();
- fVM.allThreads();
- } catch (VMDisconnectedException e) {
- assertTrue("3", false);
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMInformation.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMInformation.java
deleted file mode 100644
index 56eba84..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMInformation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.VirtualMachine;
-
-/**
- * This class allows to hold on information about the VM
- * that we don't want to loose between 2 tests.
- */
-public class VMInformation {
- VirtualMachine fVM;
- Process fLaunchedVM;
- EventReader fEventReader;
- AbstractReader fConsoleReader;
- String fVMType;
-
- /**
- * Creates a new VMInformation for the given vm, vm type, launched vm, event reader and console reader.
- */
- VMInformation(VirtualMachine vm, String vmType, Process launchedVM, EventReader eventReader, AbstractReader consoleReader) {
- fVM = vm;
- fLaunchedVM = launchedVM;
- fEventReader = eventReader;
- fConsoleReader = consoleReader;
- fVMType = vmType;
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ValueTest.java
deleted file mode 100644
index 5f9990a..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ValueTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.Value;
-
-/**
- * Tests for JDI com.sun.jdi.Value.
- */
-public class ValueTest extends AbstractJDITest {
- private Value fBoolean,
- fByte,
- fChar,
- fDouble,
- fFloat,
- fInteger,
- fLong,
- fShort,
- fArray,
- fObject;
- /**
- * Creates a new test.
- */
- public ValueTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get primitive values
- fBoolean = fVM.mirrorOf(true);
- fByte = fVM.mirrorOf((byte) 1);
- fChar = fVM.mirrorOf('a');
- fDouble = fVM.mirrorOf(12345.6789);
- fFloat = fVM.mirrorOf(12345.6789f);
- fInteger = fVM.mirrorOf(12345);
- fLong = fVM.mirrorOf(123456789l);
- fShort = fVM.mirrorOf((short) 12345);
-
- // Get object references
- fArray = getObjectArrayReference();
- fObject = getObjectReference();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new ValueTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.Value";
- }
- /**
- * Test JDI type().
- */
- public void testJDIType() {
- assertEquals("1", "boolean", fBoolean.type().name());
- assertEquals("2", "byte", fByte.type().name());
- assertEquals("3", "char", fChar.type().name());
- assertEquals("4", "double", fDouble.type().name());
- assertEquals("5", "float", fFloat.type().name());
- assertEquals("6", "int", fInteger.type().name());
- assertEquals("7", "long", fLong.type().name());
- assertEquals("8", "short", fShort.type().name());
- assertEquals("9", "java.lang.String[]", fArray.type().name());
- assertEquals(
- "10",
- "org.eclipse.debug.jdi.tests.program.MainClass",
- fObject.type().name());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java
deleted file mode 100644
index 976a6a8..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.VMDisconnectedException;
-
-/**
- * Tests for JDI com.sun.jdi.VirtualMachine.exit().
- */
-public class VirtualMachineExitTest extends AbstractJDITest {
- /**
- * Creates a new test .
- */
- public VirtualMachineExitTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Finish the shut down
- shutDownTarget();
-
- // Start up again
- launchTargetAndStartProgram();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(String[] args) {
- new VirtualMachineExitTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.VirtualMachine.exit(int)";
- }
- /**
- * Test JDI exit().
- */
- public void testJDIExit() {
- try {
- fVM.exit(0);
- } catch (VMDisconnectedException e) {
- assertTrue("1", false);
- }
-
- try {
- Thread.sleep(200);
- assertTrue("2", !vmIsRunning());
- fVM.allThreads();
- assertTrue("3", false);
- } catch (VMDisconnectedException e) {
- } catch (InterruptedException e) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java
deleted file mode 100644
index 568eb8a..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java
+++ /dev/null
@@ -1,420 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import junit.framework.Test;
-
-import com.sun.jdi.BooleanValue;
-import com.sun.jdi.ByteValue;
-import com.sun.jdi.CharValue;
-import com.sun.jdi.DoubleValue;
-import com.sun.jdi.FloatValue;
-import com.sun.jdi.IntegerValue;
-import com.sun.jdi.LongValue;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.ShortValue;
-import com.sun.jdi.StringReference;
-import com.sun.jdi.ThreadGroupReference;
-import com.sun.jdi.ThreadReference;
-
-/**
- * Tests for JDI com.sun.jdi.VirtualMachine
- * and JDWP VM command set.
- *
- * Example of arguments:
- * -launcher SunVMLauncher -address c:\jdk1.2.2\ -classpath d:\target
- */
-public class VirtualMachineTest extends AbstractJDITest {
-
- /**
- * Creates a new test .
- */
- public VirtualMachineTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new VirtualMachineTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.VirtualMachine";
- }
- /**
- * Don't start the program yet, so that the testNotStarted* tests can run before.
- */
- protected void setUp() {
- launchTargetAndConnectToVM();
- }
- /**
- * Starts the target program.
- * NB: This method is copied in this class only so that it can be invoked
- * dynamically.
- */
- public void startProgram() {
- super.startProgram();
- }
- /**
- * Returns all tests
- */
- protected Test suite() {
- JDITestSuite suite = new JDITestSuite(this);
-
- // Tests that run before the program is started
- Vector testNames = getAllMatchingTests("testNotStarted");
- Iterator iterator = testNames.iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
- suite.addTest(new JDITestCase(this, name));
- }
-
- // The method that starts the program
- suite.addTest(new JDITestCase(this, "startProgram"));
-
- // Tests that run after the program has started
- testNames = getAllMatchingTests("testStarted");
- iterator = testNames.iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
- suite.addTest(new JDITestCase(this, name));
- }
-
- // All other tests
- testNames = getAllMatchingTests("testJDI");
- iterator = testNames.iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
- suite.addTest(new JDITestCase(this, name));
- }
-
- return suite;
- }
- /**
- * Test JDI canGetBytecodes().
- */
- public void testJDICanGetBytecodes() {
- fVM.canGetBytecodes();
- }
- /**
- * Test JDI canGetCurrentContendedMonitor().
- */
- public void testJDICanGetCurrentContendedMonitor() {
- fVM.canGetCurrentContendedMonitor();
- }
- /**
- * Test JDI canGetMonitorInfo().
- */
- public void testJDICanGetMonitorInfo() {
- fVM.canGetMonitorInfo();
- }
- /**
- * Test JDI canGetOwnedMonitorInfo().
- */
- public void testJDICanGetOwnedMonitorInfo() {
- fVM.canGetOwnedMonitorInfo();
- }
- /**
- * Test JDI canGetSyntheticAttribute().
- */
- public void testJDICanGetSyntheticAttribute() {
- // This is optional functionality, thus this is not a failure
- fVM.canGetSyntheticAttribute();
- }
- /**
- * Test JDI canWatchFieldAccess().
- */
- public void testJDICanWatchFieldAccess() {
- // This is optional functionality, thus this is not a failure
- fVM.canWatchFieldAccess();
- }
- /**
- * Test JDI canWatchFieldModification().
- */
- public void testJDICanWatchFieldModification() {
- // This is optional functionality, thus this is not a failure
- fVM.canWatchFieldModification();
- }
- /**
- * Test JDI eventQueue().
- */
- public void testJDIEventQueue() {
- assertNotNull("1", fVM.eventQueue());
- }
- /**
- * Test JDI eventRequestManager().
- */
- public void testJDIEventRequestManager() {
- assertNotNull("1", fVM.eventRequestManager());
- }
- /**
- * Test JDI mirrorOf(boolean).
- */
- public void testJDIMirrorOfBoolean() {
- boolean value = true;
- BooleanValue mirror = fVM.mirrorOf(value);
- assertTrue("1", value == mirror.value());
- }
- /**
- * Test JDI mirrorOf(byte).
- */
- public void testJDIMirrorOfByte() {
- byte value = 1;
- ByteValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value());
- }
- /**
- * Test JDI mirrorOf(char).
- */
- public void testJDIMirrorOfChar() {
- char value = 'a';
- CharValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value());
- }
- /**
- * Test JDI mirrorOf(double).
- */
- public void testJDIMirrorOfDouble() {
- double value = 12345.6789;
- DoubleValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value(), 0);
- }
- /**
- * Test JDI mirrorOf(float).
- */
- public void testJDIMirrorOfFloat() {
- float value = 12345.6789f;
- FloatValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value(), 0);
- }
- /**
- * Test JDI mirrorOf(int).
- */
- public void testJDIMirrorOfInt() {
- int value = 12345;
- IntegerValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value());
- }
- /**
- * Test JDI mirrorOf(long).
- */
- public void testJDIMirrorOfLong() {
- long value = 1234567890l;
- LongValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value());
- }
- /**
- * Test JDI mirrorOf(short).
- */
- public void testJDIMirrorOfShort() {
- short value = (short) 12345;
- ShortValue mirror = fVM.mirrorOf(value);
- assertEquals("1", value, mirror.value());
- }
- /**
- * Test JDI mirrorOf(String) and JDWP 'VM - Create String'.
- */
- public void testJDIMirrorOfString() {
- String testString = "Test";
- StringReference newString = null;
- newString = fVM.mirrorOf(testString);
- assertEquals("1", newString.value(), testString);
- }
- /**
- * Test JDI setDebugTraceMode(int).
- */
- public void testJDISetDebugTraceMode() {
- fVM.setDebugTraceMode(com.sun.jdi.VirtualMachine.TRACE_ALL);
- fVM.setDebugTraceMode(com.sun.jdi.VirtualMachine.TRACE_SENDS);
- fVM.setDebugTraceMode(com.sun.jdi.VirtualMachine.TRACE_RECEIVES);
- fVM.setDebugTraceMode(com.sun.jdi.VirtualMachine.TRACE_NONE);
-
- // restore original value
- fVM.setDebugTraceMode(fVMTraceFlags);
- }
- /**
- * Test JDI getVersion().
- */
- public void testJDIVersion() {
- String version = fVM.version();
- assertTrue("1", version != null);
- }
- /**
- * Test JDI allClasses() and JDWP 'VM - Get all classes'
- * while the test program has not been started.
- */
- public void testNotStartedAllClasses() {
- List classes = fVM.allClasses();
- Iterator iterator = classes.listIterator();
- int i = 0;
- while (iterator.hasNext())
- assertTrue(Integer.toString(i++), iterator.next() instanceof ReferenceType);
- }
- /**
- * Test JDI allThreads() and JDWP 'VM - Get all threads'
- * while the test program has not been started.
- */
- public void testNotStartedAllThreads() {
- List threads = fVM.allThreads();
- Iterator iterator = threads.listIterator();
- int i = 0;
- while (iterator.hasNext())
- assertTrue(Integer.toString(i++), iterator.next() instanceof ThreadReference);
- }
- /**
- * Test JDI classesByName() while the test program has not been started.
- */
- public void testNotStartedClassesByName() {
- List classes = fVM.classesByName("java.lang.Object");
- assertEquals("1", 1, classes.size());
- }
- /**
- * Test JDI allClasses() and JDWP 'VM- Get all classes'
- * once the test program has been started.
- */
- public void testStartedAllClasses() {
-
- // The test program has started, the number of classes is != 0
- List classes = fVM.allClasses();
- assertTrue("1", classes.size() != 0);
-
- // Collect names of received classes
- String[] names = new String[classes.size()];
- ListIterator iterator = classes.listIterator();
- int i = 0;
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- names[i++] = type.name();
- }
-
- // Check that they are the expected names
- String[] expected =
- new String[] {
- "java.lang.Object",
- "java.util.Date",
- "org.eclipse.debug.jdi.tests.program.Printable",
- "org.eclipse.debug.jdi.tests.program.MainClass" };
- for (int j = 0; j < expected.length; j++) {
- boolean isIncluded = false;
- iteration : for (int k = 0; k < names.length; k++) {
- if (names[k].equals(expected[j])) {
- isIncluded = true;
- break iteration;
- }
- }
- assertTrue("2." + j, isIncluded);
- }
- }
- /**
- * Test JDI allThreads() and JDWP 'VM - Get all threads'
- * once the test program has been started.
- */
- public void testStartedAllThreads() {
-
- // The test program has started, the number of threads is != 0
- List threads = fVM.allThreads();
- assertTrue("1", threads.size() != 0);
-
- // Collect names of received threads
- String[] names = new String[threads.size()];
- ListIterator iterator = threads.listIterator();
- int i = 0;
- while (iterator.hasNext()) {
- ThreadReference thread = (ThreadReference) iterator.next();
- names[i++] = thread.name();
- }
-
- // Check that they contain at least the expected names
- String[] expected = new String[] { "Test Thread" };
- boolean isIncluded = false;
- iteration : for (int j = 0; j < expected.length; j++) {
- for (int k = 0; k < names.length; k++) {
- if (expected[j].equals(names[k])) {
- isIncluded = true;
- break iteration;
- }
- }
- }
- assertTrue("2", isIncluded);
- }
- /**
- * Test JDI classesByName() once the test program has been started.
- */
- public void testStartedClassesByName() {
-
- // The test program has started, the number of java.lang.Object is 1
- List classes = fVM.classesByName("java.lang.Object");
- assertEquals("1", classes.size(), 1);
-
- // Collect names of received classes
- String[] names = new String[classes.size()];
- ListIterator iterator = classes.listIterator();
- int i = 0;
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType) iterator.next();
- names[i++] = type.name();
- }
-
- // Check that they are all "java.lang.Object"
- for (int j = 0; j < names.length; j++) {
- assertEquals("2." + j, "java.lang.Object", names[j]);
- }
- }
- /**
- * Test JDI suspend() and resume() once the test program has been started.
- */
- public void testStartedSuspendResume() {
- // Suspend
- fVM.suspend();
- ListIterator threads = fVM.allThreads().listIterator();
- while (threads.hasNext()) {
- ThreadReference thread = (ThreadReference) threads.next();
- assertTrue("1." + thread.name(), thread.isSuspended());
- }
-
- // Resume
- fVM.resume();
- // Cannot assertTrue that all threads are not suspended because they might have been suspended
- // by the program itself
-
- // Suspend VM and suspend one thread
- fVM.suspend();
- threads = fVM.allThreads().listIterator();
- ThreadReference suspended = getThread();
- suspended.suspend();
- while (threads.hasNext()) {
- ThreadReference thread = (ThreadReference) threads.next();
- assertTrue("2." + thread.name(), thread.isSuspended());
- }
-
- // Resume VM and ensure that the one thread that was suspended is still suspended
- fVM.resume();
- assertTrue("3", suspended.isSuspended());
- }
- /**
- * Test JDI topLevelThreadGroups().
- */
- public void testStartedTopLevelThreadGroups() {
- List topLevelThreadGroups = fVM.topLevelThreadGroups();
- assertEquals("1", 1, topLevelThreadGroups.size());
- assertTrue("2", topLevelThreadGroups.get(0) instanceof ThreadGroupReference);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java
deleted file mode 100644
index 51eb536..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.util.ArrayList;
-
-import com.sun.jdi.BooleanValue;
-import com.sun.jdi.StringReference;
-import com.sun.jdi.event.AccessWatchpointEvent;
-import com.sun.jdi.event.ModificationWatchpointEvent;
-import com.sun.jdi.event.WatchpointEvent;
-import com.sun.jdi.request.EventRequestManager;
-
-/**
- * Tests for JDI com.sun.jdi.event.WatchpointEvent.
- */
-public class WatchpointEventTest extends AbstractJDITest {
-
- private WatchpointEvent fAccessWatchpointEvent,
- fStaticAccessWatchpointEvent,
- fModificationWatchpointEvent;
- // NB: Static modification watchpoint event is tested in ModificationWatchpointTest
- /**
- * Creates a new test.
- */
- public WatchpointEventTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Trigger an access watchpoint event
- fAccessWatchpointEvent =
- (AccessWatchpointEvent) triggerAndWait(getAccessWatchpointRequest(),
- "AccessWatchpointEvent",
- true);
- assertTrue("Got access watchpoint event", fAccessWatchpointEvent != null);
-
- // Trigger a static access watchpoint event
- fStaticAccessWatchpointEvent =
- (AccessWatchpointEvent) triggerAndWait(
- getStaticAccessWatchpointRequest(),
- "StaticAccessWatchpointEvent",
- true);
- assertTrue(
- "Got static access watchpoint event",
- fStaticAccessWatchpointEvent != null);
-
- // Trigger a modification watchpoint event
- fModificationWatchpointEvent =
- (ModificationWatchpointEvent) triggerAndWait(
- getModificationWatchpointRequest(),
- "ModificationWatchpointEvent",
- false);
- // Interrupt the VM so that we can test valueCurrent()
- assertTrue(
- "Got modification watchpoint event",
- fModificationWatchpointEvent != null);
-
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Ensure that the modification of the "fBool" field has completed
- fVM.resume();
- waitUntilReady();
-
- // Delete the event requests we created in this test
- EventRequestManager requestManager = fVM.eventRequestManager();
- requestManager.deleteEventRequests(
- new ArrayList(requestManager.accessWatchpointRequests()));
- requestManager.deleteEventRequests(
- new ArrayList(requestManager.modificationWatchpointRequests()));
-
- // Set the value of the "fBool" field back to its original value
- resetField();
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new WatchpointEventTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.event.WatchpointEvent";
- }
- /**
- * Test JDI field().
- */
- public void testJDIField() {
- assertEquals("1", getField("fBool"), fAccessWatchpointEvent.field());
- assertEquals(
- "2",
- getField("fString"),
- fStaticAccessWatchpointEvent.field());
- assertEquals(
- "3",
- getField("fBool"),
- fModificationWatchpointEvent.field());
- }
- /**
- * Test JDI object().
- */
- public void testJDIObject() {
- assertEquals(
- "1",
- getObjectReference(),
- fAccessWatchpointEvent.object());
- assertTrue("2", fStaticAccessWatchpointEvent.object() == null);
- assertEquals(
- "3",
- getObjectReference(),
- fModificationWatchpointEvent.object());
- }
- /**
- * Test JDI valueCurrent().
- */
- public void testJDIValueCurrent() {
- assertTrue(
- "1",
- false
- == ((BooleanValue) fAccessWatchpointEvent.valueCurrent()).value());
-
- assertEquals(
- "2",
- "Hello World",
- ((StringReference) fStaticAccessWatchpointEvent.valueCurrent())
- .value());
-
- assertTrue(
- "3",
- false
- == ((BooleanValue) fModificationWatchpointEvent.valueCurrent())
- .value());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointRequestTest.java
deleted file mode 100644
index 7e013a9..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointRequestTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.debug.jdi.tests;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import com.sun.jdi.request.WatchpointRequest;
-
-/**
- * Tests for JDI com.sun.jdi.request.WatchpointRequest.
- */
-public class WatchpointRequestTest extends AbstractJDITest {
-
- private WatchpointRequest fAccessWatchpointRequest,
- fModificationWatchpointRequest;
- /**
- * Creates a new test .
- */
- public WatchpointRequestTest() {
- super();
- }
- /**
- * Init the fields that are used by this test only.
- */
- public void localSetUp() {
- // Get an acces watchpoint request
- fAccessWatchpointRequest = getAccessWatchpointRequest();
-
- // Get a modification watchpoint request
- fModificationWatchpointRequest = getModificationWatchpointRequest();
- }
- /**
- * Make sure the test leaves the VM in the same state it found it.
- */
- public void localTearDown() {
- // Delete the watchpoint requests we created in this test
- fVM.eventRequestManager().deleteEventRequest(fAccessWatchpointRequest);
- fVM.eventRequestManager().deleteEventRequest(
- fModificationWatchpointRequest);
- }
- /**
- * Run all tests and output to standard output.
- */
- public static void main(java.lang.String[] args) {
- new WatchpointRequestTest().runSuite(args);
- }
- /**
- * Gets the name of the test case.
- */
- public String getName() {
- return "com.sun.jdi.request.WatchpointRequest";
- }
- /**
- * Test JDI field().
- */
- public void testJDIField() {
- assertEquals("1", getField("fBool"), fAccessWatchpointRequest.field());
- assertEquals(
- "2",
- getField("fBool"),
- fModificationWatchpointRequest.field());
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/MainClass.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/MainClass.java
deleted file mode 100644
index ae7d107..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/MainClass.java
+++ /dev/null
@@ -1,321 +0,0 @@
-package org.eclipse.debug.jdi.tests.program;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-/**
- * Main class for target VM tests.
- * This class is intended to be run by the target VM.
- * It will use other classes in this package, and it will create and terminate
- * threads as a regular program would do.
- *
- * WARNING, WARNING:
- * Tests in org.eclipse.debug.jdi.tests assume the content of this class,
- * as well as its behavior. So if this class or one of the types in this
- * package is changed, the corresponding tests must also be changed.
- */
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Date;
-
-public class MainClass extends Date implements Runnable, Printable {
-
- private static byte[] byteArray = new byte[0];
- private static byte[][] byteDoubleArray = new byte[0][0];
- private static short[] shortArray = new short[0];
- private static short[][] shortDoubleArray = new short[0][0];
- private static int[] intArray = new int[0];
- private static int[][] intDoubleArray = new int[0][0];
- private static long[] longArray = new long[0];
- private static long[][] longDoubleArray = new long[0][0];
- private static double[] doubleArray = new double[0];
- private static double[][] doubleDoubleArray = new double[0][0];
- private static float[] floatArray = new float[0];
- private static float[][] floatDoubleArray = new float[0][0];
- private static char[] charArray = new char[0];
- private static char[][] charDoubleArray = new char[0][0];
- private static boolean[] booleanArray = new boolean[0];
- private static boolean[][] booleanDoubleArray = new boolean[0][0];
-
- private String string = "";
- private String[] stringArray = new String[0];
- private String[][] stringDoubleArray = new String[0][0];
-
- public static int fInt = 0;
-
- public static MainClass fObject = new MainClass();
-
- public static String fString = "Hello World";
-
- public static Thread fThread;
-
- public static Thread fMainThread;
-
- public static String[] fArray = new String[] { "foo", "bar", "hop" };
-
- public static double[] fDoubleArray = new double[] { 1, 2.2, 3.33 };
-
- public static String fEventType = "";
-
- public boolean fBool = false;
-
- private char fChar = 'a';
-
- private String fString2 = "Hello";
-
- protected final String fString3 = "HEY";
-
- public MainClass() {
- }
-
- /* Used to test ClassType.newInstance */
- public MainClass(int i, Object o1, Object o2) {
- }
-
- /* For invocation tests */
- private static String invoke1(int x, Object o) {
- if (o == null)
- return (new Integer(x)).toString();
- else
- return "";
- }
- /* For invocation tests */
- private static void invoke2() {
- throw new IndexOutOfBoundsException();
- }
- /* For invocation tests */
- private int invoke3(String str, Object o) {
- return Integer.parseInt(str);
- }
- /* For invocation tests */
- private long invoke4() throws java.io.EOFException {
- throw new java.io.EOFException();
- }
- /* For variables test */
- private void variablesTest(long l) {
- }
- public static void main(java.lang.String[] args) {
- // Start the test program
- ThreadGroup group = new ThreadGroup("Test ThreadGroup");
- fThread = new Thread(group, fObject, "Test Thread");
- fThread.start();
-
- fMainThread = Thread.currentThread();
-
- // Prevent this thread from dying
- while (true)
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- }
- public void print(OutputStream out) {
- String string = fInt++ +". " + fString;
- PrintWriter writer = new PrintWriter(out);
- writer.println(string);
- writer.flush();
- }
- synchronized public void printAndSignal() {
- print(System.out);
-
- // Signal readiness by throwing an exception
- try {
- throw new NegativeArraySizeException();
- } catch (NegativeArraySizeException exc) {
- }
- }
- public void run() {
- try {
- Thread t = Thread.currentThread();
- MainClass o = new OtherClass();
- // The front-end tests use the class load event to determine that the program has started
-
- if (CONSTANT == 2)
- System.out.println("CONSTANT=2");
-
- while (true) {
- printAndSignal();
- triggerEvent();
- useLocalVars(t, o);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- }
- } finally {
- System.out.println("Running finally block in MainClass.run()");
- }
- }
- /**
- * Trigger an access watchpoint event for the front-end.
- */
- private void triggerAccessWatchpointEvent() {
- if (fBool)
- System.out.println("fBool is true");
- }
- /**
- * Trigger a breakpoint event for the front-end.
- */
- private void triggerBreakpointEvent() {
- System.out.println("Breakpoint");
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent() {
- new TestClass();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent1() {
- new TestClass1();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent2() {
- new TestClass2();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent3() {
- new TestClass3();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent4() {
- new TestClass4();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent5() {
- new TestClass5();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent6() {
- new TestClass6();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent7() {
- new TestClass7();
- new TestClazz8();
- }
- /**
- * Trigger a class prepare event for the front-end.
- */
- private void triggerClassPrepareEvent8() {
- new TestClazz9();
- new TestClazz10();
- }
- /**
- * Trigger an event for the front-end.
- */
- private void triggerEvent() {
- /* Ensure we do it only once */
- String eventType = fEventType;
- fEventType = "";
-
- /* Trigger event according to the field fEventType */
- if (eventType.equals(""))
- return;
- else if (eventType.equals("AccessWatchpointEvent"))
- triggerAccessWatchpointEvent();
- else if (eventType.equals("StaticAccessWatchpointEvent"))
- triggerStaticAccessWatchpointEvent();
- else if (eventType.equals("BreakpointEvent"))
- triggerBreakpointEvent();
- else if (eventType.equals("ClassPrepareEvent"))
- triggerClassPrepareEvent();
- else if (eventType.equals("ClassPrepareEvent1"))
- triggerClassPrepareEvent1();
- else if (eventType.equals("ClassPrepareEvent2"))
- triggerClassPrepareEvent2();
- else if (eventType.equals("ClassPrepareEvent3"))
- triggerClassPrepareEvent3();
- else if (eventType.equals("ClassPrepareEvent4"))
- triggerClassPrepareEvent4();
- else if (eventType.equals("ClassPrepareEvent5"))
- triggerClassPrepareEvent5();
- else if (eventType.equals("ClassPrepareEvent6"))
- triggerClassPrepareEvent6();
- else if (eventType.equals("ClassPrepareEvent7"))
- triggerClassPrepareEvent7();
- else if (eventType.equals("ClassPrepareEvent8"))
- triggerClassPrepareEvent8();
- else if (eventType.equals("ExceptionEvent"))
- triggerExceptionEvent();
- else if (eventType.equals("ModificationWatchpointEvent"))
- triggerModificationWatchpointEvent();
- else if (eventType.equals("StaticModificationWatchpointEvent"))
- triggerStaticModificationWatchpointEvent();
- else if (eventType.equals("ThreadStartEvent"))
- triggerThreadStartEvent();
- else if (eventType.equals("ThreadDeathEvent"))
- triggerThreadDeathEvent();
- else
- System.out.println("Unknown event type: " + eventType);
- }
- /**
- * Trigger an exception event for the front-end.
- */
- private void triggerExceptionEvent() {
- Thread t = new Thread(new Runnable() {
- public void run() {
- throw new Error();
- }
- }, "Test Exception Event");
- t.start();
- }
- /**
- * Trigger a modification watchpoint event for the front-end.
- */
- private void triggerModificationWatchpointEvent() {
- fBool = true;
- }
- /**
- * Trigger an access watchpoint event to a static field
- * for the front-end.
- */
- private void triggerStaticAccessWatchpointEvent() {
- if (fObject == null)
- System.out.println("fObject is null");
- }
- /**
- * Trigger a modification watchpoint event of a static field
- * for the front-end.
- */
- private void triggerStaticModificationWatchpointEvent() {
- fString = "Hello Universe";
- }
- /**
- * Trigger a thread end event for the front-end.
- */
- private void triggerThreadDeathEvent() {
- new Thread("Test Thread Death Event").start();
- }
- /**
- * Trigger a thread start event for the front-end.
- */
- private void triggerThreadStartEvent() {
- new Thread("Test Thread Start Event").start();
- }
- private void useLocalVars(Thread t, MainClass o) {
- if (t == null)
- System.out.println("t is null");
- if (o == null)
- System.out.println("o is null");
-
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/OtherClass.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/OtherClass.java
deleted file mode 100644
index bd1b750..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/OtherClass.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.debug.jdi.tests.program;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-public class OtherClass extends MainClass {
- class InnerClass {
- }
- InnerClass fInner = new InnerClass();
- /**
- * OtherClass constructor comment.
- */
- public OtherClass() {
- super();
- }
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/Printable.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/Printable.java
deleted file mode 100644
index b31261e..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/Printable.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.debug.jdi.tests.program;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-/**
- * Interface type for target VM tests.
- * This interface is intended to be loaded by the target VM.
- *
- * WARNING, WARNING:
- * Tests in org.eclipse.debug.jdi.tests assume the content of this interface.
- * So if this interface or one of the types in this
- * package is changed, the corresponding tests must also be changed.
- */
-
-import java.io.OutputStream;
-
-public interface Printable extends Cloneable {
- int CONSTANT = 1;
-public void print(OutputStream out);
-}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass.java
deleted file mode 100644
index bbe205f..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass1.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass1.java
deleted file mode 100644
index 560143a..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass1.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass2.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass2.java
deleted file mode 100644
index 8b61cce..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass2.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass3.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass3.java
deleted file mode 100644
index f0f50f7..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass3.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass4.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass4.java
deleted file mode 100644
index 7ccef59..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass4.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass5.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass5.java
deleted file mode 100644
index ddba5d1..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass5.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass6.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass6.java
deleted file mode 100644
index e638623..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass6.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass7.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass7.java
deleted file mode 100644
index dc940f2..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClass7.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz10.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz10.java
deleted file mode 100644
index abd8b35..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz10.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz8.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz8.java
deleted file mode 100644
index 491cc7d..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz8.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz9.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz9.java
deleted file mode 100644
index 44387d9..0000000
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/program/TestClazz9.java
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.debug/buildnotes_jdt-debug.html b/org.eclipse.jdt.debug/buildnotes_jdt-debug.html
index 81d7e77..6b3a248 100644
--- a/org.eclipse.jdt.debug/buildnotes_jdt-debug.html
+++ b/org.eclipse.jdt.debug/buildnotes_jdt-debug.html
@@ -21,6 +21,7 @@
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55000">55000</a>: Invalid null check in JDIModelPresentation#getExpressionText()<br>
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54993">54993</a>: Internal Error while building<br>
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54896">54896</a>: Disabled watch expressions still update<br>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55179">55179</a>: Toggle Breakpoint action and key binding missing<br>
<h1>
Eclipse Platform Build Notes <br>
diff --git a/org.eclipse.jdt.launching.macosx/.classpath b/org.eclipse.jdt.launching.macosx/.classpath
deleted file mode 100644
index 64ec817..0000000
--- a/org.eclipse.jdt.launching.macosx/.classpath
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="macosx"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.debug"/>
- <classpathentry kind="src" path="/org.eclipse.debug.core"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.core"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.launching"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime.compatibility"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.ui"/>
- <classpathentry kind="src" path="/org.eclipse.jface"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.launching.macosx/.cvsignore b/org.eclipse.jdt.launching.macosx/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/org.eclipse.jdt.launching.macosx/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.jdt.launching.macosx/.project b/org.eclipse.jdt.launching.macosx/.project
deleted file mode 100644
index 74cfe59..0000000
--- a/org.eclipse.jdt.launching.macosx/.project
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.launching.macosx</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.debug.core</project>
- <project>org.eclipse.jdt.core</project>
- <project>org.eclipse.jdt.debug</project>
- <project>org.eclipse.jdt.launching</project>
- <project>org.eclipse.jdt.ui</project>
- <project>org.eclipse.jface</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.launching.macosx/about.html b/org.eclipse.jdt.launching.macosx/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/org.eclipse.jdt.launching.macosx/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.jdt.launching.macosx/build.properties b/org.eclipse.jdt.launching.macosx/build.properties
deleted file mode 100644
index 5b18a3a..0000000
--- a/org.eclipse.jdt.launching.macosx/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = icons/,\
- plugin.xml,\
- about.html,\
- plugin.properties,\
- *.jar
-source.macosxlaunching.jar = macosx/
diff --git a/org.eclipse.jdt.launching.macosx/icons/full/ctool16/exportappbundle_wiz.gif b/org.eclipse.jdt.launching.macosx/icons/full/ctool16/exportappbundle_wiz.gif
deleted file mode 100644
index 6388d79..0000000
--- a/org.eclipse.jdt.launching.macosx/icons/full/ctool16/exportappbundle_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXDebugVMRunner.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXDebugVMRunner.java
deleted file mode 100644
index 3942411..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXDebugVMRunner.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.launching.macosx;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.launching.StandardVMDebugger;
-import org.eclipse.jdt.launching.IVMInstall;
-
-public class MacOSXDebugVMRunner extends StandardVMDebugger {
-
- public MacOSXDebugVMRunner(IVMInstall vmInstance) {
- super(vmInstance);
- }
-
- protected Process exec(String[] cmdLine, File workingDirectory) throws CoreException {
- return super.exec(MacOSXLaunchingPlugin.wrap(getClass(), cmdLine), workingDirectory);
- }
-
- protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
- return super.exec(MacOSXLaunchingPlugin.wrap(getClass(), cmdLine), workingDirectory, envp);
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLauncherMessages.properties b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLauncherMessages.properties
deleted file mode 100644
index b4e1482..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLauncherMessages.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-######################################################################
-# Copyright (c) 2002, 2004 IBM Corp. and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v0.5
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v05.html
-#
-# Contributors:
-# Andre Weinand - Initial implementation
-######################################################################
-
-MacOSXVMType.jvmName= JVM {0}
-MacOSXVMType.jvmDefaultName= JVM {0} (MacOS X Default)
-MacOSXVMType.error.notRoot=Not a JDK Root; MacOS X executable was not found
-MacOSXVMType.name=MacOS X VM
-
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLaunchingPlugin.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLaunchingPlugin.java
deleted file mode 100644
index 02ca7e9..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXLaunchingPlugin.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.launching.macosx;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Plugin;
-
-public class MacOSXLaunchingPlugin extends Plugin {
-
- private static MacOSXLaunchingPlugin fgPlugin;
- private static final String RESOURCE_BUNDLE= "org.eclipse.jdt.internal.launching.macosx.MacOSXLauncherMessages";//$NON-NLS-1$
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- public MacOSXLaunchingPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- fgPlugin= this;
- }
-
- public static MacOSXLaunchingPlugin getDefault() {
- return fgPlugin;
- }
-
- static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- static String getUniqueIdentifier() {
- if (getDefault() == null) {
- // If the default instance is not yet initialized,
- // return a static identifier. This identifier must
- // match the plugin id defined in plugin.xml
- return "org.eclipse.jdt.launching.macosx"; //$NON-NLS-1$
- }
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- static String[] wrap(Class clazz, String[] cmdLine) {
-
- for (int i= 0; i < cmdLine.length; i++) {
- // test whether we depend on SWT
- if (useSWT(cmdLine[i]))
- return createSWTlauncher(clazz, cmdLine, cmdLine[0]);
- }
- return cmdLine;
- }
-
- /*
- * Heuristics: returns true if given argument refers to SWT.
- */
- private static boolean useSWT(String arg) {
- return arg.indexOf("swt.jar") >= 0 || //$NON-NLS-1$
- arg.indexOf("org.eclipse.swt") >= 0 || //$NON-NLS-1$
- "-ws".equals(arg); //$NON-NLS-1$
- }
-
- /**
- * Returns path to executable.
- */
- static String[] createSWTlauncher(Class clazz, String[] cmdLine, String vmVersion) {
-
- // the following property is defined if Eclipse is started via java_swt
- String java_swt= System.getProperty("org.eclipse.swtlauncher"); //$NON-NLS-1$
- if (java_swt == null) {
- // if not defined try to guess...
- URL url= BootLoader.getInstallURL();
- java_swt= url.getPath() + "Eclipse.app/Contents/MacOS/java_swt"; //$NON-NLS-1$
- }
-
- if (java_swt == null)
- return cmdLine; // give up
-
- try {
- // copy java_swt to /tmp in order to get the app name right
- Process process= Runtime.getRuntime().exec(new String[] { "/bin/cp", java_swt, "/tmp" }); //$NON-NLS-1$ //$NON-NLS-2$
- process.waitFor();
- java_swt= "/tmp/java_swt"; //$NON-NLS-1$
- } catch (IOException e) {
- // ignore and run java_swt in place
- } catch (InterruptedException e) {
- // ignore and run java_swt in place
- }
-
- String[] newCmdLine= new String[cmdLine.length+1];
- int argCount= 0;
- newCmdLine[argCount++]= java_swt;
- newCmdLine[argCount++]= "-XXvm=" + vmVersion; //$NON-NLS-1$
- for (int i= 1; i < cmdLine.length; i++)
- newCmdLine[argCount++]= cmdLine[i];
-
- return newCmdLine;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstall.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstall.java
deleted file mode 100644
index fa2ccaf..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstall.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.launching.macosx;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.launching.AbstractVMInstall;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.IVMRunner;
-
-public class MacOSXVMInstall extends AbstractVMInstall {
-
- MacOSXVMInstall(IVMInstallType type, String id) {
- super(type, id);
- }
-
- public IVMRunner getVMRunner(String mode) {
- if (ILaunchManager.RUN_MODE.equals(mode))
- return new MacOSXVMRunner(this);
-
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return new MacOSXDebugVMRunner(this);
-
- return null;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java
deleted file mode 100644
index dbe4899..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.launching.macosx;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jdt.internal.launching.LibraryInfo;
-import org.eclipse.jdt.internal.launching.StandardVMType;
-
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jdt.launching.VMStandin;
-
-/**
- * This plugins into the org.eclipse.jdt.launching.vmInstallTypes extension point
- */
-public class MacOSXVMInstallType extends StandardVMType {
-
- /*
- * The directory structure for Java VMs is as follows:
- *
- * /System/Library/Frameworks/JavaVM.framework/Versions/
- * 1.3.1
- * Classes
- * classes.jar
- * ui.jar
- * Home
- * src.jar
- * 1.4.1
- * Classes
- * classes.jar
- * ui.jar
- * Home
- * src.jar
- * CurrentJDK -> 1.3.1
- */
-
- private static final String JAVA_VM_NAME= "Java HotSpot(TM) Client VM"; //$NON-NLS-1$
-
- /** The OS keeps all the JVM versions in this directory */
- private static final String JVM_VERSION_LOC= "/System/Library/Frameworks/JavaVM.framework/Versions/"; //$NON-NLS-1$
- /** The name of a Unix link to MacOS X's default VM */
- private static final String CURRENT_JVM= "CurrentJDK"; //$NON-NLS-1$
- /** The root of a JVM */
- private static final String JVM_ROOT= "Home"; //$NON-NLS-1$
- /** The doc (for all JVMs) lives here (if the developer kit has been expanded)*/
- private static final String JAVADOC_LOC= "/Developer/Documentation/Java/Reference/"; //$NON-NLS-1$
- /** The doc for 1.4.1 is kept in a sub directory of the above. */
- private static final String JAVADOC_SUBDIR= "/doc/api"; //$NON-NLS-1$
-
-
- public String getName() {
- return MacOSXLaunchingPlugin.getString("MacOSXVMType.name"); //$NON-NLS-1$
- }
-
- public IVMInstall doCreateVMInstall(String id) {
- return new MacOSXVMInstall(this, id);
- }
-
- /**
- * @see IVMInstallType#detectInstallLocation()
- */
- public File detectInstallLocation() {
-
- String javaVMName= System.getProperty("java.vm.name"); //$NON-NLS-1$
- if (javaVMName == null || !JAVA_VM_NAME.equals(javaVMName))
- return null;
-
- // find all installed VMs
- File defaultLocation= null;
- File versionDir= new File(JVM_VERSION_LOC);
- if (versionDir.exists() && versionDir.isDirectory()) {
- File currentJDK= new File(versionDir, CURRENT_JVM);
- try {
- currentJDK= currentJDK.getCanonicalFile();
- } catch (IOException ex) {
- // NeedWork
- }
- File[] versions= versionDir.listFiles();
- for (int i= 0; i < versions.length; i++) {
- String version= versions[i].getName();
- File home= new File(versions[i], JVM_ROOT);
- if (home.exists() && findVMInstall(version) == null && !CURRENT_JVM.equals(version)) {
-
- boolean isDefault= currentJDK.equals(versions[i]);
-
- VMStandin vm= new VMStandin(this, version);
- vm.setInstallLocation(home);
- String format= MacOSXLaunchingPlugin.getString(isDefault
- ? "MacOSXVMType.jvmDefaultName" //$NON-NLS-1$
- : "MacOSXVMType.jvmName"); //$NON-NLS-1$
- vm.setName(MessageFormat.format(format, new Object[] { version } ));
- vm.setLibraryLocations(getDefaultLibraryLocations(home));
- URL doc= getDefaultJavadocLocation(home);
- if (doc != null)
- vm.setJavadocLocation(doc);
-
- IVMInstall rvm= vm.convertToRealVM();
-
- if (isDefault) {
- defaultLocation= home;
- try {
- JavaRuntime.setDefaultVMInstall(rvm, null);
- } catch (CoreException e) {
- // NeedWork
- }
- }
- }
- }
- }
- return defaultLocation;
- }
-
- /**
- * Returns default library info for the given install location.
- *
- * @param installLocation
- * @return LibraryInfo
- */
- protected LibraryInfo getDefaultLibraryInfo(File installLocation) {
-
- File classes = new File(installLocation, "../Classes"); //$NON-NLS-1$
- File lib1= new File(classes, "classes.jar"); //$NON-NLS-1$
- File lib2= new File(classes, "ui.jar"); //$NON-NLS-1$
-
- String[] libs = new String[] { lib1.toString(),lib2.toString() };
-
- File lib = new File(installLocation, "lib"); //$NON-NLS-1$
- File extDir = new File(lib, "ext"); //$NON-NLS-1$
- String[] dirs = null;
- if (extDir == null)
- dirs = new String[0];
- else
- dirs = new String[] {extDir.getAbsolutePath()};
-
- File endDir = new File(lib, "endorsed"); //$NON-NLS-1$
- String[] endDirs = null;
- if (endDir == null)
- endDirs = new String[0];
- else
- endDirs = new String[] {endDir.getAbsolutePath()};
-
- return new LibraryInfo("???", libs, dirs, endDirs); //$NON-NLS-1$
- }
-
- protected IPath getDefaultSystemLibrarySource(File libLocation) {
- File parent= libLocation.getParentFile();
- while (parent != null) {
- File home= new File(parent, JVM_ROOT);
- File parentsrc= new File(home, "src.jar"); //$NON-NLS-1$
- if (parentsrc.isFile()) {
- setDefaultRootPath("src");//$NON-NLS-1$
- return new Path(parentsrc.getPath());
- }
- parentsrc= new File(home, "src.zip"); //$NON-NLS-1$
- if (parentsrc.isFile()) {
- setDefaultRootPath(""); //$NON-NLS-1$
- return new Path(parentsrc.getPath());
- }
- parent = parent.getParentFile();
- }
- setDefaultRootPath(""); //$NON-NLS-1$
- return Path.EMPTY; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.launching.IVMInstallType#validateInstallLocation(java.io.File)
- */
- public IStatus validateInstallLocation(File javaHome) {
- String id= MacOSXLaunchingPlugin.getUniqueIdentifier();
- File java= new File(javaHome, "bin"+File.separator+"java"); //$NON-NLS-2$ //$NON-NLS-1$
- if (java.isFile())
- return new Status(IStatus.OK, id, 0, "ok", null); //$NON-NLS-1$
- return new Status(IStatus.ERROR, id, 0, MacOSXLaunchingPlugin.getString("MacOSXVMType.error.notRoot"), null); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.launching.AbstractVMInstallType#getDefaultJavadocLocation(java.io.File)
- */
- public URL getDefaultJavadocLocation(File installLocation) {
-
- // try in local filesystem
- String id= null;
- try {
- String post= File.separator + JVM_ROOT;
- String path= installLocation.getCanonicalPath();
- if (path.startsWith(JVM_VERSION_LOC) && path.endsWith(post))
- id= path.substring(JVM_VERSION_LOC.length(), path.length()-post.length());
- } catch (IOException ex) {
- // we use the fall back from below
- }
- if (id != null) {
- String s= JAVADOC_LOC + id + JAVADOC_SUBDIR; //$NON-NLS-1$
- File docLocation= new File(s);
- if (!docLocation.exists()) {
- s= JAVADOC_LOC + id;
- docLocation= new File(s);
- if (!docLocation.exists())
- s= null;
- }
- if (s != null) {
- try {
- return new URL("file", "", s); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (MalformedURLException ex) {
- // we use the fall back from below
- }
- }
- }
-
- // fall back
- return super.getDefaultJavadocLocation(installLocation);
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMRunner.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMRunner.java
deleted file mode 100644
index c6d8227..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMRunner.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.launching.macosx;
-
-import java.io.*;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.launching.StandardVMRunner;
-import org.eclipse.jdt.launching.IVMInstall;
-
-public class MacOSXVMRunner extends StandardVMRunner {
-
- public MacOSXVMRunner(IVMInstall vmInstance) {
- super(vmInstance);
- }
-
- protected Process exec(String[] cmdLine, File workingDirectory) throws CoreException {
- return super.exec(MacOSXLaunchingPlugin.wrap(getClass(), cmdLine), workingDirectory);
- }
-
- protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
- return super.exec(MacOSXLaunchingPlugin.wrap(getClass(), cmdLine), workingDirectory, envp);
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleAttributes.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleAttributes.java
deleted file mode 100644
index 188f763..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleAttributes.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-/**
- * All keys used in the BundleDescription.
- */
-public interface BundleAttributes {
- static final String LAUNCHER = "CFBundleExecutable"; //$NON-NLS-1$
-
- static final String ALL= "ALL"; //$NON-NLS-1$
-
- static final String GETINFO = "GetInfo"; //$NON-NLS-1$
- static final String IDENTIFIER = "Identifier"; //$NON-NLS-1$
- static final String ICONFILE = "IconFile"; //$NON-NLS-1$
- static final String VMOPTIONS = "VMOptions"; //$NON-NLS-1$
- static final String ARGUMENTS = "Arguments"; //$NON-NLS-1$
- static final String WORKINGDIR = "WorkingDir"; //$NON-NLS-1$
- static final String VERSION = "Version"; //$NON-NLS-1$
- static final String MAINCLASS = "MainClass"; //$NON-NLS-1$
- static final String SIGNATURE = "Signature"; //$NON-NLS-1$
- static final String DESTINATIONDIRECTORY = "DestinationDirectory"; //$NON-NLS-1$
- static final String APPNAME = "AppName"; //$NON-NLS-1$
- static final String JVMVERSION = "JVMVersion"; //$NON-NLS-1$
- static final String USES_SWT = "UsesSWT"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java
deleted file mode 100644
index 686839e..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import java.io.*;
-import java.util.*;
-import java.util.List;
-
-import javax.xml.parsers.*;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.transform.*;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.*;
-import org.w3c.dom.Document;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-
-public class BundleBuilder implements BundleAttributes {
-
- private List fProcesses= new ArrayList();
- private BundleDescription fBundleDescription;
-
-
- public void createBundle(BundleDescription bd, IProgressMonitor pm) throws IOException {
-
- fBundleDescription= bd;
-
- File tmp_dir= new File(bd.get(DESTINATIONDIRECTORY));
- String app_dir_name= bd.get(APPNAME) + ".app"; //$NON-NLS-1$
- File app_dir= new File(tmp_dir, app_dir_name);
- if (app_dir.exists())
- deleteDir(app_dir);
- app_dir= createDir(tmp_dir, app_dir_name, false); //$NON-NLS-1$
-
- File contents_dir= createDir(app_dir, "Contents", false); //$NON-NLS-1$
- createPkgInfo(contents_dir);
-
- File macos_dir= createDir(contents_dir, "MacOS", false); //$NON-NLS-1$
- String launcher_path= bd.get(LAUNCHER);
- if (launcher_path == null)
- throw new IOException();
- String launcher= copyFile(macos_dir, launcher_path, null);
-
- File resources_dir= createDir(contents_dir, "Resources", false); //$NON-NLS-1$
- File java_dir= createDir(resources_dir, "Java", false); //$NON-NLS-1$
-
- createInfoPList(contents_dir, resources_dir, java_dir, launcher);
-
- Iterator iter= fProcesses.iterator();
- while (iter.hasNext()) {
- Process p= (Process) iter.next();
- try {
- p.waitFor();
- } catch (InterruptedException e) {
- // silently ignore
- }
- }
- }
-
- private void createInfoPList(File contents_dir, File resources_dir, File java_dir, String launcher) throws IOException {
-
- File info= new File(contents_dir, "Info.plist"); //$NON-NLS-1$
- FileOutputStream fos= new FileOutputStream(info);
- BufferedOutputStream fOutputStream= new BufferedOutputStream(fos);
-
- DocumentBuilder docBuilder= null;
- DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- try {
- docBuilder= factory.newDocumentBuilder();
- } catch (ParserConfigurationException ex) {
- System.err.println("createInfoPList: could not get XML builder"); //$NON-NLS-1$
- }
- Document doc= docBuilder.newDocument();
-
- Element plist= doc.createElement("plist"); //$NON-NLS-1$
- doc.appendChild(plist);
- plist.setAttribute("version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- Element dict= doc.createElement("dict"); //$NON-NLS-1$
- plist.appendChild(dict);
-
- pair(dict, "CFBundleExecutable", null, launcher); //$NON-NLS-1$
- pair(dict, "CFBundleGetInfoString", GETINFO, null); //$NON-NLS-1$
- pair(dict, "CFBundleInfoDictionaryVersion", null, "6.0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- String iconName= null;
- String appName= fBundleDescription.get(APPNAME, null);
- if (appName != null)
- iconName= appName + ".icns"; //$NON-NLS-1$
- String fname= copyFile(resources_dir, fBundleDescription.get(ICONFILE, null), iconName);
- if (fname != null)
- pair(dict, "CFBundleIconFile", null, fname); //$NON-NLS-1$
-
- pair(dict, "CFBundleIdentifier", IDENTIFIER, null); //$NON-NLS-1$
- pair(dict, "CFBundleName", APPNAME, null); //$NON-NLS-1$
- pair(dict, "CFBundlePackageType", null, "APPL"); //$NON-NLS-1$ //$NON-NLS-2$
- pair(dict, "CFBundleShortVersionString", VERSION, null); //$NON-NLS-1$
- pair(dict, "CFBundleSignature", SIGNATURE, "????"); //$NON-NLS-1$ //$NON-NLS-2$
- pair(dict, "CFBundleVersion", null, "1.0.1"); //$NON-NLS-1$ //$NON-NLS-2$
-
- Element jdict= doc.createElement("dict"); //$NON-NLS-1$
- add(dict, "Java", jdict); //$NON-NLS-1$
-
- pair(jdict, "JVMVersion", JVMVERSION, null); //$NON-NLS-1$
- pair(jdict, "MainClass", MAINCLASS, null); //$NON-NLS-1$
- pair(jdict, "WorkingDirectory", WORKINGDIR, null); //$NON-NLS-1$
-
- String arguments= fBundleDescription.get(ARGUMENTS, null);
- if (arguments != null) {
- Element argArray= doc.createElement("array"); //$NON-NLS-1$
- add(jdict, "Arguments", argArray); //$NON-NLS-1$
- StringTokenizer st= new StringTokenizer(arguments);
- while (st.hasMoreTokens()) {
- String arg= st.nextToken();
- Element type= doc.createElement("string"); //$NON-NLS-1$
- argArray.appendChild(type);
- type.appendChild(doc.createTextNode(arg));
- }
- }
-
- pair(jdict, "VMOptions", VMOPTIONS, null); //$NON-NLS-1$
-
- int[] id= new int[] { 0 };
- ResourceInfo[] ris= fBundleDescription.getResources(true);
- if (ris.length > 0) {
- StringBuffer cp= new StringBuffer();
- for (int i= 0; i < ris.length; i++) {
- ResourceInfo ri= ris[i];
- String e= processClasspathEntry(java_dir, ri.fPath, id);
- if (cp.length() > 0)
- cp.append(':');
- cp.append(e);
- }
- add(jdict, "ClassPath", cp.toString()); //$NON-NLS-1$
- }
-
- ris= fBundleDescription.getResources(false);
- if (ris.length > 0) {
- for (int i= 0; i < ris.length; i++) {
- ResourceInfo ri= ris[i];
- processClasspathEntry(java_dir, ri.fPath, id);
- }
- }
-
- try {
- // Write the document to the stream
- Transformer transformer= TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Apple Computer//DTD PLIST 1.0//EN"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://www.apple.com/DTDs/PropertyList-1.0.dtd"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$
- DOMSource source= new DOMSource(doc);
- StreamResult result= new StreamResult(fOutputStream);
- transformer.transform(source, result);
- } catch (TransformerException e) {
- System.err.println("createInfoPList: could not transform to XML"); //$NON-NLS-1$
- }
- }
-
- private void add(Element dict, String key, Element value) {
- Document document= dict.getOwnerDocument();
- Element k= document.createElement("key"); //$NON-NLS-1$
- dict.appendChild(k);
- k.appendChild(document.createTextNode(key));
- dict.appendChild(value);
- }
-
- private void create(Element parent, String s) {
- Document document= parent.getOwnerDocument();
- Element type= document.createElement("string"); //$NON-NLS-1$
- parent.appendChild(type);
- type.appendChild(document.createTextNode(s));
- }
-
- private void add(Element dict, String key, String value) {
- Document document= dict.getOwnerDocument();
- Element k= document.createElement("key"); //$NON-NLS-1$
- dict.appendChild(k);
- k.appendChild(document.createTextNode(key));
- create(dict, value);
- }
-
- private void pair(Element dict, String outkey, String inkey, String dflt) {
- String value= null;
- if (inkey != null)
- value= fBundleDescription.get(inkey, dflt);
- else
- value= dflt;
- if (value != null && value.trim().length() > 0) {
- add(dict, outkey, value);
- }
- }
-
- private String processClasspathEntry(File java_dir, String name, int[] id_ref) throws IOException {
- File f= new File(name);
- if (f.isDirectory()) {
- int id= id_ref[0]++;
- String archivename= "jar_" + id + ".jar"; //$NON-NLS-1$ //$NON-NLS-2$
- File to= new File(java_dir, archivename);
- zip(name, to.getAbsolutePath());
- name= archivename;
- } else {
- name= copyFile(java_dir, name, null);
- }
- return "$JAVAROOT/" + name; //$NON-NLS-1$
- }
-
- private void createPkgInfo(File contents_dir) throws IOException {
- File pkgInfo= new File(contents_dir, "PkgInfo"); //$NON-NLS-1$
- FileOutputStream os= new FileOutputStream(pkgInfo);
- os.write(("APPL" + fBundleDescription.get(SIGNATURE, "????")).getBytes()); //$NON-NLS-1$ //$NON-NLS-2$
- os.close();
- }
-
- private static void deleteDir(File dir) {
- File[] files= dir.listFiles();
- if (files != null) {
- for (int i= 0; i < files.length; i++)
- deleteDir(files[i]);
- }
- dir.delete();
- }
-
- private File createDir(File parent_dir, String dir_name, boolean remove) throws IOException {
- File dir= new File(parent_dir, dir_name);
- if (dir.exists()) {
- if (!remove)
- return dir;
- deleteDir(dir);
- }
- if (! dir.mkdir())
- throw new IOException("cannot create dir " + dir_name); //$NON-NLS-1$
- return dir;
- }
-
- private String copyFile(File todir, String fromPath, String toname) throws IOException {
- if (toname == null) {
- int pos= fromPath.lastIndexOf('/');
- if (pos >= 0)
- toname= fromPath.substring(pos+1);
- else
- toname= fromPath;
- }
- File to= new File(todir, toname);
- fProcesses.add(Runtime.getRuntime().exec(new String[] { "/bin/cp", fromPath, to.getAbsolutePath() })); //$NON-NLS-1$
- return toname;
- }
-
- private void zip(String dir, String dest) throws IOException {
- fProcesses.add(Runtime.getRuntime().exec(new String[] { "/usr/bin/jar", "cf", dest, "-C", dir, "." })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleDescription.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleDescription.java
deleted file mode 100644
index 2f2e6b7..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleDescription.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import java.io.*;
-import java.io.File;
-import java.util.*;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.util.ListenerList;
-
-import org.eclipse.debug.core.*;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
-
-
-class BundleDescription implements BundleAttributes {
-
- private ListenerList fListeners= new ListenerList();
- private Properties fProperties= new Properties();
- private List fClassPath= new ArrayList();
- private List fResources= new ArrayList();
- Properties fProperties2= new Properties();
-
-
- BundleDescription() {
- clear();
- }
-
- void clear() {
- fProperties.clear();
- fClassPath.clear();
- fResources.clear();
- fProperties2.clear();
- fProperties.put(SIGNATURE, "????"); //$NON-NLS-1$
- fProperties.put(ICONFILE, "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Resources/GenericApp.icns"); //$NON-NLS-1$
- }
-
- void addResource(ResourceInfo ri, boolean onClasspath) {
- if (onClasspath)
- fClassPath.add(ri);
- else
- fResources.add(ri);
- }
-
- boolean removeResource(ResourceInfo ri, boolean onClasspath) {
- if (onClasspath)
- return fClassPath.remove(ri);
- return fResources.remove(ri);
- }
-
- ResourceInfo[] getResources(boolean onClasspath) {
- if (onClasspath)
- return (ResourceInfo[]) fClassPath.toArray(new ResourceInfo[fClassPath.size()]);
- return (ResourceInfo[]) fResources.toArray(new ResourceInfo[fResources.size()]);
- }
-
- void addListener(IPropertyChangeListener listener) {
- fListeners.add(listener);
- }
-
- void removeListener(IPropertyChangeListener listener) {
- fListeners.remove(listener);
- }
-
- String get(String key) {
- return fProperties.getProperty(key);
- }
-
- public String get(String key, String dflt) {
- return fProperties.getProperty(key, dflt);
- }
-
- public boolean get(String key, boolean dflt) {
- Boolean v= (Boolean) fProperties.get(key);
- if (v == null)
- return dflt;
- return v.booleanValue();
- }
-
- void setValue(String key, Object value) {
- fProperties.put(key, value);
- }
-
- void inititialize(ILaunchConfiguration lc) {
- AbstractJavaLaunchConfigurationDelegate lcd;
- try {
- lcd= (AbstractJavaLaunchConfigurationDelegate) lc.getType().getDelegate(ILaunchManager.RUN_MODE);
- } catch (CoreException e) {
- return;
- }
-
- String appName= lc.getName();
- fProperties.put(APPNAME, appName);
- fProperties.put(GETINFO, appName + Util.getString("BundleDescription.copyright.format")); //$NON-NLS-1$
-
- try {
- fProperties.put(MAINCLASS, lcd.getMainTypeName(lc));
- } catch (CoreException e) {
- fProperties.put(MAINCLASS, ""); //$NON-NLS-1$
- }
- try {
- fProperties.put(ARGUMENTS, lcd.getProgramArguments(lc));
- } catch (CoreException e) {
- fProperties.put(ARGUMENTS, ""); //$NON-NLS-1$
- }
- String wd= null;
- try {
- wd= lcd.getWorkingDirectory(lc).getAbsolutePath();
-// fProperties.put(WORKINGDIR, wd); //$NON-NLS-1$
- } catch (CoreException e) {
-// fProperties.put(WORKINGDIR, ""); //$NON-NLS-1$
- }
- try {
- fProperties.put(MAINCLASS, lcd.getMainTypeName(lc));
- } catch (CoreException e) {
- fProperties.put(MAINCLASS, ""); //$NON-NLS-1$
- }
-
- try {
- String[] classpath= lcd.getClasspath(lc);
- for (int i= 0; i < classpath.length; i++)
- addResource(new ResourceInfo(classpath[i]), true); //$NON-NLS-1$
- } catch (CoreException e) {
- //
- }
-
- String vmOptions2= ""; //$NON-NLS-1$
- String vmOptions= null;
- try {
- vmOptions= lcd.getVMArguments(lc);
- } catch (CoreException e) {
- //
- }
- if (vmOptions != null) {
- StringTokenizer st= new StringTokenizer(vmOptions);
- while (st.hasMoreTokens()) {
- String token= st.nextToken();
- int pos= token.indexOf('=');
- if (pos > 2 && token.startsWith("-D")) { //$NON-NLS-1$
- String key= token.substring(2, pos).trim();
- String value= token.substring(pos+1).trim();
- int l= value.length();
- if (l >= 2 && value.charAt(0) == '"' && value.charAt(l-1) == '"')
- value= value.substring(1, l-1);
- if ("java.library.path".equals(key)) { //$NON-NLS-1$
- addDllDir(wd, value);
- } else {
- fProperties2.put(key, value);
- }
- } else {
- vmOptions2= vmOptions2 + token + ' ';
- }
- }
- }
-
- fProperties.put(VMOPTIONS, vmOptions2);
-
- boolean isSWT= false;
- Iterator iter= fResources.iterator();
- while (iter.hasNext()) {
- ResourceInfo ri= (ResourceInfo) iter.next();
- if (ri.fPath.indexOf("libswt-carbon") >= 0) { //$NON-NLS-1$
- isSWT= true;
- break;
- }
- }
- fProperties.put(USES_SWT, new Boolean(isSWT));
-
- String launcher= null;
- if (isSWT) {
- launcher= System.getProperty("org.eclipse.swtlauncher"); //$NON-NLS-1$
- } else {
- setValue(JVMVERSION, "1.4*"); //$NON-NLS-1$
- launcher= "/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/MacOS/JavaApplicationStub"; //$NON-NLS-1$
- }
- setValue(LAUNCHER, launcher);
-
-
- IJavaProject p= null;
- try {
- p= lcd.getJavaProject(lc);
- } catch (CoreException e) {
- // ignore
- }
- if (p != null)
- fProperties.put(IDENTIFIER, p.getElementName());
- else
- fProperties.put(IDENTIFIER, ""); //$NON-NLS-1$
-
- fireChange();
- }
-
- void fireChange() {
- PropertyChangeEvent e= new PropertyChangeEvent(this, ALL, null, null);
- Object[] listeners= fListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IPropertyChangeListener)listeners[i]).propertyChange(e);
- }
-
- private void addDllDir(String wd, String path) {
- File lib_dir;
- if (path.startsWith("../")) { //$NON-NLS-1$
- lib_dir= new File(wd, path);
- } else {
- lib_dir= new File(path);
- }
- if (lib_dir.isDirectory()) {
- File[] dlls= lib_dir.listFiles();
- for (int j= 0; j < dlls.length; j++) {
- try {
- String name= dlls[j].getCanonicalPath();
- if (name.endsWith(".jnilib")) //$NON-NLS-1$
- addResource(new ResourceInfo(name), false); //$NON-NLS-1$
- } catch (IOException e) {
- // NeedWork Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
-
- static boolean verify(ILaunchConfiguration lc) {
- String name= lc.getName();
- if (name.indexOf("jpage") >= 0) //$NON-NLS-1$
- return false;
- AbstractJavaLaunchConfigurationDelegate lcd;
- try {
- lcd= (AbstractJavaLaunchConfigurationDelegate) lc.getType().getDelegate(ILaunchManager.RUN_MODE);
- if (lcd.getMainTypeName(lc) == null)
- return false;
- return true;
- } catch (CoreException e) {
- return false;
- }
- }
-
- static boolean matches(ILaunchConfiguration lc, IJavaProject project) {
- AbstractJavaLaunchConfigurationDelegate lcd;
- try {
- lcd= (AbstractJavaLaunchConfigurationDelegate) lc.getType().getDelegate(ILaunchManager.RUN_MODE);
- } catch (CoreException e) {
- return false;
- }
- IJavaProject p= null;
- try {
- p= lcd.getJavaProject(lc);
- } catch (CoreException e) {
- return false;
- }
- return project != null && project.equals(p);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleMessages.properties b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleMessages.properties
deleted file mode 100644
index f02e84f..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleMessages.properties
+++ /dev/null
@@ -1,56 +0,0 @@
-######################################################################
-# Copyright (c) 2002, 2004 IBM Corp. and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v0.5
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v05.html
-#
-# Contributors:
-# Andre Weinand - Initial implementation
-######################################################################
-
-MacBundleWizard.title=Application Bundle Export
-
-page1.title=Basic Properties and Location
-page1.message=Message1
-page1.description= Specify basic properties and location
-page1.launchConfig.label=Use this launch configuration:
-page1.mainClass.label=Main class:
-page1.mainClass.chooseButton.label=Search...
-page1.mainClass.dialog.title=Choose Main Type
-page1.mainClass.dialog.message=Not yet implemented
-page1.arguments.label=Arguments:
-page1.appName.label=Application name:
-page1.appFolder.label=Folder:
-page1.appFolder.browseButton.label=Browse...
-page1.appFolder.browseDialog.message=Choose the folder in which to create the application
-page1.appFolder.browseDialog.title=Choose Folder
-page1.jvm.label=JVM version:
-page1.useSWT.label=Use SWT:
-page1.appIcon.label=Icon:
-page1.appIcon.chooseButton.label=Choose...
-page1.appIcon.chooseDialog.title=Choose a *.icns file
-
-page2.title= Classpath and Libraries
-page2.message=Message2
-page2.description= Specify files to copy into application bundle
-page2.workingDirectory.label=Working directory:
-page2.addToClasspath.group.label=Add to classpath
-page2.addToBundle.group.label=Add to bundle
-page2.addFile.button.label=Add file...
-page2.chooseFileDialog.title=Choose a file
-page2.addFolder.button.label=Add folder...
-page2.chooseFolder.dialog.title=Choose a folder
-page2.remove.button.label=Remove
-
-page3.title= Properties and Options
-page3.message=Message3
-page3.description= Specify properties and options
-page3.identifier.label=Identifier:
-page3.signature.label=Signature:
-page3.vmOptions.label=VM options:
-page3.propertiesGroup.label=Properties
-page3.keys.column.label=Keys
-page3.values.column.label=Values
-
-BundleDescription.copyright.format=1.0, Copyright {user} 2004. All rights reserved.
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardBasePage.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardBasePage.java
deleted file mode 100644
index 7ab1dec..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardBasePage.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.wizard.*;
-
-
-public abstract class BundleWizardBasePage extends DialogPage implements IWizardPage, BundleAttributes, IPropertyChangeListener {
-
- /**
- * The page that was shown right before this page became visible;
- * <code>null</code> if none.
- */
- private IWizardPage fPreviousPage;
- /**
- * This page's message key.
- */
- private String fKey;
- /**
- * The wizard to which this page belongs; <code>null</code>
- * if this page has yet to be added to a wizard.
- */
- private IWizard fWizard;
-
- BundleDescription fBundleDescription;
-
-
- BundleWizardBasePage(String key, BundleDescription bd) {
- super(Util.getString(key + ".title")); //$NON-NLS-1$
- fKey= key;
- fBundleDescription= bd;
- //setMessage(Util.getString(fKey + ".message")); //$NON-NLS-1$
- setDescription(Util.getString(fKey + ".description")); //$NON-NLS-1$
-
- bd.addListener(this);
- }
-
- /* (non-Javadoc)
- * Method declared in WizardPage
- */
- public void setVisible(boolean visible) {
- if (visible)
- enterPage();
- else
- leavePage();
- super.setVisible(visible);
- }
-
- void enterPage() {
- //System.out.println("enterPage: " + getName());
- }
-
- void leavePage() {
- //System.out.println("leavePage: " + getName());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- final public void createControl(Composite parent) {
-
- Composite c= new Composite(parent, SWT.NULL);
- c.setLayout(new GridLayout(1, false));
- setControl(c);
-
- createContents(c);
-
- checkIfPageComplete();
- }
-
- abstract public void createContents(Composite parent);
-
- static void setHeightHint(Control control, int height) {
- GridData gd1= new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gd1.heightHint= height;
- control.setLayoutData(gd1);
- }
-
- static Label createLabel(Composite parent, String text, int align) {
- Label l= new Label(parent, SWT.NONE);
- l.setText(text);
- l.setLayoutData(new GridData(align));
- return l;
- }
-
- static Composite createComposite(Composite parent, int columns) {
- Composite c= new Composite(parent, SWT.NONE);
- c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout gl= new GridLayout(columns, false);
- gl.marginWidth= 0;
- c.setLayout(gl);
- return c;
- }
-
- Text createText(Composite parent, String key, int lines) {
- Text t= new Text(parent, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- if (lines == 2)
- gd.heightHint= 30;
- t.setLayoutData(gd);
- hookField(t, key);
- return t;
- }
-
- Combo createCombo(Composite parent, String key) {
- Combo c= new Combo(parent, SWT.BORDER);
- c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hookField(c, key);
- return c;
- }
-
- static Group createGroup(Composite parent, String text, int columns) {
- Group g= new Group(parent, SWT.NONE);
- g.setText(text);
- g.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- g.setLayout(new GridLayout(columns, false));
- return g;
- }
-
- Button createButton(Composite parent, int flags, String text) {
- Button b= new Button(parent, flags);
- if (text != null)
- b.setText(text);
- return b;
- }
-
- static Composite createHBox(Composite parent) {
- Composite c= new Composite(parent, SWT.NONE);
- c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout gl= new GridLayout(2, false);
- gl.marginWidth= gl.marginHeight= 0;
- c.setLayout(gl);
- return c;
- }
-
- void hookField(final Text tf, final String key) {
- tf.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- fBundleDescription.setValue(key, tf.getText());
- checkIfPageComplete();
- }
- });
- }
-
- void hookField(final Combo tf, final String key) {
- tf.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- fBundleDescription.setValue(key, tf.getText());
- checkIfPageComplete();
- }
- });
- }
-
- void hookButton(final Button b, final String key) {
- b.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fBundleDescription.setValue(key, new Boolean(b.getSelection()));
- checkIfPageComplete();
- }
- });
- }
-
- final void checkIfPageComplete() {
- IWizardContainer c= (fWizard != null) ? fWizard.getContainer() : null;
- if (c != null && this == c.getCurrentPage())
- c.updateButtons();
- }
-
- /////////////////////////////////////////////////////////
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- return isPageComplete() && getNextPage() != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#getName()
- */
- public String getName() {
- return Util.getString(fKey + ".title"); //$NON-NLS-1$;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#getNextPage()
- */
- public IWizardPage getNextPage() {
- if (fWizard == null)
- return null;
- return fWizard.getNextPage(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#getPreviousPage()
- */
- public IWizardPage getPreviousPage() {
- if (fPreviousPage != null)
- return fPreviousPage;
- if (fWizard != null)
- return fWizard.getPreviousPage(this);
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#getWizard()
- */
- public IWizard getWizard() {
- return fWizard;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#setPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public void setPreviousPage(IWizardPage page) {
- fPreviousPage= page;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
- */
- public void setWizard(IWizard newWizard) {
- fWizard= newWizard;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage1.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage1.java
deleted file mode 100644
index 895f319..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage1.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import java.util.*;
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-
-public class BundleWizardPage1 extends BundleWizardBasePage {
-
- static String[] JVMS= {
- "1.3+", //$NON-NLS-1$
- "1.3*", //$NON-NLS-1$
- "1.4.1", //$NON-NLS-1$
- "1.4+", //$NON-NLS-1$
- "1.4*" //$NON-NLS-1$
- };
-
- ILaunchConfiguration[] fConfigurations= new ILaunchConfiguration[0];
- Combo fLocation;
- Combo fLaunchConfigs;
- Combo fJVMVersion;
- Text fAppName;
- Text fMainClass;
- Text fArguments;
- Text fIconFileName;
- Button fUseSWT;
-
-
- public BundleWizardPage1(BundleDescription bd) {
- super("page1", bd); //$NON-NLS-1$
- }
-
- public void createContents(Composite c) {
-
- final Shell shell= c.getShell();
-
- Composite c1= createComposite(c, 2);
- createLabel(c1, Util.getString("page1.launchConfig.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
-
- fLaunchConfigs= new Combo(c1, SWT.READ_ONLY);
- fillCombo(fLaunchConfigs);
- fLaunchConfigs.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int ix= fLaunchConfigs.getSelectionIndex();
- if (ix > 0 && ix < fConfigurations.length) {
- fBundleDescription.clear();
- fBundleDescription.inititialize(fConfigurations[ix]);
- }
- }
- }
- );
-
-
- Group c2= createGroup(c, "Main", 2); //$NON-NLS-1$
- createLabel(c2, Util.getString("page1.mainClass.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- Composite c7a= createHBox(c2);
-
- fMainClass= createText(c7a, MAINCLASS, 1);
- Button b1= createButton(c7a, SWT.NONE, Util.getString("page1.mainClass.chooseButton.label")); //$NON-NLS-1$
- b1.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox mb= new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- mb.setMessage(Util.getString("page1.mainClass.dialog.message")); //$NON-NLS-1$
- mb.setText(Util.getString("page1.mainClass.dialog.title")); //$NON-NLS-1$
- mb.open();
- }
- });
-
- createLabel(c2, Util.getString("page1.arguments.label"), GridData.VERTICAL_ALIGN_BEGINNING); //$NON-NLS-1$
- fArguments= createText(c2, ARGUMENTS, 2);
-
- Group c5= createGroup(c, "Destination", 2); //$NON-NLS-1$
- createLabel(c5, Util.getString("page1.appName.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- fAppName= createText(c5, APPNAME, 1);
-
- createLabel(c5, Util.getString("page1.appFolder.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- Composite c3a= createHBox(c5);
-
- fLocation= createCombo(c3a, DESTINATIONDIRECTORY);
-
- final Button browse= createButton(c3a, SWT.NONE, Util.getString("page1.appFolder.browseButton.label")); //$NON-NLS-1$
- browse.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dd= new DirectoryDialog(browse.getShell(), SWT.SAVE);
- dd.setMessage(Util.getString("page1.appFolder.browseDialog.message")); //$NON-NLS-1$
- dd.setText(Util.getString("page1.appFolder.browseDialog.title")); //$NON-NLS-1$
- String name= dd.open();
- if (name != null)
- fLocation.setText(name);
- }
- });
-
- Group g6= createGroup(c, "Options", 2); //$NON-NLS-1$
-
- createLabel(g6, Util.getString("page1.jvm.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
-
- Composite c8= createComposite(g6, 4);
-
- fJVMVersion= new Combo(c8, SWT.READ_ONLY);
- for (int i= 0; i < JVMS.length; i++)
- fJVMVersion.add(JVMS[i]);
- fJVMVersion.setText(JVMS[4]);
- hookField(fJVMVersion, JVMVERSION);
- createLabel(c8, " ", GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- createLabel(c8, Util.getString("page1.useSWT.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- fUseSWT= createButton(c8, SWT.CHECK, null); //$NON-NLS-1$
- hookButton(fUseSWT, USES_SWT);
-
- createLabel(g6, Util.getString("page1.appIcon.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- Composite c7= createComposite(g6, 2);
- fIconFileName= createText(c7, ICONFILE, 1);
- final Button b= createButton(c7, SWT.NONE, Util.getString("page1.appIcon.chooseButton.label")); //$NON-NLS-1$
- b.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog fd= new FileDialog(b.getShell(), SWT.OPEN);
- fd.setText(Util.getString("page1.appIcon.chooseDialog.title")); //$NON-NLS-1$
- fd.setFilterExtensions(new String[] { "icns" }); //$NON-NLS-1$
- String name= fd.open();
- if (name != null)
- fIconFileName.setText(name);
- }
- });
-
- }
-
- void enterPage() {
- super.enterPage();
- initCombo(fLaunchConfigs);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (fAppName != null)
- fAppName.setText(fBundleDescription.get(APPNAME, "")); //$NON-NLS-1$
- if (fMainClass != null)
- fMainClass.setText(fBundleDescription.get(MAINCLASS, "")); //$NON-NLS-1$
- if (fJVMVersion != null)
- fJVMVersion.setText(fBundleDescription.get(JVMVERSION, "")); //$NON-NLS-1$
- if (fUseSWT != null)
- fUseSWT.setSelection(fBundleDescription.get(USES_SWT, false)); //$NON-NLS-1$
- }
-
- public boolean isPageComplete() {
- return fAppName != null && fAppName.getText().length() > 0 && fLocation.getText().length() > 0;
- }
-
- // private stuff
-
- private void collectLaunchConfigs() {
- ArrayList configs= new ArrayList();
- ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type= manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
- try {
- ILaunchConfiguration[] configurations= manager.getLaunchConfigurations(type);
- for (int i= 0; i < configurations.length; i++) {
- ILaunchConfiguration configuration= configurations[i];
- if (BundleDescription.verify(configuration))
- configs.add(configuration);
- }
- } catch (CoreException e) {
- //
- }
- fConfigurations= (ILaunchConfiguration[]) configs.toArray(new ILaunchConfiguration[configs.size()]);
- Arrays.sort(fConfigurations, new Comparator() {
- public int compare(Object o1, Object o2) {
- ILaunchConfiguration lc1= (ILaunchConfiguration) o1;
- ILaunchConfiguration lc2= (ILaunchConfiguration) o2;
- return lc1.getName().compareTo(lc2.getName());
- }
-
- public boolean equals(Object obj) {
- return false;
- }
- });
- }
-
- private void fillCombo(Combo c) {
- collectLaunchConfigs();
- for (int i= 0; i < fConfigurations.length; i++) {
- ILaunchConfiguration configuration= fConfigurations[i];
- c.add(configuration.getName());
- }
- }
-
- private void initCombo(Combo c) {
- IStructuredSelection sel= ((MacBundleWizard)getWizard()).getSelection();
- Object o= sel.getFirstElement();
- if (o instanceof IJavaElement) {
- IJavaProject project= ((IJavaElement) o).getJavaProject();
- if (project != null) {
- for (int i= 0; i < fConfigurations.length; i++) {
- ILaunchConfiguration configuration= fConfigurations[i];
- if (BundleDescription.matches(configuration, project)) {
- c.setText(configuration.getName());
- fBundleDescription.inititialize(configuration);
- return;
- }
- }
- }
- }
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage2.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage2.java
deleted file mode 100644
index c5e8786..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage2.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-
-public class BundleWizardPage2 extends BundleWizardBasePage {
-
- Text fWorkingDir;
- Table fClassPath;
- Table fResources;
-
-
- protected BundleWizardPage2(BundleDescription bd) {
- super("page2", bd); //$NON-NLS-1$
- }
-
- public void createContents(Composite parent) {
-
- Composite c= createComposite(parent, 2);
- createLabel(c, Util.getString("page2.workingDirectory.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- fWorkingDir= createText(c, WORKINGDIR, 1);
-
- fClassPath= createTableGroup(parent, Util.getString("page2.addToClasspath.group.label"), true); //$NON-NLS-1$
- fResources= createTableGroup(parent, Util.getString("page2.addToBundle.group.label"), false); //$NON-NLS-1$
- }
-
- Table createTableGroup(Composite parent, String groupName, final boolean onClasspath) {
- Group g1= createGroup(parent, groupName, 1);
- final Table table= new Table(g1, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- setHeightHint(table, 80);
- Composite c1= createComposite(g1, 3);
- final Button addButton1= createButton(c1, SWT.NONE, Util.getString("page2.addFile.button.label")); //$NON-NLS-1$
- addButton1.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog fd= new FileDialog(addButton1.getShell(), SWT.OPEN);
- fd.setText(Util.getString("page2.chooseFileDialog.title")); //$NON-NLS-1$
- String path= fd.open();
- if (path != null) {
- ResourceInfo ri= new ResourceInfo(path);
- fBundleDescription.addResource(ri, onClasspath);
- add(table, ri);
- }
- }
- });
- final Button addButton2= createButton(c1, SWT.NONE, Util.getString("page2.addFolder.button.label")); //$NON-NLS-1$
- addButton1.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog fd= new DirectoryDialog(addButton2.getShell(), SWT.OPEN);
- fd.setText(Util.getString("page2.chooseFolder.dialog.title")); //$NON-NLS-1$
- String path= fd.open();
- if (path != null) {
- ResourceInfo ri= new ResourceInfo(path);
- fBundleDescription.addResource(ri, onClasspath);
- add(table, ri);
- }
- }
- });
- final Button removeButton= createButton(c1, SWT.NONE, Util.getString("page2.remove.button.label")); //$NON-NLS-1$
- removeButton.setEnabled(false);
- removeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- remove(table, onClasspath, removeButton);
- }
- });
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- removeButton.setEnabled(table.getSelectionCount() > 0);
- }
- });
- return table;
- }
-
- private void add(Table t, ResourceInfo ri) {
- TableItem ti= new TableItem(t, SWT.NONE);
- ti.setData(ri);
- ti.setText(ri.fPath);
- }
-
- private void remove(Table table, boolean b, Button removeButton) {
- TableItem[] selection= table.getSelection();
- for (int i= 0; i < selection.length; i++) {
- TableItem ti= selection[i];
- ResourceInfo ri= (ResourceInfo) ti.getData();
- if (fBundleDescription.removeResource(ri, b)) {
- int ix= table.indexOf(ti);
- if (ix >= 0)
- table.remove(ix);
- }
- }
- removeButton.setEnabled(table.getSelectionCount() > 0);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (fWorkingDir != null)
- fWorkingDir.setText(fBundleDescription.get(WORKINGDIR, "")); //$NON-NLS-1$
-
- if (fClassPath != null) {
- fClassPath.removeAll();
- ResourceInfo[] ris= fBundleDescription.getResources(true);
- for (int i= 0; i < ris.length; i++)
- add(fClassPath, ris[i]);
- }
-
- if (fResources != null) {
- fResources.removeAll();
- ResourceInfo[] ris= fBundleDescription.getResources(false);
- for (int i= 0; i < ris.length; i++)
- add(fResources, ris[i]);
- }
- }
-
- public boolean isPageComplete() {
- return true;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage3.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage3.java
deleted file mode 100644
index c9f518e..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/BundleWizardPage3.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import java.util.Enumeration;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-
-public class BundleWizardPage3 extends BundleWizardBasePage {
-
- Text fIdentifier;
- Text fSignature;
- Text fVMOptions;
- Table fProperties;
-
- protected BundleWizardPage3(BundleDescription bd) {
- super("page3", bd); //$NON-NLS-1$
- }
-
- public void createContents(Composite c) {
-
- Composite c1= createComposite(c, 4);
-
- createLabel(c1, Util.getString("page3.identifier.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- fIdentifier= createText(c1, IDENTIFIER, 1);
-
- createLabel(c1, Util.getString("page3.signature.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- fSignature= createText(c1, SIGNATURE, 1);
-
- createLabel(c, Util.getString("page3.vmOptions.label"), GridData.VERTICAL_ALIGN_CENTER); //$NON-NLS-1$
- fVMOptions= createText(c, VMOPTIONS, 2);
-
- Group g= createGroup(c, Util.getString("page3.propertiesGroup.label"), 1); //$NON-NLS-1$
- fProperties= new Table(g, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
- fProperties.setHeaderVisible(true);
- fProperties.setLinesVisible(true);
- fProperties.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- //
- }
- });
- setHeightHint(fProperties, 60);
-
- TableColumn col0= new TableColumn(fProperties, SWT.NONE);
- col0.setText(Util.getString("page3.keys.column.label")); //$NON-NLS-1$
- col0.setWidth(150);
-
- TableColumn col1= new TableColumn(fProperties, SWT.NONE);
- col1.setText(Util.getString("page3.values.column.label")); //$NON-NLS-1$
- col1.setWidth(150);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (fProperties == null)
- return;
- fIdentifier.setText(fBundleDescription.get(IDENTIFIER, "")); //$NON-NLS-1$
- fSignature.setText(fBundleDescription.get(SIGNATURE, "")); //$NON-NLS-1$
- fVMOptions.setText(fBundleDescription.get(VMOPTIONS, "")); //$NON-NLS-1$
-
- fProperties.removeAll();
- if (fBundleDescription.fProperties2 != null && fBundleDescription.fProperties2.size() > 0) {
- Enumeration iter= fBundleDescription.fProperties2.keys();
- for (int i= 0; iter.hasMoreElements(); i++) {
- String key= (String) iter.nextElement();
- String value= (String) fBundleDescription.fProperties2.get(key);
- TableItem ti= new TableItem(fProperties, SWT.NONE);
- ti.setText(0, key);
- ti.setText(1, value);
- }
- }
- }
-
- public boolean isPageComplete() {
- return true;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/MacBundleWizard.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/MacBundleWizard.java
deleted file mode 100644
index 4495a6b..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/MacBundleWizard.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import java.io.IOException;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IExportWizard;
-
-
-public class MacBundleWizard extends Wizard implements IExportWizard, BundleAttributes {
-
- IWorkbench fWorkbench;
- IStructuredSelection fSelection;
- BundleDescription fBundleDescription= new BundleDescription();
-
-
- public MacBundleWizard() {
- //setDefaultPageImageDescriptor(CompareUIPlugin.getImageDescriptor("wizban/applypatch_wizban.gif")); //$NON-NLS-1$
- setWindowTitle(Util.getString("MacBundleWizard.title")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- fWorkbench= workbench;
- fSelection= selection;
- }
-
- IStructuredSelection getSelection() {
- return fSelection;
- }
-
- /*
- * (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- super.addPages();
- addPage(new BundleWizardPage1(fBundleDescription));
- addPage(new BundleWizardPage2(fBundleDescription));
- addPage(new BundleWizardPage3(fBundleDescription));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- public boolean performFinish() {
- try {
- BundleBuilder bb= new BundleBuilder();
- bb.createBundle(fBundleDescription, null);
- } catch (IOException e) {
- // NeedWork Auto-generated catch block
- e.printStackTrace();
- }
- return true;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/ResourceInfo.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/ResourceInfo.java
deleted file mode 100644
index de1bb04..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/ResourceInfo.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-public class ResourceInfo {
-
- String fPath;
-
- ResourceInfo(String path) {
- fPath= path;
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/Util.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/Util.java
deleted file mode 100644
index d27f171..0000000
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/ui/macbundler/Util.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui.macbundler;
-
-import java.util.*;
-import java.util.ResourceBundle;
-
-
-public class Util {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.jdt.internal.ui.macbundler.BundleMessages"; //$NON-NLS-1$
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-
- static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/org.eclipse.jdt.launching.macosx/plugin.properties b/org.eclipse.jdt.launching.macosx/plugin.properties
deleted file mode 100644
index 5aa3c2e..0000000
--- a/org.eclipse.jdt.launching.macosx/plugin.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-pluginName = Mac OS X Launcher
-providerName=Eclipse.org
-
-#
-# Mac OS X Application Bundle Export Wizard
-#
-MacOSXAppBundleExporter.label=Mac OS X application bundle
-MacOSXAppBundleExporter.description=Package resources into a Mac OS X application bundle on the local file system
\ No newline at end of file
diff --git a/org.eclipse.jdt.launching.macosx/plugin.xml b/org.eclipse.jdt.launching.macosx/plugin.xml
deleted file mode 100644
index c321187..0000000
--- a/org.eclipse.jdt.launching.macosx/plugin.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.jdt.launching.macosx"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.jdt.internal.launching.macosx.MacOSXLaunchingPlugin">
-
- <runtime>
- <library name="macosxlaunching.jar"/>
- </runtime>
- <requires>
- <import plugin="org.eclipse.jdt.debug"/>
- <import plugin="org.eclipse.debug.core"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.jdt.core"/>
- <import plugin="org.eclipse.jdt.launching"/>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- <import plugin="org.eclipse.jdt.ui"/>
- <import plugin="org.eclipse.jface"/>
- <import plugin="org.eclipse.ui"/>
- </requires>
-
-
- <extension
- point="org.eclipse.jdt.launching.vmInstallTypes">
- <vmInstallType
- class="org.eclipse.jdt.internal.launching.macosx.MacOSXVMInstallType"
- id="org.eclipse.jdt.internal.launching.macosx.MacOSXType">
- </vmInstallType>
- </extension>
-
- <extension
- point="org.eclipse.ui.exportWizards">
- <wizard
- name="%MacOSXAppBundleExporter.label"
- icon="icons/full/ctool16/exportappbundle_wiz.gif"
- class="org.eclipse.jdt.internal.ui.macbundler.MacBundleWizard"
- id="org.eclipse.jdt.internal.ui.macbundler.MacBundleWizard">
- <description>
- %MacOSXAppBundleExporter.description
- </description>
- <selection
- class="org.eclipse.jdt.core.IJavaElement">
- </selection>
- </wizard>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.jdt.launching.macosx/scripts/exportplugin.xml b/org.eclipse.jdt.launching.macosx/scripts/exportplugin.xml
deleted file mode 100644
index 99e12fe..0000000
--- a/org.eclipse.jdt.launching.macosx/scripts/exportplugin.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!-- build script to create a plugin from org.eclipse.jdt.launching.macosx -->
-
-<project name="org.eclipse.jdt.launching.macosx" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.jdt.launching.macosx_3.0.0" />
- <property name="dest" value="${destdir}/${plugin}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/macosxlaunching.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- <zip zipfile="${dest}/macosxlaunchingsrc.zip">
- <fileset dir="macosx" />
- </zip>
- </target>
-</project>