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