/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. */ /** * @author Viacheslav G. Rybalov */ /** * Created on 05.03.2005 */ package org.apache.harmony.jpda.tests.jdwp.ClassObjectReference; import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants; import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; import org.apache.harmony.jpda.tests.jdwp.ClassObjectReference.AbstractReflectedTypeTestCase.TypeSignatureAndTag; import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase; import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer; /** * JDWP unit test for ClassObjectReference.ReflectedType command. */ public class ReflectedTypeTest extends AbstractReflectedTypeTestCase { private static final String DEBUGGEE_CLASS_NAME = "org.apache.harmony.jpda.tests.jdwp.share.debuggee.HelloWorld"; /** * Returns full name of debuggee class which is used by this test. * @return full name of debuggee class. */ protected String getDebuggeeClassName() { return DEBUGGEE_CLASS_NAME; } /** * This testcase exercises ClassObjectReference.ReflectedType command. *
Starts HelloWorld debuggee. *
Then checks the following four classes: *
   - java/lang/Object; *
   - java/lang/String; *
   - java/lang/Runnable; *
   - HelloWorld. *
   *
The following statements are checked: *
 It is expected: *
   - refTypeTag takes one of the TypeTag constants: CLASS, INTERFACE; *
   - refTypeTag equals to refTypeTag returned by command * VirtualMachine.ClassesBySignature; *
   - typeID equals to typeID returned by the JDWP command * VirtualMachine.ClassesBySignature; *
   - All data were read; */ public void testReflectedType001() { logWriter.println("==> testReflectedType001 START..."); synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY); // Builds debuggee class signature string. String debuggeeClassSignature = "L" + DEBUGGEE_CLASS_NAME.replace('.', '/') + ";"; TypeSignatureAndTag[] array = new TypeSignatureAndTag[] { new TypeSignatureAndTag("Ljava/lang/Object;", JDWPConstants.TypeTag.CLASS), new TypeSignatureAndTag("Ljava/lang/String;", JDWPConstants.TypeTag.CLASS), new TypeSignatureAndTag("Ljava/lang/Runnable;", JDWPConstants.TypeTag.INTERFACE), new TypeSignatureAndTag(debuggeeClassSignature, JDWPConstants.TypeTag.CLASS) }; runReflectedTypeTest(array); synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE); } }