當前位置: 首頁>>代碼示例>>Java>>正文


Java ReplyPacket.getNextValueAsObjectID方法代碼示例

本文整理匯總了Java中org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsObjectID方法的典型用法代碼示例。如果您正苦於以下問題:Java ReplyPacket.getNextValueAsObjectID方法的具體用法?Java ReplyPacket.getNextValueAsObjectID怎麽用?Java ReplyPacket.getNextValueAsObjectID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket的用法示例。


在下文中一共展示了ReplyPacket.getNextValueAsObjectID方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getObjectID

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //導入方法依賴的package包/類
private long getObjectID() {
    // Compose Instances command to get tested thread objectID
    CommandPacket InstancesCommand = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);

    long testThreadTypeID = getClassIDBySignature(testObjSignature);
    InstancesCommand.setNextValueAsReferenceTypeID(testThreadTypeID);
    InstancesCommand.setNextValueAsInt(1);

    ReplyPacket checkedReply = debuggeeWrapper.vmMirror
            .performCommand(InstancesCommand);
    InstancesCommand = null;

    // Get the number of instances that returned.
    int objNum = checkedReply.getNextValueAsInt();
    // Get the tagged-objectID
    byte tag = checkedReply.getNextValueAsByte();
    long objectID = checkedReply.getNextValueAsObjectID();
    return objectID;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:22,代碼來源:ForceEarlyReturn006Test.java

示例2: getClassObjectId

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //導入方法依賴的package包/類
/**
 * Returns the class object corresponding to this type
 * 
 * @param refType
 *            The reference type ID.
 * @return The class object.
 */
public final long getClassObjectId(long refType) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.ClassObjectCommand);
    command.setNextValueAsReferenceTypeID(refType);
    ReplyPacket reply = checkReply(performCommand(command));
    return reply.getNextValueAsObjectID();
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:16,代碼來源:VmMirror.java

示例3: testClassLoader001

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //導入方法依賴的package包/類
/**
 * 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");
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:36,代碼來源:ClassLoaderTest.java

示例4: testInstances_String

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //導入方法依賴的package包/類
/**
 * It starts InstancesDebuggee class, requests referenceTypeId for String
 * class by VirtualMachine.ClassesBySignature command, then performs
 * ReferenceType.Instances command and checks that returned reachable String
 * objects are expected.
 */
public void testInstances_String() {
    String thisTestName = "testInstances_String";

    // check capability, relevant for this test
    logWriter.println("=> Check capability: canGetInstanceInfo");
    debuggeeWrapper.vmMirror.capabilities();
    boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetInstanceInfo;
    if (!isCapability) {
        logWriter
                .println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
        return;
    }

    logWriter.println("==> " + thisTestName + " for " + thisCommandName
            + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    long stringRefTypeID = getClassIDBySignature(stringSignature);
    maxInstances = 10;

    logWriter.println("=> CHECK: send " + thisCommandName
            + " and check reply for ERROR...");

    CommandPacket InstancesCommand = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
    InstancesCommand.setNextValueAsReferenceTypeID(stringRefTypeID);
    InstancesCommand.setNextValueAsInt(maxInstances);

    ReplyPacket checkedReply = debuggeeWrapper.vmMirror
            .performCommand(InstancesCommand);
    InstancesCommand = null;
    checkReplyPacket(checkedReply, thisTestName);

    // Get the number of instances that returned.
    int reachableInstancesNum = checkedReply.getNextValueAsInt();

    for (int i = 0; i < reachableInstancesNum; i++) {
        // Get the tagged-objectID
        byte tag = checkedReply.getNextValueAsByte();
        assertEquals(thisCommandName + "returned String tag is invalid.",
                's', tag, null, null);
        long objectID = checkedReply.getNextValueAsObjectID();
        logWriter.println("=> ObjectID is: " + objectID);

    }
    logWriter.println("=> CHECK: PASSED: expected instances are returned:");
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
    logWriter.println("==> " + thisTestName + " for " + thisCommandName
            + ": FINISH");
    assertAllDataRead(checkedReply);

}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:60,代碼來源:InstancesTest.java

示例5: testInstances_Array

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //導入方法依賴的package包/類
/**
 * It starts InstancesDebuggee class, requests referenceTypeId for Array
 * class by VirtualMachine.ClassesBySignature command, then performs
 * ReferenceType.Instances command and checks that returned reachable Array
 * objects are expected.
 */
public void testInstances_Array() {
    String thisTestName = "testInstances_Array";

    // check capability, relevant for this test
    logWriter.println("=> Check capability: canGetInstanceInfo");
    debuggeeWrapper.vmMirror.capabilities();
    boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetInstanceInfo;
    if (!isCapability) {
        logWriter
                .println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
        return;
    }

    logWriter.println("==> " + thisTestName + " for " + thisCommandName
            + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    long intArrayRefTypeID = getClassIDBySignature(intArraySignature);
    maxInstances = 10;

    logWriter.println("=> CHECK: send " + thisCommandName
            + " and check reply for ERROR...");

    CommandPacket InstancesCommand = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
    InstancesCommand.setNextValueAsReferenceTypeID(intArrayRefTypeID);
    InstancesCommand.setNextValueAsInt(maxInstances);

    ReplyPacket checkedReply = debuggeeWrapper.vmMirror
            .performCommand(InstancesCommand);
    InstancesCommand = null;
    checkReplyPacket(checkedReply, thisTestName);

    // Get the number of instances that returned.
    int reachableInstancesNum = checkedReply.getNextValueAsInt();

    for (int i = 0; i < reachableInstancesNum; i++) {
        // Get the tagged-objectID
        byte tag = checkedReply.getNextValueAsByte();
        assertEquals(thisCommandName + "returned Array tag is invalid.",
                '[', tag, null, null);
        long objectID = checkedReply.getNextValueAsObjectID();
        logWriter.println("=> ObjectID is: " + objectID);

    }
    logWriter.println("=> CHECK: PASSED: expected instances are returned:");
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
    logWriter.println("==> " + thisTestName + " for " + thisCommandName
            + ": FINISH");
    assertAllDataRead(checkedReply);

}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:60,代碼來源:InstancesTest.java

示例6: testReferringObjects_IllegalArgument

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //導入方法依賴的package包/類
/**
 * This testcase exercises ObjectReference.ReferringObjects command. <BR>
 * Compose a ReferringObjects command with negative maxReferrers
 * The vm should throw a ILLEGAL_ARGUMENT exception.
 */
public void testReferringObjects_IllegalArgument() {
    String thisTestName = "testReferringObjects_IllegalArgument";
    
    if (!isCapability()) {
        logWriter.println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
        return;
    }
    
    int maxReferrers = -1;
    
    logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    // Compose Instances command to get referree objectID
    CommandPacket InstancesCommand = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
    
    long referreeObjTypeID = getClassIDBySignature(referreeObjSignature);
    InstancesCommand.setNextValueAsReferenceTypeID(referreeObjTypeID);
    InstancesCommand.setNextValueAsInt(1);
    
    ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(InstancesCommand);
    InstancesCommand = null;
    
    // Get the number of instances that returned. 
    int objNum = checkedReply.getNextValueAsInt();
    // Get the tagged-objectID
    byte tag = checkedReply.getNextValueAsByte();
    long objectID = checkedReply.getNextValueAsObjectID();
    
    // Compose ReferringObjects commnad
    CommandPacket ReferringObjectsCommand = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.ReferringObjectsCommand);
    
    ReferringObjectsCommand.setNextValueAsObjectID(objectID);
    ReferringObjectsCommand.setNextValueAsInt(maxReferrers);
    
    // Perform ReferringObjects command and attain reply package
    checkedReply = debuggeeWrapper.vmMirror
            .performCommand(ReferringObjectsCommand);
    ReferringObjectsCommand = null;

    short errorCode = checkedReply.getErrorCode();
    if (errorCode != JDWPConstants.Error.NONE) {
        if (errorCode == JDWPConstants.Error.NOT_IMPLEMENTED) {
            logWriter.println("=> CHECK PASSED: Expected error (NOT_IMPLEMENTED) is returned");
            return;
        }
        else if(errorCode == JDWPConstants.Error.ILLEGAL_ARGUMENT) {
            logWriter.println("=> CHECK PASSED: Expected error (ILLEGAL_ARGUMENT) is returned");
            return;
        }
    }
    printErrorAndFail(thisCommandName + " should throw ILLEGAL_ARGUMENT exception when maxReferrers is negative.");
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:63,代碼來源:ReferringObjectsTest.java


注:本文中的org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsObjectID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。