Source Code Cross Referenced for MethodEntryExitTest.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » jpda » tests » jdwp » MultiSession » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.jpda.tests.jdwp.MultiSession 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *
015:         *  See the License for the specific language governing permissions and
016:         *  limitations under the License.
017:         */
018:
019:        /**
020:         * @author Aleksander V. Budniy
021:         * @version $Revision: 1.3 $
022:         */
023:
024:        /**
025:         * Created on 8.7.2005
026:         */package org.apache.harmony.jpda.tests.jdwp.MultiSession;
027:
028:        import org.apache.harmony.jpda.tests.framework.TestOptions;
029:        import org.apache.harmony.jpda.tests.framework.TestErrorException;
030:        import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
031:        import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
032:        import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
033:        import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
034:        import org.apache.harmony.jpda.tests.jdwp.share.JDWPUnitDebuggeeWrapper;
035:        import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
036:
037:        /**
038:         * JDWP Unit test for verifying canceling of some events after re-connection.
039:         */
040:        public class MethodEntryExitTest extends JDWPSyncTestCase {
041:
042:            private String DEBUGGEE_SIGNATURE = "Lorg/apache/harmony/jpda/tests/jdwp/MultiSession/MultiSessionDebuggee;";
043:
044:            private String METHOD_NAME = "printWord";
045:
046:            String classNameRegexp = "org.apache.harmony.jpda.tests.jdwp.MultiSession.MultiSessionDebuggee";
047:
048:            protected String getDebuggeeClassName() {
049:                return "org.apache.harmony.jpda.tests.jdwp.MultiSession.MultiSessionDebuggee";
050:            }
051:
052:            /**
053:             * This testcase verifies canceling of some events after re-connection.
054:             * <BR>It runs MultiSessionDebuggee, sets requests for BREAKPOINT, METHOD_ENTRY
055:             * and METHOD_EXIT events and then re-connects.
056:             * <BR>It is expected that no any events, including requested events, occur after re-connection
057:             * and before MultiSessionDebuggee finish.
058:             */
059:            public void testMethodEvent001() {
060:                logWriter.println("==> testMethodEvent001 started..");
061:
062:                synchronizer
063:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
064:
065:                long classID = debuggeeWrapper.vmMirror
066:                        .getClassID(DEBUGGEE_SIGNATURE);
067:
068:                logWriter.println("=> Set breakpoint at method begin");
069:                //long requestID =
070:                debuggeeWrapper.vmMirror.setBreakpointAtMethodBegin(classID,
071:                        METHOD_NAME);
072:
073:                logWriter.println("=> Set request for METHOD_ENTRY event");
074:                debuggeeWrapper.vmMirror.setMethodEntry(classNameRegexp);
075:
076:                logWriter.println("=> Set request for METHOD_EXIT event");
077:                debuggeeWrapper.vmMirror.setMethodExit(classNameRegexp);
078:
079:                logWriter.println("");
080:                logWriter.println("=> CLOSE CONNECTION..");
081:                closeConnection();
082:                logWriter.println("=> CONNECTION CLOSED");
083:
084:                logWriter.println("");
085:                logWriter.println("=> OPEN NEW CONNECTION..");
086:                openConnection();
087:                logWriter.println("=> CONNECTION OPENED");
088:
089:                //resuming debuggee
090:                synchronizer
091:                        .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
092:                synchronizer
093:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
094:                synchronizer
095:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
096:
097:                //      receive event
098:                logWriter.println("=> Wait for event..");
099:                CommandPacket event = null;
100:                try {
101:                    event = debuggeeWrapper.vmMirror.receiveEvent();
102:                } catch (TestErrorException thrown) {
103:                    logWriter.println("=> Exception while receiving event:"
104:                            + thrown);
105:
106:                }
107:                if (event == null) {
108:                    logWriter
109:                            .println("=> It's expected result, nothing was caught");
110:                    logWriter.println("=> Resuming debuggee");
111:                    //resuming debuggee
112:                    synchronizer
113:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
114:                    logWriter.println("==> testMethodEvent001 PASSED! ");
115:                } else {
116:
117:                    logWriter.println("##FAILURE: Event was received");
118:
119:                    try {
120:                        ParsedEvent[] parsedEvents = ParsedEvent
121:                                .parseEventPacket(event);
122:
123:                        logWriter.println("=> Number of events = "
124:                                + parsedEvents.length);
125:                        for (int i = 0; i < parsedEvents.length; i++) {
126:                            logWriter.println("=> EventKind() = "
127:                                    + parsedEvents[0].getEventKind()
128:                                    + " ("
129:                                    + JDWPConstants.EventKind
130:                                            .getName(parsedEvents[0]
131:                                                    .getEventKind()) + ")");
132:                            logWriter.println("=> EventRequestID() = "
133:                                    + parsedEvents[0].getRequestID());
134:
135:                        }
136:                    } catch (Throwable thrown) {
137:                        logWriter
138:                                .println("##FAILURE: Exception while analyzing received event:"
139:                                        + thrown);
140:                        fail("Exception while analyzing received event:"
141:                                + thrown);
142:                    }
143:
144:                    synchronizer
145:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
146:                    synchronizer
147:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
148:                    logWriter.println("==> testMethodEvent001 failed");
149:                }
150:            }
151:
152:            protected void beforeDebuggeeStart(
153:                    JDWPUnitDebuggeeWrapper debuggeeWrapper) {
154:                settings.setAttachConnectorKind();
155:                if (settings.getTransportAddress() == null) {
156:                    settings
157:                            .setTransportAddress(TestOptions.DEFAULT_ATTACHING_ADDRESS);
158:                }
159:                logWriter.println("ATTACH connector kind");
160:                super .beforeDebuggeeStart(debuggeeWrapper);
161:            }
162:
163:            public static void main(String[] args) {
164:                junit.textui.TestRunner.run(MethodEntryExitTest.class);
165:            }
166:        }
w___w__w__.j__av_a2__s__.___c___o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.