Source Code Cross Referenced for Breakpoints.java in  » IDE-Netbeans » spi » gui » debuggercore » 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 Netbeans » spi » gui.debuggercore 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         * The Original Software is NetBeans.
0026:         * The Initial Developer of the Original Software is Sun Microsystems, Inc.
0027:         * Portions created by Sun Microsystems, Inc. are Copyright (C) 2005
0028:         * All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         *
0041:         * Contributor(s): Sun Microsystems, Inc.
0042:         */
0043:
0044:        package gui.debuggercore;
0045:
0046:        import junit.textui.TestRunner;
0047:        import org.netbeans.jellytools.Bundle;
0048:        import org.netbeans.jellytools.EditorOperator;
0049:        import org.netbeans.jellytools.JellyTestCase;
0050:        import org.netbeans.jellytools.NbDialogOperator;
0051:        import org.netbeans.jellytools.TopComponentOperator;
0052:        import org.netbeans.jellytools.TreeTableOperator;
0053:        import org.netbeans.jellytools.actions.DebugProjectAction;
0054:        import org.netbeans.jellytools.actions.OpenAction;
0055:        import org.netbeans.jellytools.modules.debugger.actions.ContinueAction;
0056:        import org.netbeans.jellytools.modules.debugger.actions.NewBreakpointAction;
0057:        import org.netbeans.jellytools.nodes.Node;
0058:        import org.netbeans.jellytools.nodes.SourcePackagesNode;
0059:        import org.netbeans.jemmy.EventTool;
0060:        import org.netbeans.jemmy.JemmyProperties;
0061:        import org.netbeans.jemmy.operators.JCheckBoxOperator;
0062:        import org.netbeans.jemmy.operators.JComboBoxOperator;
0063:        import org.netbeans.jemmy.operators.JEditorPaneOperator;
0064:        import org.netbeans.jemmy.operators.JTableOperator;
0065:        import org.netbeans.jemmy.operators.JTextFieldOperator;
0066:        import org.netbeans.jemmy.operators.JPopupMenuOperator;
0067:        import org.netbeans.jemmy.operators.Operator.StringComparator;
0068:        import org.netbeans.junit.NbTestSuite;
0069:
0070:        /**
0071:         *
0072:         * @author ehucka
0073:         */
0074:        public class Breakpoints extends JellyTestCase {
0075:
0076:            //MainWindowOperator.StatusTextTracer stt = null;
0077:            /**
0078:             *
0079:             * @param name
0080:             */
0081:            public Breakpoints(String name) {
0082:                super (name);
0083:            }
0084:
0085:            /**
0086:             *
0087:             * @param args
0088:             */
0089:            public static void main(String[] args) {
0090:                TestRunner.run(suite());
0091:            }
0092:
0093:            /**
0094:             *
0095:             * @return
0096:             */
0097:            public static NbTestSuite suite() {
0098:                NbTestSuite suite = new NbTestSuite();
0099:                suite.addTest(new Breakpoints("testLineBreakpointCreation"));
0100:                suite
0101:                        .addTest(new Breakpoints(
0102:                                "testLineBreakpointFunctionality"));
0103:                suite.addTest(new Breakpoints(
0104:                        "testLineBreakpointFunctionalityAfterContinue"));
0105:                suite.addTest(new Breakpoints(
0106:                        "testLineBreakpointFunctionalityInStaticMethod"));
0107:                suite.addTest(new Breakpoints(
0108:                        "testLineBreakpointFunctionalityInInitializer"));
0109:                suite.addTest(new Breakpoints(
0110:                        "testLineBreakpointFunctionalityInConstructor"));
0111:                suite.addTest(new Breakpoints(
0112:                        "testLineBreakpointFunctionalityInInnerClass"));
0113:                suite.addTest(new Breakpoints(
0114:                        "testLineBreakpointFunctionalityInSecondaryClass"));
0115:                suite.addTest(new Breakpoints(
0116:                        "testConditionalLineBreakpointFunctionality"));
0117:                suite.addTest(new Breakpoints("testLineBreakpointActions"));
0118:                suite.addTest(new Breakpoints("testLineBreakpointsValidation"));
0119:                suite.addTest(new Breakpoints("testLineBreakpointsHitCount"));
0120:
0121:                suite.addTest(new Breakpoints(
0122:                        "testMethodBreakpointPrefilledConstructor"));
0123:                suite.addTest(new Breakpoints(
0124:                        "testMethodBreakpointPrefilledMethod"));
0125:                suite.addTest(new Breakpoints("testMethodBreakpointCreation"));
0126:                suite.addTest(new Breakpoints(
0127:                        "testMethodBreakpointFunctionalityInPrimaryClass"));
0128:                suite.addTest(new Breakpoints(
0129:                        "testMethodBreakpointFunctionalityInSecondClass"));
0130:                suite.addTest(new Breakpoints(
0131:                        "testMethodBreakpointFunctionalityOnAllMethods"));
0132:                suite.addTest(new Breakpoints(
0133:                        "testMethodBreakpointFunctionalityOnExit"));
0134:                suite.addTest(new Breakpoints(
0135:                        "testConditionalMethodBreakpointFunctionality"));
0136:                suite
0137:                        .addTest(new Breakpoints(
0138:                                "testMethodBreakpointsValidation"));
0139:
0140:                suite.addTest(new Breakpoints(
0141:                        "testClassBreakpointPrefilledInClass"));
0142:                suite.addTest(new Breakpoints(
0143:                        "testClassBreakpointPrefilledInInitializer"));
0144:                suite.addTest(new Breakpoints(
0145:                        "testClassBreakpointPrefilledInConstructor"));
0146:                suite.addTest(new Breakpoints(
0147:                        "testClassBreakpointPrefilledInMethod"));
0148:                suite.addTest(new Breakpoints(
0149:                        "testClassBreakpointPrefilledInSecondClass"));
0150:                suite.addTest(new Breakpoints("testClassBreakpointCreation"));
0151:                suite.addTest(new Breakpoints(
0152:                        "testClassBreakpointFunctionalityOnPrimaryClass"));
0153:                suite.addTest(new Breakpoints(
0154:                        "testClassBreakpointFunctionalityOnSecondClass"));
0155:                suite.addTest(new Breakpoints(
0156:                        "testClassBreakpointFunctionalityWithFilter"));
0157:
0158:                suite.addTest(new Breakpoints(
0159:                        "testFieldBreakpointPrefilledValues"));
0160:                suite.addTest(new Breakpoints("testFieldBreakpointCreation"));
0161:                suite.addTest(new Breakpoints(
0162:                        "testFieldBreakpointFunctionalityAccess"));
0163:                suite.addTest(new Breakpoints(
0164:                        "testFieldBreakpointFunctionalityModification"));
0165:                suite.addTest(new Breakpoints(
0166:                        "testConditionalFieldBreakpointFunctionality"));
0167:                suite
0168:                        .addTest(new Breakpoints(
0169:                                "testFieldBreakpointsValidation"));
0170:
0171:                suite.addTest(new Breakpoints("testThreadBreakpointCreation"));
0172:                suite.addTest(new Breakpoints(
0173:                        "testThreadBreakpointFunctionality"));
0174:                suite.addTest(new Breakpoints(
0175:                        "testThreadBreakpointFunctionalityHitCount"));
0176:
0177:                suite
0178:                        .addTest(new Breakpoints(
0179:                                "testExceptionBreakpointCreation"));
0180:                suite.addTest(new Breakpoints(
0181:                        "testExceptionBreakpointFunctionality"));
0182:                suite.addTest(new Breakpoints(
0183:                        "testExceptionBreakpointMatchClasses"));
0184:                suite.addTest(new Breakpoints(
0185:                        "testExceptionBreakpointExcludeClasses"));
0186:                suite
0187:                        .addTest(new Breakpoints(
0188:                                "testExceptionBreakpointHitCount"));
0189:                suite.addTest(new Breakpoints(
0190:                        "testConditionalExceptionBreakpoint"));
0191:                return suite;
0192:            }
0193:
0194:            /**
0195:             *
0196:             */
0197:            public void setUp() {
0198:                System.out.println("########  " + getName() + "  ####### ");
0199:            }
0200:
0201:            /**
0202:             *
0203:             */
0204:            public void tearDown() {
0205:                JemmyProperties.getCurrentOutput().printTrace("\nteardown\n");
0206:                Utilities.endAllSessions();
0207:                Utilities.deleteAllBreakpoints();
0208:            }
0209:
0210:            /**
0211:             *
0212:             */
0213:            public void testLineBreakpointCreation() throws Throwable {
0214:                try {
0215:                    //open source
0216:                    Node beanNode = new Node(new SourcePackagesNode(
0217:                            Utilities.testProjectName),
0218:                            "examples.advanced|MemoryView.java"); //NOI18N
0219:                    new OpenAction().performAPI(beanNode);
0220:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0221:                    //toggle breakpoints
0222:                    Utilities.toggleBreakpoint(eo, 73);
0223:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
0224:                    JTableOperator jTableOperator = new JTableOperator(
0225:                            new TopComponentOperator(
0226:                                    Utilities.breakpointsViewTitle));
0227:                    assertEquals("Line MemoryView.java:73", jTableOperator
0228:                            .getValueAt(0, 0).toString());
0229:                    eo = new EditorOperator("MemoryView.java");
0230:                    Utilities.toggleBreakpoint(eo, 73, false);
0231:                    new EventTool().waitNoEvent(1000);
0232:                    jTableOperator = new JTableOperator(
0233:                            new TopComponentOperator(
0234:                                    Utilities.breakpointsViewTitle));
0235:                    assertEquals(0, jTableOperator.getRowCount());
0236:                } catch (Throwable th) {
0237:                    Utilities.captureScreen(this );
0238:                    Utilities.captureScreen(this );
0239:                    throw th;
0240:                }
0241:            }
0242:
0243:            /**
0244:             *
0245:             */
0246:            public void testLineBreakpointFunctionality() throws Throwable {
0247:                try {
0248:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0249:                    //toggle breakpoints
0250:                    Utilities.toggleBreakpoint(eo, 73);
0251:                    Utilities.startDebugger();
0252:                    Utilities.waitDebuggerConsole(
0253:                            "Thread main stopped at MemoryView.java:73", 0);
0254:                } catch (Throwable th) {
0255:                    Utilities.captureScreen(this );
0256:                    throw th;
0257:                }
0258:            }
0259:
0260:            /**
0261:             *
0262:             */
0263:            public void testLineBreakpointFunctionalityAfterContinue()
0264:                    throws Throwable {
0265:                try {
0266:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0267:                    //toggle breakpoints
0268:                    Utilities.toggleBreakpoint(eo, 52);
0269:                    Utilities.startDebugger();
0270:                    Utilities.waitDebuggerConsole(
0271:                            "Thread main stopped at MemoryView.java:52", 0);
0272:                    eo = new EditorOperator("MemoryView.java");
0273:                    Utilities.toggleBreakpoint(eo, 74);
0274:                    new ContinueAction().perform();
0275:                    Utilities.waitDebuggerConsole(
0276:                            "Thread main stopped at MemoryView.java:74", 0);
0277:                } catch (Throwable th) {
0278:                    Utilities.captureScreen(this );
0279:                    throw th;
0280:                }
0281:            }
0282:
0283:            /**
0284:             *
0285:             */
0286:            public void testLineBreakpointFunctionalityInStaticMethod()
0287:                    throws Throwable {
0288:                try {
0289:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0290:                    //toggle breakpoints
0291:                    Utilities.toggleBreakpoint(eo, 114);
0292:                    Utilities.startDebugger();
0293:                    Utilities.waitDebuggerConsole(
0294:                            "Thread main stopped at MemoryView.java:114", 0);
0295:                } catch (Throwable th) {
0296:                    Utilities.captureScreen(this );
0297:                    throw th;
0298:                }
0299:            }
0300:
0301:            /**
0302:             *
0303:             */
0304:            public void testLineBreakpointFunctionalityInInitializer()
0305:                    throws Throwable {
0306:                try {
0307:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0308:                    //toggle breakpoints
0309:                    Utilities.toggleBreakpoint(eo, 45);
0310:                    Utilities.startDebugger();
0311:                    Utilities.waitDebuggerConsole(
0312:                            "Thread main stopped at MemoryView.java:45", 0);
0313:                } catch (Throwable th) {
0314:                    Utilities.captureScreen(this );
0315:                    throw th;
0316:                }
0317:            }
0318:
0319:            /**
0320:             *
0321:             */
0322:            public void testLineBreakpointFunctionalityInConstructor()
0323:                    throws Throwable {
0324:                try {
0325:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0326:                    //toggle breakpoints
0327:                    Utilities.toggleBreakpoint(eo, 54);
0328:                    Utilities.startDebugger();
0329:                    Utilities.waitDebuggerConsole(
0330:                            "Thread main stopped at MemoryView.java:54", 0);
0331:                } catch (Throwable th) {
0332:                    Utilities.captureScreen(this );
0333:                    throw th;
0334:                }
0335:            }
0336:
0337:            /**
0338:             *
0339:             */
0340:            public void testLineBreakpointFunctionalityInInnerClass()
0341:                    throws Throwable {
0342:                try {
0343:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0344:                    //toggle breakpoints
0345:                    Utilities.toggleBreakpoint(eo, 123);
0346:                    Utilities.startDebugger();
0347:                    Utilities
0348:                            .waitDebuggerConsole(
0349:                                    "Thread Thread-0 stopped at MemoryView.java:123",
0350:                                    0);
0351:                } catch (Throwable th) {
0352:                    Utilities.captureScreen(this );
0353:                    throw th;
0354:                }
0355:            }
0356:
0357:            /**
0358:             *
0359:             */
0360:            public void testLineBreakpointFunctionalityInSecondaryClass()
0361:                    throws Throwable {
0362:                try {
0363:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0364:                    //toggle breakpoints
0365:                    Utilities.toggleBreakpoint(eo, 154);
0366:                    Utilities.startDebugger();
0367:                    Utilities.waitDebuggerConsole(
0368:                            "Thread main stopped at MemoryView.java:154", 0);
0369:                } catch (Throwable th) {
0370:                    Utilities.captureScreen(this );
0371:                    throw th;
0372:                }
0373:            }
0374:
0375:            /**
0376:             *
0377:             */
0378:            public void testConditionalLineBreakpointFunctionality()
0379:                    throws Throwable {
0380:                try {
0381:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0382:                    //toggle breakpoints
0383:                    Utilities.toggleBreakpoint(eo, 63);
0384:                    Utilities.toggleBreakpoint(eo, 64);
0385:
0386:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
0387:                    JTableOperator jTableOperator = new JTableOperator(
0388:                            new TopComponentOperator(
0389:                                    Utilities.breakpointsViewTitle));
0390:                    assertEquals("Line MemoryView.java:64", jTableOperator
0391:                            .getValueAt(1, 0).toString());
0392:                    new JPopupMenuOperator(jTableOperator.callPopupOnCell(1, 0))
0393:                            .pushMenuNoBlock("Customize");
0394:                    NbDialogOperator dialog = new NbDialogOperator(
0395:                            Utilities.customizeBreakpointTitle);
0396:                    new JCheckBoxOperator(dialog, 0).changeSelection(true);
0397:                    new JEditorPaneOperator(dialog, 0).setText("i > 0");
0398:                    dialog.ok();
0399:                    Utilities.startDebugger();
0400:                    int lines = Utilities.waitDebuggerConsole(
0401:                            "Thread main stopped at MemoryView.java:63", 0);
0402:                    new ContinueAction().perform();
0403:                    lines = Utilities.waitDebuggerConsole(
0404:                            "Thread main stopped at MemoryView.java:63",
0405:                            lines + 1);
0406:                    new ContinueAction().perform();
0407:                    Utilities.waitDebuggerConsole(
0408:                            "Thread main stopped at MemoryView.java:64",
0409:                            lines + 1);
0410:                } catch (Throwable th) {
0411:                    Utilities.captureScreen(this );
0412:                    throw th;
0413:                }
0414:            }
0415:
0416:            /**
0417:             *
0418:             */
0419:            public void testLineBreakpointActions() throws Throwable {
0420:                try {
0421:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0422:                    //toggle breakpoints
0423:                    Utilities.toggleBreakpoint(eo, 102);
0424:                    Utilities.toggleBreakpoint(eo, 104);
0425:
0426:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
0427:                    JTableOperator jTableOperator = new JTableOperator(
0428:                            new TopComponentOperator(
0429:                                    Utilities.breakpointsViewTitle));
0430:                    assertEquals("Line MemoryView.java:102", jTableOperator
0431:                            .getValueAt(0, 0).toString());
0432:                    new JPopupMenuOperator(jTableOperator.callPopupOnCell(0, 0))
0433:                            .pushMenuNoBlock("Customize");
0434:                    NbDialogOperator dialog = new NbDialogOperator(
0435:                            Utilities.customizeBreakpointTitle);
0436:
0437:                    String nothread = Bundle
0438:                            .getString(
0439:                                    "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0440:                                    "LBL_CB_Actions_Panel_Suspend_None");
0441:                    new JComboBoxOperator(dialog, 1).selectItem(nothread);
0442:                    String breakpointHitText = "Line breakpoint hit on {className}:{lineNumber}"; //noi18n
0443:                    new JTextFieldOperator(dialog, 4)
0444:                            .setText(breakpointHitText);
0445:                    dialog.ok();
0446:                    Utilities.startDebugger();
0447:                    int lines = Utilities
0448:                            .waitDebuggerConsole(
0449:                                    "Line breakpoint hit on examples.advanced.MemoryView:102",
0450:                                    0);
0451:                    lines = Utilities.waitDebuggerConsole(
0452:                            "Thread main stopped at MemoryView.java:104",
0453:                            lines + 1);
0454:                } catch (Throwable th) {
0455:                    Utilities.captureScreen(this );
0456:                    throw th;
0457:                }
0458:            }
0459:
0460:            public void testLineBreakpointsValidation() throws Throwable {
0461:                try {
0462:                    int[] prelines = new int[] { 33, 34, 37, 43, 49 };
0463:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0464:                    //toggle breakpoints
0465:                    for (int i = 0; i < prelines.length; i++) {
0466:                        Utilities.toggleBreakpoint(eo, prelines[i]);
0467:                    }
0468:                    //start debugging
0469:                    Utilities.startDebugger();
0470:                    int lines = Utilities.waitDebuggerConsole(
0471:                            "User program running", 0);
0472:                    for (int i = 0; i < prelines.length; i++) {
0473:                        Utilities.waitDebuggerConsole(
0474:                                "Invalid LineBreakpoint MemoryView.java : "
0475:                                        + prelines[i], lines + 1);
0476:                    }
0477:                    int[] debuglines = new int[] { 72, 81, 83, 95, 96, 105,
0478:                            108, 122, 125, 153 };
0479:                    //toggle breakpoints
0480:                    for (int i = 0; i < debuglines.length; i++) {
0481:                        Utilities.toggleBreakpoint(eo, debuglines[i]);
0482:                        Utilities.waitDebuggerConsole(
0483:                                "Invalid LineBreakpoint MemoryView.java : "
0484:                                        + debuglines[i], lines + 1);
0485:                    }
0486:                } catch (Throwable th) {
0487:                    Utilities.captureScreen(this );
0488:                    throw th;
0489:                }
0490:            }
0491:
0492:            public void testLineBreakpointsHitCount() throws Throwable {
0493:                try {
0494:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0495:                    //toggle breakpoints
0496:                    Utilities.toggleBreakpoint(eo, 64);
0497:                    Utilities.toggleBreakpoint(eo, 65);
0498:                    Utilities.toggleBreakpoint(eo, 66);
0499:                    //set hit conditions
0500:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
0501:                    JTableOperator jTableOperator = new JTableOperator(
0502:                            new TopComponentOperator(
0503:                                    Utilities.breakpointsViewTitle));
0504:                    new JPopupMenuOperator(jTableOperator.callPopupOnCell(0, 0))
0505:                            .pushMenuNoBlock("Customize");
0506:                    NbDialogOperator dialog = new NbDialogOperator(
0507:                            Utilities.customizeBreakpointTitle);
0508:                    new JCheckBoxOperator(dialog, 1).changeSelection(true);
0509:                    new JComboBoxOperator(dialog, 0)
0510:                            .selectItem(Bundle
0511:                                    .getString(
0512:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0513:                                            "ConditionsPanel.cbWhenHitCount.equals"));
0514:                    new JTextFieldOperator(dialog, 2).setText("45");
0515:                    dialog.ok();
0516:
0517:                    new JPopupMenuOperator(jTableOperator.callPopupOnCell(1, 0))
0518:                            .pushMenuNoBlock("Customize");
0519:                    dialog = new NbDialogOperator(
0520:                            Utilities.customizeBreakpointTitle);
0521:                    new JCheckBoxOperator(dialog, 1).changeSelection(true);
0522:                    new JComboBoxOperator(dialog, 0)
0523:                            .selectItem(Bundle
0524:                                    .getString(
0525:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0526:                                            "ConditionsPanel.cbWhenHitCount.greater"));
0527:                    new JTextFieldOperator(dialog, 2).setText("48");
0528:                    dialog.ok();
0529:
0530:                    new JPopupMenuOperator(jTableOperator.callPopupOnCell(2, 0))
0531:                            .pushMenuNoBlock("Customize");
0532:                    dialog = new NbDialogOperator(
0533:                            Utilities.customizeBreakpointTitle);
0534:                    new JCheckBoxOperator(dialog, 1).changeSelection(true);
0535:                    new JComboBoxOperator(dialog, 0)
0536:                            .selectItem(Bundle
0537:                                    .getString(
0538:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0539:                                            "ConditionsPanel.cbWhenHitCount.multiple"));
0540:                    new JTextFieldOperator(dialog, 2).setText("47");
0541:                    dialog.ok();
0542:
0543:                    //start debugging
0544:                    Utilities.startDebugger();
0545:                    //check values
0546:                    StringComparator comp = new StringComparator() {
0547:
0548:                        public boolean equals(String arg0, String arg1) {
0549:                            return arg0.equals(arg1);
0550:                        }
0551:                    };
0552:                    int lines = Utilities.waitDebuggerConsole(
0553:                            "Thread main stopped at MemoryView.java:64", 0);
0554:                    Utilities.showDebuggerView(Utilities.localVarsViewTitle);
0555:                    jTableOperator = new JTableOperator(
0556:                            new TopComponentOperator(
0557:                                    Utilities.localVarsViewTitle));
0558:                    TreeTableOperator treeTableOperator = new TreeTableOperator(
0559:                            (javax.swing.JTable) jTableOperator.getSource());
0560:                    int row = treeTableOperator.findCellRow("i", comp);
0561:                    org.openide.nodes.Node.Property property = (org.openide.nodes.Node.Property) treeTableOperator
0562:                            .getValueAt(row, 2);
0563:                    assertEquals("44", property.getValue());
0564:                    new ContinueAction().perform();
0565:
0566:                    lines = Utilities.waitDebuggerConsole(
0567:                            "Thread main stopped at MemoryView.java:66",
0568:                            lines + 1);
0569:                    Utilities.showDebuggerView(Utilities.localVarsViewTitle);
0570:                    jTableOperator = new JTableOperator(
0571:                            new TopComponentOperator(
0572:                                    Utilities.localVarsViewTitle));
0573:                    treeTableOperator = new TreeTableOperator(
0574:                            (javax.swing.JTable) jTableOperator.getSource());
0575:                    row = treeTableOperator.findCellRow("i", comp);
0576:                    property = (org.openide.nodes.Node.Property) treeTableOperator
0577:                            .getValueAt(row, 2);
0578:                    assertEquals("46", property.getValue());
0579:                    new ContinueAction().perform();
0580:
0581:                    lines = Utilities.waitDebuggerConsole(
0582:                            "Thread main stopped at MemoryView.java:65",
0583:                            lines + 1);
0584:                    Utilities.showDebuggerView(Utilities.localVarsViewTitle);
0585:                    jTableOperator = new JTableOperator(
0586:                            new TopComponentOperator(
0587:                                    Utilities.localVarsViewTitle));
0588:                    treeTableOperator = new TreeTableOperator(
0589:                            (javax.swing.JTable) jTableOperator.getSource());
0590:                    row = treeTableOperator.findCellRow("i", comp);
0591:                    property = (org.openide.nodes.Node.Property) treeTableOperator
0592:                            .getValueAt(row, 2);
0593:                    assertEquals("47", property.getValue());
0594:                } catch (Throwable th) {
0595:                    Utilities.captureScreen(this );
0596:                    throw th;
0597:                }
0598:            }
0599:
0600:            /**
0601:             *
0602:             */
0603:            public void testMethodBreakpointPrefilledConstructor()
0604:                    throws Throwable {
0605:                try {
0606:                    NbDialogOperator dialog = Utilities.newBreakpoint(53);
0607:                    setBreakpointType(dialog, "Method");
0608:                    assertEquals("Class Name was not set to correct value.",
0609:                            "examples.advanced.MemoryView",
0610:                            new JEditorPaneOperator(dialog, 0).getText());
0611:                    assertEquals("Method Name was not set to correct value.",
0612:                            "MemoryView ()", new JTextFieldOperator(dialog, 0)
0613:                                    .getText());
0614:                    dialog.cancel();
0615:                } catch (Throwable th) {
0616:                    Utilities.captureScreen(this );
0617:                    throw th;
0618:                }
0619:            }
0620:
0621:            /**
0622:             *
0623:             */
0624:            public void testMethodBreakpointPrefilledMethod() throws Throwable {
0625:                try {
0626:                    NbDialogOperator dialog = Utilities.newBreakpoint(92);
0627:                    setBreakpointType(dialog, "Method");
0628:                    assertEquals("Class Name was not set to correct value.",
0629:                            "examples.advanced.MemoryView",
0630:                            new JEditorPaneOperator(dialog, 0).getText());
0631:                    assertEquals("Method Name was not set to correct value.",
0632:                            "updateStatus ()",
0633:                            new JTextFieldOperator(dialog, 0).getText());
0634:                    dialog.cancel();
0635:                } catch (Throwable th) {
0636:                    Utilities.captureScreen(this );
0637:                    throw th;
0638:                }
0639:            }
0640:
0641:            /**
0642:             *
0643:             */
0644:            public void testMethodBreakpointCreation() throws Throwable {
0645:                try {
0646:                    NbDialogOperator dialog = Utilities.newBreakpoint(92);
0647:                    setBreakpointType(dialog, "Method");
0648:                    dialog.ok();
0649:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
0650:                    JTableOperator jTableOperator = new JTableOperator(
0651:                            new TopComponentOperator(
0652:                                    Utilities.breakpointsViewTitle));
0653:                    assertEquals("Method MemoryView.updateStatus",
0654:                            jTableOperator.getValueAt(0, 0).toString());
0655:                } catch (Throwable th) {
0656:                    Utilities.captureScreen(this );
0657:                    throw th;
0658:                }
0659:            }
0660:
0661:            /**
0662:             *
0663:             */
0664:            public void testMethodBreakpointFunctionalityInPrimaryClass()
0665:                    throws Throwable {
0666:                try {
0667:                    NbDialogOperator dialog = Utilities.newBreakpoint(92);
0668:                    setBreakpointType(dialog, "Method");
0669:                    dialog.ok();
0670:                    Utilities.startDebugger();
0671:                    Utilities.waitDebuggerConsole(
0672:                            "Thread main stopped at MemoryView.java:92", 0);
0673:                } catch (Throwable th) {
0674:                    Utilities.captureScreen(this );
0675:                    throw th;
0676:                }
0677:            }
0678:
0679:            /**
0680:             *
0681:             */
0682:            public void testMethodBreakpointFunctionalityInSecondClass()
0683:                    throws Throwable {
0684:                try {
0685:                    NbDialogOperator dialog = Utilities.newBreakpoint(154);
0686:                    setBreakpointType(dialog, "Method");
0687:                    dialog.ok();
0688:                    Utilities.startDebugger();
0689:                    Utilities.waitDebuggerConsole(
0690:                            "Thread main stopped at MemoryView.java:154", 0);
0691:                } catch (Throwable th) {
0692:                    Utilities.captureScreen(this );
0693:                    throw th;
0694:                }
0695:            }
0696:
0697:            /**
0698:             *
0699:             */
0700:            public void testMethodBreakpointFunctionalityOnAllMethods()
0701:                    throws Throwable {
0702:                try {
0703:                    NbDialogOperator dialog = Utilities.newBreakpoint(37);
0704:                    setBreakpointType(dialog, "Method");
0705:                    dialog.ok();
0706:                    Utilities.startDebugger();
0707:                    int lines = Utilities.waitDebuggerConsole(
0708:                            "Thread main stopped at MemoryView.java:39", 0);
0709:                    new ContinueAction().perform();
0710:                    lines = Utilities.waitDebuggerConsole(
0711:                            "Thread main stopped at MemoryView.java:114",
0712:                            lines + 1);
0713:                    new ContinueAction().perform();
0714:                    lines = Utilities.waitDebuggerConsole(
0715:                            "Thread main stopped at MemoryView.java:50",
0716:                            lines + 1);
0717:                    new ContinueAction().perform();
0718:                    lines = Utilities.waitDebuggerConsole(
0719:                            "Thread main stopped at MemoryView.java:51",
0720:                            lines + 1);
0721:                    new ContinueAction().perform();
0722:                    lines = Utilities.waitDebuggerConsole(
0723:                            "Thread main stopped at MemoryView.java:121",
0724:                            lines + 1);
0725:                    new ContinueAction().perform();
0726:                    lines = Utilities.waitDebuggerConsole(
0727:                            "Thread main stopped at MemoryView.java:79",
0728:                            lines + 1);
0729:                    new ContinueAction().perform();
0730:                    Utilities.waitDebuggerConsole(
0731:                            "Thread main stopped at MemoryView.java:92",
0732:                            lines + 1);
0733:                } catch (Throwable th) {
0734:                    Utilities.captureScreen(this );
0735:                    throw th;
0736:                }
0737:            }
0738:
0739:            public void testMethodBreakpointFunctionalityOnExit()
0740:                    throws Throwable {
0741:                try {
0742:                    NbDialogOperator dialog = Utilities.newBreakpoint(54);
0743:                    setBreakpointType(dialog, "Method");
0744:                    new JComboBoxOperator(dialog, 2)
0745:                            .setSelectedItem(Bundle
0746:                                    .getString(
0747:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0748:                                            "LBL_Method_Breakpoint_Type_Entry_or_Exit")); //method entry
0749:                    dialog.ok();
0750:
0751:                    dialog = Utilities.newBreakpoint(80);
0752:                    setBreakpointType(dialog, "Method");
0753:                    new JComboBoxOperator(dialog, 2)
0754:                            .setSelectedItem(Bundle
0755:                                    .getString(
0756:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0757:                                            "LBL_Method_Breakpoint_Type_Entry")); //method entry
0758:                    dialog.ok();
0759:
0760:                    dialog = Utilities.newBreakpoint(102);
0761:                    setBreakpointType(dialog, "Method");
0762:                    new JComboBoxOperator(dialog, 2)
0763:                            .setSelectedItem(Bundle
0764:                                    .getString(
0765:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0766:                                            "LBL_Method_Breakpoint_Type_Exit")); //method entry
0767:                    dialog.ok();
0768:
0769:                    Utilities.startDebugger();
0770:                    int lines = Utilities.waitDebuggerConsole(
0771:                            "Thread main stopped at MemoryView.java:50", 0);
0772:                    new ContinueAction().perform();
0773:                    lines = Utilities.waitDebuggerConsole(
0774:                            "Thread main stopped at MemoryView.java:76",
0775:                            lines + 1);
0776:                    new ContinueAction().perform();
0777:                    lines = Utilities.waitDebuggerConsole(
0778:                            "Thread main stopped at MemoryView.java:79",
0779:                            lines + 1);
0780:                    new ContinueAction().perform();
0781:                    lines = Utilities.waitDebuggerConsole(
0782:                            "Thread main stopped at MemoryView.java:109",
0783:                            lines + 1);
0784:                } catch (Throwable th) {
0785:                    Utilities.captureScreen(this );
0786:                    throw th;
0787:                }
0788:            }
0789:
0790:            public void testConditionalMethodBreakpointFunctionality()
0791:                    throws Throwable {
0792:                try {
0793:                    NbDialogOperator dialog = Utilities.newBreakpoint(104);
0794:                    setBreakpointType(dialog, "Method");
0795:                    new JComboBoxOperator(dialog, 2)
0796:                            .setSelectedItem(Bundle
0797:                                    .getString(
0798:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
0799:                                            "LBL_Method_Breakpoint_Type_Entry")); //method entry
0800:                    new JCheckBoxOperator(dialog, 1).changeSelection(true);
0801:                    new JEditorPaneOperator(dialog, 1)
0802:                            .setText("UPDATE_TIME >= 1001");
0803:
0804:                    dialog.ok();
0805:                    EditorOperator eo = new EditorOperator("MemoryView.java");
0806:                    //toggle control line breakpoint
0807:                    Utilities.toggleBreakpoint(eo, 104);
0808:
0809:                    Utilities.startDebugger();
0810:                    int lines = Utilities.waitDebuggerConsole(
0811:                            "Thread main stopped at MemoryView.java:104", 0);
0812:                    new ContinueAction().perform();
0813:                    lines = Utilities.waitDebuggerConsole(
0814:                            "Thread main stopped at MemoryView.java:92",
0815:                            lines + 1);
0816:                } catch (Throwable th) {
0817:                    Utilities.captureScreen(this );
0818:                    throw th;
0819:                }
0820:            }
0821:
0822:            public void testMethodBreakpointsValidation() throws Throwable {
0823:                try {
0824:                    NbDialogOperator dialog = Utilities.newBreakpoint(104);
0825:                    setBreakpointType(dialog, "Method");
0826:                    String wrongname = "wrong";
0827:                    new JTextFieldOperator(dialog, 0).setText(wrongname);
0828:                    dialog.ok();
0829:
0830:                    Utilities.startDebugger();
0831:                    int lines = Utilities
0832:                            .waitDebuggerConsole(
0833:                                    "Not able to submit breakpoint MethodBreakpoint [examples.advanced.MemoryView]."
0834:                                            + wrongname, 0);
0835:                    dialog = Utilities.newBreakpoint(104);
0836:                    setBreakpointType(dialog, "Method");
0837:                    wrongname = "wrong2";
0838:                    new JTextFieldOperator(dialog, 0).setText(wrongname);
0839:                    dialog.ok();
0840:                    lines = Utilities
0841:                            .waitDebuggerConsole(
0842:                                    "Not able to submit breakpoint MethodBreakpoint [examples.advanced.MemoryView]."
0843:                                            + wrongname, lines + 1);
0844:                } catch (Throwable th) {
0845:                    Utilities.captureScreen(this );
0846:                    throw th;
0847:                }
0848:            }
0849:
0850:            /**
0851:             *
0852:             */
0853:            public void testClassBreakpointPrefilledInClass() throws Throwable {
0854:                try {
0855:                    NbDialogOperator dialog = Utilities.newBreakpoint(37);
0856:                    assertTrue("Class breakpoint is not pre-selected",
0857:                            new JComboBoxOperator(dialog, 1).getSelectedItem()
0858:                                    .equals("Class"));
0859:                    assertEquals("Class Name was not set to correct value.",
0860:                            "examples.advanced.MemoryView",
0861:                            new JTextFieldOperator(dialog, 0).getText());
0862:                    dialog.cancel();
0863:                } catch (Throwable th) {
0864:                    Utilities.captureScreen(this );
0865:                    throw th;
0866:                }
0867:            }
0868:
0869:            /**
0870:             *
0871:             */
0872:            public void testClassBreakpointPrefilledInInitializer()
0873:                    throws Throwable {
0874:                try {
0875:                    NbDialogOperator dialog = Utilities.newBreakpoint(45);
0876:                    assertTrue("Class breakpoint is not pre-selected",
0877:                            new JComboBoxOperator(dialog, 1).getSelectedItem()
0878:                                    .equals("Class"));
0879:                    assertEquals("Class Name was not set to correct value.",
0880:                            "examples.advanced.MemoryView",
0881:                            new JTextFieldOperator(dialog, 0).getText());
0882:                    dialog.cancel();
0883:                } catch (Throwable th) {
0884:                    Utilities.captureScreen(this );
0885:                    throw th;
0886:                }
0887:            }
0888:
0889:            /**
0890:             *
0891:             */
0892:            public void testClassBreakpointPrefilledInConstructor()
0893:                    throws Throwable {
0894:                try {
0895:                    NbDialogOperator dialog = Utilities.newBreakpoint(51);
0896:                    setBreakpointType(dialog, "Class");
0897:                    assertEquals("Class Name was not set to correct value.",
0898:                            "examples.advanced.MemoryView",
0899:                            new JTextFieldOperator(dialog, 0).getText());
0900:                    dialog.cancel();
0901:                } catch (Throwable th) {
0902:                    Utilities.captureScreen(this );
0903:                    throw th;
0904:                }
0905:            }
0906:
0907:            /**
0908:             *
0909:             */
0910:            public void testClassBreakpointPrefilledInMethod() throws Throwable {
0911:                try {
0912:                    NbDialogOperator dialog = Utilities.newBreakpoint(80);
0913:                    setBreakpointType(dialog, "Class");
0914:                    assertEquals("Class Name was not set to correct value.",
0915:                            "examples.advanced.MemoryView",
0916:                            new JTextFieldOperator(dialog, 0).getText());
0917:                    dialog.cancel();
0918:                } catch (Throwable th) {
0919:                    Utilities.captureScreen(this );
0920:                    throw th;
0921:                }
0922:            }
0923:
0924:            /**
0925:             *
0926:             */
0927:            public void testClassBreakpointPrefilledInSecondClass()
0928:                    throws Throwable {
0929:                try {
0930:                    NbDialogOperator dialog = Utilities.newBreakpoint(154);
0931:                    setBreakpointType(dialog, "Class");
0932:                    assertEquals("Class Name was not set to correct value.",
0933:                            "examples.advanced.Helper", new JTextFieldOperator(
0934:                                    dialog, 0).getText());
0935:                    dialog.cancel();
0936:                } catch (Throwable th) {
0937:                    Utilities.captureScreen(this );
0938:                    throw th;
0939:                }
0940:            }
0941:
0942:            /**
0943:             *
0944:             */
0945:            public void testClassBreakpointCreation() throws Throwable {
0946:                try {
0947:                    NbDialogOperator dialog = Utilities.newBreakpoint(73);
0948:                    setBreakpointType(dialog, "Class");
0949:                    dialog.ok();
0950:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
0951:                    JTableOperator jTableOperator = new JTableOperator(
0952:                            new TopComponentOperator(
0953:                                    Utilities.breakpointsViewTitle));
0954:                    assertEquals("Class breakpoint was not created.",
0955:                            "Class MemoryView prepare / unload", jTableOperator
0956:                                    .getValueAt(0, 0).toString());
0957:                } catch (Throwable th) {
0958:                    Utilities.captureScreen(this );
0959:                    throw th;
0960:                }
0961:            }
0962:
0963:            /**
0964:             *
0965:             */
0966:            public void testClassBreakpointFunctionalityOnPrimaryClass()
0967:                    throws Throwable {
0968:                try {
0969:                    NbDialogOperator dialog = Utilities.newBreakpoint(73);
0970:                    setBreakpointType(dialog, "Class");
0971:                    dialog.ok();
0972:                    new EventTool().waitNoEvent(500);
0973:                    Utilities.startDebugger();
0974:                    int lines = Utilities.waitDebuggerConsole(
0975:                            "Thread main stopped.", 0);
0976:                    new ContinueAction().perform();
0977:                    Utilities.waitDebuggerConsole(
0978:                            Utilities.runningStatusBarText, lines + 1);
0979:                } catch (Throwable th) {
0980:                    Utilities.captureScreen(this );
0981:                    throw th;
0982:                }
0983:            }
0984:
0985:            /**
0986:             *
0987:             */
0988:            public void testClassBreakpointFunctionalityOnSecondClass()
0989:                    throws Throwable {
0990:                try {
0991:                    NbDialogOperator dialog = Utilities.newBreakpoint(154);
0992:                    setBreakpointType(dialog, "Class");
0993:                    dialog.ok();
0994:                    Utilities.startDebugger();
0995:                    int lines = Utilities.waitDebuggerConsole(
0996:                            "Thread main stopped.", 0);
0997:                    new ContinueAction().perform();
0998:                    Utilities.waitDebuggerConsole(
0999:                            Utilities.runningStatusBarText, lines + 1);
1000:                } catch (Throwable th) {
1001:                    Utilities.captureScreen(this );
1002:                    throw th;
1003:                }
1004:            }
1005:
1006:            /**
1007:             *
1008:             */
1009:            public void testClassBreakpointFunctionalityWithFilter()
1010:                    throws Throwable {
1011:                try {
1012:                    NbDialogOperator dialog = Utilities.newBreakpoint(73);
1013:                    setBreakpointType(dialog, "Class");
1014:                    new JTextFieldOperator(dialog, 0)
1015:                            .setText("examples.advanced.*");
1016:                    new JCheckBoxOperator(dialog, 0).changeSelection(true);
1017:                    new JTextFieldOperator(dialog, 1).setText("*.MemoryView");
1018:                    dialog.ok();
1019:
1020:                    new DebugProjectAction().perform();
1021:                    Utilities.getDebugToolbar().waitComponentVisible(true);
1022:                    //Class breakpoint hit for class examples.advanced.Helper.");
1023:                    int lines = Utilities
1024:                            .waitDebuggerConsole(
1025:                                    "Class breakpoint hit for class examples.advanced.Helper",
1026:                                    0);
1027:                    new ContinueAction().perform();
1028:                    lines = Utilities
1029:                            .waitDebuggerConsole(
1030:                                    "Class breakpoint hit for class examples.advanced.MemoryView$1.",
1031:                                    lines + 1);
1032:                    //Class breakpoint hit for class examples.advanced.MemoryView$1
1033:                    lines = Utilities.waitDebuggerConsole(
1034:                            "Thread main stopped at MemoryView.java:121.",
1035:                            lines + 1);
1036:                    new ContinueAction().perform();
1037:                    Utilities.waitDebuggerConsole(
1038:                            Utilities.runningStatusBarText, lines + 1);
1039:                } catch (Throwable th) {
1040:                    Utilities.captureScreen(this );
1041:                    throw th;
1042:                }
1043:            }
1044:
1045:            /**
1046:             *
1047:             */
1048:            public void testFieldBreakpointPrefilledValues() throws Throwable {
1049:                try {
1050:                    NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
1051:                    setBreakpointType(dialog, "Field");
1052:                    assertEquals("Class Name was not set to correct value.",
1053:                            "examples.advanced.MemoryView",
1054:                            new JTextFieldOperator(dialog, 0).getText());
1055:                    assertEquals("Field Name was not set to correct value.",
1056:                            "msgMemory", new JTextFieldOperator(dialog, 1)
1057:                                    .getText());
1058:                    dialog.cancel();
1059:                } catch (Throwable th) {
1060:                    Utilities.captureScreen(this );
1061:                    throw th;
1062:                }
1063:            }
1064:
1065:            /**
1066:             *
1067:             */
1068:            public void testFieldBreakpointCreation() throws Throwable {
1069:                try {
1070:                    NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
1071:                    setBreakpointType(dialog, "Field");
1072:                    new JComboBoxOperator(dialog, 2)
1073:                            .selectItem(Bundle
1074:                                    .getString(
1075:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1076:                                            "LBL_Field_Breakpoint_Type_Access"));
1077:                    dialog.ok();
1078:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
1079:                    JTableOperator jTableOperator = new JTableOperator(
1080:                            new TopComponentOperator(
1081:                                    Utilities.breakpointsViewTitle));
1082:                    assertEquals("Field breakpoint was not created.",
1083:                            "Field MemoryView.msgMemory access", jTableOperator
1084:                                    .getValueAt(0, 0).toString());
1085:                } catch (Throwable th) {
1086:                    Utilities.captureScreen(this );
1087:                    throw th;
1088:                }
1089:            }
1090:
1091:            /**
1092:             *
1093:             */
1094:            public void testFieldBreakpointFunctionalityAccess()
1095:                    throws Throwable {
1096:                try {
1097:                    NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
1098:                    setBreakpointType(dialog, "Field");
1099:                    new JComboBoxOperator(dialog, 2)
1100:                            .selectItem(Bundle
1101:                                    .getString(
1102:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1103:                                            "LBL_Field_Breakpoint_Type_Access"));
1104:                    dialog.ok();
1105:                    Utilities.startDebugger();
1106:                    Utilities.waitDebuggerConsole(
1107:                            "Thread main stopped at MemoryView.java:104.", 0);
1108:                } catch (Throwable th) {
1109:                    Utilities.captureScreen(this );
1110:                    throw th;
1111:                }
1112:            }
1113:
1114:            /**
1115:             *
1116:             */
1117:            public void testFieldBreakpointFunctionalityModification()
1118:                    throws Throwable {
1119:                try {
1120:                    NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
1121:                    setBreakpointType(dialog, "Field");
1122:                    new JComboBoxOperator(dialog, 2)
1123:                            .selectItem(Bundle
1124:                                    .getString(
1125:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1126:                                            "LBL_Field_Breakpoint_Type_Modification"));
1127:                    dialog.ok();
1128:                    Utilities.startDebugger();
1129:                    Utilities.waitDebuggerConsole(
1130:                            "Thread main stopped at MemoryView.java:45", 0);
1131:                } catch (Throwable th) {
1132:                    Utilities.captureScreen(this );
1133:                    throw th;
1134:                }
1135:            }
1136:
1137:            public void testConditionalFieldBreakpointFunctionality()
1138:                    throws Throwable {
1139:                try {
1140:                    NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
1141:                    setBreakpointType(dialog, "Field");
1142:                    new JComboBoxOperator(dialog, 2)
1143:                            .selectItem(Bundle
1144:                                    .getString(
1145:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1146:                                            "LBL_Field_Breakpoint_Type_Access"));
1147:                    new JCheckBoxOperator(dialog, 0).changeSelection(true);
1148:                    new JEditorPaneOperator(dialog, 0)
1149:                            .setText("UPDATE_TIME >= 1001");
1150:                    dialog.ok();
1151:
1152:                    EditorOperator eo = new EditorOperator("MemoryView.java");
1153:                    //toggle breakpoints
1154:                    Utilities.toggleBreakpoint(eo, 109);
1155:
1156:                    Utilities.startDebugger();
1157:                    int lines = Utilities.waitDebuggerConsole(
1158:                            "Thread main stopped at MemoryView.java:109", 0);
1159:                    new ContinueAction().perform();
1160:                    Utilities.waitDebuggerConsole(
1161:                            "Thread main stopped at MemoryView.java:104",
1162:                            lines + 1);
1163:                } catch (Throwable th) {
1164:                    Utilities.captureScreen(this );
1165:                    throw th;
1166:                }
1167:            }
1168:
1169:            public void testFieldBreakpointsValidation() throws Throwable {
1170:                try {
1171:                    NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
1172:                    setBreakpointType(dialog, "Field");
1173:                    String wrongname = "wrongname";
1174:                    new JTextFieldOperator(dialog, 1).setText(wrongname);
1175:                    dialog.ok();
1176:
1177:                    Utilities.startDebugger();
1178:                    int lines = Utilities.waitDebuggerConsole(
1179:                            "Not able to submit breakpoint FieldBreakpoint examples.advanced.MemoryView."
1180:                                    + wrongname, 0);
1181:                    dialog = Utilities.newBreakpoint(36, 36);
1182:                    setBreakpointType(dialog, "Field");
1183:                    wrongname = "wrongname2";
1184:                    new JTextFieldOperator(dialog, 1).setText(wrongname);
1185:                    dialog.ok();
1186:                    Utilities.waitDebuggerConsole(
1187:                            "Not able to submit breakpoint FieldBreakpoint examples.advanced.MemoryView."
1188:                                    + wrongname, lines + 1);
1189:                } catch (Throwable th) {
1190:                    Utilities.captureScreen(this );
1191:                    throw th;
1192:                }
1193:            }
1194:
1195:            /**
1196:             *
1197:             */
1198:            public void testThreadBreakpointCreation() throws Throwable {
1199:                try {
1200:                    new NewBreakpointAction().perform();
1201:                    NbDialogOperator dialog = new NbDialogOperator(
1202:                            Utilities.newBreakpointTitle);
1203:                    setBreakpointType(dialog, "Thread");
1204:                    dialog.ok();
1205:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
1206:                    JTableOperator jTableOperator = new JTableOperator(
1207:                            new TopComponentOperator(
1208:                                    Utilities.breakpointsViewTitle));
1209:                    assertEquals("Thread breakpoint was not created.",
1210:                            "Thread started", jTableOperator.getValueAt(0, 0)
1211:                                    .toString());
1212:                } catch (Throwable th) {
1213:                    Utilities.captureScreen(this );
1214:                    throw th;
1215:                }
1216:            }
1217:
1218:            /**
1219:             *
1220:             */
1221:            public void testThreadBreakpointFunctionality() throws Throwable {
1222:                try {
1223:                    new NewBreakpointAction().perform();
1224:                    NbDialogOperator dialog = new NbDialogOperator(
1225:                            Utilities.newBreakpointTitle);
1226:                    setBreakpointType(dialog, "Thread");
1227:                    dialog.ok();
1228:
1229:                    Utilities.startDebugger();
1230:                    int lines = Utilities.waitDebuggerConsole(
1231:                            "Thread breakpoint hit by thread ", 0);
1232:                    new ContinueAction().perform();
1233:                    lines = Utilities.waitDebuggerConsole(
1234:                            "Thread breakpoint hit by thread ", lines + 1);
1235:                    new ContinueAction().perform();
1236:                    Utilities.waitDebuggerConsole(
1237:                            Utilities.runningStatusBarText, lines + 1);
1238:                } catch (Throwable th) {
1239:                    Utilities.captureScreen(this );
1240:                    throw th;
1241:                }
1242:            }
1243:
1244:            /**
1245:             *
1246:             */
1247:            public void testThreadBreakpointFunctionalityHitCount()
1248:                    throws Throwable {
1249:                try {
1250:                    new NewBreakpointAction().perform();
1251:                    NbDialogOperator dialog = new NbDialogOperator(
1252:                            Utilities.newBreakpointTitle);
1253:                    setBreakpointType(dialog, "Thread");
1254:                    dialog.ok();
1255:
1256:                    Utilities.startDebugger();
1257:                    int lines = Utilities.waitDebuggerConsole(
1258:                            "Thread breakpoint hit by thread ", 0);
1259:                    new ContinueAction().perform();
1260:                    int backline = lines;
1261:                    lines = Utilities.waitDebuggerConsole(
1262:                            Utilities.runningStatusBarText, lines + 1);
1263:                    assertEquals(
1264:                            "There were more than one hit of the breakpoint",
1265:                            backline, lines - 2);
1266:                } catch (Throwable th) {
1267:                    Utilities.captureScreen(this );
1268:                    throw th;
1269:                }
1270:            }
1271:
1272:            /**
1273:             *
1274:             */
1275:            public void testExceptionBreakpointCreation() throws Throwable {
1276:                try {
1277:                    new NewBreakpointAction().perform();
1278:                    NbDialogOperator dialog = new NbDialogOperator(
1279:                            Utilities.newBreakpointTitle);
1280:                    setBreakpointType(dialog, "Exception");
1281:
1282:                    new JTextFieldOperator(dialog, 0)
1283:                            .setText("java.lang.NullPointerException");
1284:                    new JComboBoxOperator(dialog, 2)
1285:                            .selectItem(Bundle
1286:                                    .getString(
1287:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1288:                                            "LBL_Exception_Breakpoint_Type_Catched"));
1289:                    dialog.ok();
1290:                    Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
1291:                    JTableOperator jTableOperator = new JTableOperator(
1292:                            new TopComponentOperator(
1293:                                    Utilities.breakpointsViewTitle));
1294:                    assertEquals("Thread breakpoint was not created.",
1295:                            "Exception NullPointerException caught",
1296:                            jTableOperator.getValueAt(0, 0).toString());
1297:                } catch (Throwable th) {
1298:                    Utilities.captureScreen(this );
1299:                    throw th;
1300:                }
1301:            }
1302:
1303:            /**
1304:             *
1305:             */
1306:            public void testExceptionBreakpointFunctionality() throws Throwable {
1307:                try {
1308:                    new NewBreakpointAction().perform();
1309:                    NbDialogOperator dialog = new NbDialogOperator(
1310:                            Utilities.newBreakpointTitle);
1311:                    setBreakpointType(dialog, "Exception");
1312:                    new JTextFieldOperator(dialog, 0)
1313:                            .setText("java.lang.ClassNotFoundException");
1314:                    new JComboBoxOperator(dialog, 2)
1315:                            .selectItem(Bundle
1316:                                    .getString(
1317:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1318:                                            "LBL_Exception_Breakpoint_Type_Catched"));
1319:                    dialog.ok();
1320:                    Utilities.startDebugger();
1321:                    new ContinueAction().perform();
1322:                    Utilities.waitDebuggerConsole(
1323:                            "Thread main stopped at URLClassLoader.java", 0);
1324:                } catch (Throwable th) {
1325:                    Utilities.captureScreen(this );
1326:                    throw th;
1327:                }
1328:            }
1329:
1330:            /**
1331:             *
1332:             */
1333:            public void testExceptionBreakpointMatchClasses() throws Throwable {
1334:                try {
1335:                    new NewBreakpointAction().perform();
1336:                    NbDialogOperator dialog = new NbDialogOperator(
1337:                            Utilities.newBreakpointTitle);
1338:                    setBreakpointType(dialog, "Exception");
1339:                    new JTextFieldOperator(dialog, 0)
1340:                            .setText("java.lang.ClassNotFoundException");
1341:                    new JComboBoxOperator(dialog, 2)
1342:                            .selectItem(Bundle
1343:                                    .getString(
1344:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1345:                                            "LBL_Exception_Breakpoint_Type_Catched"));
1346:                    new JCheckBoxOperator(dialog, 0).changeSelection(true);
1347:                    new JTextFieldOperator(dialog, 1)
1348:                            .setText("java.lang.ClassLoader");
1349:                    dialog.ok();
1350:                    Utilities.startDebugger();
1351:                    int lines = Utilities.waitDebuggerConsole(
1352:                            "Thread main stopped at ClassLoader.java", 0);
1353:                    new ContinueAction().perform();
1354:                    lines = Utilities.waitDebuggerConsole(
1355:                            "Thread main stopped at ClassLoader.java",
1356:                            lines + 1);
1357:                    new ContinueAction().perform();
1358:                    lines = Utilities.waitDebuggerConsole(
1359:                            "Thread main stopped at ClassLoader.java",
1360:                            lines + 1);
1361:                    assertFalse(
1362:                            "The debugger hit disabled breakpoint",
1363:                            Utilities
1364:                                    .checkConsoleForText(
1365:                                            "Thread main stopped at URLClassLoader.java",
1366:                                            0));
1367:                } catch (Throwable th) {
1368:                    Utilities.captureScreen(this );
1369:                    throw th;
1370:                }
1371:            }
1372:
1373:            /**
1374:             *
1375:             */
1376:            public void testExceptionBreakpointExcludeClasses()
1377:                    throws Throwable {
1378:                try {
1379:                    new NewBreakpointAction().perform();
1380:                    NbDialogOperator dialog = new NbDialogOperator(
1381:                            Utilities.newBreakpointTitle);
1382:                    setBreakpointType(dialog, "Exception");
1383:                    new JTextFieldOperator(dialog, 0)
1384:                            .setText("java.lang.ClassNotFoundException");
1385:                    new JComboBoxOperator(dialog, 2)
1386:                            .selectItem(Bundle
1387:                                    .getString(
1388:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1389:                                            "LBL_Exception_Breakpoint_Type_Catched"));
1390:                    new JCheckBoxOperator(dialog, 0).changeSelection(true);
1391:                    new JTextFieldOperator(dialog, 2)
1392:                            .setText("java.net.URLClassLoader*");
1393:                    dialog.ok();
1394:                    Utilities.startDebugger();
1395:                    int lines = Utilities.waitDebuggerConsole(
1396:                            "Thread main stopped at ClassLoader.java", 0);
1397:                    new ContinueAction().perform();
1398:                    lines = Utilities.waitDebuggerConsole(
1399:                            "Thread main stopped at ClassLoader.java",
1400:                            lines + 1);
1401:                    new ContinueAction().perform();
1402:                    lines = Utilities.waitDebuggerConsole(
1403:                            "Thread main stopped at ClassLoader.java",
1404:                            lines + 1);
1405:                    assertFalse(
1406:                            "The debugger hit disabled breakpoint",
1407:                            Utilities
1408:                                    .checkConsoleForText(
1409:                                            "Thread main stopped at URLClassLoader.java",
1410:                                            0));
1411:                } catch (Throwable th) {
1412:                    Utilities.captureScreen(this );
1413:                    throw th;
1414:                }
1415:            }
1416:
1417:            /**
1418:             *
1419:             */
1420:            public void testExceptionBreakpointHitCount() throws Throwable {
1421:                try {
1422:                    new NewBreakpointAction().perform();
1423:                    NbDialogOperator dialog = new NbDialogOperator(
1424:                            Utilities.newBreakpointTitle);
1425:                    setBreakpointType(dialog, "Exception");
1426:                    new JTextFieldOperator(dialog, 0)
1427:                            .setText("java.lang.ClassNotFoundException");
1428:                    new JComboBoxOperator(dialog, 2)
1429:                            .selectItem(Bundle
1430:                                    .getString(
1431:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1432:                                            "LBL_Exception_Breakpoint_Type_Catched"));
1433:                    new JCheckBoxOperator(dialog, 2).changeSelection(true);
1434:                    new JComboBoxOperator(dialog, 3)
1435:                            .selectItem(Bundle
1436:                                    .getString(
1437:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1438:                                            "ConditionsPanel.cbWhenHitCount.equals"));
1439:                    new JTextFieldOperator(dialog, 3).setText("1");
1440:                    dialog.ok();
1441:                    Utilities.startDebugger();
1442:                    int lines = Utilities.waitDebuggerConsole(
1443:                            "Thread main stopped at ClassLoader.java", 0);
1444:                    new ContinueAction().perform();
1445:                    assertFalse("The debugger hit disabled breakpoint",
1446:                            Utilities.checkConsoleForText(
1447:                                    "Thread main stopped", lines + 1));
1448:                } catch (Throwable th) {
1449:                    Utilities.captureScreen(this );
1450:                    throw th;
1451:                }
1452:            }
1453:
1454:            /**
1455:             *
1456:             */
1457:            public void testConditionalExceptionBreakpoint() throws Throwable {
1458:                try {
1459:                    new NewBreakpointAction().perform();
1460:                    NbDialogOperator dialog = new NbDialogOperator(
1461:                            Utilities.newBreakpointTitle);
1462:                    setBreakpointType(dialog, "Exception");
1463:                    new JTextFieldOperator(dialog, 0)
1464:                            .setText("java.lang.ClassNotFoundException");
1465:                    new JComboBoxOperator(dialog, 2)
1466:                            .selectItem(Bundle
1467:                                    .getString(
1468:                                            "org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle",
1469:                                            "LBL_Exception_Breakpoint_Type_Catched"));
1470:                    new JCheckBoxOperator(dialog, 1).changeSelection(true);
1471:                    new JEditorPaneOperator(dialog, 0).setText("false");
1472:                    dialog.ok();
1473:                    Utilities.startDebugger();
1474:                    Utilities.waitDebuggerConsole(
1475:                            Utilities.runningStatusBarText, 0);
1476:                    assertFalse("The debugger hit disabled breakpoint",
1477:                            Utilities.checkConsoleForText(
1478:                                    "Thread main stopped", 0));
1479:                } catch (Throwable th) {
1480:                    Utilities.captureScreen(this );
1481:                    throw th;
1482:                }
1483:            }
1484:
1485:            protected void setBreakpointType(NbDialogOperator dialog,
1486:                    String type) {
1487:                new JComboBoxOperator(dialog, 0).selectItem("Java");
1488:                new JComboBoxOperator(dialog, 1).selectItem(type);
1489:            }
1490:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.