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 [29/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/ReferenceType/FieldsWithGenericTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,232 @@
+/*
+ * 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.FieldsWithGeneric command.
+ */
+public class FieldsWithGenericTest extends JDWPSyncTestCase {
+
+ static final int testStatusPassed = 0;
+ static final int testStatusFailed = -1;
+ static final String thisCommandName = "ReferenceType.FieldsWithGeneric command";
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericDebuggee;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.FieldsWithGenericDebuggee";
+ }
+
+ /**
+ * This testcase exercises ReferenceType.FieldsWithGeneric command.
+ * <BR>The test starts FieldsWithGenericDebuggee class,
+ * requests referenceTypeId for this class by VirtualMachine.ClassesBySignature
+ * command, then performs ReferenceType.FieldsWithGeneric command
+ * and checks that returned list of fields corresponds to expected list
+ * with expected attributes.
+ */
+ public void testFieldsWithGeneric001() {
+ String thisTestName = "testFieldsWithGeneric001";
+ 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 fieldsWithGenericCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.FieldsWithGenericCommand);
+ fieldsWithGenericCommand.setNextValueAsReferenceTypeID(refTypeID);
+
+ ReplyPacket fieldsWithGenericReply = debuggeeWrapper.vmMirror.performCommand(fieldsWithGenericCommand);
+ fieldsWithGenericCommand = null;
+ checkReplyPacket(fieldsWithGenericReply, thisCommandName);
+
+ int returnedFieldsNumber = fieldsWithGenericReply.getNextValueAsInt();
+ logWriter.println("=> Returned fields number = " + returnedFieldsNumber);
+
+ String fieldNames[] = {
+ "staticLongField",
+ "stringArrayField",
+ "objectArrayField",
+ "classObjectField"
+ };
+
+ String fieldSignatures[] = {
+ "J",
+ "[Ljava/lang/String;",
+ "[Ljava/lang/Object;",
+ "Ljava/lang/Class;"
+ };
+
+ String fieldGenericSignatures[] = {
+ "",
+ "",
+ "",
+ ""
+ };
+
+ int fieldModifiers[] = {
+ 0x8, // ACC_STATIC flag
+ 0x0,
+ 0x0,
+ 0x0
+ };
+
+ boolean fieldFound[] = {
+ false,
+ false,
+ false,
+ false
+ };
+ int expectedFieldsNumber = fieldNames.length;
+ int fieldSyntheticFlag = 0xf0000000;
+ String message = null;
+
+ logWriter.println("=> CHECK for all expected fields...");
+ for (int i = 0; i < returnedFieldsNumber; i++) {
+ long returnedFieldID = fieldsWithGenericReply.getNextValueAsFieldID();
+ String returnedFieldName = fieldsWithGenericReply.getNextValueAsString();
+ String returnedFieldSignature = fieldsWithGenericReply.getNextValueAsString();
+ String returnedGenericSignature = fieldsWithGenericReply.getNextValueAsString();
+ int returnedFieldModifiers = fieldsWithGenericReply.getNextValueAsInt();
+ logWriter.println("\n=> Field ID = " + returnedFieldID);
+ logWriter.println("=> Field name = " + returnedFieldName);
+ logWriter.println("=> Field signature = \"" + returnedFieldSignature + "\"");
+ logWriter.println("=> Field generic signature = \"" + returnedGenericSignature + "\"");
+ 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 out repeatedly in the list");
+ logWriter.println("## Field name = " + returnedFieldName);
+ testStatus = testStatusFailed;
+ message = "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;
+ message = "Unexpected signature is returned for field: " + returnedFieldName +
+ ", expected: " + fieldSignatures[k] +
+ ", returned: " + returnedFieldSignature;
+ }
+ if ( ! fieldGenericSignatures[k].equals(returnedGenericSignature) ) {
+ logWriter.println("\n## FAILURE: Unexpected field generic signature is returned:");
+ logWriter.println("## Field name = " + returnedFieldName);
+ logWriter.println
+ ("## Expected generic signature = \"" + fieldGenericSignatures[k] + "\"");
+ logWriter.println
+ ("## Returned generic signature = \"" + returnedGenericSignature + "\"");
+ testStatus = testStatusFailed;
+ message = "Unexpected generic signature is returned for filed: " +
+ returnedFieldName +
+ ", expected: \"" + fieldGenericSignatures[k] + "\"" +
+ ", returned: \"" + returnedGenericSignature + "\"";
+ }
+ 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;
+ message = "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 generic signature = \"" + returnedGenericSignature + "\"");
+ logWriter.println
+ ("## Field modifiers = 0x" + Integer.toHexString(returnedFieldModifiers));
+ testStatus = testStatusFailed;
+ message =
+ "Unexpected returned field: " +
+ returnedFieldName +
+ ", signature = " + returnedFieldSignature +
+ ", generic signature = \"" + returnedGenericSignature + "\"" +
+ ", 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;
+ message =
+ "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(message);
+ }
+
+ assertAllDataRead(fieldsWithGenericReply);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(FieldsWithGenericTest.class);
+ }
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/FieldsWithGenericTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/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 10.03.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 GetValues002Debuggee extends SyncDebuggee {
+
+ int nonStaticIntField;
+ long nonStaticLongField;
+ String nonStaticStringField;
+ Object nonStaticObjectField;
+ boolean nonStaticBooleanField;
+ byte nonStaticByteField;
+ char nonStaticCharField;
+ short nonStaticShortField;
+ float nonStaticFloatField;
+ double nonStaticDoubleField;
+ int[] nonStaticArrayField;
+
+ static GetValues002Debuggee getValues002DebuggeeField;
+
+
+ public void run() {
+ logWriter.println("--> Debuggee: GetValues002Debuggee: START");
+ getValues002DebuggeeField = new GetValues002Debuggee();
+
+ getValues002DebuggeeField.nonStaticIntField = 99;
+ getValues002DebuggeeField.nonStaticLongField = 2147483647;
+ getValues002DebuggeeField.nonStaticStringField = "nonStaticStringField";
+ getValues002DebuggeeField.nonStaticObjectField = new Object();
+ getValues002DebuggeeField.nonStaticBooleanField = true;
+ getValues002DebuggeeField.nonStaticByteField = 1;
+ getValues002DebuggeeField.nonStaticCharField = 'a';
+ getValues002DebuggeeField.nonStaticShortField = 2;
+ getValues002DebuggeeField.nonStaticFloatField = 2;
+ getValues002DebuggeeField.nonStaticDoubleField = 3.1;
+ getValues002DebuggeeField.nonStaticArrayField = 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/ReferenceType/GetValues002Debuggee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,195 @@
+/*
+ * 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 10.03.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.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 ReferenceType.ClassLoader command for NON-static fields.
+ */
+public class GetValues002Test extends JDWPSyncTestCase {
+
+ static final int testStatusPassed = 0;
+ static final int testStatusFailed = -1;
+ static final String thisCommandName = "ReferenceType.GetValues command";
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues002Debuggee;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.GetValues002Debuggee";
+ }
+
+ /**
+ * This test exercises ReferenceType.GetValues command for NON-static fields.
+ * <BR>The test starts GetValues002Debuggee class, requests referenceTypeId
+ * for this class by VirtualMachine.ClassesBySignature command, then
+ * performs ReferenceType.Fields command and gets fieldIDs for checked fields
+ * which are non static.
+ * Then test performs ReferenceType.GetValues command for checked fields and checks
+ * that command returns INVALID_FIELDID error.
+ */
+ 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[] = {
+ "nonStaticLongField",
+ "nonStaticIntField",
+ "nonStaticStringField",
+ "nonStaticObjectField",
+ "nonStaticBooleanField",
+ "nonStaticByteField",
+ "nonStaticCharField",
+ "nonStaticShortField",
+ "nonStaticFloatField",
+ "nonStaticDoubleField",
+ "nonStaticArrayField",
+ };
+
+ long checkedFieldIDs[] = checkFields(refTypeID, checkedFieldNames);
+ int checkedFieldsNumber = checkedFieldNames.length;
+
+ logWriter.println("=> CHECK: send " + thisCommandName + " and check reply...");
+ CommandPacket getValuesCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+ getValuesCommand.setNextValueAsReferenceTypeID(refTypeID);
+ getValuesCommand.setNextValueAsInt(checkedFieldsNumber);
+ for (int k = 0; k < checkedFieldsNumber; k++) {
+ getValuesCommand.setNextValueAsFieldID(checkedFieldIDs[k]);
+ }
+
+ ReplyPacket getValuesReply = debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+ getValuesCommand = null;
+
+ short errorCode = getValuesReply.getErrorCode();
+ if ( errorCode != JDWPConstants.Error.NONE ) {
+ if ( errorCode != JDWPConstants.Error.INVALID_FIELDID ) {
+ logWriter.println("## Reply packet CHECK: FAILURE: " + thisCommandName
+ + " returns unexpected ERROR = " + errorCode
+ + "(" + JDWPConstants.Error.getName(errorCode) + ")");
+ fail(thisCommandName
+ + " returned unexpected ERROR = " + errorCode
+ + "(" + JDWPConstants.Error.getName(errorCode) + ")");
+ }
+ logWriter.println("=> CHECK PASSED: Expected error (INVALID_FIELDID) is returned");
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+ return;
+ }
+ logWriter.println
+ ("\n## FAILURE: " + thisCommandName + " does NOT return expected error - INVALID_FIELDID");
+
+ // next is only for extra info
+ int returnedValuesNumber = getValuesReply.getNextValueAsInt();
+ logWriter.println("=> Returned values number = " + returnedValuesNumber);
+ logWriter.println("=> CHECK for returned values...");
+ byte expectedFieldTags[] = {
+ JDWPConstants.Tag.LONG_TAG,
+ JDWPConstants.Tag.INT_TAG,
+ JDWPConstants.Tag.OBJECT_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.OBJECT_TAG,
+ };
+
+ for (int k = 0; k < returnedValuesNumber; k++) {
+ Value fieldValue = getValuesReply.getNextValueAsValue();
+ byte fieldTag = fieldValue.getTag();
+ logWriter.println
+ ("\n=> Check for returned value for field: " + checkedFieldNames[k] + " ...");
+ logWriter.println("=> Returned value tag = " + fieldTag
+ + "(" + JDWPConstants.Tag.getName(fieldTag) + ")");
+ if ( fieldTag != expectedFieldTags[k] ) {
+ break;
+ }
+ switch ( fieldTag ) {
+ case JDWPConstants.Tag.INT_TAG:
+ int intValue = fieldValue.getIntValue();
+ logWriter.println("=> Int value = " + intValue);
+ break;
+ case JDWPConstants.Tag.LONG_TAG:
+ long longValue = fieldValue.getLongValue();
+ logWriter.println("=> Long value = " + longValue);
+ 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);
+ break;
+ case JDWPConstants.Tag.BYTE_TAG:
+ byte byteValue = fieldValue.getByteValue();
+ logWriter.println("=> Byte value = " + byteValue);
+ break;
+ case JDWPConstants.Tag.CHAR_TAG:
+ char charValue = fieldValue.getCharValue();
+ logWriter.println("=> Char value = " + (int)charValue);
+ break;
+ case JDWPConstants.Tag.SHORT_TAG:
+ short shortValue = fieldValue.getShortValue();
+ logWriter.println("=> Short value = " + shortValue);
+ break;
+ case JDWPConstants.Tag.FLOAT_TAG:
+ float floatValue = fieldValue.getFloatValue();
+ logWriter.println("=> Float value = " + floatValue);
+ break;
+ case JDWPConstants.Tag.DOUBLE_TAG:
+ double doubleValue = fieldValue.getDoubleValue();
+ logWriter.println("=> Double value = " + doubleValue);
+ break;
+ }
+ }
+
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+
+ fail(thisCommandName + " does NOT return expected error - INVALID_FIELDID");
+ }
+
+ 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/ReferenceType/GetValues002Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,57 @@
+/*
+ * 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 20.05.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 GetValues003Debuggee extends SyncDebuggee {
+
+ static int superClassStaticIntVar;
+
+ public void run() {
+ logWriter.println("--> Debuggee: GetValues003Debuggee: START");
+
+ RFGetValues003CheckedClass.setVar();
+
+ 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 RFGetValues003CheckedClass extends GetValues003Debuggee {
+
+ static void setVar () {
+ superClassStaticIntVar = 99;
+ }
+
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Debuggee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,147 @@
+/*
+ * 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 20.05.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.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 ReferenceType.GetValues command for field of super class.
+ */
+public class GetValues003Test extends JDWPSyncTestCase {
+
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues003Debuggee;";
+ static final String chekedClassSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/RFGetValues003CheckedClass;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.GetValues003Debuggee";
+ }
+
+ /**
+ * This testcase exercises ReferenceType.GetValues command for field of super class.
+ * <BR>The test starts GetValues003Debuggee and checks that
+ * ReferenceType.GetValues command runs correctly for field declaring
+ * in super class of passed to GetValues command ReferenceTypeID.
+ * <BR>Test checks that expected value of this field is returned.
+ */
+ public void testGetValues003() {
+ String thisTestName = "testGetValues003";
+ logWriter.println("==> " + thisTestName + " for ReferenceType.GetValues command: START...");
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+ logWriter.println
+ ("\n=> Get debuggeeRefTypeID for debuggee class = " + getDebuggeeClassName() + "...");
+ long debuggeeRefTypeID = 0;
+ try {
+ debuggeeRefTypeID = debuggeeWrapper.vmMirror.getClassID(debuggeeSignature);
+ } catch ( Throwable thrown) {
+ logWriter.println("## FAILURE: Can not get debuggeeRefTypeID:");
+ logWriter.println("## Exception: " + thrown);
+ fail("Can not get debuggeeRefTypeID, Exception: " + thrown);
+ }
+ if ( debuggeeRefTypeID == -1 ) {
+ logWriter.println("## FAILURE: Can not get debuggeeRefTypeID for given signature!");
+ logWriter.println("## Signature = |" + debuggeeSignature + "|");
+ fail("Can not get debuggeeRefTypeID for given signature:<" + debuggeeSignature + ">");
+ }
+ logWriter.println("=> debuggeeRefTypeID = " + debuggeeRefTypeID);
+
+ logWriter.println
+ ("\n=> Get superClassCheckedFieldID for field of debuggee class...");
+ String superClassCheckedFieldName = "superClassStaticIntVar";
+ long superClassCheckedFieldID = 0;
+ try {
+ superClassCheckedFieldID
+ = debuggeeWrapper.vmMirror.getFieldID(debuggeeRefTypeID, superClassCheckedFieldName);
+ } catch ( Throwable thrown) {
+ logWriter.println("## FAILURE: Can not get superClassCheckedFieldID:");
+ logWriter.println("## Exception: " + thrown);
+ fail("Can not get superClassCheckedFieldID, Exception: " + thrown);
+ }
+ logWriter.println("=> superClassCheckedFieldID = " + superClassCheckedFieldID);
+
+ logWriter.println
+ ("\n=> Get chekedClassRefTypeID for chekedClass class = RFGetValues003CheckedClass...");
+ long chekedClassRefTypeID = 0;
+ try {
+ chekedClassRefTypeID = debuggeeWrapper.vmMirror.getClassID(chekedClassSignature);
+ } catch ( Throwable thrown) {
+ logWriter.println("## FAILURE: Can not get chekedClassRefTypeID:");
+ logWriter.println("## Exception: " + thrown);
+ fail(" Can not get chekedClassRefTypeID, Exception: " + thrown);
+ }
+ if ( chekedClassRefTypeID == -1 ) {
+ logWriter.println("## FAILURE: Can not get chekedClassRefTypeID for given signature!");
+ logWriter.println("## Signature = |" + chekedClassSignature + "|");
+ fail("Can not get chekedClassRefTypeID for given signature:<" + chekedClassSignature + ">");
+ }
+ logWriter.println("=> chekedClassRefTypeID = " + chekedClassRefTypeID);
+
+ logWriter.println
+ ("\n=> CHECK ReferenceType::GetValues command for chekedClassRefTypeID, superClassCheckedFieldID...");
+ CommandPacket getValuesCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+ getValuesCommand.setNextValueAsReferenceTypeID(chekedClassRefTypeID);
+ getValuesCommand.setNextValueAsInt(1);
+ getValuesCommand.setNextValueAsFieldID(superClassCheckedFieldID);
+ ReplyPacket getValuesReply = debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+ checkReplyPacket(getValuesReply, "ReferenceType::GetValues command");
+
+ //int returnedValuesNumber =
+ getValuesReply.getNextValueAsInt();
+ Value fieldValue = getValuesReply.getNextValueAsValue();
+ byte fieldTag = fieldValue.getTag();
+ logWriter.println("=> Returned value tag = " + fieldTag
+ + "(" + JDWPConstants.Tag.getName(fieldTag) + ")");
+ assertEquals("Invalid value tag is returned,", JDWPConstants.Tag.INT_TAG, fieldTag
+ , JDWPConstants.Tag.getName(JDWPConstants.Tag.INT_TAG)
+ , JDWPConstants.Tag.getName(fieldTag));
+
+ int intValue = fieldValue.getIntValue();
+ logWriter.println("=> Returned value = " + intValue);
+ // here expected value = 99 (staticIntField)
+ int expectedIntValue = 99;
+ assertEquals("Invalid int value,", expectedIntValue, intValue);
+
+ assertAllDataRead(getValuesReply);
+
+ logWriter.println("=> CHECK PASSED: Expected value is returned!");
+
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("==> " + thisTestName + " for ReferenceType::GetValues command: FINISH");
+ }
+
+ 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/ReferenceType/GetValues003Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,55 @@
+/*
+ * 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 20.05.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 GetValues004Debuggee extends SyncDebuggee {
+
+ static int superClassStaticIntVar;
+
+ public void run() {
+ logWriter.println("--> Debuggee: GetValues004Debuggee: START");
+
+ RFGetValues004AnotherClass.anotherClassStaticIntVar = 88;
+
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("--> Debuggee: GetValues004Debuggee: FINISH");
+ }
+
+ public static void main(String [] args) {
+ runDebuggee(GetValues004Debuggee.class);
+ }
+
+}
+
+class RFGetValues004AnotherClass {
+
+ static int anotherClassStaticIntVar;
+
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Debuggee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,149 @@
+/*
+ * 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 20.05.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.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 ReferenceType.GetValues command for field from another class.
+ */
+public class GetValues004Test extends JDWPSyncTestCase {
+
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Debuggee;";
+ static final String anotherClassSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/RFGetValues004AnotherClass;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.GetValues004Debuggee";
+ }
+
+ /**
+ * This testcase exercises ReferenceType.GetValues command for field from another class.
+ * <BR>The test starts GetValues004Debuggee and checks that
+ * ReferenceType.GetValues command runs correctly for field declaring
+ * in some another class than passed to GetValues command ReferenceTypeID which is
+ * not assignable from that another class.
+ * <BR>Test expects that INVALID_FIELDID error is returned.
+ */
+ public void testGetValues004() {
+ String thisTestName = "testGetValues004";
+ logWriter.println("==> " + thisTestName + " for ReferenceType.GetValues command: START...");
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+ logWriter.println
+ ("\n=> Get anotherClassRefTypeID for checkedClass class = RFGetValues003AnotherClass...");
+ long anotherClassRefTypeID = 0;
+ try {
+ anotherClassRefTypeID = debuggeeWrapper.vmMirror.getClassID(anotherClassSignature);
+ } catch ( Throwable thrown) {
+ logWriter.println("## FAILURE: Can not get anotherClassRefTypeID:");
+ logWriter.println("## Exception: " + thrown);
+ fail("Can not get anotherClassRefTypeID, Exception: " + thrown);
+ }
+ if ( anotherClassRefTypeID == -1 ) {
+ logWriter.println("## FAILURE: Can not get debuggeeRefTypeID for given signature!");
+ logWriter.println("## Signature = |" + anotherClassSignature + "|");
+ fail("Can not get debuggeeRefTypeID for given signature:<" + anotherClassSignature + ">");
+ }
+ logWriter.println("=> anotherClassRefTypeID = " + anotherClassRefTypeID);
+
+ logWriter.println
+ ("\n=> Get anotherClassCheckedFieldID for field of anotherClass...");
+ String anotherClassCheckedFieldName = "anotherClassStaticIntVar";
+ long anotherClassCheckedFieldID = 0;
+ try {
+ anotherClassCheckedFieldID
+ = debuggeeWrapper.vmMirror.getFieldID(anotherClassRefTypeID, anotherClassCheckedFieldName);
+ } catch ( Throwable thrown) {
+ logWriter.println("## FAILURE: Can not get anotherClassCheckedFieldID:");
+ logWriter.println("## Exception: " + thrown);
+ fail("Can not get anotherClassCheckedFieldID, Exception: " + thrown);
+ }
+ logWriter.println("=> superClassCheckedFieldID = " + anotherClassCheckedFieldID);
+
+ logWriter.println
+ ("\n=> Get debuggeeRefTypeID for debuggee class = " + getDebuggeeClassName() + "...");
+ long debuggeeRefTypeID = 0;
+ try {
+ debuggeeRefTypeID = debuggeeWrapper.vmMirror.getClassID(debuggeeSignature);
+ } catch ( Throwable thrown) {
+ logWriter.println("## FAILURE: Can not get debuggeeRefTypeID:");
+ logWriter.println("## Exception: " + thrown);
+ fail("Can not get debuggeeRefTypeID, Exception: " + thrown);
+ }
+ if ( debuggeeRefTypeID == -1 ) {
+ logWriter.println("## FAILURE: Can not get debuggeeRefTypeID for given signature!");
+ logWriter.println("## Signature = |" + debuggeeSignature + "|");
+ fail("Can not get debuggeeRefTypeID for given signature:<" + debuggeeSignature + ">");
+ }
+ logWriter.println("=> debuggeeRefTypeID = " + debuggeeRefTypeID);
+
+ logWriter.println
+ ("\n=> CHECK ReferenceType::GetValues command for debuggeeRefTypeID, anotherClassCheckedFieldID...");
+ logWriter.println
+ ("=> 'INVALID_FIELDID' error is expected as anotherClassCheckedField is not field of debuggee class!");
+ CommandPacket getValuesCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+ getValuesCommand.setNextValueAsReferenceTypeID(debuggeeRefTypeID);
+ getValuesCommand.setNextValueAsInt(1);
+ getValuesCommand.setNextValueAsFieldID(anotherClassCheckedFieldID);
+ ReplyPacket getValuesReply = debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+ short errorCode = getValuesReply.getErrorCode();
+ if ( errorCode != JDWPConstants.Error.NONE ) {
+ checkReplyPacket(getValuesReply, "ReferenceType::GetValues command", JDWPConstants.Error.INVALID_FIELDID);
+ logWriter.println("=> CHECK PASSED: Expected error (INVALID_FIELDID) is returned");
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ return;
+ }
+ logWriter.println
+ ("## FAILURE: ReferenceType::GetValues command does NOT return expected error - INVALID_FIELDID");
+
+ // next is only for extra info
+ //int returnedValuesNumber =
+ getValuesReply.getNextValueAsInt();
+ Value fieldValue = getValuesReply.getNextValueAsValue();
+ byte fieldTag = fieldValue.getTag();
+ logWriter.println("## Returned value tag = " + fieldTag
+ + "(" + JDWPConstants.Tag.getName(fieldTag) + ")");
+ if ( fieldTag == JDWPConstants.Tag.INT_TAG ) {
+ int intValue = fieldValue.getIntValue();
+ logWriter.println("## Returned value = " + intValue);
+ }
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ fail("ReferenceType::GetValues command does NOT return expected error - INVALID_FIELDID");
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(GetValues004Test.class);
+ }
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues004Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,93 @@
+/*
+ * 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.ReferenceType;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+public class GetValues005Debuggee extends SyncDebuggee {
+
+ static int intArrayField[]; // JDWP_TAG_ARRAY = 91
+ static GetValues005Debuggee objectArrayField[]; // JDWP_TAG_ARRAY = 91
+ static GetValues005Debuggee objectField; // JDWP_TAG_OBJECT = 76
+ static String stringField; // JDWP_TAG_STRING = 115
+ static Thread threadField; // JDWP_TAG_THREAD = 116
+ static ThreadGroup threadGroupField; // JDWP_TAG_THREAD_GROUP = 103
+ static Class classField; // JDWP_TAG_CLASS_OBJECT = 99
+ static ClassLoader classLoaderField; // DWP_TAG_CLASS_LOADER = 108
+
+
+
+ public void run() {
+ logWriter.println("--> Debuggee: GetValues005Debuggee: START");
+
+ intArrayField = new int[1];
+ intArrayField[0]= 999;
+ objectArrayField = new GetValues005Debuggee[1];
+ objectArrayField[0] = new GetValues005Debuggee();
+ objectField = new GetValues005Debuggee();
+ stringField = "stringField";
+ threadField = new GetValues005DebuggeeThread();
+ threadGroupField = new ThreadGroup("ThreadGroupName");
+ classField = GetValues005Debuggee.class;
+ classLoaderField = classField.getClassLoader();
+
+ intArrayField = null;
+ objectArrayField = null;
+ objectField = null;
+ stringField = null;
+ threadField = null;
+ threadGroupField = null;
+ classField = null;
+ classLoaderField = null;
+
+ logWriter.println("\n--> Debuggee: GetValues005Debuggee: Before ReferenceType::GetValues command:");
+ logWriter.println("--> intArrayField value = " + intArrayField);
+ logWriter.println("--> objectArrayField value = " + objectArrayField);
+ logWriter.println("--> objectField value = " + objectField);
+ logWriter.println("--> stringField value = " + stringField);
+ logWriter.println("--> threadField value = " + threadField);
+ logWriter.println("--> threadGroupField value = " + threadGroupField);
+ logWriter.println("--> classField value = " + classField);
+ logWriter.println("--> classLoaderField value = " + classLoaderField);
+
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+ logWriter.println("--> Debuggee: GetValues005Debuggee: FINISH");
+ }
+
+ public static void main(String [] args) {
+ runDebuggee(GetValues005Debuggee.class);
+ }
+}
+
+
+class GetValues005DebuggeeThread extends Thread {
+ public void myMethod() {
+ }
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Debuggee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,149 @@
+/*
+ * 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.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.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 ReferenceType.GetValues command for fields with null value.
+ */
+public class GetValues005Test extends JDWPSyncTestCase {
+
+ static final String thisCommandName = "ReferenceType.GetValues command";
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Debuggee;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.GetValues005Debuggee";
+ }
+
+ /**
+ * This testcase exercises ReferenceType.GetValues command for fields with null value.
+ * <BR>The test starts GetValues005Debuggee class and performs
+ * ReferenceType.GetValues command for fields of different
+ * referenceTypes with value=null for all fields.
+ * <BR>The test expects the all returned values should be represented by expected
+ * JDWP tag with null value.
+ */
+ public void testGetValues005() {
+ String thisTestName = "testGetValues005";
+ logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+ long debuggeeRefTypeID = getClassIDBySignature(debuggeeSignature);
+
+ logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+ logWriter.println("=> referenceTypeID for Debuggee class = " + debuggeeRefTypeID);
+
+ String checkedFieldNames[] = {
+ "intArrayField",
+ "objectArrayField",
+ "objectField",
+ "stringField",
+ "threadField",
+ "threadGroupField",
+ "classField",
+ "classLoaderField",
+ };
+
+ long checkedFieldIDs[] = checkFields(debuggeeRefTypeID, checkedFieldNames);
+ int checkedFieldsNumber = checkedFieldNames.length;
+
+ logWriter.println
+ ("=> CHECK: send " + thisCommandName
+ + " for Debuggee class for fields of different referenceTypes with with null values...");
+
+ CommandPacket checkedCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+ checkedCommand.setNextValueAsObjectID(debuggeeRefTypeID);
+ checkedCommand.setNextValueAsInt(checkedFieldsNumber);
+ for (int i = 0; i < checkedFieldsNumber; i++) {
+ checkedCommand.setNextValueAsFieldID(checkedFieldIDs[i]);
+ }
+ ReplyPacket checkedReply =
+ debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+ checkedCommand = null;
+
+ checkReplyPacket(checkedReply, thisCommandName);
+
+ int returnedValuesNumber = checkedReply.getNextValueAsInt();
+ logWriter.println("=> Returned values number = " + returnedValuesNumber);
+ if ( checkedFieldsNumber != returnedValuesNumber ) {
+ logWriter.println
+ ("\n## FAILURE: ReferenceType::GetValues command returned unexpected number of values:");
+ logWriter.println("## Expected number = " + checkedFieldsNumber);
+ logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
+ assertTrue(false);
+ }
+ 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] + " ...");
+ 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) + ")");
+ //testStatus = testStatusFailed;
+ 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(GetValues005Test.class);
+ }
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValues005Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,57 @@
+/*
+ * 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 10.03.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 GetValuesDebuggee extends SyncDebuggee {
+
+ static int staticIntField;
+ static long staticLongField;
+ static String staticStringField;
+ static GetValuesDebuggee getValuesDebuggeeField;
+ static int[] staticArrayField;
+
+ public void run() {
+ logWriter.println("--> Debuggee: GetValuesDebuggee: START");
+
+ staticIntField = 99;
+ staticLongField = 2147483647;
+ staticStringField = "staticStringField";
+ getValuesDebuggeeField = new GetValuesDebuggee();
+ staticArrayField = new int[10];
+
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("--> Debuggee: GetValuesDebuggee: FINISH");
+ }
+
+ public static void main(String [] args) {
+ runDebuggee(GetValuesDebuggee.class);
+ }
+
+}
\ No newline at end of file
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,168 @@
+/*
+ * 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 10.03.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.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 ReferenceType.GetValues command.
+ */
+public class GetValuesTest extends JDWPSyncTestCase {
+
+ static final int testStatusPassed = 0;
+ static final int testStatusFailed = -1;
+ static final String thisCommandName = "ReferenceType.GetValues command";
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.GetValuesDebuggee";
+ }
+
+ /**
+ * This testcase exercises ReferenceType.GetValues command.
+ * <BR>The test starts GetValuesDebuggee class, requests referenceTypeId
+ * for this class by VirtualMachine.ClassesBySignature command, then
+ * performs ReferenceType.Fields command and gets fieldIDs for checked fields.
+ * <BR>Then test performs ReferenceType.GetValues command for checked fields and checks
+ * that returned field values are expected.
+ */
+ public void testGetValues001() {
+ String thisTestName = "testGetValues001";
+ 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[] = {
+ "staticIntField",
+ "staticLongField",
+ "getValuesDebuggeeField",
+ "staticStringField",
+ "staticArrayField",
+ };
+
+ String checkedFieldSignatures[] = {
+ "I",
+ "J",
+ "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesDebuggee;",
+ "Ljava/lang/String;",
+ "[I",
+ };
+
+ long checkedFieldIDs[] = checkFields(refTypeID, checkedFieldNames, checkedFieldSignatures, null);
+ int checkedFieldsNumber = checkedFieldNames.length;
+
+ logWriter.println("=> CHECK: send " + thisCommandName + " and check reply...");
+ CommandPacket getValuesCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
+ getValuesCommand.setNextValueAsReferenceTypeID(refTypeID);
+ getValuesCommand.setNextValueAsInt(checkedFieldsNumber);
+ for (int k=0; k < checkedFieldsNumber; k++) {
+ getValuesCommand.setNextValueAsFieldID(checkedFieldIDs[k]);
+ }
+
+ ReplyPacket getValuesReply = debuggeeWrapper.vmMirror.performCommand(getValuesCommand);
+ getValuesCommand = null;
+ checkReplyPacket(getValuesReply, thisCommandName);
+
+ int returnedValuesNumber = getValuesReply.getNextValueAsInt();
+ logWriter.println("=> Returned values number = " + returnedValuesNumber);
+ assertEquals("Invalid number of values,", checkedFieldsNumber, returnedValuesNumber);
+
+ logWriter.println("=> CHECK for returned values...");
+ byte expectedFieldTags[] = {
+ JDWPConstants.Tag.INT_TAG,
+ JDWPConstants.Tag.LONG_TAG,
+ JDWPConstants.Tag.OBJECT_TAG,
+ JDWPConstants.Tag.STRING_TAG,
+ JDWPConstants.Tag.ARRAY_TAG,
+ };
+ for (int k=0; k < checkedFieldsNumber; k++) {
+ Value fieldValue = getValuesReply.getNextValueAsValue();
+ byte fieldTag = fieldValue.getTag();
+ logWriter.println
+ ("\n=> Check for returned value for field: " + checkedFieldNames[k] + " ...");
+ logWriter.println("=> Returned value tag = " + fieldTag
+ + "(" + JDWPConstants.Tag.getName(fieldTag) + ")");
+
+ assertEquals("Invalid value tag is returned,", expectedFieldTags[k], fieldTag
+ , JDWPConstants.Tag.getName(expectedFieldTags[k])
+ , JDWPConstants.Tag.getName(fieldTag));
+
+ switch ( fieldTag ) {
+ case JDWPConstants.Tag.INT_TAG:
+ int intValue = fieldValue.getIntValue();
+ logWriter.println("=> Int value = " + intValue);
+ // here expected value = 99 (staticIntField)
+ int expectedIntValue = 99;
+ assertEquals("Invalid int value,", expectedIntValue, intValue);
+ break;
+ case JDWPConstants.Tag.LONG_TAG:
+ long longValue = fieldValue.getLongValue();
+ logWriter.println("=> Long value = " + longValue);
+ // here expected value = 2147483647 (staticLongField)
+ long expectedLongValue = 2147483647;
+ assertEquals("Invalid Long value,", expectedLongValue, longValue);
+ break;
+ case JDWPConstants.Tag.OBJECT_TAG:
+ long objectIdValue = fieldValue.getLongValue();
+ logWriter.println("=> ObjectID value = " + objectIdValue);
+ break;
+ case JDWPConstants.Tag.STRING_TAG:
+ long stringIDValue = fieldValue.getLongValue();
+ logWriter.println("=> StringID value = " + stringIDValue);
+ break;
+ case JDWPConstants.Tag.ARRAY_TAG:
+ long arrayIDValue = fieldValue.getLongValue();
+ logWriter.println("=> ArrayID value = " + arrayIDValue);
+ break;
+ }
+ }
+
+ assertAllDataRead(getValuesReply);
+
+ 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(GetValuesTest.class);
+ }
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/GetValuesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,57 @@
+/*
+ * 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 InterfacesDebuggee extends SyncDebuggee {
+
+ public void run() {
+ CheckedClass_Interfaces001 checkedClass = new CheckedClass_Interfaces001();
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+ logWriter.println("--> Debuggee: InterfacesDebuggee...");
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("--> Debuggee: DUMP{" + checkedClass + "}");
+ }
+
+ public static void main(String [] args) {
+ runDebuggee(InterfacesDebuggee.class);
+ }
+
+}
+
+interface Interface_1_1_Interfaces001 {}
+
+interface Interface_1_Interfaces001 extends Interface_1_1_Interfaces001 {}
+
+interface Interface_2_1_Interfaces001 {}
+
+interface Interface_2_Interfaces001 extends Interface_2_1_Interfaces001 {}
+
+class CheckedClass_Interfaces001 implements Interface_1_Interfaces001, Interface_2_Interfaces001 {}
+
+
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesDebuggee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesTest.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.4 $
+ */
+
+/**
+ * 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.Interfaces command.
+ */
+public class InterfacesTest extends JDWPSyncTestCase {
+
+ static final int testStatusPassed = 0;
+ static final int testStatusFailed = -1;
+ static final String thisCommandName = "ReferenceType.Interfaces command";
+ static final String debuggeeSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesDebuggee;";
+
+ protected String getDebuggeeClassName() {
+ return "org.apache.harmony.jpda.tests.jdwp.ReferenceType.InterfacesDebuggee";
+ }
+
+ /**
+ * This testcase exercises ReferenceType.Interfaces command.
+ * <BR>The test starts InterfacesDebuggee class, requests referenceTypeId
+ * for this class by VirtualMachine.ClassesBySignature command, then
+ * performs ReferenceType.Interfaces command and checks that returned
+ * list of interfaces corresponds to expected list.
+ */
+ public void testInterfaces001() {
+ String thisTestName = "testInterfaces001";
+ logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+ String checkedClassSignature = "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/CheckedClass_Interfaces001;";
+ long refTypeID = getClassIDBySignature(checkedClassSignature);
+
+ logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
+ logWriter.println("=> Checked class = org.apache.harmony.jpda.tests.jdwp.ReferenceType.CheckedClass_Interfaces001");
+ logWriter.println("=> referenceTypeID for Checked class = " + refTypeID);
+ logWriter.println("=> CHECK: send " + thisCommandName + " for Checked class and check reply...");
+
+ CommandPacket checkedCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.InterfacesCommand);
+ checkedCommand.setNextValueAsReferenceTypeID(refTypeID);
+ ReplyPacket checkedReply =
+ debuggeeWrapper.vmMirror.performCommand(checkedCommand);
+ checkedCommand = null;
+ checkReplyPacket(checkedReply, thisCommandName);
+
+ int returnedInterfacesNumber = checkedReply.getNextValueAsInt();
+ logWriter.println("=> Returned interfaces number = " + returnedInterfacesNumber);
+
+ String interfacesSignatures[] = {
+ "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/Interface_1_Interfaces001;",
+ "Lorg/apache/harmony/jpda/tests/jdwp/ReferenceType/Interface_2_Interfaces001;",
+ };
+
+ boolean interfacesFound[] = {
+ false,
+ false,
+ };
+
+ int expectedInterfacesNumber = interfacesSignatures.length;
+
+ logWriter.println("=> CHECK for all expected interfaces...");
+ for (int i=0; i < returnedInterfacesNumber; i++) {
+ logWriter.println("\n=> Check for returned interface[" + i + "] ...");
+ long returnedInterfaceID = checkedReply.getNextValueAsReferenceTypeID();
+ logWriter.println("=> RefTypeID of interface = " + returnedInterfaceID);
+ logWriter.println("=> Get signature for interface...");
+
+ CommandPacket signatureCommand = new CommandPacket(
+ JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
+ JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
+ signatureCommand.setNextValueAsReferenceTypeID(returnedInterfaceID);
+ ReplyPacket signatureReply =
+ debuggeeWrapper.vmMirror.performCommand(signatureCommand);
+ signatureCommand = null;
+ checkReplyPacket(signatureReply, "ReferenceType::Signature command");
+
+ String returnedSignature = signatureReply.getNextValueAsString();
+ logWriter.println("=> Signature of interface = " + returnedSignature);
+ signatureReply = null;
+ logWriter.println("=> Signature of interface = " + returnedSignature);
+
+ int k = 0;
+ for (; k < expectedInterfacesNumber; k++) {
+ if ( ! interfacesSignatures[k].equals(returnedSignature)) {
+ continue;
+ }
+ if ( interfacesFound[k] ) {
+ logWriter.println("\n## FAILURE: This interface is found repeatedly in the list");
+ fail("This interface is found repeatedly in the list");
+ break;
+ }
+ interfacesFound[k] = true;
+ break;
+ }
+ if ( k == expectedInterfacesNumber ) {
+ // returned interface is not found out in the list of expected interfaces
+ logWriter.println("\n## FAILURE: It is unexpected interface");
+ fail("It is unexpected interface");
+ }
+ }
+ for (int k=0; k < expectedInterfacesNumber; k++) {
+ if ( ! interfacesFound[k] ) {
+ logWriter.println
+ ("\n## FAILURE: Expected interface is NOT found in the returned list:");
+ logWriter.println("=> Signature of interface = " +
+ interfacesSignatures[k]);
+ fail("Expected interface is NOT found in the returned list: " +
+ interfacesSignatures[k]);
+ }
+ }
+
+ assertAllDataRead(checkedReply);
+
+ logWriter.println
+ ("\n=> CHECK PASSED: All expected interfaces are found out");
+
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ logWriter.println("\n==> " + thisTestName + " for " + thisCommandName + ": OK.");
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(InterfacesTest.class);
+ }
+}
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/InterfacesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/MethodsDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/MethodsDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/MethodsDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/MethodsDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,51 @@
+/*
+ * 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 MethodsDebuggee extends SyncDebuggee {
+
+ static int staticTestMethod(long longParam) {
+ return 1;
+ }
+
+ Object objectTestMethod(Object objectParam) {
+ return null;
+ }
+
+ public void run() {
+ synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+ logWriter.println("--> Debuggee: MethodsDebuggee...");
+ synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+ }
+
+ public static void main(String [] args) {
+ runDebuggee(MethodsDebuggee.class);
+ }
+
+}
\ No newline at end of file
Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ReferenceType/MethodsDebuggee.java
------------------------------------------------------------------------------
svn:eol-style = native