Merge tag android-5.1.0_r1 into AOSP_5.1_MERGE

Change-Id: I81c8ae51ebfc0b048b6c180660b3ee8491195ce2
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java
index 68cefd6..6576065 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java
@@ -362,7 +362,6 @@
         checkReplyPacket(reply, "ClassType::InvokeMethod command", JDWPConstants.Error.INVALID_METHODID);
 
         logWriter.println("==> PASSED: Expected error (INVALID_METHODID) is returned");
-        logWriter.println("\n==> resumeDebuggee...");
         resumeDebuggee();
 
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
@@ -490,7 +489,6 @@
         checkReplyPacket(reply, "ClassType::InvokeMethod command", JDWPConstants.Error.INVALID_METHODID);
 
         logWriter.println("==> PASSED: Expected error (INVALID_METHODID) is returned");
-        logWriter.println("\n==> resumeDebuggee...");
         resumeDebuggee();
 
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierDebuggee.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierDebuggee.java
index 5ea9087..89ab4b0 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierDebuggee.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierDebuggee.java
@@ -27,7 +27,6 @@
 public class CountModifierDebuggee extends SyncDebuggee {
     static int locationEventCount = 0;
     static int exceptionEventCount = 0;
-    static int threadRunCount = 0;
     static int fieldReadWriteCount = 0;
 
     static int watchedField = 0;
@@ -62,18 +61,6 @@
         }
     }
 
-    void runThread() {
-        ++threadRunCount;
-        System.out.println("CountModifierDebuggee.startThread: threadRunCount=" + threadRunCount);
-        Thread t = new Thread("TestThread-" + threadRunCount);
-        t.start();
-        try {
-            t.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
     void readAndWriteField() {
         ++fieldReadWriteCount;
         System.out.println("CountModifierDebuggee.readAndWriteField: fieldReadWriteCount=" + fieldReadWriteCount);
@@ -102,11 +89,6 @@
             catchException(obj);
         }
 
-        threadRunCount = 0;
-        for (int i = 0; i < EVENT_COUNT; ++i) {
-            runThread();
-        }
-
         fieldReadWriteCount = 0;
         for (int i = 0; i < EVENT_COUNT; ++i) {
             readAndWriteField();
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierTest.java
index b70f02a..3a3938e 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/EventModifiers/CountModifierTest.java
@@ -169,46 +169,6 @@
     }
 
     /**
-     * This testcase is for THREAD_START event with Count modifier.
-     * <BR>It runs CountModifierDebuggee and requests THREAD_START event.
-     * <BR>Then calls {@link CountModifierDebuggee#runThread()}
-     * method multiple times and verifies that requested THREAD_START event
-     * occurs once after having called the method (count - 1) times. We check
-     * this by looking at the value in the field
-     * {@link CountModifierDebuggee#threadRunCount}.
-     */
-    public void testThreadStart() {
-        logWriter.println("testThreadStart started");
-
-        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
-
-        EventBuilder builder = createThreadStartBuilder();
-        testEventWithCountModifier(builder, THREAD_RUN_COUNT_FIELD_NAME);
-
-        logWriter.println("testThreadStart done");
-    }
-
-    /**
-     * This testcase is for THREAD_END event with Count modifier.
-     * <BR>It runs CountModifierDebuggee and requests THREAD_END event.
-     * <BR>Then calls {@link CountModifierDebuggee#runThread()}
-     * method multiple times and verifies that requested THREAD_END event
-     * occurs once after having called the method (count - 1) times. We check
-     * this by looking at the value in the field
-     * {@link CountModifierDebuggee#threadRunCount}.
-     */
-    public void testThreadEnd() {
-        logWriter.println("testThreadEnd started");
-
-        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
-
-        EventBuilder builder = createThreadEndBuilder();
-        testEventWithCountModifier(builder, THREAD_RUN_COUNT_FIELD_NAME);
-
-        logWriter.println("testThreadEnd done");
-    }
-
-    /**
      * This testcase is for FIELD_ACCESS event with Count modifier.
      * <BR>It runs CountModifierDebuggee and requests FIELD_ACCESS event for
      * {@link CountModifierDebuggee#watchedField}.
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/EventLocationEventTestCase.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/EventLocationEventTestCase.java
new file mode 100644
index 0000000..a363121
--- /dev/null
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/EventLocationEventTestCase.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.Event;
+import org.apache.harmony.jpda.tests.framework.jdwp.EventBuilder;
+import org.apache.harmony.jpda.tests.framework.jdwp.EventPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.Location;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Base class to test event with LocationOnly modifier.
+ */
+abstract class EventLocationEventTestCase extends JDWPEventTestCase {
+
+    private Set<Integer> requestIds = new HashSet<Integer>();
+
+    protected abstract String getDebuggeeSignature();
+    protected abstract String getExpectedLocationMethodName();
+    protected abstract void createEventBuilder(EventBuilder builder);
+    protected abstract void checkEvent(ParsedEvent event);
+
+    protected void runEventWithLocationTest(byte eventKind) {
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        // Request event for all possible locations in the expected
+        // method.
+        requestEventForAllLocations(eventKind);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        // Wait for the event.
+        EventPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        // We expect only one event.
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+
+        ParsedEvent parsedEvent = parsedEvents[0];
+
+        // Check this is the event we expect.
+        assertEquals("Invalid event kind,",
+                eventKind,
+                parsedEvent.getEventKind(),
+                JDWPConstants.EventKind.getName(eventKind),
+                JDWPConstants.EventKind.getName(parsedEvent.getEventKind()));
+
+        // Check this is one event we requested.
+        int eventRequestId = parsedEvent.getRequestID();
+        assertTrue("Unexpected event request " + eventRequestId,
+                requestIds.contains(Integer.valueOf(eventRequestId)));
+
+        // Check the event is the expected one.
+        checkEvent(parsedEvent);
+
+        // Clear all event requests.
+        clearAllEvents(eventKind);
+
+        // Resume debuggee before leaving.
+        resumeDebuggee();
+    }
+
+    /**
+     * Since we don't know the location where the event can be reported,
+     * we send a request for all possible locations inside the method.
+     */
+    private void requestEventForAllLocations(byte eventKind) {
+        // Ensure we start with no request.
+        requestIds.clear();
+
+        // Find the method where we expect the event to occur.
+        long typeId = getClassIDBySignature(getDebuggeeSignature());
+        long methodId = getMethodID(typeId, getExpectedLocationMethodName());
+
+        // Get its line table
+        ReplyPacket replyPacket = getLineTable(typeId, methodId);
+        long startIndex = replyPacket.getNextValueAsLong();
+        long endIndex = replyPacket.getNextValueAsLong();
+        logWriter.println("Method code index starts at " + startIndex +
+                " and ends at " + endIndex);
+
+        // Request event at all possible locations. We'd like to do
+        // this for each code instruction but we do not know them and
+        // do not know their size. Therefore we include any code
+        // index between start and end.
+        logWriter.println("Creating request for each possible index");
+        for (long idx = startIndex; idx <= endIndex; ++idx) {
+            Location location = new Location(JDWPConstants.TypeTag.CLASS,
+                    typeId, methodId, idx);
+            EventBuilder builder = new EventBuilder(eventKind,
+                            JDWPConstants.SuspendPolicy.ALL);
+            createEventBuilder(builder);
+            setEvent(builder, location);
+
+        }
+        logWriter.println("Created " + requestIds.size() + " requests");
+    }
+
+    private void setEvent(EventBuilder builder, Location location) {
+        builder.setLocationOnly(location);
+        Event event = builder.build();
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setEvent(event);
+        int requestId = reply.getNextValueAsInt();
+        logWriter.println("=> New request " + requestId);
+        requestIds.add(Integer.valueOf(requestId));
+    }
+
+    private void clearAllEvents(byte eventKind) {
+        logWriter.println("Clear all field requests");
+        for (Integer requestId : requestIds) {
+            clearEvent(eventKind, requestId.intValue());
+        }
+        requestIds.clear();
+    }
+
+    private void clearEvent(byte fieldEventKind, int requestId) {
+        logWriter.println("=> Clear request " + requestId);
+        debuggeeWrapper.vmMirror.clearEvent(fieldEventKind, requestId);
+    }
+}
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationDebuggee.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationDebuggee.java
new file mode 100644
index 0000000..0563a11
--- /dev/null
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationDebuggee.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for ExceptionWithLocationTest unit test.
+ */
+public class ExceptionWithLocationDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(ExceptionWithLocationDebuggee.class);
+    }
+
+    public void unexpectedThrowException() {
+        try {
+            throw new DebuggeeException("Unexpected exception");
+        } catch (DebuggeeException e) {
+            logWriter.println("ExceptionWithLocationDebuggee: Exception: \""+e.getMessage()+"\" was thrown");
+        }
+    }
+
+    public void expectedThrowException() {
+        try {
+            throw new DebuggeeException("Expected exception");
+        } catch (DebuggeeException e) {
+            logWriter.println("ExceptionLocationDebuggee: Exception: \""+e.getMessage()+"\" was thrown");
+        }
+    }
+
+    public void run() {
+        logWriter.println("ExceptionWithLocationDebuggee: STARTED");
+        // load and prepare DebuggeeException class
+        DebuggeeException ex = new DebuggeeException("dummy exception");
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        unexpectedThrowException();
+        expectedThrowException();
+
+        logWriter.println("ExceptionWithLocationDebuggee: FINISHing...");
+    }
+}
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationTest.java
new file mode 100644
index 0000000..b646a65
--- /dev/null
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationTest.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.EventBuilder;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.Location;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject;
+
+/**
+ * JDWP Unit test for caught EXCEPTION event with LocationOnly modifier.
+ */
+public class ExceptionWithLocationTest extends EventLocationEventTestCase {
+    private static final String EXCEPTION_SIGNATURE = "Lorg/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException;";
+
+    // Cache exception class ID.
+    private long exceptionClassId = -1;
+
+    /**
+     * This testcase is for caught EXCEPTION event with LocationOnly
+     * modifier.<BR>
+     * It runs ExceptionWithLocationDebuggee that throws caught
+     * DebuggeeException in two different methods.
+     * The test verifies that requested EXCEPTION event occurs in the
+     * expected method.
+     */
+    public void testExceptionLocationEvent() {
+        logWriter.println("testExceptionLocationEvent STARTED");
+
+        runEventWithLocationTest(JDWPConstants.EventKind.EXCEPTION);
+
+        logWriter.println("testExceptionLocationEvent FINISHED");
+    }
+
+    @Override
+    protected String getDebuggeeClassName() {
+        return ExceptionWithLocationDebuggee.class.getName();
+    }
+
+    @Override
+    protected String getDebuggeeSignature() {
+        return "Lorg/apache/harmony/jpda/tests/jdwp/Events/ExceptionWithLocationDebuggee;";
+    }
+
+    @Override
+    protected String getExpectedLocationMethodName() {
+        return "expectedThrowException";
+    }
+
+    @Override
+    protected void createEventBuilder(EventBuilder builder) {
+        if (exceptionClassId == -1) {
+            exceptionClassId = getClassIDBySignature(EXCEPTION_SIGNATURE);
+        }
+        // Receive caught DebuggeeException.
+        builder.setExceptionOnly(exceptionClassId, true, false);
+    }
+
+    @Override
+    protected void checkEvent(ParsedEvent event) {
+        ParsedEvent.Event_EXCEPTION eventException =
+                (ParsedEvent.Event_EXCEPTION) event;
+
+        TaggedObject exception = eventException.getException();
+        assertEquals(JDWPConstants.Tag.OBJECT_TAG, exception.tag);
+
+        long thrownExceptionClassId = getObjectReferenceType(exception.objectID);
+        assertEquals("Received incorrect exception",
+                exceptionClassId, thrownExceptionClassId);
+
+        Location catchLocation = eventException.getCatchLocation();
+        assertNotNull("Incorrect catch location", catchLocation);
+    }
+}
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationDebuggee.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationDebuggee.java
new file mode 100644
index 0000000..a8c707d
--- /dev/null
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationDebuggee.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for FieldWithLocationTest unit test.
+ */
+public class FieldWithLocationDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(FieldWithLocationDebuggee.class);
+    }
+
+    private int testIntField = 0;
+
+    private void unexpectedMethodForFieldEvent() {
+        System.out.println("incrementMethodOne");
+        int currentValue = testIntField; // field access
+        System.out.println("testIntField = " + currentValue);
+        testIntField = currentValue + 1;  // field modification
+    }
+
+    private void expectedMethodForFieldEvent() {
+        System.out.println("incrementMethodTwo");
+        int currentValue = testIntField; // field access
+        System.out.println("testIntField = " + currentValue);
+        testIntField = currentValue + 1;  // field modification
+    }
+
+    public void run() {
+        logWriter.println("FieldWithLocationDebuggee started");
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        unexpectedMethodForFieldEvent();
+        expectedMethodForFieldEvent();
+
+        logWriter.println("FieldWithLocationDebuggee finished");
+    }
+}
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationTest.java
new file mode 100644
index 0000000..abdeda7
--- /dev/null
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationTest.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.EventBuilder;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject;
+import org.apache.harmony.jpda.tests.framework.jdwp.VmMirror;
+
+/**
+ *
+ * JDWP Unit test for FIELD_ACCESS and FIELD_MODIFICATION events with
+ * LocationOnly modifier.
+ */
+public class FieldWithLocationTest extends EventLocationEventTestCase {
+
+    private static final String DEBUGGEE_SIGNATURE =
+            "Lorg/apache/harmony/jpda/tests/jdwp/Events/FieldWithLocationDebuggee;";
+    private static final String FIELD_NAME = "testIntField";
+
+    // Cache debuggee class ID.
+    private long debuggeeClassId = -1;
+
+    // Cache field ID.
+    private long fieldId = -1;
+
+    /**
+     * This testcase is for FIELD_ACCESS event.
+     * <BR>It runs FieldDebuggee that accesses to the value of its internal field
+     * and verify that requested FIELD_ACCESS event occurs in the
+     * expected method.
+     */
+    public void testFieldAccessLocationEvent() {
+        logWriter.println("testFieldAccessLocationEvent started");
+
+        runFieldLocationTest(false);
+
+        logWriter.println("testFieldAccessLocationEvent done");
+    }
+
+    /**
+     * This testcase is for FIELD_MODIFICATION event.
+     * <BR>It runs FieldDebuggee that modifies the value of its internal field
+     * and verify that requested FIELD_MODIFICATION event occurs in the
+     * expected method.
+     */
+    public void testFieldModificationLocationEvent() {
+        logWriter.println("testFieldModificationLocationEvent started");
+
+        runFieldLocationTest(true);
+
+        logWriter.println("testFieldModificationLocationEvent done");
+    }
+
+    @Override
+    protected final String getDebuggeeClassName() {
+        return FieldWithLocationDebuggee.class.getName();
+    }
+
+    @Override
+    protected final String getDebuggeeSignature() {
+        return DEBUGGEE_SIGNATURE;
+    }
+
+    @Override
+    protected final String getExpectedLocationMethodName() {
+        return "expectedMethodForFieldEvent";
+    }
+
+    @Override
+    protected final void createEventBuilder(EventBuilder builder) {
+        if (debuggeeClassId == -1) {
+            debuggeeClassId = getClassIDBySignature(DEBUGGEE_SIGNATURE);
+        }
+        if (fieldId == -1) {
+            fieldId = debuggeeWrapper.vmMirror.getFieldID(debuggeeClassId, FIELD_NAME);
+        }
+        builder.setFieldOnly(debuggeeClassId, fieldId);
+    }
+
+    @Override
+    protected void checkEvent(ParsedEvent event) {
+        TaggedObject accessedField = null;
+        byte fieldEventKind = event.getEventKind();
+        if (fieldEventKind  == JDWPConstants.EventKind.FIELD_ACCESS) {
+            accessedField = ((ParsedEvent.Event_FIELD_ACCESS)event).getObject();
+        } else if (fieldEventKind == JDWPConstants.EventKind.FIELD_MODIFICATION) {
+            accessedField = ((ParsedEvent.Event_FIELD_MODIFICATION)event).getObject();
+        }
+
+        // Check the field receiver is an instance of our debuggee class.
+        long typeID = getObjectReferenceType(accessedField.objectID);
+        String returnedExceptionSignature = getClassSignature(typeID);
+        assertString("Invalid class signature,",
+                DEBUGGEE_SIGNATURE, returnedExceptionSignature);
+    }
+
+    private boolean supportFieldCapability(boolean modification) {
+        VmMirror mirror = debuggeeWrapper.vmMirror;
+        return modification ? mirror.canWatchFieldModification() :
+            mirror.canWatchFieldAccess();
+    }
+
+    private static String getFieldCapabilityName(boolean modification) {
+        return modification ? "canWatchFieldModification" :
+            "canWatchFieldAccess";
+    }
+
+    private static byte getFieldEventKind(boolean modification) {
+        return modification ? JDWPConstants.EventKind.FIELD_MODIFICATION :
+            JDWPConstants.EventKind.FIELD_ACCESS;
+    }
+
+    private void runFieldLocationTest(boolean modification) {
+        final byte eventKind = getFieldEventKind(modification);
+        final String capabilityname = getFieldCapabilityName(modification);
+
+        logWriter.println("Check capability " + capabilityname);
+        if (supportFieldCapability(modification)) {
+            runEventWithLocationTest(eventKind);
+        } else {
+            logWriter.println("##WARNING: this VM doesn't possess capability " +
+                    capabilityname);
+        }
+    }
+}
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepWithLocationTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepWithLocationTest.java
new file mode 100644
index 0000000..af01250
--- /dev/null
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepWithLocationTest.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.EventMod;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.Location;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+/**
+ * JDWP Unit test for SINGLE_STEP event with LocationOnly modifier.
+ */
+public class SingleStepWithLocationTest extends JDWPEventTestCase {
+
+    private String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/SingleStepDebuggee;";
+
+    private static final String BREAKPOINT_METHOD_NAME = "breakpointTest";
+
+    protected String getDebuggeeClassName() {
+        return SingleStepDebuggee.class.getName();
+    }
+
+    /**
+     * This test case exercises SINGLE_STEP event.<BR>
+     *
+     * Runs SingleStepDebuggee and sets breakpoint to its
+     * breakpointTest method, sends a request for single step event with the
+     * location of the last line so we single-step until there. Then verifies
+     * that requested SINGLE_STEP event occurs.
+     */
+    public void testSingleStepToLocation() {
+        logWriter.println("=> testSingleStepToLocation started");
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        // Set breakpoint.
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
+        logWriter.println("=> Send ReferenceType::Methods command and get methodIDs ");
+
+        long requestID = debuggeeWrapper.vmMirror.setBreakpointAtMethodBegin(
+                refTypeID, BREAKPOINT_METHOD_NAME);
+        logWriter.println("=> breakpointID = " + requestID);
+        logWriter.println("=> starting thread");
+
+        // Execute the breakpoint
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        // Wait for breakpoint event so the program is suspended.
+        long breakpointThreadID = debuggeeWrapper.vmMirror
+                .waitForBreakpoint(requestID);
+
+        logWriter.println("=> breakpointThreadID = " + breakpointThreadID);
+
+        // Remove breakpoint.
+        debuggeeWrapper.vmMirror.clearBreakpoint((int)requestID);
+
+        // Get line table and get code index of the last line.
+        long methodID = getMethodID(refTypeID, BREAKPOINT_METHOD_NAME);
+        ReplyPacket lineTableReply = getLineTable(refTypeID, methodID);
+        checkReplyPacket(lineTableReply, "Method.LineTable");
+        lineTableReply.getNextValueAsLong();  // startIndex
+        lineTableReply.getNextValueAsLong();  // endIndex
+        int linesCount = lineTableReply.getNextValueAsInt();
+        long lastLineCodeIndex = -1;
+        int lastLineNumber = -1;
+        for (int i = 0; i < linesCount; ++i) {
+            lastLineCodeIndex = lineTableReply.getNextValueAsLong();
+            lastLineNumber = lineTableReply.getNextValueAsInt();
+        }
+
+        logWriter.println("Single-step until line " + lastLineNumber);
+
+        // Location of last line.
+        Location location = new Location(JDWPConstants.TypeTag.CLASS,
+                refTypeID, methodID, lastLineCodeIndex);
+
+        // Sending a SINGLE_STEP request
+        CommandPacket setRequestCommand = new CommandPacket(
+                JDWPCommands.EventRequestCommandSet.CommandSetID,
+                JDWPCommands.EventRequestCommandSet.SetCommand);
+        setRequestCommand.setNextValueAsByte(
+                JDWPConstants.EventKind.SINGLE_STEP);
+        setRequestCommand.setNextValueAsByte(JDWPConstants.SuspendPolicy.ALL);
+        setRequestCommand.setNextValueAsInt(2);
+        setRequestCommand.setNextValueAsByte(EventMod.ModKind.Step);
+        setRequestCommand.setNextValueAsThreadID(breakpointThreadID);
+        setRequestCommand.setNextValueAsInt(JDWPConstants.StepSize.LINE);
+        setRequestCommand.setNextValueAsInt(JDWPConstants.StepDepth.OVER);
+        setRequestCommand.setNextValueAsByte(EventMod.ModKind.LocationOnly);
+        setRequestCommand.setNextValueAsLocation(location);
+
+        ReplyPacket setRequestReply = debuggeeWrapper.vmMirror
+                .performCommand(setRequestCommand);
+        checkReplyPacket(setRequestReply, "Set SINGLE_STEP event");
+        requestID = setRequestReply.getNextValueAsInt();
+
+        logWriter.println("=> RequestID = " + requestID);
+        assertAllDataRead(setRequestReply);
+
+        // Resume debuggee so we can suspend on single-step.
+        resumeDebuggee();
+
+        // Wait for event.
+        logWriter.println("==> Wait for SINGLE_STEP event");
+        CommandPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        // Check if received event is expected.
+        logWriter.println("==> Received " + parsedEvents.length + " events");
+
+        // Trace events
+        for (int i = 0; i < parsedEvents.length; i++) {
+            logWriter.println("");
+            logWriter.println("==> Event #" + i + ";");
+            logWriter.println("==> EventKind: " + parsedEvents[i].getEventKind() + "("
+                    + JDWPConstants.EventKind.getName(parsedEvents[i].getEventKind()) + ")");
+            logWriter.println("==> RequestID: " + parsedEvents[i].getRequestID());
+        }
+
+        // Check all
+        assertEquals("Received wrong number of events,", 1, parsedEvents.length);
+        assertEquals("Received wrong event request ID,", requestID, parsedEvents[0].getRequestID());
+        assertEquals("Invalid event kind,", JDWPConstants.EventKind.SINGLE_STEP,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.SINGLE_STEP),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+
+        // Clear SINGLE_STEP event
+        logWriter.println("==> Clearing SINGLE_STEP event..");
+        ReplyPacket clearRequestReply =
+            debuggeeWrapper.vmMirror.clearEvent(JDWPConstants.EventKind.SINGLE_STEP, (int) requestID);
+        checkReplyPacket(clearRequestReply, "Clear SINGLE_STEP event");
+        logWriter.println("==> SINGLE_STEP event has been cleared");
+
+        // Resuming debuggee before leaving.
+        resumeDebuggee();
+        logWriter.println("==> Test PASSED!");
+    }
+}
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/VMDeath002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/VMDeath002Test.java
index 6799c52..1ba7f10 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/VMDeath002Test.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/VMDeath002Test.java
@@ -192,7 +192,6 @@
             assertTrue("Failure in processing VM_DEATH event", success);
         }
 
-        logWriter.println("=> Resume debuggee");
         resumeDebuggee();
 
         logWriter.println("==> test PASSED!");
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/MonitorInfoTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/MonitorInfoTest.java
index 71170e8..5e803e7 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/MonitorInfoTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/MonitorInfoTest.java
@@ -187,8 +187,6 @@
         logWriter.println("=> CHECK 1: PASSED - expected monitor info is received");
         checkedReply = null;
 
-        logWriter.println("\n=> Send VirtualMachine::Resume command ...");
-
         resumeDebuggee();
 
         logWriter.println("=> Send to Debuggee signal to continue and to enter in synchronized block ...");
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ChildrenTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ChildrenTest.java
index 13604d0..22153e1 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ChildrenTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ChildrenTest.java
@@ -27,8 +27,10 @@
 
 import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
 import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPTestConstants;
 import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
 
 
@@ -127,4 +129,70 @@
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
     }
 
+    /**
+     * This testcase exercises ThreadGroupReference.Children command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Children command
+     * checks that INVALID_OBJECT error is returned for the null object id.
+     *
+     */
+    public void testChildren_NullObject() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        checkCommandError(JDWPTestConstants.NULL_OBJECT_ID,
+                          JDWPConstants.Error.INVALID_OBJECT);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Children command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Children command
+     * checks that INVALID_OBJECT error is returned for an invalid object id.
+     *
+     */
+    public void testChildren_InvalidObject() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        checkCommandError(JDWPTestConstants.INVALID_OBJECT_ID,
+                          JDWPConstants.Error.INVALID_OBJECT);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Children command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Children command
+     * checks that INVALID_THREAD_GROUP error is returned for an object that is
+     * not a java.lang.ThreadGroup.
+     *
+     */
+    public void testChildren_InvalidThreadGroup() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long threadID = debuggeeWrapper.vmMirror.getThreadID(NameDebuggee.TESTED_THREAD);
+
+        checkCommandError(threadID, JDWPConstants.Error.INVALID_THREAD_GROUP);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    private void checkCommandError(long groupID, int expectedError) {
+        logWriter.println("Send ThreadGroupReference.Children command with id " + groupID);
+
+        CommandPacket packet = new CommandPacket(
+                JDWPCommands.ThreadGroupReferenceCommandSet.CommandSetID,
+                JDWPCommands.ThreadGroupReferenceCommandSet.ChildrenCommand);
+        packet.setNextValueAsThreadGroupID(groupID);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+
+        checkReplyPacket(reply, "ThreadGroupReference::Name command",
+                         expectedError);
+    }
+
 }
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/NameTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/NameTest.java
index fb11355..f7812bc 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/NameTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/NameTest.java
@@ -27,8 +27,10 @@
 
 import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
 import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPTestConstants;
 import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
 
 
@@ -81,4 +83,69 @@
 
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
     }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Name command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Name command
+     * checks that INVALID_OBJECT error is returned for the null object id.
+     *
+     */
+    public void testName001_NullObject() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        checkCommandError(JDWPTestConstants.NULL_OBJECT_ID,
+                          JDWPConstants.Error.INVALID_OBJECT);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Name command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Name command
+     * checks that INVALID_OBJECT error is returned for an invalid object id.
+     *
+     */
+    public void testName001_InvalidObject() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        checkCommandError(JDWPTestConstants.INVALID_OBJECT_ID,
+                          JDWPConstants.Error.INVALID_OBJECT);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Name command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Name command
+     * checks that INVALID_THREAD_GROUP error is returned for an object that is
+     * not a java.lang.ThreadGroup.
+     *
+     */
+    public void testName001_InvalidThreadGroup() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long threadID = debuggeeWrapper.vmMirror.getThreadID(NameDebuggee.TESTED_THREAD);
+
+        checkCommandError(threadID, JDWPConstants.Error.INVALID_THREAD_GROUP);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    private void checkCommandError(long groupID, int expectedError) {
+        logWriter.println("Send ThreadGroupReference.Name command with id " + groupID);
+
+        CommandPacket packet = new CommandPacket(
+                JDWPCommands.ThreadGroupReferenceCommandSet.CommandSetID,
+                JDWPCommands.ThreadGroupReferenceCommandSet.NameCommand);
+        packet.setNextValueAsThreadGroupID(groupID);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+
+        checkReplyPacket(reply, "ThreadGroupReference::Name command", expectedError);
+    }
 }
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ParentTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ParentTest.java
index 0d3661b..9316861 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ParentTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadGroupReference/ParentTest.java
@@ -27,8 +27,10 @@
 
 import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
 import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPTestConstants;
 import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
 
 
@@ -91,4 +93,69 @@
 
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
     }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Parent command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Parent command
+     * checks that INVALID_OBJECT error is returned for the null object id.
+     *
+     */
+    public void testParent_NullObject() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        checkCommandError(JDWPTestConstants.NULL_OBJECT_ID,
+                          JDWPConstants.Error.INVALID_OBJECT);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Parentcommand.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Parent command
+     * checks that INVALID_OBJECT error is returned for an invalid object id.
+     *
+     */
+    public void testParent_InvalidObject() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        checkCommandError(JDWPTestConstants.INVALID_OBJECT_ID,
+                          JDWPConstants.Error.INVALID_OBJECT);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ThreadGroupReference.Parent command.
+     * <BR>At first the test starts NameDebuggee.
+     * <BR> Then the test with help of the ThreadGroupReference.Parent command
+     * checks that INVALID_THREAD_GROUP error is returned for an object that is
+     * not a java.lang.ThreadGroup.
+     *
+     */
+    public void testParent_InvalidThreadGroup() {
+        logWriter.println("wait for SGNL_READY");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long threadID = debuggeeWrapper.vmMirror.getThreadID(NameDebuggee.TESTED_THREAD);
+
+        checkCommandError(threadID, JDWPConstants.Error.INVALID_THREAD_GROUP);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    private void checkCommandError(long groupID, int expectedError) {
+        logWriter.println("Send ThreadGroupReference.Name command with id " + groupID);
+
+        CommandPacket packet = new CommandPacket(
+                JDWPCommands.ThreadGroupReferenceCommandSet.CommandSetID,
+                JDWPCommands.ThreadGroupReferenceCommandSet.NameCommand);
+        packet.setNextValueAsThreadGroupID(groupID);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+
+        checkReplyPacket(reply, "ThreadGroupReference::Name command", expectedError);
+    }
 }
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/ResumeTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/ResumeTest.java
index 47c6aa8..61aeec4 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/ResumeTest.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/ResumeTest.java
@@ -30,9 +30,11 @@
 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
 import org.apache.harmony.jpda.tests.framework.jdwp.exceptions.ReplyErrorCodeException;
-import org.apache.harmony.jpda.tests.jdwp.ThreadReference.ResumeDebuggee;
 import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
 
+import java.util.ArrayList;
+import java.util.List;
+
 
 /**
  * JDWP Unit test for VirtualMachine.Resume command.
@@ -42,8 +44,17 @@
     static final String debuggeeSignature =
         "Lorg/apache/harmony/jpda/tests/jdwp/VirtualMachine/ResumeDebuggee;";
 
-   protected String getDebuggeeClassName() {
-        return "org.apache.harmony.jpda.tests.jdwp.VirtualMachine.ResumeDebuggee";
+    protected String getDebuggeeClassName() {
+        return ResumeDebuggee.class.getName();
+    }
+
+    @Override
+    protected void internalTearDown() {
+        // We need to finish the tested threads before detaching.
+        logWriter.println("Finish debuggee tested threads");
+        setStaticIntField(debuggeeSignature,
+                ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
+        super.internalTearDown();
     }
 
     /**
@@ -56,38 +67,236 @@
      */
     public void testResume001() {
         logWriter.println("==> testResume001: START...");
+
+        // The error messages in case of test failure.
+        List<String> errorMessages = new ArrayList<String>();
+
+        // All the threads we're interested in.
+        ThreadInfo[] threadInfos = createThreadInfos();
+
+        // Suspend all threads with VirtualMachine.Suspend command.
+        suspendAll();
+
+        // Check all threads are suspended now.
+        logWriter.println("\n==> Check that all tested threads are suspended " +
+                "after VirtualMachine.Suspend command...");
+        checkThreadStatus(threadInfos, true, errorMessages);
+
+        // Resume all threads with VirtualMachine.Resume command.
+        resumeAll();
+
+        // Check all threads are NOT suspended anymore.
+        logWriter.println("\n==> Check that all tested threads are resumed " +
+                "after VirtualMachine.Resume command...");
+        checkThreadStatus(threadInfos, false, errorMessages);
+
+        if (!errorMessages.isEmpty()) {
+            // Print error messages first.
+            for (String errorMessage : errorMessages) {
+                logWriter.printError(errorMessage + "\n");
+            }
+            printErrorAndFail("\ntestResume001 FAILED");
+        } else {
+            logWriter.println("\n==> testResume001 - OK!");
+        }
+    }
+
+    /**
+     * This testcase exercises VirtualMachine.Resume command.
+     * <BR>At first the test starts ResumeDebuggee which starts and runs some
+     * tested threads.
+     * <BR> Then the test performs VirtualMachine.Suspend command twice and
+     * checks, with help of ThreadReference.Status command, that all debuggee
+     * tested threads are suspended.
+     * <BR> Then the test performs VirtualMachine.Resume command and checks
+     * that all debuggee tested threads are still suspended.
+     * <BR> Then the test performs VirtualMachine.Resume command again and
+     * checks that all debuggee tested threads are resumed.
+     */
+    public void testResume002() {
+        logWriter.println("==> testResume002: START...");
+
+        // The error messages in case of test failure.
+        List<String> errorMessages = new ArrayList<String>();
+
+        // All the threads we're interested in.
+        ThreadInfo[] threadInfos = createThreadInfos();
+
+        // Suspend all threads with VirtualMachine.Suspend command.
+        suspendAll();
+
+        // Check all threads are suspended now.
+        logWriter.println("\n==> Check that all tested threads are suspended " +
+                "after VirtualMachine.Suspend command...");
+        checkThreadStatus(threadInfos, true, errorMessages);
+
+        // Suspend all threads again.
+        suspendAll();
+
+        // Check all threads are still suspended.
+        logWriter.println("\n==> Check that all tested threads are still " +
+                "suspended after another VirtualMachine.Suspend command...");
+        checkThreadStatus(threadInfos, true, errorMessages);
+
+        // Resume all threads with VirtualMachine.Resume command.
+        resumeAll();
+
+        // Check all threads are still suspended.
+        logWriter.println("\n==> Check that all tested threads are still " +
+                "suspended after VirtualMachine.Resume command...");
+        checkThreadStatus(threadInfos, true, errorMessages);
+
+        // Resume all threads again.
+        resumeAll();
+
+        // Check all threads are NOT suspended anymore.
+        logWriter.println("\n==> Check that all tested threads are resumed " +
+                "after VirtualMachine.Resume command...");
+        checkThreadStatus(threadInfos, false, errorMessages);
+
+        if (!errorMessages.isEmpty()) {
+            // Print error messages first.
+            for (String errorMessage : errorMessages) {
+                logWriter.printError(errorMessage + "\n");
+            }
+            printErrorAndFail("\ntestResume002 FAILED");
+        } else {
+            logWriter.println("\n==> testResume002 - OK!");
+        }
+    }
+
+    /**
+     * This testcase exercises VirtualMachine.Resume command.
+     * <BR>At first the test starts ResumeDebuggee which starts and runs some
+     * tested threads.
+     * <BR> Then the test performs VirtualMachine.Resume command and checks it
+     * does not cause any error if we do not perform VirtualMachine.Suspend
+     * before.
+     * <BR> Then the test performs VirtualMachine.Suspend command and checks
+     * that all debuggee tested threads are suspended.
+     * <BR> Then the test performs VirtualMachine.Resume command and checks
+     * that all debuggee tested threads are resumed.
+     */
+    public void testResume003() {
+        logWriter.println("==> testResume002: START...");
+
+        // The error messages in case of test failure.
+        List<String> errorMessages = new ArrayList<String>();
+
+        // All the threads we're interested in.
+        ThreadInfo[] threadInfos = createThreadInfos();
+
+        // Resume all threads: should be a no-op.
+        resumeAll();
+
+        // Check all threads are NOT suspended.
+        logWriter.println("\n==> Check that no tested thread is suspended " +
+                "after VirtualMachine.Resume command...");
+        checkThreadStatus(threadInfos, false, errorMessages);
+
+        // Suspend all threads with VirtualMachine.Suspend command.
+        suspendAll();
+
+        // Check all threads are suspended now.
+        logWriter.println("\n==> Check that all tested threads are suspended " +
+                "after VirtualMachine.Suspend command...");
+        checkThreadStatus(threadInfos, true, errorMessages);
+
+        // Resume all threads with VirtualMachine.Resume command.
+        resumeAll();
+
+        // Check all threads are NOT suspended anymore.
+        logWriter.println("\n==> Check that all tested threads are resumed " +
+                "after VirtualMachine.Resume command...");
+        checkThreadStatus(threadInfos, false, errorMessages);
+
+        if (!errorMessages.isEmpty()) {
+            // Print error messages first.
+            for (String errorMessage : errorMessages) {
+                logWriter.printError(errorMessage + "\n");
+            }
+            printErrorAndFail("\ntestResume002 FAILED");
+        } else {
+            logWriter.println("\n==> testResume002 - OK!");
+        }
+    }
+    private static class ThreadInfo {
+        final String threadName;
+        long threadId = 0;
+
+        public ThreadInfo(String threadName) {
+            this.threadName = threadName;
+        }
+    }
+
+    /**
+     * Suspends all threads using VirtualMachine.Suspend command.
+     */
+    private void suspendAll() {
+        logWriter.println("\n==> Send VirtualMachine.Suspend command...");
+        CommandPacket packet = new CommandPacket(
+                JDWPCommands.VirtualMachineCommandSet.CommandSetID,
+                JDWPCommands.VirtualMachineCommandSet.SuspendCommand);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+        checkReplyPacket(reply, "VirtualMachine.Suspend");
+        logWriter.println("==> VirtualMachine.Suspend command - OK.");
+    }
+
+    /**
+     * Resumes all threads using VirtualMachine.Resume command.
+     */
+    private void resumeAll() {
+        logWriter.println("\n==> Send VirtualMachine.Resume command...");
+        CommandPacket packet = new CommandPacket(
+                JDWPCommands.VirtualMachineCommandSet.CommandSetID,
+                JDWPCommands.VirtualMachineCommandSet.ResumeCommand);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+        checkReplyPacket(reply, "VirtualMachine.Resume");
+        logWriter.println("==> VirtualMachine.Resume command - OK.");
+    }
+
+    /**
+     * Returns the number of threads used in the tests (including the main
+     * thread).
+     */
+    private int getThreadsNumber() {
         String debuggeeMessage = synchronizer.receiveMessage();
         int testedThreadsNumber = 0;
         try {
             testedThreadsNumber = Integer.valueOf(debuggeeMessage).intValue();
         } catch (NumberFormatException exception) {
-            logWriter.println
-                ("## FAILURE: Exception while getting number of started threads from debuggee = " + exception);
-            setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
-            printErrorAndFail("\n## Can NOT get number of started threads from debuggee! ");
+            logWriter.println("## FAILURE: Exception while getting number of"
+                    + " started threads from debuggee = " + exception);
+            printErrorAndFail("\n## Can NOT get number of started threads "
+                    + "from debuggee! ");
         }
-        testedThreadsNumber++; // to add debuggee main thread
-        logWriter.println("==>  Number of threads in debuggee to test = " + testedThreadsNumber);
-        String[] testedThreadsNames = new String[testedThreadsNumber];
-        long[] testedThreadsIDs = new long[testedThreadsNumber];
-        String debuggeeMainThreadName = synchronizer.receiveMessage();
-        for (int i = 0; i < testedThreadsNumber; i++) {
-            if ( i < (testedThreadsNumber-1) ) {
-                testedThreadsNames[i] = ResumeDebuggee.THREAD_NAME_PATTERN + i;
-            } else {
-                testedThreadsNames[i] = debuggeeMainThreadName;
-            }
-            testedThreadsIDs[i] = 0;
-        }
+        return testedThreadsNumber + 1;  // to add debuggee main thread
+    }
 
-        // getting ID of the tested thread
+    /**
+     * Creates ThreadInfo array containing information about each tested thread:
+     * thread name and thread JDWP id.
+     */
+    private ThreadInfo[] createThreadInfos() {
+        int testedThreadsNumber = getThreadsNumber();
+        logWriter.println("==>  Number of threads in debuggee to test = "
+                + testedThreadsNumber);
+        ThreadInfo[] threadInfos = new ThreadInfo[testedThreadsNumber];
+
+        String debuggeeMainThreadName = synchronizer.receiveMessage();
+        // Initialize all threads
+        for (int i = 0, e = threadInfos.length - 1; i < e; ++i) {
+            threadInfos[i] = new ThreadInfo(ResumeDebuggee.THREAD_NAME_PATTERN + i);
+        }
+        threadInfos[threadInfos.length - 1] = new ThreadInfo(debuggeeMainThreadName);
+
+        // Getting ID of the tested thread using VirtualMachine.AllThreads.
         ReplyPacket allThreadIDReply = null;
         try {
             allThreadIDReply = debuggeeWrapper.vmMirror.getAllThreadID();
         } catch (ReplyErrorCodeException exception) {
             logWriter.println
                 ("## FAILURE: Exception in vmMirror.getAllThreadID() = " + exception);
-            setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
             printErrorAndFail("\n## Can NOT get all ThreadID in debuggee! ");
         }
         int threads = allThreadIDReply.getNextValueAsInt();
@@ -102,59 +311,63 @@
                     ("==> WARNING: Can NOT get thread name for threadID = " + threadID);
                 continue;
             }
-            int k = 0;
-            for (; k < testedThreadsNumber; k++) {
-                if ( threadName.equals(testedThreadsNames[k]) ) {
-                    testedThreadsIDs[k] = threadID;
+            for (ThreadInfo threadInfo : threadInfos) {
+                if (threadInfo.threadName.equals(threadName) ) {
+                    threadInfo.threadId = threadID;
                     break;
                 }
             }
         }
 
+        // Check we found thread id for each thread.
         boolean testedThreadNotFound = false;
-        for (int i = 0; i < testedThreadsNumber; i++) {
-            if ( testedThreadsIDs[i] == 0 ) {
-                logWriter.println("## FAILURE: Tested thread is not found out among debuggee threads!");
-                logWriter.println("##          Thread name = " + testedThreadsNames[i]);
+        for (ThreadInfo threadInfo : threadInfos) {
+            if (threadInfo.threadId == 0) {
+                logWriter.println("## FAILURE: Tested thread is not found out "
+                        + "among debuggee threads!");
+                logWriter.println("##          Thread name = "
+                        + threadInfo.threadName);
                 testedThreadNotFound = true;
             }
         }
-        if ( testedThreadNotFound ) {
-            setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
+        if (testedThreadNotFound) {
             printErrorAndFail("\n## Some of tested threads are not found!");
         }
 
-        logWriter.println("\n==> Send VirtualMachine.Suspend command...");
-        CommandPacket packet = new CommandPacket(
-                JDWPCommands.VirtualMachineCommandSet.CommandSetID,
-                JDWPCommands.VirtualMachineCommandSet.SuspendCommand);
-        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
-        int errorCode = reply.getErrorCode();
-        if ( errorCode !=  JDWPConstants.Error.NONE ) {
-            setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
-            logWriter.println("## FAILURE: VirtualMachine.Suspend command returns error = " + errorCode
-                    + "(" + JDWPConstants.Error.getName(errorCode) + ")");
-            printErrorAndFail("\nVirtualMachine.Suspend command FAILED!");
-        } else {
-            logWriter.println("==> VirtualMachine.Suspend command - OK.");
-        }
+        return threadInfos;
+    }
 
-        logWriter.println
-        ("\n==> Check that all tested threads are suspended after VirtualMachine.Suspend command...");
-
+    /**
+     * Checks suspend status of each tested thread is the expected one.
+     *
+     * @param threadInfos
+     *          the thread information
+     * @param isSuspended
+     *          if true, thread must be suspended; otherwise thread
+     *          must not be suspended.
+     * @param errorMessages
+     *          a list of String to append error message.
+     */
+    private void checkThreadStatus(ThreadInfo[] threadInfos,
+            boolean isSuspended, List<String> errorMessages) {
         boolean statusCommandFailed = false;
         boolean suspendStatusFailed = false;
-        for (int i = 0; i < testedThreadsNumber; i++) {
-            logWriter.println("\n==> Check for Thread: threadID = " + testedThreadsIDs[i]
-                + "; threadName = " + testedThreadsNames[i]);
+
+        for (ThreadInfo threadInfo : threadInfos) {
+            logWriter.println("\n==> Check for Thread: threadID = "
+                    + threadInfo.threadId
+                    + " (" + threadInfo.threadName + ")");
 
             logWriter.println("==> Send ThreadReference.Status command...");
-            packet = new CommandPacket(
+            CommandPacket packet = new CommandPacket(
                     JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
                     JDWPCommands.ThreadReferenceCommandSet.StatusCommand);
-            packet.setNextValueAsReferenceTypeID(testedThreadsIDs[i]);
-            reply = debuggeeWrapper.vmMirror.performCommand(packet);
-            if ( ! checkReplyPacketWithoutFail(reply, "ThreadReference.Status command") ) {
+            packet.setNextValueAsThreadID(threadInfo.threadId);
+            ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+            if (!checkReplyPacketWithoutFail(reply, "ThreadReference.Status command")) {
+                logWriter.println("Can't get thread status for thread " +
+                        threadInfo.threadId +
+                        " \"" + threadInfo.threadName + "\"");
                 statusCommandFailed = true;
                 continue;
             }
@@ -162,95 +375,32 @@
             int threadStatus = reply.getNextValueAsInt();
             int suspendStatus = reply.getNextValueAsInt();
 
-            logWriter.println("==> threadStatus = " + threadStatus + "("
+            logWriter.println("==> threadStatus = " + threadStatus + " ("
                     + JDWPConstants.ThreadStatus.getName(threadStatus) + ")");
-            logWriter.println("==> suspendStatus = " + suspendStatus + "("
+            logWriter.println("==> suspendStatus = " + suspendStatus + " ("
                     + JDWPConstants.SuspendStatus.getName(suspendStatus) + ")");
-            if (suspendStatus
-                    != JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED) {
-                logWriter.println("## FAILURE: Unexpected suspendStatus for checked thread!");
+
+            boolean isThreadSuspended =
+                    (suspendStatus == JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED);
+            if (isThreadSuspended != isSuspended) {
+                logWriter.println("## FAILURE: Unexpected suspendStatus for " +
+                        "checked thread " + threadInfo.threadId +
+                        " \"" + threadInfo.threadName + "\"");
                 logWriter.println("##          Expected suspendStatus  = "
-                    + JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED
-                    + "(" + JDWPConstants.SuspendStatus.getName
-                    (JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED) +")");
+                        + JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED
+                        + "(" + JDWPConstants.SuspendStatus.getName
+                        (JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED) +")");
                 suspendStatusFailed = true;
                 continue;
             }
         }
 
-        String errorMessage = "";
-        if ( statusCommandFailed ) {
-            errorMessage = errorMessage + "## Error found out while ThreadReference.Status command performing!\n";
+        if (statusCommandFailed) {
+            errorMessages.add("## Error found out while ThreadReference.Status "
+                    + "command performing!");
         }
-        if ( suspendStatusFailed ) {
-            errorMessage = errorMessage + "## Unexpected suspendStatus found out!\n";
+        if (suspendStatusFailed) {
+            errorMessages.add("## Unexpected suspendStatus found out!");
         }
-
-        logWriter.println("\n==> Send VirtualMachine.Resume command...");
-        packet = new CommandPacket(
-                JDWPCommands.VirtualMachineCommandSet.CommandSetID,
-                JDWPCommands.VirtualMachineCommandSet.ResumeCommand);
-        reply = debuggeeWrapper.vmMirror.performCommand(packet);
-        errorCode = reply.getErrorCode();
-        if ( errorCode !=  JDWPConstants.Error.NONE ) {
-            setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
-            logWriter.println("## FAILURE: VirtualMachine.Resume command returns error = " + errorCode
-                    + "(" + JDWPConstants.Error.getName(errorCode) + ")");
-            printErrorAndFail("\nVirtualMachine.Resume command FAILED!");
-        } else {
-            logWriter.println("==> VirtualMachine.Resume command - OK.");
-        }
-
-        if ( ! errorMessage.equals("") ) {
-            setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
-            printErrorAndFail("\ntestResume001 FAILED:\n" + errorMessage);
-        }
-
-        logWriter.println
-        ("\n==> Check that all tested threads are resumed after VirtualMachine.Resume command...");
-
-        for (int i = 0; i < testedThreadsNumber; i++) {
-            logWriter.println("\n==> Check for Thread: threadID = " + testedThreadsIDs[i]
-                + "; threadName = " + testedThreadsNames[i]);
-
-            logWriter.println("==> Send ThreadReference.Status command...");
-            packet = new CommandPacket(
-                    JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
-                    JDWPCommands.ThreadReferenceCommandSet.StatusCommand);
-            packet.setNextValueAsReferenceTypeID(testedThreadsIDs[i]);
-            reply = debuggeeWrapper.vmMirror.performCommand(packet);
-            if ( ! checkReplyPacketWithoutFail(reply, "ThreadReference.Status command") ) {
-                statusCommandFailed = true;
-                continue;
-            }
-
-            int threadStatus = reply.getNextValueAsInt();
-            int suspendStatus = reply.getNextValueAsInt();
-
-            logWriter.println("==> threadStatus = " + threadStatus + "("
-                    + JDWPConstants.ThreadStatus.getName(threadStatus) + ")");
-            logWriter.println("==> suspendStatus = " + suspendStatus + "("
-                    + JDWPConstants.SuspendStatus.getName(suspendStatus) + ")");
-            if (suspendStatus
-                    == JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED) {
-                logWriter.println
-                    ("## FAILURE: Thread still is suspended after VirtualMachine.Resume commands!");
-                suspendStatusFailed = true;
-            }
-        }
-
-        if ( statusCommandFailed ) {
-            errorMessage = errorMessage + "## Error found out while ThreadReference.Status command performing!\n";
-        }
-        if ( suspendStatusFailed ) {
-            errorMessage = errorMessage + "## Unexpected suspendStatus found out!\n";
-        }
-
-        setStaticIntField(debuggeeSignature, ResumeDebuggee.TO_FINISH_DEBUGGEE_FIELD_NAME, 99);
-        if ( ! errorMessage.equals("") ) {
-            printErrorAndFail("\ntestResume001 FAILED:\n" + errorMessage);
-        }
-
-        logWriter.println("\n==> testResume001 - OK!");
     }
 }
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/share/JDWPTestCase.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/share/JDWPTestCase.java
index 039300b..4191f2c 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/share/JDWPTestCase.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/share/JDWPTestCase.java
@@ -333,6 +333,7 @@
      * Helper function for resuming debuggee.
      */
     protected void resumeDebuggee() {
+        logWriter.println("=> Resume debuggee");
         CommandPacket packet = new CommandPacket(
                 JDWPCommands.VirtualMachineCommandSet.CommandSetID,
                 JDWPCommands.VirtualMachineCommandSet.ResumeCommand);
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/share/AllTests.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/share/AllTests.java
index 52e2366..2d80830 100644
--- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/share/AllTests.java
+++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/share/AllTests.java
@@ -80,12 +80,15 @@
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.CombinedEvents003Test.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.ExceptionTest.class);
+    suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.ExceptionWithLocationTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.FieldAccessTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.FieldModification002Test.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.FieldModificationTest.class);
+    suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.FieldWithLocationTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.MethodEntryTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.MethodExitTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.MethodExitWithReturnValueTest.class);
+    suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.SingleStepWithLocationTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.SingleStepTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.ThreadEndTest.class);
     suite.addTestSuite(org.apache.harmony.jpda.tests.jdwp.Events.ThreadStartTest.class);