• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
20  * @author Vitaly A. Provodin
21  */
22 
23 /**
24  * Created on 31.01.2005
25  */
26 package org.apache.harmony.jpda.tests.jdwp.VirtualMachine;
27 
28 import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
29 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
30 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
31 import org.apache.harmony.jpda.tests.jdwp.share.JDWPTestCase;
32 
33 
34 /**
35  * JDWP Unit test for VirtualMachine.IDSizes command.
36  */
37 public class IDSizesTest extends JDWPTestCase {
38 
39     @Override
getDebuggeeClassName()40     protected String getDebuggeeClassName() {
41         return "org.apache.harmony.jpda.tests.jdwp.share.debuggee.SimpleHelloWorld";
42     }
43 
44     /**
45      * This testcase exercises VirtualMachine.IDSizes command.
46      * <BR>At first the test starts HelloWorld debuggee.
47      * <BR> Then the test performs VirtualMachine.IDSizes command
48      * and checks that all returned sizes are non-zero values.
49      */
testIDSizes001()50     public void testIDSizes001() {
51 
52         CommandPacket packet = new CommandPacket(
53                 JDWPCommands.VirtualMachineCommandSet.CommandSetID,
54                 JDWPCommands.VirtualMachineCommandSet.IDSizesCommand);
55 
56         ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
57         checkReplyPacket(reply, "VirtualMachine::IDSizes command");
58 
59         int fieldIDSize = reply.getNextValueAsInt();
60         int methodIDSize = reply.getNextValueAsInt();
61         int objectIDSize = reply.getNextValueAsInt();
62         int referenceTypeIDSize = reply.getNextValueAsInt();
63         int frameIDSize = reply.getNextValueAsInt();
64         logWriter.println("fieldIDSize = " + fieldIDSize);
65         logWriter.println("methodIDSize = " + methodIDSize);
66         logWriter.println("objectIDSize = " + objectIDSize);
67         logWriter.println("referenceTypeIDSize = " + referenceTypeIDSize);
68         logWriter.println("frameIDSize = " + frameIDSize);
69 
70         assertTrue("Invalid fieldIDSize: " + fieldIDSize, fieldIDSize > 0);
71         assertTrue("Invalid methodIDSize: " + methodIDSize, methodIDSize > 0);
72         assertTrue("Invalid objectIDSize: " + objectIDSize, objectIDSize > 0);
73         assertTrue("Invalid referenceTypeIDSize: " + referenceTypeIDSize, referenceTypeIDSize > 0);
74         assertTrue("Invalid frameIDSize: " + frameIDSize, frameIDSize > 0);
75 
76         debuggeeWrapper.resume();
77     }
78 }
79