Source Code Cross Referenced for ThreadStartTest.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.6 $
022:         */
023:
024:        /**
025:         * Created on 11.03.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.Event;
032:        import org.apache.harmony.jpda.tests.framework.jdwp.EventMod;
033:        import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
034:        import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
035:        import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
036:        import org.apache.harmony.jpda.tests.jdwp.share.JDWPUnitDebuggeeWrapper;
037:        import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
038:
039:        /**
040:         * JDWP Unit test for verifying canceling of THREAD_START event after re-connection.
041:         */
042:        public class ThreadStartTest extends JDWPEventTestCase {
043:
044:            public static void main(String[] args) {
045:                junit.textui.TestRunner.run(ThreadStartTest.class);
046:            }
047:
048:            /**
049:             * This testcase verifies canceling of THREAD_START event after re-connection.
050:             * <BR>It runs EventDebuggee, sets request for THREAD_START event
051:             * and re-connects.
052:             * <BR>It is expected that no any events, including THREAD_START, occur after re-connection
053:             * and before EventDebuggee finish.
054:             */
055:            public void testThreadStart001() {
056:                logWriter.println("==> testThreadStart001 - STARTED...");
057:
058:                synchronizer
059:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
060:
061:                logWriter.println("=> set ThreadStartEvent...");
062:                ReplyPacket reply;
063:                //        reply = debuggeeWrapper.vmMirror.setThreadStart();
064:                byte eventKind = JDWPConstants.EventKind.THREAD_START;
065:                byte suspendPolicy = JDWPConstants.SuspendPolicy.NONE;
066:                EventMod[] mods = new EventMod[0];
067:                Event eventToSet = new Event(eventKind, suspendPolicy, mods);
068:
069:                reply = debuggeeWrapper.vmMirror.setEvent(eventToSet);
070:                checkReplyPacket(reply, "Set THREAD_START event");
071:
072:                logWriter.println("=> set ThreadStartEvent - DONE");
073:
074:                logWriter.println("");
075:                logWriter.println("=> CLOSE CONNECTION");
076:                closeConnection();
077:                logWriter.println("=> CONNECTION CLOSED");
078:
079:                logWriter.println("");
080:                logWriter.println("=> OPEN NEW CONNECTION");
081:                openConnection();
082:                logWriter.println("=> CONNECTION OPENED");
083:
084:                logWriter.println("=> Resuming debuggee");
085:
086:                // start the thread
087:                synchronizer
088:                        .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
089:                // wait for thread start and finish
090:                synchronizer
091:                        .receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
092:
093:                logWriter.println("=> vmMirror.receiveEvent()...");
094:                CommandPacket event = null;
095:                try {
096:                    event = debuggeeWrapper.vmMirror.receiveEvent();
097:                } catch (TestErrorException thrown) {
098:                    logWriter.println("=> Exception while receiving event:"
099:                            + thrown);
100:
101:                }
102:                if (event == null) {
103:                    logWriter
104:                            .println("=> It's expected result, nothing was caught");
105:                    logWriter.println("=> Resuming debuggee");
106:                    //resuming debuggee
107:                    synchronizer
108:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
109:                    logWriter.println("==> testThreadStart001 PASSED! ");
110:                } else {
111:
112:                    logWriter.println("##FAILURE: Event was received");
113:
114:                    try {
115:                        ParsedEvent[] parsedEvents = ParsedEvent
116:                                .parseEventPacket(event);
117:                        logWriter.println("=> Number of events = "
118:                                + parsedEvents.length);
119:                        for (int i = 0; i < parsedEvents.length; i++) {
120:                            logWriter.println("=> EventKind() = "
121:                                    + parsedEvents[0].getEventKind()
122:                                    + " ("
123:                                    + JDWPConstants.EventKind
124:                                            .getName(parsedEvents[0]
125:                                                    .getEventKind()) + ")");
126:                            logWriter.println("=> EventRequestID() = "
127:                                    + parsedEvents[0].getRequestID());
128:
129:                        }
130:                    } catch (Throwable thrown) {
131:                        logWriter
132:                                .println("##FAILURE: Exception while analyzing received event:"
133:                                        + thrown);
134:                        fail("##FAILURE: Exception while analyzing received event:"
135:                                + thrown);
136:                    }
137:
138:                    synchronizer
139:                            .sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
140:                    logWriter.println("==> testThreadStart001 PASSED");
141:                }
142:            }
143:
144:            protected void beforeDebuggeeStart(
145:                    JDWPUnitDebuggeeWrapper debuggeeWrapper) {
146:                settings.setAttachConnectorKind();
147:                if (settings.getTransportAddress() == null) {
148:                    settings
149:                            .setTransportAddress(TestOptions.DEFAULT_ATTACHING_ADDRESS);
150:                }
151:                logWriter.println("ATTACH connector kind");
152:                super.beforeDebuggeeStart(debuggeeWrapper);
153:            }
154:        }
ww_w._j___av_a2s__.com___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.