Source Code Cross Referenced for BreakpointTest.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 4.08.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 BREAKPOINT event after re-connection.
039:         */
040:        public class BreakpointTest 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:            protected String getDebuggeeClassName() {
047:                return "org.apache.harmony.jpda.tests.jdwp.MultiSession.MultiSessionDebuggee";
048:            }
049:
050:            /**
051:             * This testcase verifies canceling of BREAKPOINT event after re-connection.
052:             * <BR>It runs MultiSessionDebuggee, sets request for BREAKPOINT event
053:             * and re-connects.
054:             * <BR>It is expected that no any events, including BREAKPOINT, occur after re-connection
055:             * and before MultiSessionDebuggee finish.
056:             */
057:            public void testClearBreakpoint001() {
058:                logWriter.println("==> testClearBreakpoint001 started..");
059:                synchronizer
060:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
061:
062:                long classID = debuggeeWrapper.vmMirror
063:                        .getClassID(DEBUGGEE_SIGNATURE);
064:
065:                //long requestID =
066:                debuggeeWrapper.vmMirror.setBreakpointAtMethodBegin(classID,
067:                        METHOD_NAME);
068:
069:                logWriter.println("");
070:                logWriter.println("=> CLOSE CONNECTION");
071:                closeConnection();
072:                logWriter.println("=> CONNECTION CLOSED");
073:
074:                logWriter.println("");
075:                logWriter.println("=> OPEN NEW CONNECTION");
076:                openConnection();
077:                logWriter.println("=> CONNECTION OPENED");
078:
079:                //resuming debuggee
080:                synchronizer
081:                        .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
082:                synchronizer
083:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
084:                synchronizer
085:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
086:
087:                //      receive event
088:                logWriter.println("=> Wait for event..");
089:                CommandPacket event = null;
090:                try {
091:                    event = debuggeeWrapper.vmMirror.receiveEvent();
092:                } catch (TestErrorException thrown) {
093:                    logWriter.println("=> Exception while receiving event:"
094:                            + thrown);
095:
096:                }
097:                if (event == null) {
098:                    logWriter
099:                            .println("=> It's expected result, nothing was caught");
100:                    logWriter.println("=> Resuming debuggee");
101:                    //resuming debuggee
102:                    synchronizer
103:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
104:                    logWriter.println("==> testMethodEvent001 PASSED! ");
105:                } else {
106:
107:                    logWriter.println("##FAILURE: Event was received");
108:
109:                    try {
110:                        ParsedEvent[] parsedEvents = ParsedEvent
111:                                .parseEventPacket(event);
112:
113:                        logWriter.println("=> Number of events = "
114:                                + parsedEvents.length);
115:                        for (int i = 0; i < parsedEvents.length; i++) {
116:                            logWriter.println("=> EventKind() = "
117:                                    + parsedEvents[0].getEventKind()
118:                                    + " ("
119:                                    + JDWPConstants.EventKind
120:                                            .getName(parsedEvents[0]
121:                                                    .getEventKind()) + ")");
122:                            logWriter.println("=> EventRequestID() = "
123:                                    + parsedEvents[0].getRequestID());
124:
125:                        }
126:                    } catch (Throwable thrown) {
127:                        logWriter
128:                                .println("##FAILURE: Exception while analyzing received event:"
129:                                        + thrown);
130:                        fail("Exception while analyzing received event: "
131:                                + thrown);
132:                    }
133:
134:                    synchronizer
135:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
136:                    synchronizer
137:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
138:                    logWriter.println("==> testClearBreakpoint001 PASSED");
139:                }
140:            }
141:
142:            protected void beforeDebuggeeStart(
143:                    JDWPUnitDebuggeeWrapper debuggeeWrapper) {
144:                settings.setAttachConnectorKind();
145:                if (settings.getTransportAddress() == null) {
146:                    settings
147:                            .setTransportAddress(TestOptions.DEFAULT_ATTACHING_ADDRESS);
148:                }
149:                logWriter.println("ATTACH connector kind");
150:                super .beforeDebuggeeStart(debuggeeWrapper);
151:            }
152:
153:            public static void main(String[] args) {
154:
155:                junit.textui.TestRunner.run(BreakpointTest.class);
156:
157:            }
158:        }
w_w_w.___j___av___a__2_s_.__c__om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.