You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/11/28 18:49:31 UTC

svn commit: r480141 [26/38] - in /harmony/enhanced/jdktools/trunk/modules/jpda: ./ doc/ doc/images/ make/ src/ src/common/ src/common/other/ src/common/other/jpda/ src/common/other/jpda/jdwp/ src/common/other/jpda/jdwp/agent/ src/common/other/jpda/jdwp...

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadEndTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadEndTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadEndTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadEndTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Aleksander V. Budniy
+ * @version $Revision: 1.6 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.MultiSession;
+
+import org.apache.harmony.jpda.tests.framework.TestOptions;
+import org.apache.harmony.jpda.tests.framework.TestErrorException;
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.Event;
+import org.apache.harmony.jpda.tests.framework.jdwp.EventMod;
+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.ReplyPacket;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPUnitDebuggeeWrapper;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for verifying canceling of THREAD_END event after re-connection.
+ */
+public class ThreadEndTest extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ThreadEndTest.class);
+    }
+
+    /**
+     * This testcase verifies canceling of THREAD_END event after re-connection.
+     * <BR>It runs EventDebuggee, sets request for THREAD_END event
+     * and re-connects.
+     * <BR>It is expected that no any events, including THREAD_END, occur after re-connection
+     * and before EventDebuggee finish.
+     */
+    public void testThreadEnd001() {
+        logWriter.println("==> testThreadEnd001 - STARTED...");
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        logWriter.println("=> set ThreadEndEvent...");
+        ReplyPacket reply;
+        byte eventKind = JDWPConstants.EventKind.THREAD_END;
+        byte suspendPolicy = JDWPConstants.SuspendPolicy.NONE;
+        EventMod[] mods = new EventMod[0];
+        Event eventToSet = new Event(eventKind, suspendPolicy, mods);
+
+        reply = debuggeeWrapper.vmMirror.setEvent(eventToSet);
+        checkReplyPacket(reply, "Set THREAD_END event");
+
+        logWriter.println("=> set ThreadEndEvent - DONE");
+
+        logWriter.println("");
+        logWriter.println("=> CLOSE CONNECTION");
+        closeConnection();
+        logWriter.println("=> CONNECTION CLOSED");
+
+        logWriter.println("");
+        logWriter.println("=> OPEN NEW CONNECTION");
+        openConnection();
+        logWriter.println("=> CONNECTION OPENED");
+
+        logWriter.println("=> Resuming debuggee");
+
+        // start the thread
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        // wait for thread start and finish
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        logWriter.println("=> vmMirror.receiveEvent()...");
+        CommandPacket event = null;
+        try {
+            event = debuggeeWrapper.vmMirror.receiveEvent();
+        } catch (TestErrorException thrown) {
+            logWriter.println("=> Exception while receiving event:" + thrown);
+        }
+        if (event == null) {
+            logWriter.println("=> It's expected result, nothing was caught");
+            logWriter.println("=> Resuming debuggee");
+            //resuming debuggee
+            synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+            logWriter.println("==> testThreadStart001 PASSED! ");
+        } else {
+            logWriter.println("##FAILURE: Event was received");
+            try {
+                ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+                logWriter.println("=> Number of events = " + parsedEvents.length);
+                for (int i = 0; i < parsedEvents.length; i++) {
+                    logWriter.println("=> EventKind() = "
+                            + parsedEvents[0].getEventKind()
+                            + " ("
+                            + JDWPConstants.EventKind.getName(parsedEvents[0]
+                                    .getEventKind()) + ")");
+                    logWriter.println("=> EventRequestID() = "
+                            + parsedEvents[0].getRequestID());
+
+                }
+            } catch (Throwable thrown) {
+                logWriter.println("##FAILURE: Exception while analyzing received event:"
+                        + thrown);
+                fail("##FAILURE: Exception while analyzing received event:" + thrown);
+            }
+
+            synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+            logWriter.println("==> testThreadEnd001 PASSED");
+        }
+    }
+
+    protected void beforeDebuggeeStart(JDWPUnitDebuggeeWrapper debuggeeWrapper) {
+        settings.setAttachConnectorKind();
+        if (settings.getTransportAddress() == null) {
+            settings.setTransportAddress(TestOptions.DEFAULT_ATTACHING_ADDRESS);
+        }
+        logWriter.println("ATTACH connector kind");
+        super.beforeDebuggeeStart(debuggeeWrapper);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadEndTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadStartTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadStartTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadStartTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadStartTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Aleksander V. Budniy
+ * @version $Revision: 1.6 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.MultiSession;
+
+import org.apache.harmony.jpda.tests.framework.TestOptions;
+import org.apache.harmony.jpda.tests.framework.TestErrorException;
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.Event;
+import org.apache.harmony.jpda.tests.framework.jdwp.EventMod;
+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.ReplyPacket;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPUnitDebuggeeWrapper;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for verifying canceling of THREAD_START event after re-connection.
+ */
+public class ThreadStartTest extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ThreadStartTest.class);
+    }
+
+    /**
+     * This testcase verifies canceling of THREAD_START event after re-connection.
+     * <BR>It runs EventDebuggee, sets request for THREAD_START event
+     * and re-connects.
+     * <BR>It is expected that no any events, including THREAD_START, occur after re-connection
+     * and before EventDebuggee finish.
+     */
+    public void testThreadStart001() {
+        logWriter.println("==> testThreadStart001 - STARTED...");
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        logWriter.println("=> set ThreadStartEvent...");
+        ReplyPacket reply;
+        //        reply = debuggeeWrapper.vmMirror.setThreadStart();
+        byte eventKind = JDWPConstants.EventKind.THREAD_START;
+        byte suspendPolicy = JDWPConstants.SuspendPolicy.NONE;
+        EventMod[] mods = new EventMod[0];
+        Event eventToSet = new Event(eventKind, suspendPolicy, mods);
+
+        reply = debuggeeWrapper.vmMirror.setEvent(eventToSet);
+        checkReplyPacket(reply, "Set THREAD_START event");
+
+        logWriter.println("=> set ThreadStartEvent - DONE");
+
+        logWriter.println("");
+        logWriter.println("=> CLOSE CONNECTION");
+        closeConnection();
+        logWriter.println("=> CONNECTION CLOSED");
+
+        logWriter.println("");
+        logWriter.println("=> OPEN NEW CONNECTION");
+        openConnection();
+        logWriter.println("=> CONNECTION OPENED");
+
+        logWriter.println("=> Resuming debuggee");
+
+        // start the thread
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        // wait for thread start and finish
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        logWriter.println("=> vmMirror.receiveEvent()...");
+        CommandPacket event = null;
+        try {
+            event = debuggeeWrapper.vmMirror.receiveEvent();
+        } catch (TestErrorException thrown) {
+            logWriter.println("=> Exception while receiving event:" + thrown);
+
+        }
+        if (event == null) {
+            logWriter.println("=> It's expected result, nothing was caught");
+            logWriter.println("=> Resuming debuggee");
+            //resuming debuggee
+            synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+            logWriter.println("==> testThreadStart001 PASSED! ");
+        } else {
+
+            logWriter.println("##FAILURE: Event was received");
+
+            try {
+                ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+                logWriter.println("=> Number of events = " + parsedEvents.length);
+                for (int i = 0; i < parsedEvents.length; i++) {
+                    logWriter.println("=> EventKind() = "
+                            + parsedEvents[0].getEventKind()
+                            + " ("
+                            + JDWPConstants.EventKind.getName(parsedEvents[0]
+                                    .getEventKind()) + ")");
+                    logWriter.println("=> EventRequestID() = "
+                            + parsedEvents[0].getRequestID());
+
+                }
+            } catch (Throwable thrown) {
+                logWriter.println("##FAILURE: Exception while analyzing received event:"
+                        + thrown);
+                fail("##FAILURE: Exception while analyzing received event:" + thrown);
+            }
+
+            synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+            logWriter.println("==> testThreadStart001 PASSED");
+        }
+    }
+
+    protected void beforeDebuggeeStart(JDWPUnitDebuggeeWrapper debuggeeWrapper) {
+        settings.setAttachConnectorKind();
+        if (settings.getTransportAddress() == null) {
+            settings.setTransportAddress(TestOptions.DEFAULT_ATTACHING_ADDRESS);
+        }
+        logWriter.println("ATTACH connector kind");
+        super.beforeDebuggeeStart(debuggeeWrapper);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadStartTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/VMDeathTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/VMDeathTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/VMDeathTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/VMDeathTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Aleksander V. Budniy
+ * @version $Revision: 1.3 $
+ */
+
+/**
+ * Created on 8.7.2005
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.MultiSession;
+
+import org.apache.harmony.jpda.tests.framework.TestOptions;
+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.ParsedEvent;
+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.JDWPUnitDebuggeeWrapper;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for verifying canceling of requested VM_DEATH event after re-connection.
+ */
+public class VMDeathTest extends JDWPSyncTestCase {
+
+    int requestID = 0;
+
+    static final String DEBUGGEE_CLASS_NAME = "org.apache.harmony.jpda.tests.jdwp.Events.EventDebuggee";
+
+    protected String getDebuggeeClassName() {
+        return DEBUGGEE_CLASS_NAME;
+    }
+
+    /**
+     * This testcase verifies canceling of requested VM_DEATH event after re-connection.
+     * <BR>It runs EventDebuggee, sets request for VM_DEATH event
+     * and re-connects.
+     * <BR>It is expected that only auto VM_DEATH event occurs after re-connection,
+     * but no any other event, including requested VM_DEATH event.
+     */
+    public void testVMDeathRequest() {
+        logWriter.println("==> testVMDeathRequest started");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        //set request for VM_DEATH event with suspend policy SUSPEND_ALL
+        byte suspendPolicy = JDWPConstants.SuspendPolicy.ALL;
+        logWriter.println("=> Create request for VM_DEATH event with suspend policy: "
+                + suspendPolicy
+                + "/"
+                + JDWPConstants.SuspendPolicy.getName(suspendPolicy));
+        CommandPacket setRequestCommand = new CommandPacket(
+                JDWPCommands.EventRequestCommandSet.CommandSetID,
+                JDWPCommands.EventRequestCommandSet.SetCommand);
+
+        setRequestCommand.setNextValueAsByte(JDWPConstants.EventKind.VM_DEATH);
+        setRequestCommand.setNextValueAsByte(JDWPConstants.SuspendPolicy.ALL);
+        setRequestCommand.setNextValueAsInt(0);
+
+        ReplyPacket setRequestReply = debuggeeWrapper.vmMirror
+                .performCommand(setRequestCommand);
+        
+        checkReplyPacket(setRequestReply, "Set VM_DEATH event");
+
+        requestID = setRequestReply.getNextValueAsInt();
+        logWriter.println("=> RequestID = " + requestID);
+
+        assertAllDataRead(setRequestReply);
+
+        logWriter.println("");
+        logWriter.println("=> CLOSE CONNECTION");
+        closeConnection();
+        logWriter.println("=> CONNECTION IS CLOSED");
+
+        logWriter.println("");
+        logWriter.println("=> OPEN NEW CONNECTION");
+        openConnection();
+        logWriter.println("=> CONNECTION IS OPENED");
+
+        //release debuggee
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        //receive and parse event set
+        logWriter.println("=> Wait for event..");
+        CommandPacket eventPacket = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(eventPacket);
+        int eventsCount = parsedEvents.length;
+        logWriter.println("=> Received event set: count=" + eventsCount);
+
+        //ckeck if received events are expected
+        int result = 0;
+        int autoEvents = 0;
+        int wrongEvents = 0;
+        for (int i = 0; i < eventsCount; i++) {
+            ParsedEvent event = parsedEvents[i];
+            logWriter.println("=> Event #" + i + ";");
+
+            // print event info
+            byte eventSuspendPolicy = event.getSuspendPolicy();
+            logWriter.println("=> SuspendPolicy=" + eventSuspendPolicy + "/"
+                    + JDWPConstants.SuspendPolicy.getName(eventSuspendPolicy));
+            byte eventKind = event.getEventKind();
+            logWriter.println("=> EventKind=" + eventKind + "/"
+                    + JDWPConstants.EventKind.getName(eventKind));
+            int eventRequestID = event.getRequestID();
+            logWriter.println("=> RequestID=" + eventRequestID);
+
+            // check if event is expected
+            if (eventKind == JDWPConstants.EventKind.VM_DEATH) {
+                if (parsedEvents[i].getRequestID() == 0) {
+                    autoEvents++;
+                    logWriter.println("=> found auto VM_DEATH event!");
+                    // for automatical event suspend policy can be changed
+                } else {
+                    logWriter.println("## FAILURE: VM_DEATH event "
+                            + "with unexpected RequestID: " + eventRequestID);
+                    result = 1;
+                }
+            } else {
+                wrongEvents++;
+                logWriter.println("## FAILURE: unexpected event kind: "
+                        + eventKind);
+                result = 2;
+            }
+        }
+
+        if (1 == result)
+            fail("VM_DEATH event with unexpected RequestID");
+        else if (2 == result)
+            fail("Unexpected event kind");
+        
+        logWriter.println("==> test PASSED!");
+    }
+
+    protected void beforeDebuggeeStart(JDWPUnitDebuggeeWrapper debuggeeWrapper) {
+        settings.setAttachConnectorKind();
+        if (settings.getTransportAddress() == null) {
+            settings.setTransportAddress(TestOptions.DEFAULT_ATTACHING_ADDRESS);
+        }
+        logWriter.println("ATTACH connector kind");
+        super.beforeDebuggeeStart(debuggeeWrapper);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(VMDeathTest.class);
+
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/MultiSession/VMDeathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.3 $
+ */
+
+/**
+ * Created on 04.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class DisableCollectionDebuggee extends SyncDebuggee {
+    
+    static DisableCollectionObject001_01 checkedObject;
+    static boolean checkedObject_Finalized = false; 
+    static DisableCollectionObject001_02 patternObject;
+    static boolean patternObject_Finalized = false; 
+
+    public void run() {
+        logWriter.println("--> Debuggee: DisableCollectionDebuggee: START");
+        
+        checkedObject = new DisableCollectionObject001_01();
+        patternObject = new DisableCollectionObject001_02();
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        String messageFromTest = 
+            synchronizer.receiveMessageWithoutException("DisableCollectionDebuggee(#1)");
+        logWriter.println("--> messageFromTest = |" + messageFromTest + "|");
+        if ( messageFromTest.equals("TO_FINISH")) {
+            logWriter.println("--> Debuggee: DisableCollectionDebuggee: FINISH");
+            return;
+        }
+        
+        logWriter.println("--> Debuggee: BEFORE System.gc():");
+        logWriter.println("--> Debuggee: checkedObject = " + 
+                checkedObject);
+        logWriter.println("--> Debuggee: checkedObject_UNLOADed = " + 
+                checkedObject_Finalized);
+        logWriter.println("--> Debuggee: patternObject = " + 
+                patternObject);
+        logWriter.println("--> Debuggee: patternObject_UNLOADed = " + 
+                patternObject_Finalized);
+
+        checkedObject = null;
+        patternObject = null;
+        long[][] longArray;
+        int i = 0;
+        try {
+            longArray = new long[1000000][];
+            int arraysNumberLimit = 7; // max - longArray.length
+            logWriter.println
+            ("--> Debuggee: memory depletion - creating 'long[1000000]' arrays (" + arraysNumberLimit + ")..."); 
+            for (; i < arraysNumberLimit; i++) {
+                longArray[i] = new long[1000000];
+            }
+        } catch ( OutOfMemoryError outOfMem ) {
+            logWriter.println("--> Debuggee: OutOfMemoryError!!!");
+            // logWriter.println("--> Debuggee: i = " + i);
+        }
+        longArray = null;
+        System.gc();
+        logWriter.println("--> Debuggee: AFTER System.gc():");
+        logWriter.println("--> Debuggee: checkedObject = " + 
+                checkedObject);
+        logWriter.println("--> Debuggee: checkedObject_UNLOADed = " + 
+                checkedObject_Finalized);
+        logWriter.println("--> Debuggee: patternObject = " + 
+                patternObject);
+        logWriter.println("--> Debuggee: patternObject_UNLOADed = " + 
+                patternObject_Finalized);
+
+        String messageForTest = null;
+        if ( checkedObject_Finalized ) {
+            messageForTest = "Checked Object is UNLOADed!";
+        } else {
+            messageForTest = "Checked Object is NOT UNLOADed!";
+        }
+        logWriter.println("--> Debuggee: Send to test message: \"" + messageForTest + "\"");
+        synchronizer.sendMessage(messageForTest);
+        synchronizer.receiveMessageWithoutException("DisableCollectionDebuggee(#2)");
+
+        logWriter.println("--> Debuggee: DisableCollectionDebuggee: FINISH");
+
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(DisableCollectionDebuggee.class);
+    }
+
+}
+
+class DisableCollectionObject001_01 {
+    protected void finalize() throws Throwable {
+        DisableCollectionDebuggee.checkedObject_Finalized = true;
+        super.finalize();
+    }
+}   
+
+class DisableCollectionObject001_02 {
+    protected void finalize() throws Throwable {
+        DisableCollectionDebuggee.patternObject_Finalized = true;
+        super.finalize();
+    }
+}   

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.5 $
+ */
+
+/**
+ * Created on 04.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+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.framework.jdwp.Value;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ObjectReference.DisableCollection command.
+ */
+public class DisableCollectionTest extends JDWPSyncTestCase {
+
+    static final String thisCommandName = "ObjectReference::DisableCollection command";
+
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionDebuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.DisableCollectionDebuggee";
+    }
+
+    /**
+     * This testcase exercises ObjectReference.DisableCollection command.
+     * <BR>The test starts DisableCollectionDebuggee class, gets
+     * objectID as value of static field of this class which (field) represents
+     * checked object. Then for this objectID test executes
+     * ObjectReference.DisableCollection command for checked object. After that
+     * Debuggee tries to unload checked object and checks if checked object is
+     * unloaded. <BR>If so the test fails, otherwise it passes.
+     */
+    public void testDisableCollection001() {
+        String thisTestName = "testDisableCollection001";
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName
+                + ": START...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        finalSyncMessage = "TO_FINISH";
+
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = "
+                + refTypeID);
+
+        long checkedFieldID = checkField(refTypeID, "checkedObject");
+
+        logWriter
+                .println("=> Send ReferenceType::GetValues command for received fieldID and get ObjectID to check...");
+
+        CommandPacket getValuesCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+        getValuesCommand.setNextValueAsReferenceTypeID(refTypeID);
+        getValuesCommand.setNextValueAsInt(1);
+        getValuesCommand.setNextValueAsFieldID(checkedFieldID);
+
+        ReplyPacket getValuesReply = debuggeeWrapper.vmMirror
+                .performCommand(getValuesCommand);
+        getValuesCommand = null;
+        checkReplyPacket(getValuesReply, "ReferenceType::GetValues command");
+
+        int returnedValuesNumber = getValuesReply.getNextValueAsInt();
+        logWriter
+                .println("=> Returned values number = " + returnedValuesNumber);
+        assertEquals(
+                "Invalid number of values returned from ReferenceType::GetValues command,",
+                1, returnedValuesNumber);
+
+        Value checkedObjectFieldValue = getValuesReply.getNextValueAsValue();
+        byte checkedObjectFieldTag = checkedObjectFieldValue.getTag();
+        logWriter.println("=> Returned field value tag for checked object= "
+                + checkedObjectFieldTag + "("
+                + JDWPConstants.Tag.getName(checkedObjectFieldTag) + ")");
+        assertEquals("Invalid value tag for checked object,",
+                JDWPConstants.Tag.OBJECT_TAG, checkedObjectFieldTag,
+                JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG),
+                JDWPConstants.Tag.getName((byte) (checkedObjectFieldTag)));
+
+        long checkedObjectID = checkedObjectFieldValue.getLongValue();
+        logWriter.println("=> Returned checked ObjectID = " + checkedObjectID);
+
+        logWriter.println("\n=> CHECK: send " + thisCommandName
+                + " for checked ObjectID...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.DisableCollectionCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+
+        ReplyPacket checkedReply = debuggeeWrapper.vmMirror
+                .performCommand(checkedCommand);
+        checkedCommand = null;
+        checkReplyPacket(checkedReply, thisCommandName);
+
+        logWriter.println("=> CHECK: Reply is received without any error");
+        logWriter
+                .println("=> Send to Debuggee signal to continue and try to unload checked ObjectID...");
+        finalSyncMessage = null;
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        String messageFromDebuggee = synchronizer
+                .receiveMessageWithoutException("DisableCollectionDebuggee(#2)");
+        logWriter.println("==> debuggeeMsg = |" + messageFromDebuggee + "|");
+        if (messageFromDebuggee.equals("Checked Object is UNLOADed!")) {
+            logWriter.println("\n## FAILURE: Checked Object is UNLOADed after "
+                    + thisCommandName);
+            fail("Checked Object is UNLOADed after " + thisCommandName);
+        } else {
+            logWriter
+                    .println("\n=> PASSED: Checked Object is NOT UNLOADed after "
+                            + thisCommandName);
+        }
+
+        logWriter.println("=> Send to Debuggee signal to funish ...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName
+                + ": FINISH");
+
+        assertAllDataRead(checkedReply);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(DisableCollectionTest.class);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/DisableCollectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.3 $
+ */
+
+/**
+ * Created on 04.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class EnableCollectionDebuggee extends SyncDebuggee {
+    
+    static EnableCollectionObject001_01 checkedObject;
+    static boolean checkedObject_Finalized = false; 
+    static EnableCollectionObject001_02 patternObject;
+    static boolean patternObject_Finalized = false; 
+
+    public void run() {
+        logWriter.println("--> Debuggee: EnableCollectionDebuggee: START");
+        
+        checkedObject = new EnableCollectionObject001_01();
+        patternObject = new EnableCollectionObject001_02();
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        String messageFromTest = synchronizer.receiveMessage();
+        if ( messageFromTest.equals("TO_FINISH")) {
+            logWriter.println("--> Debuggee: EnableCollectionDebuggee: FINISH");
+            return;
+        }
+        
+        logWriter.println("--> Debuggee: BEFORE System.gc():");
+        logWriter.println("--> Debuggee: checkedObject = " + 
+                checkedObject);
+        logWriter.println("--> Debuggee: checkedObject_UNLOADed = " + 
+                checkedObject_Finalized);
+        logWriter.println("--> Debuggee: patternObject = " + 
+                patternObject);
+        logWriter.println("--> Debuggee: patternObject_UNLOADed = " + 
+                patternObject_Finalized);
+
+        checkedObject = null;
+        patternObject = null;
+        long[][] longArray;
+        int i = 0;
+        try {
+            longArray = new long[1000000][];
+            int arraysNumberLimit = 8; // max - longArray.length
+            logWriter.println
+            ("--> Debuggee: memory depletion - creating 'long[1000000]' arrays (" + arraysNumberLimit + ")..."); 
+            for (; i < arraysNumberLimit; i++) {
+                longArray[i] = new long[1000000];
+            }
+        } catch ( OutOfMemoryError outOfMem ) {
+            logWriter.println("--> Debuggee: OutOfMemoryError!!!");
+        }
+        longArray = null;
+        System.gc();
+        logWriter.println("--> Debuggee: AFTER System.gc():");
+        logWriter.println("--> Debuggee: checkedObject = " + 
+                checkedObject);
+        logWriter.println("--> Debuggee: checkedObject_UNLOADed = " + 
+                checkedObject_Finalized);
+        logWriter.println("--> Debuggee: patternObject = " + 
+                patternObject);
+        logWriter.println("--> Debuggee: patternObject_UNLOADed = " + 
+                patternObject_Finalized);
+
+        String messageForTest = null;
+        if ( checkedObject_Finalized ) {
+            if ( patternObject_Finalized ) {
+                messageForTest = "Checked Object is UNLOADed; Pattern Object is UNLOADed;";
+            } else {
+                messageForTest = "Checked Object is UNLOADed; Pattern Object is NOT UNLOADed;";
+            }
+        } else {
+            if ( patternObject_Finalized ) {
+                messageForTest = "Checked Object is NOT UNLOADed; Pattern Object is UNLOADed;";
+            } else {
+                messageForTest = "Checked Object is NOT UNLOADed; Pattern Object is NOT UNLOADed;";
+            }
+        }
+        logWriter.println("--> Debuggee: Send to test message: \"" + messageForTest + "\"");
+        synchronizer.sendMessage(messageForTest);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        logWriter.println("--> Debuggee: EnableCollectionDebuggee: FINISH");
+
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(EnableCollectionDebuggee.class);
+    }
+
+}
+
+class EnableCollectionObject001_01 {
+    protected void finalize() throws Throwable {
+        EnableCollectionDebuggee.checkedObject_Finalized = true;
+        super.finalize();
+    }
+}   
+
+class EnableCollectionObject001_02 {
+    protected void finalize() throws Throwable {
+        EnableCollectionDebuggee.patternObject_Finalized = true;
+        super.finalize();
+    }
+}   
+

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.6 $
+ */
+
+/**
+ * Created on 04.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+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.framework.jdwp.Value;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ObjectReference.EnableCollection command.
+ */
+public class EnableCollectionTest extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ObjectReference::EnableCollection command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionDebuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.EnableCollectionDebuggee";
+    }
+
+    /**
+     * This testcase exercises ObjectReference.EnableCollection command.
+     * <BR>The test starts EnableCollectionDebuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference::DisableCollection command 
+     * and ObjectReference.EnableCollection command. After that Debuggee tries to
+     * unload checked object and checks if checked object is unloaded.
+     * <BR>If so the test passes. Otherwise it fails in case when pattern object is unloaded.
+     */
+    public void testEnableCollection001() {
+        String thisTestName = "testEnableCollection001";
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        finalSyncMessage = "TO_FINISH";
+
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
+
+        logWriter.println
+        ("=> Send ReferenceType::Fields command and get fieldID for field representing checked object...");
+
+        long checkedFieldID = checkFields(refTypeID, new String[] { "checkedObject" })[0];
+
+        logWriter.println
+        ("=> Send ReferenceType::GetValues command for received fieldID and get ObjectID to check...");
+
+        CommandPacket getValuesCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+        getValuesCommand.setNextValueAsReferenceTypeID(refTypeID);
+        getValuesCommand.setNextValueAsInt(1);
+        getValuesCommand.setNextValueAsFieldID(checkedFieldID);
+
+        ReplyPacket getValuesReply = debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+        getValuesCommand = null;
+        checkReplyPacket(getValuesReply, "ReferenceType::GetValues command");
+
+        int returnedValuesNumber = getValuesReply.getNextValueAsInt();
+        logWriter.println("=> Returned values number = " + returnedValuesNumber);
+        assertEquals("Invalid number of values,", 1, returnedValuesNumber);
+
+        Value checkedObjectFieldValue = getValuesReply.getNextValueAsValue();
+        byte checkedObjectFieldTag = checkedObjectFieldValue.getTag();
+        logWriter.println("=> Returned field value tag for checked object= " + checkedObjectFieldTag
+            + "(" + JDWPConstants.Tag.getName(checkedObjectFieldTag) + ")");
+        assertEquals("invalid value tag for checked object,", JDWPConstants.Tag.OBJECT_TAG, checkedObjectFieldTag
+                , JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG)
+                , JDWPConstants.Tag.getName(checkedObjectFieldTag));
+
+        long checkedObjectID = checkedObjectFieldValue.getLongValue();
+        logWriter.println("=> Returned checked ObjectID = " + checkedObjectID);
+
+        logWriter.println
+            ("\n=> Send ObjectReference::DisableCollection command for checked ObjectID...");
+
+        CommandPacket disableCollectionCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.DisableCollectionCommand);
+        disableCollectionCommand.setNextValueAsObjectID(checkedObjectID);
+
+        ReplyPacket disableCollectionReply = debuggeeWrapper.vmMirror.performCommand(disableCollectionCommand);
+        disableCollectionCommand = null;
+        checkReplyPacket(disableCollectionReply, "ObjectReference::DisableCollection command");
+
+        logWriter.println
+        ("\n=> CHECK: Send " + thisCommandName + " for checked ObjectID...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+            JDWPCommands.ObjectReferenceCommandSet.EnableCollectionCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+
+        ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+        checkReplyPacket(checkedReply, thisCommandName);
+
+        logWriter.println("=> CHECK: Reply is received without any error");
+
+        logWriter.println("=> Send to Debuggee signal to continue and try to unload checked ObjectID...");
+        finalSyncMessage = null;
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        String messageFromDebuggee = synchronizer.receiveMessage();
+        logWriter.println
+        ("\n=> Received message from Debuggee = \"" + messageFromDebuggee + "\"" );
+        if ( messageFromDebuggee.equals
+                ("Checked Object is NOT UNLOADed; Pattern Object is UNLOADed;") ) {
+            logWriter.println
+                ("## FAILURE: Checked Object is NOT UNLOADed after " + thisCommandName );
+            fail("Checked Object is NOT UNLOADed after " + thisCommandName);
+        } else {
+            logWriter.println("=> PASSED: It is expected result" );
+        }
+
+        assertAllDataRead(checkedReply);
+
+        logWriter.println("=> Send to Debuggee signal to funish ...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(EnableCollectionTest.class);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/EnableCollectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class GetValues002Debuggee extends SyncDebuggee {
+    
+    static int staticIntField;
+    static long staticLongField;
+    static String staticStringField;
+    static Object staticObjectField;
+    static boolean staticBooleanField;
+    static byte staticByteField;
+    static char staticCharField;
+    static short staticShortField;
+    static float staticFloatField;
+    static double staticDoubleField;
+    static int[] staticArrayField;
+    
+    static GetValues002Debuggee getValues002DebuggeeField;
+    
+
+    public void run() {
+        logWriter.println("--> Debuggee: GetValues002Debuggee: START");
+        getValues002DebuggeeField = new GetValues002Debuggee();
+
+        staticIntField = 99;
+        staticLongField = 2147483647;
+        staticStringField = "staticStringField";
+        staticObjectField = new Object();
+        staticBooleanField = true;
+        staticByteField = 1;
+        staticCharField = 'a';
+        staticShortField = 2;
+        staticFloatField = 2;
+        staticDoubleField = 3.1;
+        staticArrayField = new int[10];
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("--> Debuggee: GetValues002Debuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(GetValues002Debuggee.class);
+    }
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Debuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.6 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+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.framework.jdwp.Value;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ObjectReference.GetValues command for static fields.
+ */
+public class GetValues002Test extends JDWPSyncTestCase {
+
+    static final String thisCommandName = "ObjectReference::GetValues command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Debuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.GetValues002Debuggee";
+    }
+
+    /**
+     * This test exercises ObjectReference.GetValues command for static fields.
+     * <BR>The test starts GetValues002Debuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference.GetValues command for special
+     * set of fieldIDs and checks that command returns expected jdwpTags for all checked
+     * fields and expected values for primitive fields.
+     */
+    public void testGetValues002() {
+        String thisTestName = "testGetValues002";
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
+
+        String checkedFieldNames[] = {
+                "getValues002DebuggeeField",
+                
+                "staticLongField",
+                "staticIntField",
+                "staticStringField",
+                "staticObjectField",
+                "staticBooleanField",
+                "staticByteField",
+                "staticCharField",
+                "staticShortField",
+                "staticFloatField",
+                "staticDoubleField",
+                "staticArrayField",
+                };
+        long checkedFieldIDs[] = checkFields(refTypeID, checkedFieldNames);
+        int checkedFieldsNumber = checkedFieldNames.length;
+
+        logWriter.println
+        ("=> Send ReferenceType::GetValues command and and get ObjectID to check...");
+
+        CommandPacket getValuesCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+        getValuesCommand.setNextValueAsReferenceTypeID(refTypeID);
+        getValuesCommand.setNextValueAsInt(1);
+        getValuesCommand.setNextValueAsFieldID(checkedFieldIDs[0]);
+        
+        ReplyPacket getValuesReply = debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+        getValuesCommand = null;
+        checkReplyPacket(getValuesReply, "ReferenceType::GetValues command");
+        
+        int returnedValuesNumber = getValuesReply.getNextValueAsInt();
+        logWriter.println("=> Returned values number = " + returnedValuesNumber);
+        assertEquals("Invalid number of values,", 1, returnedValuesNumber);
+        
+        Value checkedObjectFieldValue = getValuesReply.getNextValueAsValue();
+        byte checkedObjectFieldTag = checkedObjectFieldValue.getTag();
+        logWriter.println("=> Returned field value tag for checked object= " + checkedObjectFieldTag
+            + "(" + JDWPConstants.Tag.getName(checkedObjectFieldTag) + ")");
+        assertEquals("Invalid value tag for checked object,", JDWPConstants.Tag.OBJECT_TAG, checkedObjectFieldTag
+                , JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG)
+                , JDWPConstants.Tag.getName(checkedObjectFieldTag));
+
+        long checkedObjectID = checkedObjectFieldValue.getLongValue();
+        logWriter.println("=> Returned checked ObjectID = " + checkedObjectID);
+        logWriter.println("=> CHECK: send " + thisCommandName + " for this ObjectID and check reply...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.GetValuesCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+        checkedCommand.setNextValueAsInt(checkedFieldsNumber-1);
+        int fieldIndex = 1; // !!!
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            checkedCommand.setNextValueAsFieldID(checkedFieldIDs[fieldIndex]);
+        }
+        
+        ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+        checkReplyPacket(checkedReply, thisCommandName);
+        
+        returnedValuesNumber = checkedReply.getNextValueAsInt();
+        logWriter.println("=> Returned values number = " + returnedValuesNumber);
+        assertEquals("Invalid number of values,", checkedFieldsNumber - 1, returnedValuesNumber);
+
+        byte expectedFieldTags[] = {
+                0, // dummy
+                JDWPConstants.Tag.LONG_TAG,
+                JDWPConstants.Tag.INT_TAG,
+                JDWPConstants.Tag.STRING_TAG,
+                JDWPConstants.Tag.OBJECT_TAG,
+                JDWPConstants.Tag.BOOLEAN_TAG,
+                JDWPConstants.Tag.BYTE_TAG,
+                JDWPConstants.Tag.CHAR_TAG,
+                JDWPConstants.Tag.SHORT_TAG,
+                JDWPConstants.Tag.FLOAT_TAG,
+                JDWPConstants.Tag.DOUBLE_TAG,
+                JDWPConstants.Tag.ARRAY_TAG,
+        };
+
+        logWriter.println("=> CHECK for returned values...");
+        fieldIndex = 1; // !!!
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            Value fieldValue = checkedReply.getNextValueAsValue();
+            byte fieldTag = fieldValue.getTag();
+            logWriter.println
+            ("\n=> Check for returned value for field: " + checkedFieldNames[fieldIndex] + " ...");
+            logWriter.println("=> Returned value tag = " + fieldTag 
+                + "(" + JDWPConstants.Tag.getName(fieldTag) + ")");
+            
+            assertEquals("Invalid value tag is returned,", expectedFieldTags[fieldIndex], fieldTag
+                    , JDWPConstants.Tag.getName(expectedFieldTags[fieldIndex])
+                    , JDWPConstants.Tag.getName(fieldTag));
+
+            switch ( fieldTag ) {
+            case JDWPConstants.Tag.INT_TAG:
+                int intValue = fieldValue.getIntValue();
+                logWriter.println("=> Int value = " + intValue);
+                int expectedIntValue = 99;
+                assertEquals("Invalid int value,", expectedIntValue, intValue);
+                break;
+            case JDWPConstants.Tag.LONG_TAG:
+                long longValue = fieldValue.getLongValue();
+                logWriter.println("=> Long value = " + longValue);
+                long expectedLongValue = 2147483647;
+                assertEquals("Invalid long value,", expectedLongValue, longValue);
+                break;
+            case JDWPConstants.Tag.STRING_TAG:
+                long stringIDValue = fieldValue.getLongValue();
+                logWriter.println("=> StringID value = " + stringIDValue);
+                break;
+            case JDWPConstants.Tag.OBJECT_TAG:
+                long objectIDValue = fieldValue.getLongValue();
+                logWriter.println("=> ObjectID value = " + objectIDValue);
+                break;
+            case JDWPConstants.Tag.BOOLEAN_TAG:
+                boolean booleanValue = fieldValue.getBooleanValue();
+                logWriter.println("=> Boolean value = " + booleanValue);
+                boolean expectedBooleanValue = true;
+                assertEquals("Invalid boolean value,", expectedBooleanValue, booleanValue);
+                break;
+            case JDWPConstants.Tag.BYTE_TAG:
+                byte byteValue = fieldValue.getByteValue();
+                logWriter.println("=> Byte value = " + byteValue);
+                byte expectedByteValue = 1;
+                assertEquals("Invalid byte value,", expectedByteValue, byteValue);
+                break;
+            case JDWPConstants.Tag.CHAR_TAG:
+                char charValue = fieldValue.getCharValue();
+                logWriter.println("=> Char value = " + (int)charValue);
+                char expectedCharValue = 97;
+                assertEquals("Invalid char value,", expectedCharValue, charValue);
+                break;
+            case JDWPConstants.Tag.SHORT_TAG:
+                short shortValue = fieldValue.getShortValue();
+                logWriter.println("=> Short value = " + shortValue);
+                short expectedShortValue = 2;
+                assertEquals("Invalid short value,", expectedShortValue, shortValue);
+                break;
+            case JDWPConstants.Tag.FLOAT_TAG:
+                float floatValue = fieldValue.getFloatValue();
+                logWriter.println("=> Float value = " + floatValue);
+                float expectedFloatValue = 2;
+                assertEquals("Invalid float value,", expectedFloatValue, floatValue, 0);
+                break;
+            case JDWPConstants.Tag.DOUBLE_TAG:
+                double doubleValue = fieldValue.getDoubleValue();
+                logWriter.println("=> Double value = " + doubleValue);
+                double expectedDoubleValue = 3.1;
+                assertEquals("Invalid double value,", expectedDoubleValue, doubleValue, 0);
+                break;
+            case JDWPConstants.Tag.ARRAY_TAG:
+                long arrayIDValue = fieldValue.getLongValue();
+                logWriter.println("=> ArrayID value = " + arrayIDValue);
+                break;
+            }
+        }
+
+        assertAllDataRead(checkedReply);
+
+        logWriter.println
+        ("=> CHECK PASSED: All expected field values are got and have expected attributes");
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(GetValues002Test.class);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues002Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 13.07.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class GetValues003Debuggee extends SyncDebuggee {
+    
+    static GetValues003Debuggee testedObject;
+
+    int intArrayField[]; // JDWP_TAG_ARRAY = 91
+    GetValues003Debuggee objectArrayField[]; // JDWP_TAG_ARRAY = 91
+    GetValues003Debuggee objectField; // JDWP_TAG_OBJECT = 76
+    String stringField; // JDWP_TAG_STRING = 115
+    Thread threadField; // JDWP_TAG_THREAD = 116
+    ThreadGroup threadGroupField; // JDWP_TAG_THREAD_GROUP = 103
+    Class classField; // JDWP_TAG_CLASS_OBJECT = 99
+    ClassLoader classLoaderField; // DWP_TAG_CLASS_LOADER = 108
+    
+    
+    
+    public void run() {
+        logWriter.println("--> Debuggee: GetValues003Debuggee: START");
+        testedObject = new GetValues003Debuggee();
+
+        testedObject.intArrayField = new int[1];
+        testedObject.intArrayField[0]= 999;
+        testedObject.objectArrayField = new GetValues003Debuggee[1];
+        testedObject.objectArrayField[0] = new GetValues003Debuggee();
+        testedObject.objectField = new GetValues003Debuggee();
+        testedObject.stringField = "stringField";
+        testedObject.threadField = new GetValues003DebuggeeThread();
+        testedObject.threadGroupField = new ThreadGroup("ThreadGroupName");
+        testedObject.classField = GetValues003Debuggee.class;
+        testedObject.classLoaderField = testedObject.classField.getClassLoader();
+
+        testedObject.intArrayField = null;
+        testedObject.objectArrayField = null;
+        testedObject.objectField = null;
+        testedObject.stringField = null;
+        testedObject.threadField = null;
+        testedObject.threadGroupField = null;
+        testedObject.classField = null;
+        testedObject.classLoaderField = null;
+
+        logWriter.println("\n--> Debuggee: GetValues003Debuggee: Before ObjectReference::GetValues command:");
+        logWriter.println("--> intArrayField value = " + testedObject.intArrayField);
+        logWriter.println("--> objectArrayField value = " + testedObject.objectArrayField);
+        logWriter.println("--> objectField value = " + testedObject.objectField);
+        logWriter.println("--> stringField value = " + testedObject.stringField);
+        logWriter.println("--> threadField value = " + testedObject.threadField);
+        logWriter.println("--> threadGroupField value = " + testedObject.threadGroupField);
+        logWriter.println("--> classField value = " + testedObject.classField);
+        logWriter.println("--> classLoaderField value = " + testedObject.classLoaderField);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        logWriter.println("--> Debuggee: GetValues003Debuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(GetValues003Debuggee.class);
+    }
+}
+
+class GetValues003DebuggeeThread extends Thread {
+    public void myMethod() {
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Debuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.5 $
+ */
+
+/**
+ * Created on 13.07.2005
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+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.framework.jdwp.Value;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ObjectReference.GetValues command for Object fields with value=null.
+ */
+public class GetValues003Test extends JDWPSyncTestCase {
+
+    static final String thisCommandName = "ObjectReference::GetValues command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Debuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.GetValues003Debuggee";
+    }
+
+    /**
+     * This test exercises ObjectReference.GetValues command for static fields.
+     * <BR>The test starts GetValues003Debuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference.GetValues command for
+     * fields of different referenceTypes with value=null for all fields.
+     * The test expects the all returned values should be represented by expected
+     * JDWP tag with null value.
+     */
+    public void testGetValues003() {
+        String thisTestName = "testGetValues003";
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
+
+        String checkedFieldNames[] = {
+                "testedObject",
+                
+                "intArrayField",
+                "objectArrayField",
+                "objectField",
+                "stringField",
+                "threadField",
+                "threadGroupField",
+                "classField",
+                "classLoaderField",
+        };
+        long checkedFieldIDs[] = checkFields(refTypeID, checkedFieldNames);
+        int checkedFieldsNumber = checkedFieldNames.length;
+
+        logWriter.println
+        ("=> Send ReferenceType::GetValues command and get ObjectID to check...");
+
+        CommandPacket getValuesCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+        getValuesCommand.setNextValueAsReferenceTypeID(refTypeID);
+        getValuesCommand.setNextValueAsInt(1);
+        getValuesCommand.setNextValueAsFieldID(checkedFieldIDs[0]);
+        ReplyPacket getValuesReply =
+            debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+        getValuesCommand = null;
+        checkReplyPacket(getValuesReply, "ReferenceType::GetValue command");
+
+        int returnedValuesNumber = getValuesReply.getNextValueAsInt();
+        logWriter.println("=> Returned values number = " + returnedValuesNumber);
+        assertEquals("Invalid number of values,", 1, returnedValuesNumber);
+
+        Value checkedObjectFieldValue = getValuesReply.getNextValueAsValue();
+        byte checkedObjectFieldTag = checkedObjectFieldValue.getTag();
+        logWriter.println("=> Returned field value tag for checked object= " + checkedObjectFieldTag
+            + "(" + JDWPConstants.Tag.getName(checkedObjectFieldTag) + ")");
+        assertEquals("Invalid value tag for checked object,", JDWPConstants.Tag.OBJECT_TAG, checkedObjectFieldTag
+                , JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG)
+                , JDWPConstants.Tag.getName(checkedObjectFieldTag));
+
+        long checkedObjectID = checkedObjectFieldValue.getLongValue();
+        logWriter.println("=> Returned checked ObjectID = " + checkedObjectID);
+
+        logWriter.println
+        ("=> CHECK: send " + thisCommandName 
+        + " for this ObjectID for fields of different referenceTypes with with null values...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.GetValuesCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+        checkedCommand.setNextValueAsInt(checkedFieldsNumber-1);
+        int fieldIndex = 1; // !!!
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            checkedCommand.setNextValueAsFieldID(checkedFieldIDs[fieldIndex]);
+        }
+        ReplyPacket checkedReply =
+            debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+
+        checkReplyPacket(checkedReply, thisCommandName);
+
+        returnedValuesNumber = checkedReply.getNextValueAsInt();
+        logWriter.println("=> Returned values number = " + returnedValuesNumber);
+        assertEquals("Invalid number of values,", checkedFieldsNumber - 1, returnedValuesNumber);
+
+        byte expectedFieldTags[] = {
+                JDWPConstants.Tag.ARRAY_TAG,
+                JDWPConstants.Tag.ARRAY_TAG,
+                JDWPConstants.Tag.OBJECT_TAG,
+                JDWPConstants.Tag.STRING_TAG,
+                JDWPConstants.Tag.THREAD_TAG,
+                JDWPConstants.Tag.THREAD_GROUP_TAG,
+                JDWPConstants.Tag.CLASS_OBJECT_TAG,
+                JDWPConstants.Tag.CLASS_LOADER_TAG,
+        };
+        logWriter.println("=> CHECK for returned values...");
+        for (int i = 0; i < returnedValuesNumber; i++) {
+            Value fieldValue = checkedReply.getNextValueAsValue();
+            byte fieldTag = fieldValue.getTag();
+            logWriter.println
+            ("\n=> Check for returned value for field: " + checkedFieldNames[i+1] + " ...");
+            logWriter.println("=> Returned value tag = " + fieldTag 
+                + "(" + JDWPConstants.Tag.getName(fieldTag) + ")");
+            if ( (fieldTag != expectedFieldTags[i]) && (fieldTag != JDWPConstants.Tag.OBJECT_TAG) ) {
+                logWriter.println("\n## FAILURE:  Unexpected value tag is returned");
+                logWriter.println("## Expected value tag = " + expectedFieldTags[i]
+                + "(" + JDWPConstants.Tag.getName(expectedFieldTags[i]) + ")"
+                + " or = " + JDWPConstants.Tag.OBJECT_TAG
+                + "(" + JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG) + ")");
+                fail("Unexpected value tag is returned");
+            }
+            long objectIDValue = fieldValue.getLongValue();
+            logWriter.println("=> ObjectId value = " + objectIDValue);
+            assertEquals("Invalid objectID value is returned,", 0, objectIDValue);
+        }
+
+        assertAllDataRead(checkedReply);
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": OK.");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(GetValues003Test.class);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValues003Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValuesDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValuesDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValuesDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValuesDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Anatoly F. Bondarenko
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 28.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class GetValuesDebuggee extends SyncDebuggee {
+    
+    static GetValuesDebuggee getValuesDebuggeeObject;
+
+    int intField;
+    long longField;
+    String stringField;
+    GetValuesDebuggee objectField;
+    String[] stringArrayField;
+    GetValuesDebuggee[] objectArrayField;
+    Thread threadField;
+    ThreadGroup threadGroupField;
+    Class classField;
+    ClassLoader classLoaderField;
+
+    public void run() {
+        logWriter.println("--> Debuggee: GetValuesDebuggee: START");
+        getValuesDebuggeeObject = new GetValuesDebuggee();
+
+        getValuesDebuggeeObject.intField = 9999;
+        getValuesDebuggeeObject.longField = 999999;
+        getValuesDebuggeeObject.objectField = new GetValuesDebuggee();
+        getValuesDebuggeeObject.stringField = "stringField";
+        getValuesDebuggeeObject.stringArrayField = new String[1];
+        getValuesDebuggeeObject.stringArrayField[0] = "stringArrayField";
+        getValuesDebuggeeObject.objectArrayField = new GetValuesDebuggee[1];
+        getValuesDebuggeeObject.objectArrayField[0] = new GetValuesDebuggee();
+        getValuesDebuggeeObject.threadField = new MyThread();
+        getValuesDebuggeeObject.threadGroupField = new ThreadGroup("ThreadGroupName");
+        getValuesDebuggeeObject.classField = GetValuesDebuggee.class;
+        getValuesDebuggeeObject.classLoaderField = getValuesDebuggeeObject.classField.getClassLoader();
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("--> Debuggee: GetValuesDebuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(GetValuesDebuggee.class);
+    }
+
+}
+
+class MyThread extends Thread {
+    public void myMethod() {
+    }
+}
+        
+        

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/GetValuesDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native