harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r480141 [28/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...
Date Tue, 28 Nov 2006 17:49:31 GMT
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues002Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues002Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues002Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues002Test.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 17.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.SetValues command with value which is unknown objectID.
+ */
+public class SetValues002Test extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ObjectReference.SetValues command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues002Debuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.SetValues002Debuggee";
+    }
+
+    /**
+     * This test exercises ObjectReference.SetValues command with value which is unknown objectID.
+     * <BR>The test starts SetValues002Debuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference.SetValues command for
+     * fieldID of referenceType but with value which is unknown objectID.
+     * <BR>The test expects INVALID_OBJECT error.
+     */
+    public void testSetValues002() {
+
+        String thisTestName = "testSetValues002";
+        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[] = {
+            "setValues002DebuggeeObject",
+            "objectField",
+        };
+        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::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 with value which is unknown objectID: INVALID_OBJECT error is expected...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.SetValuesCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+        checkedCommand.setNextValueAsInt(checkedFieldsNumber-1);
+        long unknownObjectID = checkedObjectID + 100;
+        logWriter.println("=> unknown objectID = " + unknownObjectID);
+        int fieldIndex = 1;
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            checkedCommand.setNextValueAsFieldID(checkedFieldIDs[fieldIndex]);
+            switch ( fieldIndex ) {
+            case 1: // objectField
+                checkedCommand.setNextValueAsObjectID(unknownObjectID);
+                break;
+            }
+        }
+        
+        ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+
+        short errorCode = checkedReply.getErrorCode();
+        if ( errorCode != JDWPConstants.Error.NONE ) {
+            if ( errorCode != JDWPConstants.Error.INVALID_OBJECT ) {
+                logWriter.println("## CHECK: FAILURE: " +  thisCommandName 
+                    + " returns unexpected ERROR = " + errorCode 
+                    + "(" + JDWPConstants.Error.getName(errorCode) + ")");
+                fail(thisCommandName 
+                        + " returns unexpected ERROR = " + errorCode 
+                        + "(" + JDWPConstants.Error.getName(errorCode) + ")");
+            } else { 
+                logWriter.println("=> CHECK PASSED: Expected error (INVALID_OBJECT) is returned");
+            }
+        } else {
+            logWriter.println
+            ("\n## FAILURE: " + thisCommandName + " does NOT return expected error - INVALID_OBJECT");
+            fail(thisCommandName + " does NOT return expected error - INVALID_OBJECT");
+        }
+
+        logWriter.println("=> Wait for Debuggee to check for set field...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(SetValues002Test.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,84 @@
+/*
+ * 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 17.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 SetValues003Debuggee extends SyncDebuggee {
+    
+    static String passedStatus = "PASSED";
+    static String failedStatus = "FAILED";
+    static String status = passedStatus;
+
+    static SetValues003Debuggee setValues003DebuggeeObject;
+
+    SetValues003Debuggee_ExtraClass objectField;
+    static SetValues003Debuggee_ExtraClass objectFieldCopy;
+
+    public void run() {
+        logWriter.println("--> Debuggee: SetValues003Debuggee: START");
+        setValues003DebuggeeObject = new SetValues003Debuggee();
+        setValues003DebuggeeObject.objectField = new SetValues003Debuggee_ExtraClass();
+        objectFieldCopy = setValues003DebuggeeObject.objectField;
+
+        logWriter.println("\n--> Debuggee: SetValues003Debuggee: Before ObjectReference::SetValues command:");
+        logWriter.println("--> objectField value = " + setValues003DebuggeeObject.objectField);
+        logWriter.println("--> value to set = " + setValues003DebuggeeObject);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        logWriter.println("\n--> Debuggee: SetValues003Debuggee: After ObjectReference::SetValues command:");
+        logWriter.println("--> objectField value = " + setValues003DebuggeeObject.objectField);
+        if ( ! objectFieldCopy.equals(setValues003DebuggeeObject.objectField) ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + objectFieldCopy);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        if ( status.equals(failedStatus) ) {
+            logWriter.println("\n##> Debuggee: Check status = FAILED");
+        } else {   
+            logWriter.println("\n--> Debuggee: Check status = PASSED");
+        }
+
+        logWriter.println("--> Debuggee: Send check status for SetValues003Test...\n");
+        synchronizer.sendMessage(status);
+
+        logWriter.println("--> Debuggee: SetValues003Debuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(SetValues003Debuggee.class);
+    }
+}
+
+class SetValues003Debuggee_ExtraClass {
+   
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,153 @@
+/*
+ * 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 17.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.SetValues command with value with incorrect Type.
+ */
+public class SetValues003Test extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ObjectReference.SetValues command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues003Debuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.SetValues003Debuggee";
+    }
+
+    /**
+     * This test exercises ObjectReference.SetValues command with value with incorrect Type.
+     * <BR>The test starts SetValues003Debuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference.SetValues command for
+     * fieldID of referenceType but with value of other referenceType.
+     * <BR>The test expects the field should not be set.
+     */
+    public void testSetValues003() {
+
+        String thisTestName = "testSetValues003";
+        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[] = {
+                "setValues003DebuggeeObject",
+                "objectField",
+        };
+        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::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 with value which has other referenceType than field to set...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.SetValuesCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+        checkedCommand.setNextValueAsInt(checkedFieldsNumber-1);
+        int fieldIndex = 1;
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            checkedCommand.setNextValueAsFieldID(checkedFieldIDs[fieldIndex]);
+            switch ( fieldIndex ) {
+            case 1: // objectField
+                checkedCommand.setNextValueAsObjectID(checkedObjectID);
+                break;
+            }
+        }
+        ReplyPacket checkedReply =
+            debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+
+        short errorCode = checkedReply.getErrorCode();
+        if ( errorCode == JDWPConstants.Error.NONE ) {
+            logWriter.println("=> " +  thisCommandName 
+                    + " run without any ERROR!");
+        } else {
+            logWriter.println("=> " +  thisCommandName 
+                    + " returns ERROR = " + errorCode 
+                    + "(" + JDWPConstants.Error.getName(errorCode) + ")");
+        }
+
+        logWriter.println("=> Wait for Debuggee's status about check for set field...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        boolean debuggeeStatus = synchronizer.receiveMessage("PASSED");
+        if ( ! debuggeeStatus ) {
+            logWriter.println("## " + thisTestName + ": Debuggee returned status FAILED");
+            fail("Debuggee returned status FAILED");
+        } else {
+            logWriter.println("=> " + thisTestName + ": Debuggee returned status PASSED");
+        }
+
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": OK.");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(SetValues003Test.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,170 @@
+/*
+ * 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 SetValues004Debuggee extends SyncDebuggee {
+    
+    static String passedStatus = "PASSED";
+    static String failedStatus = "FAILED";
+    static String status = passedStatus;
+
+    static SetValues004Debuggee testedObject;
+
+    int intArrayField[]; // JDWP_TAG_ARRAY = 91
+    SetValues004Debuggee objectArrayField[]; // JDWP_TAG_ARRAY = 91
+    SetValues004Debuggee 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: SetValues004Debuggee: START");
+        testedObject = new SetValues004Debuggee();
+
+        testedObject.intArrayField = new int[1];
+        testedObject.intArrayField[0]= 999;
+        testedObject.objectArrayField = new SetValues004Debuggee[1];
+        testedObject.objectArrayField[0] = new SetValues004Debuggee();
+        testedObject.objectField = new SetValues004Debuggee();
+        testedObject.stringField = "stringField";
+        testedObject.threadField = new SetValues004DebuggeeThread();
+        testedObject.threadGroupField = new ThreadGroup("ThreadGroupName");
+        testedObject.classField = SetValues004Debuggee.class;
+        testedObject.classLoaderField = testedObject.classField.getClassLoader();
+
+        logWriter.println("\n--> Debuggee: SetValues004Debuggee: Before ObjectReference::SetValues 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("\n--> Debuggee: SetValues004Debuggee: After ObjectReference::SetValues command:");
+        logWriter.println("--> intArrayField value = " + testedObject.intArrayField);
+        if ( testedObject.intArrayField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> objectArrayField value = " + testedObject.objectArrayField);
+        if ( testedObject.objectArrayField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> objectField value = " + testedObject.objectField);
+        if ( testedObject.objectField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> stringField value = " + testedObject.stringField);
+        if ( testedObject.stringField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> threadField value = " + testedObject.threadField);
+        if ( testedObject.threadField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> threadGroupField value = " + testedObject.threadGroupField);
+        if ( testedObject.threadGroupField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> classField value = " + testedObject.classField);
+        if ( testedObject.classField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        logWriter.println("--> classLoaderField value = " + testedObject.classLoaderField);
+        if ( testedObject.classLoaderField != null ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + null);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: OK. Expected value");
+        }
+
+        if ( status.equals(failedStatus) ) {
+            logWriter.println("\n##> Debuggee: Check status = FAILED");
+        } else {   
+            logWriter.println("\n--> Debuggee: Check status = PASSED");
+        }
+
+        logWriter.println("--> Debuggee: Send check status for SetValues004Test...\n");
+        synchronizer.sendMessage(status);
+
+        logWriter.println("--> Debuggee: SetValues004Debuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(SetValues004Debuggee.class);
+    }
+}
+
+class SetValues004DebuggeeThread extends Thread {
+    public void myMethod() {
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,148 @@
+/*
+ * 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.SetValues command with null values.
+ */
+public class SetValues004Test extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ObjectReference.SetValues command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValues004Debuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.SetValues004Debuggee";
+    }
+
+    /**
+     * This test exercises ObjectReference.SetValues command with null values.
+     * <BR>The test starts SetValues004Debuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference.SetValues command for
+     * fields of different referenceTypes with value=null for all fields.
+     * <BR>The test expects the all fields should be set by null value.
+     */
+    public void testSetValues004() {
+        String thisTestName = "testSetValues004";
+        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 null values...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.SetValuesCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+        checkedCommand.setNextValueAsInt(checkedFieldsNumber-1);
+        int fieldIndex = 1;
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            checkedCommand.setNextValueAsFieldID(checkedFieldIDs[fieldIndex]);
+            checkedCommand.setNextValueAsObjectID(0);
+        }
+        ReplyPacket checkedReply =
+            debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+
+        checkReplyPacket(checkedReply, "ObjectType::SetValue command");
+
+        logWriter.println("=> Wait for Debuggee's status about check for set fields...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        boolean debuggeeStatus = synchronizer.receiveMessage("PASSED");
+        if ( ! debuggeeStatus ) {
+            logWriter.println("## " + thisTestName + ": Debuggee returned status FAILED");
+            fail("Debuggee returned status FAILED");
+        } else {
+            logWriter.println("=> " + thisTestName + ": Debuggee returned status PASSED");
+        }
+
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": OK.");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(SetValues004Test.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,125 @@
+/*
+ * 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 SetValuesDebuggee extends SyncDebuggee {
+    
+    static SetValuesDebuggee setValuesDebuggeeObject;
+    static String passedStatus = "PASSED";
+    static String failedStatus = "FAILED";
+    static String status = passedStatus;
+
+    int intField;
+    long longField;
+    SetValuesDebuggee objectField;
+    static int staticIntField;
+    private int privateIntField;
+    final int finalIntField = 12345;
+
+    public void run() {
+        logWriter.println("--> Debuggee: SetValuesDebuggee: START");
+        setValuesDebuggeeObject = new SetValuesDebuggee();
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("--> Debuggee: SetValuesDebuggee: CHECK for set fields...");
+        String status = passedStatus;
+
+        logWriter.println("\n--> intField value = " + setValuesDebuggeeObject.intField);
+        if ( setValuesDebuggeeObject.intField != 1111 ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = 1111");
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        logWriter.println("\n--> longField value = " + setValuesDebuggeeObject.longField);
+        if ( setValuesDebuggeeObject.longField != 22222222 ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = 22222222");
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        logWriter.println("\n--> objectField value = " + setValuesDebuggeeObject.objectField);
+        if ( ! setValuesDebuggeeObject.equals(setValuesDebuggeeObject.objectField) ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = " + setValuesDebuggeeObject);
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        logWriter.println("\n--> staticIntField value = " + staticIntField);
+        if ( staticIntField != 5555 ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = 5555");
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        logWriter.println("\n--> privateIntField value = " + setValuesDebuggeeObject.privateIntField);
+        if ( setValuesDebuggeeObject.privateIntField != 7777 ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = 7777");
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        logWriter.println("\n--> finalIntField value = " + setValuesDebuggeeObject.finalIntField);
+        if ( setValuesDebuggeeObject.finalIntField != 12345 ) {
+            logWriter.println("##> Debuggee: FAILURE: Unexpected value");
+            logWriter.println("##> Expected value = 12345");
+            status = failedStatus;
+        } else {
+            logWriter.println("--> Debuggee: PASSED: Expected value");
+        }
+
+        if ( status.equals(failedStatus) ) {
+            logWriter.println("\n##> Debuggee: Check status = FAILED");
+        } else {   
+            logWriter.println("\n--> Debuggee: Check status = PASSED");
+        }
+
+        logWriter.println("--> Debuggee: Send check status for SetValuesTest...\n");
+        synchronizer.sendMessage(status);
+        logWriter.println("--> Debuggee: SetValuesDebuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(SetValuesDebuggee.class);
+    }
+
+}
+
+        

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,165 @@
+/*
+ * 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.7 $
+ */
+
+/**
+ * Created on 28.02.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.SetValues command.
+ */
+public class SetValuesTest extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ObjectReference.SetValues command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ObjectReference/SetValuesDebuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ObjectReference.SetValuesDebuggee";
+    }
+
+    /**
+     * This test exercises ObjectReference.SetValues command.
+     * <BR>The test starts SetValuesDebuggee class, gets objectID
+     * as value of static field of this class which (field) represents checked object.
+     * Then for this objectID test executes ObjectReference.SetValues command for special
+     * set of fieldIDs and checks that command returns reply without any errors.
+     * <BR>Then test waits for Debuggee to check if set fields have expected values.
+     * If so test passes, otherwise - fails.
+     */
+    public void testSetValues001() {
+        String thisTestName = "testSetValues001";
+        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[] = {
+                "setValuesDebuggeeObject",
+                "intField",
+                "longField",
+                "objectField",
+                "staticIntField",
+                "privateIntField",
+                "finalIntField",
+        };
+        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.SetValuesCommand);
+        checkedCommand.setNextValueAsObjectID(checkedObjectID);
+        checkedCommand.setNextValueAsInt(checkedFieldsNumber-1);
+        int fieldIndex = 1; // !!!
+        for (; fieldIndex < checkedFieldsNumber; fieldIndex++) {
+            checkedCommand.setNextValueAsFieldID(checkedFieldIDs[fieldIndex]);
+            switch ( fieldIndex ) {
+            case 1: // intField
+                checkedCommand.setNextValueAsInt(1111);
+                break;
+            case 2: // longField
+                checkedCommand.setNextValueAsLong(22222222);
+                break;
+            case 3: // objectField
+                checkedCommand.setNextValueAsObjectID(checkedObjectID);
+                break;
+            case 4: // staticIntField
+                checkedCommand.setNextValueAsInt(5555);
+                break;
+            case 5: // privateIntField
+                checkedCommand.setNextValueAsInt(7777);
+                break;
+            case 6: // finalIntField
+                checkedCommand.setNextValueAsInt(6666);
+                break;
+            }
+        }
+        ReplyPacket checkedReply =
+            debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+        checkReplyPacket(checkedReply, thisCommandName);
+        
+        logWriter.println("=> Reply was received without any Errors");
+        logWriter.println("=> Wait for Debuggee's status about check for set fields...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        boolean debuggeeStatus = synchronizer.receiveMessage("PASSED");
+        if ( ! debuggeeStatus ) {
+            logWriter.println("## " + thisTestName + ": Debuggee returned status FAILED");
+            fail("Debuggee returned status FAILED");
+        } else {
+            logWriter.println("=> " + thisTestName + ": Debuggee returned status PASSED");
+        }
+
+        assertAllDataRead(checkedReply);
+
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(SetValuesTest.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassLoaderTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassLoaderTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassLoaderTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,88 @@
+/*
+ * 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.4 $
+ */
+
+/**
+ * Created on 16.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ReferenceType;
+
+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.ReplyPacket;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ReferenceType.ClassLoader command.
+ */
+public class ClassLoaderTest extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ReferenceType.ClassLoader command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/share/debuggee/HelloWorld;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.share.debuggee.HelloWorld";
+    }
+
+    /**
+     * This testcase exercises ReferenceType.ClassLoader command.
+     * <BR>The test starts HelloWorld debuggee, requests referenceTypeId
+     * for it by VirtualMachine.ClassesBySignature command, then
+     * performs ReferenceType.ClassLoader command and checks that command
+     * returns reply with some classLoaderID without any ERROR
+     */
+    public void testClassLoader001() {
+        String thisTestName = "testClassLoader001";
+        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);
+        logWriter.println("=> CHECK1: send " + thisCommandName + " and check reply for ERROR...");
+
+        CommandPacket classLoaderCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.ClassLoaderCommand);
+        classLoaderCommand.setNextValueAsReferenceTypeID(refTypeID);
+        
+        ReplyPacket classLoaderReply = debuggeeWrapper.vmMirror.performCommand(classLoaderCommand);
+        classLoaderCommand = null;
+        checkReplyPacket(classLoaderReply, thisCommandName);
+        
+        long returnedClassLoaderID = classLoaderReply.getNextValueAsObjectID();
+        logWriter.println("=> CHECK1: PASSED: Returned classLoaderID = " + returnedClassLoaderID);
+
+        assertAllDataRead(classLoaderReply);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ClassLoaderTest.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,49 @@
+/*
+ * 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 24.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ReferenceType;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class ClassObjectDebuggee extends SyncDebuggee {
+
+    public void run() {
+        logWriter.println("--> Debuggee: ClassObjectDebuggee: START");
+        ClassObjectDebuggee_ExtraClass extraObject = new ClassObjectDebuggee_ExtraClass();
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("--> Debuggee: DUMP{" + extraObject + "}");
+        logWriter.println("--> Debuggee: ClassObjectDebuggee: FINISH");
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(ClassObjectDebuggee.class);
+    }
+
+}
+
+class ClassObjectDebuggee_ExtraClass {
+}   

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,144 @@
+/*
+ * 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 24.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ReferenceType;
+
+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.ReplyPacket;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ReferenceType.ClassObject command.
+ */
+public class ClassObjectTest extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ReferenceType.ClassObject command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectDebuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.ClassObjectDebuggee";
+    }
+
+    /**
+     * This testcase exercises ReferenceType.ClassObject command.
+     * <BR>The test starts ClassObjectDebuggee class, requests referenceTypeId
+     * for this class by VirtualMachine.ClassesBySignature command, then
+     * performs ReferenceType.ClassObject command and checks that returned
+     * class object is object of reference type 'java/lang/Class'.
+     */
+    public void testClassObject001() {
+        String thisTestName = "testClassObject001";
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+        //int testStatus = testStatusPassed;
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
+        
+        String debuggeeExtraClassSignature
+            = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/ClassObjectDebuggee_ExtraClass;";
+
+        long debuggeeExtraClassRefTypeID = getClassIDBySignature(debuggeeExtraClassSignature);
+
+        logWriter.println("=> referenceTypeID for Debuggee extra class = " + debuggeeExtraClassRefTypeID);
+        logWriter.println("=> CHECK: send " + thisCommandName + " and check reply...");
+
+        CommandPacket checkedCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.ClassObjectCommand);
+        checkedCommand.setNextValueAsReferenceTypeID(refTypeID);
+        
+        ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+        checkedCommand = null;
+        checkReplyPacket(checkedReply, thisCommandName);
+        
+        long classObjectID = checkedReply.getNextValueAsObjectID();
+        logWriter.println("=> Returned class ObjectID = " + classObjectID);
+        logWriter.println("=> Get reference type for returned class Object...");
+
+        CommandPacket referenceTypeCommand = new CommandPacket(
+                JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
+                JDWPCommands.ObjectReferenceCommandSet.ReferenceTypeCommand);
+        referenceTypeCommand.setNextValueAsObjectID(classObjectID);
+        
+        ReplyPacket referenceTypeReply = debuggeeWrapper.vmMirror.performCommand(referenceTypeCommand);
+        referenceTypeCommand = null;
+        
+        checkReplyPacket(referenceTypeReply, "ObjectReference::ReferenceType command");
+        
+        referenceTypeReply.getNextValueAsByte();
+        // refTypeTag of class - is NOT used here
+
+        long refTypeIDOfClassObject = referenceTypeReply.getNextValueAsReferenceTypeID();
+        referenceTypeReply = null;
+
+        logWriter.println("=> ReferenceTypeID of ClassObject = " + refTypeIDOfClassObject);
+        logWriter.println("=> Get signature for reference type of ClassObject...");
+
+        CommandPacket signatureCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
+        signatureCommand.setNextValueAsReferenceTypeID(refTypeIDOfClassObject);
+        
+        ReplyPacket signatureReply = debuggeeWrapper.vmMirror.performCommand(signatureCommand);
+        signatureCommand = null;
+        checkReplyPacket(signatureReply, "ReferenceType::Signature command");
+        
+        String returnedSignature = signatureReply.getNextValueAsString();
+        signatureReply = null;
+        logWriter.println("=> Signature of reference type of ClassObject = " + returnedSignature);
+
+        String expectedSignature = "Ljava/lang/Class;";
+        assertString("Invalid signature of reference type of ClassObject,", expectedSignature, returnedSignature);
+        logWriter.println("=> CHECK: PASSED: expected signature is returned");
+
+        assertAllDataRead(checkedReply);
+
+        CommandPacket classLoaderCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.ClassLoaderCommand);
+        classLoaderCommand.setNextValueAsReferenceTypeID(refTypeID);
+        
+        ReplyPacket classLoaderReply = debuggeeWrapper.vmMirror.performCommand(classLoaderCommand);
+        classLoaderCommand = null;
+        checkReplyPacket(classLoaderReply, "ReferenceType::ClassLoader command");
+        
+        long classLoaderID = classLoaderReply.getNextValueAsObjectID();
+        logWriter.println("=> ClassLoaderID of debuggee = " + classLoaderID);
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ClassObjectTest.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,47 @@
+/*
+ * 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 17.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ReferenceType;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class FieldsDebuggee extends SyncDebuggee {
+    
+    static int staticIntField;
+    String stringField;
+    Object objectField;
+
+    public void run() {
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        logWriter.println("--> Debuggee: FieldsDebuggee...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(FieldsDebuggee.class);
+    }
+
+}
\ No newline at end of file

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,203 @@
+/*
+ * 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 18.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ReferenceType;
+
+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.ReplyPacket;
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for ReferenceType.Fields command.
+ */
+public class FieldsTest extends JDWPSyncTestCase {
+
+    static final int testStatusPassed = 0;
+    static final int testStatusFailed = -1;
+    static final String thisCommandName = "ReferenceType.Fields command";
+    static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsDebuggee;";
+
+    protected String getDebuggeeClassName() {
+        return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.FieldsDebuggee";
+    }
+
+    /**
+     * This testcase exercises ReferenceType.Fields command.
+     * <BR>The test starts FieldsDebuggee class, requests referenceTypeId
+     * for this class by VirtualMachine.ClassesBySignature command, then
+     * performs ReferenceType.Fields command and checks that returned
+     * list of fields corresponds to expected list with expected attributes.
+     */
+    public void testFields001() {
+        String thisTestName = "testFields001";
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+        int testStatus = testStatusPassed;
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        long refTypeID = getClassIDBySignature(debuggeeSignature);
+
+        logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+        logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
+        logWriter.println("=> CHECK: send " + thisCommandName + " and check reply...");
+
+        CommandPacket fieldsCommand = new CommandPacket(
+                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+                JDWPCommands.ReferenceTypeCommandSet.FieldsCommand);
+        fieldsCommand.setNextValueAsReferenceTypeID(refTypeID);
+        
+        ReplyPacket fieldsReply = debuggeeWrapper.vmMirror.performCommand(fieldsCommand);
+        fieldsCommand = null;
+        checkReplyPacket(fieldsReply, thisCommandName);
+
+        int returnedFieldsNumber = fieldsReply.getNextValueAsInt();
+        logWriter.println("=> Returned fields number = " + returnedFieldsNumber);
+
+        String fieldNames[] = {
+                "staticIntField",
+                "stringField",
+                "objectField"
+        };
+        
+        String fieldSignatures[] = {
+                "I",
+                "Ljava/lang/String;",
+                "Ljava/lang/Object;"
+        };
+            
+        int fieldModifiers[] = {
+                0x8,
+                0x0,
+                0x0
+        };
+
+        boolean fieldFound[] = {
+                false,
+                false,
+                false
+        };
+        int expectedFieldsNumber = fieldNames.length;
+        int fieldSyntheticFlag = 0xf0000000;
+        String failMessage = null;
+
+        logWriter.println("=> CHECK for all expected fields...");
+        for (int i = 0; i < returnedFieldsNumber; i++) {
+            long returnedFieldID = fieldsReply.getNextValueAsFieldID();
+            String returnedFieldName = fieldsReply.getNextValueAsString();
+            String returnedFieldSignature = fieldsReply.getNextValueAsString();
+            int returnedFieldModifiers = fieldsReply.getNextValueAsInt();
+            logWriter.println("\n=> Field ID = " + returnedFieldID);
+            logWriter.println("=> Field name = " + returnedFieldName);
+            logWriter.println("=> Field signature = " + returnedFieldSignature);
+            logWriter.println("=> Field modifiers = 0x" + Integer.toHexString(returnedFieldModifiers));
+            if ( (returnedFieldModifiers & fieldSyntheticFlag) == fieldSyntheticFlag ) {
+                continue; // do not check synthetic fields
+            }
+            int k = 0;
+            for (; k < expectedFieldsNumber; k++) {
+                if (!fieldNames[k].equals(returnedFieldName)) {
+                    continue;
+                }
+                if (fieldFound[k]) {
+                    logWriter.println("\n## FAILURE: The field is found repeatedly in the list");
+                    logWriter.println("## Field name = " + returnedFieldName);
+                    testStatus = testStatusFailed;
+                    failMessage = "The field is found repeatedly in the list: " +
+                        returnedFieldName;
+                    break;
+                }
+                fieldFound[k] = true;
+                if (!fieldSignatures[k].equals(returnedFieldSignature) ) {
+                    logWriter.println("\n## FAILURE: Unexpected field signature is returned:");
+                    logWriter.println("## Field name = " + returnedFieldName);
+                    logWriter.println("## Expected signature = " + fieldSignatures[k]);
+                    logWriter.println("## Returned signature = " + returnedFieldSignature);
+                    testStatus = testStatusFailed;
+                    failMessage = "Unexpected signature is returned for field: " +
+                        returnedFieldName + 
+                        ", expected: " + fieldSignatures[k] +
+                        ", returned: " + returnedFieldSignature;
+                }
+                if (fieldModifiers[k] != returnedFieldModifiers) {
+                    logWriter.println("\n## FAILURE: Unexpected field modifiers are returned:");
+                    logWriter.println("## Field name = " + returnedFieldName);
+                    logWriter.println
+                    ("## Expected modifiers = 0x" + Integer.toHexString(fieldModifiers[k]));
+                    logWriter.println
+                    ("## Returned modifiers = 0x" + Integer.toHexString(returnedFieldModifiers));
+                    testStatus = testStatusFailed;
+                    failMessage = "Unexpected modifiers are returned for field: " +
+                        returnedFieldName +
+                        ", expected: 0x" + Integer.toHexString(fieldModifiers[k]) +
+                        ", returned: 0x" + Integer.toHexString(returnedFieldModifiers);
+                }
+                break;
+            }
+            if (k == expectedFieldsNumber) {
+                // returned field is not found out in the list of expected fields
+                logWriter.println("\n## FAILURE: It is found out unexpected returned field:");
+                logWriter.println("## Field name = " + returnedFieldName);
+                logWriter.println("## Field signature = " + returnedFieldSignature);
+                logWriter.println
+                ("## Field modifiers = 0x" + Integer.toHexString(returnedFieldModifiers));
+                testStatus = testStatusFailed;
+                failMessage =
+                    "Unexpected returned field: " + returnedFieldName +
+                    ", signature = " + returnedFieldSignature +
+                    ", modifiers = 0x" + Integer.toHexString(returnedFieldModifiers);
+            }
+        }
+
+        for (int k = 0; k < expectedFieldsNumber; k++) {
+            if (!fieldFound[k]) {
+                logWriter.println
+                ("\n## FAILURE: Expected field is NOT found out in the list of retuned fields:");
+                logWriter.println("## Field name = " + fieldNames[k]);
+                testStatus = testStatusFailed;
+                failMessage = "Expected field is NOT found in the list of retuned fields: " +
+                    fieldNames[k];
+            }
+        }
+
+        if (testStatus == testStatusPassed) {
+            logWriter.println
+            ("=> CHECK PASSED: All expected fields are found out and have expected attributes");
+        }
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+        if (testStatus == testStatusFailed) {
+            fail(failMessage);
+        }
+
+        assertAllDataRead(fieldsReply);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(FieldsTest.class);
+    }
+}

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

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,49 @@
+/*
+ * 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 18.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ReferenceType;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class FieldsWithGenericDebuggee extends SyncDebuggee {
+    
+    static long staticLongField;
+    String[] stringArrayField;
+    Object[] objectArrayField;
+//    Class<String> classObjectField_2;
+    Class classObjectField;
+
+    public void run() {
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        logWriter.println("--> Debuggee: FieldsWithGenericDebuggee...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    public static void main(String [] args) {
+        runDebuggee(FieldsWithGenericDebuggee.class);
+    }
+
+}

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



Mime
View raw message