1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.apache.harmony.jpda.tests.jdwp.ClassType; 20 21 import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; 22 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; 23 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; 24 import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject; 25 import org.apache.harmony.jpda.tests.framework.jdwp.Value; 26 import org.apache.harmony.jpda.tests.jdwp.share.JDWPInvokeMethodWithSuspensionTestCase; 27 import org.apache.harmony.jpda.tests.jdwp.share.debuggee.InvokeMethodWithSuspensionDebuggee; 28 29 /** 30 * JDWP unit test for ClassType.InvokeCommand command with a thread suspension. 31 */ 32 public class InvokeMethodWithSuspensionTest extends JDWPInvokeMethodWithSuspensionTestCase { 33 public void testInvokeWithMultipleEvents001() { 34 runInvokeMethodTest(InvokeMethodWithSuspensionDebuggee.STATIC_METHOD_NAME); 35 } 36 37 @Override 38 protected CommandPacket buildInvokeCommand(long threadId, long classID, 39 long methodId, int invoke_options) { 40 CommandPacket command = new CommandPacket( 41 JDWPCommands.ClassTypeCommandSet.CommandSetID, 42 JDWPCommands.ClassTypeCommandSet.InvokeMethodCommand); 43 command.setNextValueAsClassID(classID); 44 command.setNextValueAsThreadID(threadId); 45 command.setNextValueAsMethodID(methodId); 46 command.setNextValueAsInt(0); 47 command.setNextValueAsInt(invoke_options); 48 return command; 49 } 50 51 @Override 52 protected String getInvokeCommandName() { 53 return "ClassType.InvokeCommand"; 54 } 55 56 @Override 57 protected void checkInvokeReply(ReplyPacket reply) { 58 // Check result is 'void' 59 Value invokeResult = reply.getNextValueAsValue(); 60 assertNull("Expect null result value for 'void'", invokeResult); 61 62 // Check exception is null. 63 TaggedObject invokeException = reply.getNextValueAsTaggedObject(); 64 assertEquals("Invalid exception object id", 0, invokeException.objectID); 65 assertAllDataRead(reply); 66 67 } 68 69 } 70