01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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 Anton V. Karnachuk
21: * @version $Revision: 1.4 $
22: */
23:
24: /**
25: * Created on 07.04.2005
26: */package org.apache.harmony.jpda.tests.jdwp.Events;
27:
28: import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
29: import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
30: import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
31: import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
32: import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
33:
34: /**
35: * JDWP Unit test for METHOD_EXIT event.
36: */
37: public class MethodExitTest extends JDWPEventTestCase {
38:
39: protected String getDebuggeeClassName() {
40: return MethodEntryDebuggee.class.getName();
41: }
42:
43: public static void main(String[] args) {
44: junit.textui.TestRunner.run(MethodExitTest.class);
45: }
46:
47: /**
48: * This testcase is for METHOD_EXIT event.
49: * <BR>It runs MethodEntryDebuggee that executed its own method
50: * and verify that requested METHOD_EXIT event occurs.
51: */
52: public void testMethodExit() {
53: logWriter.println("testMethodExit started");
54:
55: String methodExitClassNameRegexp = "org.apache.harmony.jpda.tests.jdwp.Events.MethodEntryDebuggee";
56: //String methodExitClassNameSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee;";
57:
58: synchronizer
59: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
60:
61: ReplyPacket reply = debuggeeWrapper.vmMirror
62: .setMethodExit(methodExitClassNameRegexp);
63: checkReplyPacket(reply, "Set METHOD_EXIT event");
64:
65: synchronizer
66: .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
67:
68: CommandPacket event = debuggeeWrapper.vmMirror.receiveEvent();
69: ParsedEvent[] parsedEvents = ParsedEvent
70: .parseEventPacket(event);
71:
72: assertEquals("Invalid number of events,", 1,
73: parsedEvents.length);
74: assertEquals("Invalid event kind,",
75: JDWPConstants.EventKind.METHOD_EXIT, parsedEvents[0]
76: .getEventKind(), JDWPConstants.EventKind
77: .getName(JDWPConstants.EventKind.METHOD_EXIT),
78: JDWPConstants.EventKind.getName(parsedEvents[0]
79: .getEventKind()));
80:
81: logWriter.println("MethodExitTest done");
82: }
83: }
|