Source Code Cross Referenced for EventRequestManagerTest.java in  » IDE-Eclipse » jdt » org » eclipse » debug » jdi » tests » 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 » IDE Eclipse » jdt » org.eclipse.debug.jdi.tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         * 
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.debug.jdi.tests;
011:
012:        import java.util.List;
013:        import java.util.ListIterator;
014:
015:        import com.sun.jdi.Field;
016:        import com.sun.jdi.Location;
017:        import com.sun.jdi.request.AccessWatchpointRequest;
018:        import com.sun.jdi.request.BreakpointRequest;
019:        import com.sun.jdi.request.ClassPrepareRequest;
020:        import com.sun.jdi.request.ClassUnloadRequest;
021:        import com.sun.jdi.request.EventRequestManager;
022:        import com.sun.jdi.request.ExceptionRequest;
023:        import com.sun.jdi.request.ModificationWatchpointRequest;
024:        import com.sun.jdi.request.StepRequest;
025:        import com.sun.jdi.request.ThreadDeathRequest;
026:        import com.sun.jdi.request.ThreadStartRequest;
027:
028:        /**
029:         * Tests for JDI com.sun.jdi.request.EventRequestManager.
030:         */
031:        public class EventRequestManagerTest extends AbstractJDITest {
032:
033:            private EventRequestManager fManager;
034:
035:            /**
036:             * Creates a new test.
037:             */
038:            public EventRequestManagerTest() {
039:                super ();
040:            }
041:
042:            /**
043:             * Init the fields that are used by this test only.
044:             */
045:            public void localSetUp() {
046:                // Get the event request manager
047:                fManager = fVM.eventRequestManager();
048:            }
049:
050:            /**
051:             * Run all tests and output to standard output.
052:             * @param args
053:             */
054:            public static void main(java.lang.String[] args) {
055:                new EventRequestManagerTest().runSuite(args);
056:            }
057:
058:            /**
059:             * Gets the name of the test case.
060:             * @see junit.framework.TestCase#getName()
061:             */
062:            public String getName() {
063:                return "com.sun.jdi.request.EventRequestManager";
064:            }
065:
066:            /**
067:             * Test JDI createAccessWatchpointRequest(Field), accessWatchpointRequests()
068:             * and deleteEventRequest(EventRequest)
069:             */
070:            public void testJDIAccessWatchpointRequest() {
071:                if (!fVM.canWatchFieldAccess())
072:                    return;
073:
074:                // Create an access watchpoint request
075:                Field field = getField();
076:                AccessWatchpointRequest request = fManager
077:                        .createAccessWatchpointRequest(field);
078:                assertEquals("1", field, request.field());
079:
080:                // Get all access watchpoint requests
081:                List requests = fManager.accessWatchpointRequests();
082:                ListIterator iterator = requests.listIterator();
083:                int i = 0;
084:                while (iterator.hasNext()) {
085:                    assertTrue("2." + i++,
086:                            iterator.next() instanceof  AccessWatchpointRequest);
087:                }
088:
089:                // Delete an access watchpoint request
090:                fManager.deleteEventRequest(request);
091:                assertEquals("3", 0, fManager.accessWatchpointRequests().size());
092:            }
093:
094:            /**
095:             * Test JDI createBreakpointRequest(Location), breakpointRequests(), 
096:             * deleteEventRequest(EventRequest) and deleteAllBreakpoints()
097:             */
098:            public void testJDIBreakpointRequest() {
099:                // Create a breakpoint at a valid location
100:                Location location = getLocation();
101:                BreakpointRequest bp = fManager
102:                        .createBreakpointRequest(location);
103:                assertEquals("1", location, bp.location());
104:
105:                // Get all breakpoints
106:                List breakpoints = fManager.breakpointRequests();
107:                ListIterator iterator = breakpoints.listIterator();
108:                while (iterator.hasNext()) {
109:                    Object breakpoint = iterator.next();
110:                    assertTrue("3", breakpoint instanceof  BreakpointRequest);
111:                }
112:
113:                // Delete a breakpoint
114:                fManager.deleteEventRequest(bp);
115:                assertEquals("4", 0, fManager.breakpointRequests().size());
116:
117:                // Delete all breakpoints
118:                fManager.createBreakpointRequest(location);
119:                fManager.deleteAllBreakpoints();
120:                assertEquals("5", 0, fManager.breakpointRequests().size());
121:            }
122:
123:            /**
124:             * Test JDI createClassPrepareRequest(), classPrepareRequests()
125:             * and deleteEventRequest(EventRequest)
126:             */
127:            public void testJDIClassPrepareRequest() {
128:                // Create a class prepare request
129:                ClassPrepareRequest request = fManager
130:                        .createClassPrepareRequest();
131:
132:                // Get all class prepare requests
133:                List requests = fManager.classPrepareRequests();
134:                ListIterator iterator = requests.listIterator();
135:                int i = 0;
136:                while (iterator.hasNext()) {
137:                    assertTrue("1." + i++,
138:                            iterator.next() instanceof  ClassPrepareRequest);
139:                }
140:
141:                // Delete a class prepare request
142:                fManager.deleteEventRequest(request);
143:                assertEquals("2", 0, fManager.classPrepareRequests().size());
144:            }
145:
146:            /**
147:             * Test JDI createClassUnloadRequest(), classUnloadRequests()
148:             * and deleteEventRequest(EventRequest)
149:             */
150:            public void testJDIClassUnloadRequest() {
151:                // Create a class unload request
152:                ClassUnloadRequest request = fManager
153:                        .createClassUnloadRequest();
154:
155:                // Get all class unload requests
156:                List requests = fManager.classUnloadRequests();
157:                ListIterator iterator = requests.listIterator();
158:                int i = 0;
159:                while (iterator.hasNext()) {
160:                    assertTrue("1." + i++,
161:                            iterator.next() instanceof  ClassUnloadRequest);
162:                }
163:
164:                // Delete a class unload request
165:                fManager.deleteEventRequest(request);
166:                assertEquals("2", 0, fManager.classUnloadRequests().size());
167:            }
168:
169:            /**
170:             * Test JDI createExceptionRequest(), exceptionRequests()
171:             * and deleteEventRequest(EventRequest)
172:             */
173:            public void testJDIExceptionRequest() {
174:                // Create a exception request
175:                ExceptionRequest request = fManager.createExceptionRequest(
176:                        null, true, true);
177:
178:                // Get all exception requests
179:                List requests = fManager.exceptionRequests();
180:                ListIterator iterator = requests.listIterator();
181:                int i = 0;
182:                while (iterator.hasNext()) {
183:                    assertTrue("1." + i++,
184:                            iterator.next() instanceof  ExceptionRequest);
185:                }
186:
187:                // Delete a exception request
188:                fManager.deleteEventRequest(request);
189:                assertEquals("2", i - 1, fManager.exceptionRequests().size());
190:            }
191:
192:            /**
193:             * Test JDI createModificationWatchpointRequest(Field), 
194:             * accessWatchpointRequests() and deleteEventRequest(EventRequest)
195:             */
196:            public void testJDIModificationWatchpointRequest() {
197:                if (!fVM.canWatchFieldAccess())
198:                    return;
199:
200:                // Create a modification watchpoint
201:                Field field = getField();
202:                ModificationWatchpointRequest request = fManager
203:                        .createModificationWatchpointRequest(field);
204:                assertEquals("1", field, request.field());
205:
206:                // Get all modification watchpoints
207:                List requests = fManager.modificationWatchpointRequests();
208:                ListIterator iterator = requests.listIterator();
209:                int i = 0;
210:                while (iterator.hasNext()) {
211:                    assertTrue(
212:                            "2." + i++,
213:                            iterator.next() instanceof  ModificationWatchpointRequest);
214:                }
215:
216:                // Delete a modification watchpoint
217:                fManager.deleteEventRequest(request);
218:                assertEquals("3", 0, fManager.modificationWatchpointRequests()
219:                        .size());
220:            }
221:
222:            /**
223:             * Test JDI createStepRequest(), stepRequests()
224:             * and deleteEventRequest(EventRequest)
225:             */
226:            public void testJDIStepRequest() {
227:                // Create a step request
228:                StepRequest request = fManager.createStepRequest(getThread(),
229:                        StepRequest.STEP_LINE, StepRequest.STEP_OVER);
230:
231:                // Get all step requests
232:                List requests = fManager.stepRequests();
233:                ListIterator iterator = requests.listIterator();
234:                int i = 0;
235:                while (iterator.hasNext()) {
236:                    assertTrue("1." + i++,
237:                            iterator.next() instanceof  StepRequest);
238:                }
239:
240:                // Delete a step request
241:                fManager.deleteEventRequest(request);
242:                assertEquals("2", 0, fManager.stepRequests().size());
243:            }
244:
245:            /**
246:             * Test JDI createThreadDeathRequest(), threadDeathRequests()
247:             * and deleteEventRequest(EventRequest)
248:             */
249:            public void testJDIThreadDeathRequest() {
250:                // Create a ThreadDeath request
251:                ThreadDeathRequest request = fManager
252:                        .createThreadDeathRequest();
253:
254:                // Get all ThreadDeath requests
255:                List requests = fManager.threadDeathRequests();
256:                ListIterator iterator = requests.listIterator();
257:                int i = 0;
258:                while (iterator.hasNext()) {
259:                    assertTrue("1." + i++,
260:                            iterator.next() instanceof  ThreadDeathRequest);
261:                }
262:
263:                // Delete a ThreadDeath request
264:                fManager.deleteEventRequest(request);
265:                assertEquals("2", 0, fManager.threadDeathRequests().size());
266:            }
267:
268:            /**
269:             * Test JDI createThreadStartRequest(), classUnloadRequests()
270:             * and deleteEventRequest(EventRequest)
271:             */
272:            public void testJDIThreadStartRequest() {
273:                // Create a ThreadStart request
274:                ThreadStartRequest request = fManager
275:                        .createThreadStartRequest();
276:
277:                // Get all ThreadStart requests
278:                List requests = fManager.classUnloadRequests();
279:                ListIterator iterator = requests.listIterator();
280:                int i = 0;
281:                while (iterator.hasNext()) {
282:                    assertTrue("1." + i++,
283:                            iterator.next() instanceof  ThreadStartRequest);
284:                }
285:
286:                // Delete a ThreadStart request
287:                fManager.deleteEventRequest(request);
288:                assertEquals("2", 0, fManager.classUnloadRequests().size());
289:            }
290:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.