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


Java CommandPacket.setNextValueAsString方法代碼示例

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


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

示例1: getClassIDBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns classID for the selected jni signature
 * 
 * @param signature
 * @return classID for the selected jni signature
 */
protected long getClassIDBySignature(String signature) {
    logWriter.println("=> Getting reference type ID for class: "
            + signature);
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    packet.setNextValueAsString(signature);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::ClassesBySignature command");
    int classes = reply.getNextValueAsInt();
    logWriter.println("=> Returned number of classes: " + classes);
    long classID = 0;
    for (int i = 0; i < classes; i++) {
        reply.getNextValueAsByte();
        classID = reply.getNextValueAsReferenceTypeID();
        reply.getNextValueAsInt();
        // we need the only class, even if there were multiply ones
        break;
    }
    assertTrue(
            "VirtualMachine::ClassesBySignature command returned invalid classID:<"
                    + classID + "> for signature " + signature, classID > 0);
    return classID;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:31,代碼來源:JDWPTestCase.java

示例2: getReferenceTypeID

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns reference type ID.
 * 
 * @param signature
 * @return type ID for the selected jni signature
 */
protected long getReferenceTypeID(String signature) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    packet.setNextValueAsString(signature);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::ClassesBySignature command");
    int classes = reply.getNextValueAsInt();
    // this class may be loaded only once
    assertEquals("Invalid number of classes for reference type: "
            + signature + ",", 1, classes);
    byte refTypeTag = reply.getNextValueAsByte();
    long classID = reply.getNextValueAsReferenceTypeID();
    int status = reply.getNextValueAsInt();
    logWriter.println("VirtualMachine.ClassesBySignature: classes="
            + classes + " refTypeTag=" + refTypeTag + " typeID= " + classID
            + " status=" + status);
    assertAllDataRead(reply);
    assertEquals("", JDWPConstants.TypeTag.CLASS, refTypeTag);
    return classID;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:28,代碼來源:JDWPTestCase.java

示例3: getClassIDBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
protected long getClassIDBySignature(String signature) {
    logWriter.println("=> Getting reference type ID for class: " + signature);
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    packet.setNextValueAsString(signature);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    if (!checkReplyPacketWithoutFail(reply, "VirtualMachine::ClassesBySignature command")) {
        throw new TestErrorException("Error during performing VirtualMachine::ClassesBySignature command");
    }
    int classes = reply.getNextValueAsInt();
    logWriter.println("=> Returned number of classes: " + classes);
    long classID = 0;
    for (int i = 0; i < classes; i++) {
        reply.getNextValueAsByte();
        classID = reply.getNextValueAsReferenceTypeID();
        reply.getNextValueAsInt();
        // we need the only class, even if there were multiply ones
        break;
    }
    assertTrue("VirtualMachine::ClassesBySignature command returned invalid classID:<" +
            classID + "> for signature " + signature, classID > 0);
    return classID;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:25,代碼來源:LaunchedDebugger.java

示例4: setEventRequest

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
protected int setEventRequest() {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.EventRequestCommandSet.CommandSetID,
            JDWPCommands.EventRequestCommandSet.SetCommand);
    packet.setNextValueAsByte(JDWPConstants.EventKind.METHOD_ENTRY);
    packet.setNextValueAsByte(JDWPConstants.SuspendPolicy.ALL);
    packet.setNextValueAsInt(1);
    packet.setNextValueAsByte((byte) 5);
    packet.setNextValueAsString("*.InvokeMethodDebuggee");

    logWriter.println("\nSend EventRequest::Set command...");
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "EventRequest::Set command");
    
    int requestID = reply.getNextValueAsInt();
    logWriter.println(" EventRequest.Set: requestID=" + requestID);
    assertTrue(reply.isAllDataRead());
    return requestID;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:20,代碼來源:InvokeMethodTest.java

示例5: getClassBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Gets class reference by signature.
 * 
 * @param classSignature
 *            class signature.
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket getClassBySignature(String classSignature) {
    CommandPacket commandPacket = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    commandPacket.setNextValueAsString(classSignature);
    return checkReply(performCommand(commandPacket));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:15,代碼來源:VmMirror.java

示例6: createString

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Creates java String in target VM with the given value.
 * 
 * @param value
 *            The value of the string.
 * @return The string id.
 */
public final long createString(String value) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.CreateStringCommand);
    command.setNextValueAsString(value);
    ReplyPacket reply = checkReply(performCommand(command));
    return reply.getNextValueAsStringID();
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:16,代碼來源:VmMirror.java

示例7: createString

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Performs string creation in debuggee.
 * 
 * @param value -
 *            content for new string
 * @return StringID of new created string
 */
protected long createString(String value) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.CreateStringCommand);
    packet.setNextValueAsString(value);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::CreateString command");
    long stringID = reply.getNextValueAsStringID();
    return stringID;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:18,代碼來源:JDWPTestCase.java

示例8: testSetDefaultStratum001

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * This testcase exercises VirtualMachine.SetDefaultStratum command.
 * <BR>At first the test starts HelloWorld debuggee.
 * <BR>Then the test checks that VirtualMachine.SetDefaultStratum command runs
 * without any error or returns NOT_IMPLEMENTED error.
 * Any other error is considered as test' failure.
 */
public void testSetDefaultStratum001() {
    String thisTestName = "testSetDefaultStratum001";
    
    //check capability, relevant for this test
    logWriter.println("=> Check capability: canSetDefaultStratum");
    debuggeeWrapper.vmMirror.capabilities();
    boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canSetDefaultStratum;
    if (!isCapability) {
        logWriter.println("##WARNING: this VM dosn't possess capability: canSetDefaultStratum");
        return;
    }
    
    logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    logWriter.println("=> CHECK1: send " + thisCommandName + " and check reply for ERROR...");
    String stratumID = "C++";
    CommandPacket checkedCommand = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.SetDefaultStratumCommand);
    checkedCommand.setNextValueAsString(stratumID);
    
    ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
    checkedCommand = null;

    short errorCode = checkedReply.getErrorCode();
    if ( errorCode != JDWPConstants.Error.NONE ) {
        if ( errorCode != JDWPConstants.Error.NOT_IMPLEMENTED ) {
            printErrorAndFail(thisCommandName 
                + " returns unexpected ERROR = " + errorCode 
                + "(" + JDWPConstants.Error.getName(errorCode) + ")");
        } else { 
            logWriter.println("=> CHECK PASSED: Expected error (NOT_IMPLEMENTED) is returned");
        }
    } else {
        logWriter.println
        ("=> CHECK PASSED: No any error is received");
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:47,代碼來源:SetDefaultStratumTest.java


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