Source Code Cross Referenced for DiagramContextMenus_CPD.java in  » IDE-Netbeans » uml » org » netbeans » test » uml » diagramcontextmenu » 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 » uml » org.netbeans.test.uml.diagramcontextmenu 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.test.uml.diagramcontextmenu;
043:
044:        import java.io.*;
045:        import org.netbeans.jemmy.*;
046:        import org.netbeans.jemmy.operators.*;
047:
048:        import org.netbeans.junit.NbTestSuite;
049:        import org.netbeans.test.umllib.*;
050:        import org.netbeans.test.uml.diagramcontextmenu.utils.DCMUtils;
051:        import org.netbeans.test.umllib.testcases.UMLTestCase;
052:        import org.netbeans.test.umllib.util.PopupConstants;
053:
054:        /**
055:         *
056:         * @author yaa
057:         * @spec UML/Diagram_ContextMenus.xml
058:         */
059:        public class DiagramContextMenus_CPD extends UMLTestCase {
060:            private static String prName = "UMLProjectDCntMn";
061:            private static String cpdName = "DComponent";
062:
063:            private static final String workDir = System
064:                    .getProperty("xtest.workdir");
065:            private static String OUT_LOG_FILE = "";
066:            private static String ERR_LOG_FILE = "";
067:            private static PrintStream myOut = null;
068:            private static PrintStream myErr = null;
069:            private static BufferedReader myIn = null;
070:
071:            private String lastTestCase = null;
072:
073:            /** Need to be defined because of JUnit */
074:            public DiagramContextMenus_CPD(String name) {
075:                super (name);
076:            }
077:
078:            public static NbTestSuite suite() {
079:                NbTestSuite suite = new NbTestSuite(
080:                        org.netbeans.test.uml.diagramcontextmenu.DiagramContextMenus_CPD.class);
081:                return suite;
082:            }
083:
084:            /**
085:             * @caseblock Component Diagram
086:             * @usecase Check context menu of component diagram
087:             */
088:            public void testItemCopy() {
089:                lastTestCase = getCurrentTestMethodName();
090:                String itemName = PopupConstants.EDIT + "|"
091:                        + PopupConstants.COPY;
092:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
093:                        diagram, itemName);
094:                if (item == null) {
095:                    fail("Diagram popum menu item '" + itemName + "' not found");
096:                } else if (item.isEnabled()) {
097:                    fail("Diagram popum menu item '" + itemName
098:                            + "' is enabled but should not be");
099:                }
100:            }
101:
102:            /**
103:             * @caseblock Component Diagram
104:             * @usecase Check context menu of component diagram
105:             */
106:            public void testItemCut() {
107:                lastTestCase = getCurrentTestMethodName();
108:                String itemName = PopupConstants.EDIT + "|"
109:                        + PopupConstants.CUT;
110:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
111:                        diagram, itemName);
112:                if (item == null) {
113:                    fail("Diagram popum menu item '" + itemName + "' not found");
114:                } else if (item.isEnabled()) {
115:                    fail("Diagram popum menu item '" + itemName
116:                            + "' is enabled but should not be");
117:                }
118:            }
119:
120:            /**
121:             * @caseblock Component Diagram
122:             * @usecase Check context menu of component diagram
123:             */
124:            public void testItemDelete() {
125:                lastTestCase = getCurrentTestMethodName();
126:                String itemName = PopupConstants.EDIT + "|"
127:                        + PopupConstants.DELETE;
128:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
129:                        diagram, itemName);
130:                if (item == null) {
131:                    fail("Diagram popum menu item '" + itemName + "' not found");
132:                } else if (item.isEnabled()) {
133:                    fail("Diagram popum menu item '" + itemName
134:                            + "' is enabled but should not be");
135:                }
136:            }
137:
138:            /**
139:             * @caseblock Component Diagram
140:             * @usecase Check context menu of component diagram
141:             */
142:            public void testItemPaste() {
143:                lastTestCase = getCurrentTestMethodName();
144:                String itemName = PopupConstants.EDIT + "|"
145:                        + PopupConstants.PASTE;
146:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
147:                        diagram, itemName);
148:                if (item == null) {
149:                    fail("Diagram popum menu item '" + itemName + "' not found");
150:                } else if (item.isEnabled()) {
151:                    fail("Diagram popum menu item '" + itemName
152:                            + "' is enabled but should not be");
153:                }
154:            }
155:
156:            /**
157:             * @caseblock Component Diagram
158:             * @usecase Check context menu of component diagram
159:             */
160:            public void testItemSelectAll() {
161:                lastTestCase = getCurrentTestMethodName();
162:                String itemName = PopupConstants.EDIT + "|"
163:                        + PopupConstants.SELECT_ALL;
164:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
165:                        diagram, itemName);
166:                if (item == null) {
167:                    fail("Diagram popum menu item '" + itemName + "' not found");
168:                } else if (!item.isEnabled()) {
169:                    fail("Diagram popum menu item '" + itemName
170:                            + "' is disabled but should not be");
171:                }
172:            }
173:
174:            /**
175:             * @caseblock Component Diagram
176:             * @usecase Check context menu of component diagram
177:             */
178:            public void testItemSelectAllSimilar() {
179:                lastTestCase = getCurrentTestMethodName();
180:                String itemName = PopupConstants.EDIT + "|"
181:                        + PopupConstants.SELECT_ALL_SIMILAR;
182:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
183:                        diagram, itemName);
184:                if (item == null) {
185:                    fail("Diagram popum menu item '" + itemName + "' not found");
186:                } else if (item.isEnabled()) {
187:                    fail("Diagram popum menu item '" + itemName
188:                            + "' is enabled but should not be");
189:                }
190:            }
191:
192:            /**
193:             * @caseblock Component Diagram
194:             * @usecase Check context menu of component diagram
195:             */
196:            public void testItemInvertSelection() {
197:                lastTestCase = getCurrentTestMethodName();
198:                String itemName = PopupConstants.EDIT + "|"
199:                        + PopupConstants.INVERT_SELECTION;
200:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
201:                        diagram, itemName);
202:                if (item == null) {
203:                    fail("Diagram popum menu item '" + itemName + "' not found");
204:                } else if (!item.isEnabled()) {
205:                    fail("Diagram popum menu item '" + itemName
206:                            + "' is disabled but should not be");
207:                }
208:            }
209:
210:            /**
211:             * @caseblock Component Diagram
212:             * @usecase Check context menu of component diagram
213:             */
214:            public void testItemSetDimensions() {
215:                lastTestCase = getCurrentTestMethodName();
216:                String itemName = PopupConstants.EDIT + "|"
217:                        + PopupConstants.SET_DIMESIONS;
218:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
219:                        diagram, itemName);
220:                if (item == null) {
221:                    fail("Diagram popum menu item '" + itemName + "' not found");
222:                } else if (item.isEnabled()) {
223:                    fail("Diagram popum menu item '" + itemName
224:                            + "' is enabled but should not be");
225:                }
226:            }
227:
228:            /**
229:             * @caseblock Component Diagram
230:             * @usecase Check context menu of component diagram
231:             */
232:            public void testItemLayoutHierarchical() {
233:                lastTestCase = getCurrentTestMethodName();
234:                String itemName = DCMUtils.DiagramPopupConstants.LAYOUT + "|"
235:                        + DCMUtils.DiagramPopupConstants.LAYOUT_HIERARCHICAL;
236:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
237:                        diagram, itemName);
238:                if (item == null) {
239:                    fail("Diagram popum menu item '" + itemName + "' not found");
240:                } else if (!item.isEnabled()) {
241:                    fail("Diagram popum menu item '" + itemName
242:                            + "' is disabled but should not be");
243:                }
244:            }
245:
246:            /**
247:             * @caseblock Component Diagram
248:             * @usecase Check context menu of component diagram
249:             */
250:            public void testItemLayoutOrthogonal() {
251:                lastTestCase = getCurrentTestMethodName();
252:                String itemName = DCMUtils.DiagramPopupConstants.LAYOUT + "|"
253:                        + DCMUtils.DiagramPopupConstants.LAYOUT_ORTHOGONAL;
254:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
255:                        diagram, itemName);
256:                if (item == null) {
257:                    fail("Diagram popum menu item '" + itemName + "' not found");
258:                } else if (!item.isEnabled()) {
259:                    fail("Diagram popum menu item '" + itemName
260:                            + "' is disabled but should not be");
261:                }
262:            }
263:
264:            /**
265:             * @caseblock Component Diagram
266:             * @usecase Check context menu of component diagram
267:             */
268:            public void testItemLayoutSymmetric() {
269:                lastTestCase = getCurrentTestMethodName();
270:                String itemName = DCMUtils.DiagramPopupConstants.LAYOUT + "|"
271:                        + DCMUtils.DiagramPopupConstants.LAYOUT_SYMMETRIC;
272:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
273:                        diagram, itemName);
274:                if (item == null) {
275:                    fail("Diagram popum menu item '" + itemName + "' not found");
276:                } else if (!item.isEnabled()) {
277:                    fail("Diagram popum menu item '" + itemName
278:                            + "' is disabled but should not be");
279:                }
280:            }
281:
282:            /**
283:             * @caseblock Component Diagram
284:             * @usecase Check context menu of component diagram
285:             */
286:            public void testItemLayoutIncremental() {
287:                lastTestCase = getCurrentTestMethodName();
288:                String itemName = DCMUtils.DiagramPopupConstants.LAYOUT + "|"
289:                        + DCMUtils.DiagramPopupConstants.LAYOUT_INCREMENTAL;
290:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
291:                        diagram, itemName);
292:                if (item == null) {
293:                    fail("Diagram popum menu item '" + itemName + "' not found");
294:                } else if (!item.isEnabled()) {
295:                    fail("Diagram popum menu item '" + itemName
296:                            + "' is disabled but should not be");
297:                }
298:            }
299:
300:            /**
301:             * @caseblock Component Diagram
302:             * @usecase Check context menu of component diagram
303:             */
304:            public void testItemLayoutProperties() {
305:                lastTestCase = getCurrentTestMethodName();
306:                String itemName = DCMUtils.DiagramPopupConstants.LAYOUT + "|"
307:                        + DCMUtils.DiagramPopupConstants.LAYOUT_PROPERTIES;
308:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
309:                        diagram, itemName);
310:                if (item == null) {
311:                    fail("Diagram popum menu item '" + itemName + "' not found");
312:                } else if (!item.isEnabled()) {
313:                    fail("Diagram popum menu item '" + itemName
314:                            + "' is disabled but should not be");
315:                } else {
316:                    DCMUtils.pushDiagramPopupMenuItem(diagram, itemName);
317:                    if (!DCMUtils
318:                            .findAndCloseDialog(DCMUtils.DialogTitles.LAYOUT_PROPERTIES)) {
319:                        fail("Dialog with title '" + itemName
320:                                + "' not found or not closed correctly");
321:                    }
322:                }
323:            }
324:
325:            /**
326:             * @caseblock Component Diagram
327:             * @usecase Check context menu of component diagram
328:             */
329:            public void testItemZoom() {
330:                lastTestCase = getCurrentTestMethodName();
331:                String itemName = DCMUtils.DiagramPopupConstants.ZOOM;
332:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
333:                        diagram, itemName);
334:                if (item == null) {
335:                    fail("Diagram popum menu item '" + itemName + "' not found");
336:                } else if (!item.isEnabled()) {
337:                    fail("Diagram popum menu item '" + itemName
338:                            + "' is disabled but should not be");
339:                } else {
340:                    DCMUtils.pushDiagramPopupMenuItem(diagram, itemName);
341:                    if (!DCMUtils
342:                            .findAndCloseDialog(DCMUtils.DialogTitles.ZOOM)) {
343:                        fail("Dialog with title '" + itemName
344:                                + "' not found or not closed correctly");
345:                    }
346:                }
347:            }
348:
349:            /**
350:             * @caseblock Component Diagram
351:             * @usecase Check context menu of component diagram
352:             */
353:            public void testItemZoomIn() {
354:                lastTestCase = getCurrentTestMethodName();
355:                String itemName = DCMUtils.DiagramPopupConstants.ZOOM_IN;
356:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
357:                        diagram, itemName);
358:                if (item == null) {
359:                    fail("Diagram popum menu item '" + itemName + "' not found");
360:                } else if (!item.isEnabled()) {
361:                    fail("Diagram popum menu item '" + itemName
362:                            + "' is disabled but should not be");
363:                }
364:            }
365:
366:            /**
367:             * @caseblock Component Diagram
368:             * @usecase Check context menu of component diagram
369:             */
370:            public void testItemZoomOut() {
371:                lastTestCase = getCurrentTestMethodName();
372:                String itemName = DCMUtils.DiagramPopupConstants.ZOOM_OUT;
373:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
374:                        diagram, itemName);
375:                if (item == null) {
376:                    fail("Diagram popum menu item '" + itemName + "' not found");
377:                } else if (!item.isEnabled()) {
378:                    fail("Diagram popum menu item '" + itemName
379:                            + "' is disabled but should not be");
380:                }
381:            }
382:
383:            /**
384:             * @caseblock Component Diagram
385:             * @usecase Check context menu of component diagram
386:             */
387:            public void testItemSynchronize() {
388:                lastTestCase = getCurrentTestMethodName();
389:                String itemName = DCMUtils.DiagramPopupConstants.SYNCHRONIZE;
390:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
391:                        diagram, itemName);
392:                if (item == null) {
393:                    fail("Diagram popum menu item '" + itemName + "' not found");
394:                } else if (!item.isEnabled()) {
395:                    fail("Diagram popum menu item '" + itemName
396:                            + "' is disabled but should not be");
397:                }
398:            }
399:
400:            /**
401:             * @caseblock Component Diagram
402:             * @usecase Check context menu of component diagram
403:             */
404:            public void testItemAssociateWith() {
405:                lastTestCase = getCurrentTestMethodName();
406:                String itemName = DCMUtils.DiagramPopupConstants.ASSOCIATE_WITH;
407:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
408:                        diagram, itemName);
409:                if (item == null) {
410:                    fail("Diagram popum menu item '" + itemName + "' not found");
411:                } else if (!item.isEnabled()) {
412:                    fail("Diagram popum menu item '" + itemName
413:                            + "' is disabled but should not be");
414:                } else {
415:                    DCMUtils.pushDiagramPopupMenuItem(diagram, itemName);
416:                    if (!DCMUtils
417:                            .findAndCloseDialog(DCMUtils.DialogTitles.ASSOCIATE_WITH)) {
418:                        fail("Dialog with title '" + itemName
419:                                + "' not found or not closed correctly");
420:                    }
421:                }
422:            }
423:
424:            /**
425:             * @caseblock Component Diagram
426:             * @usecase Check context menu of component diagram
427:             */
428:            public void testItemApplyDesignPattern() {
429:                lastTestCase = getCurrentTestMethodName();
430:                String itemName = DCMUtils.DiagramPopupConstants.APPLY_DESIGN_PATTERN;
431:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
432:                        diagram, itemName);
433:                if (item == null) {
434:                    fail("Diagram popum menu item '" + itemName + "' not found");
435:                } else if (!item.isEnabled()) {
436:                    fail("Diagram popum menu item '" + itemName
437:                            + "' is disabled but should not be");
438:                } else {
439:                    DCMUtils.pushDiagramPopupMenuItem(diagram, itemName);
440:                    if (!DCMUtils
441:                            .findAndCloseDialog(DCMUtils.DialogTitles.APPLY_DESIGN_PATTERN)) {
442:                        fail("Dialog with title '" + itemName
443:                                + "' not found or not closed correctly");
444:                    }
445:                }
446:            }
447:
448:            /**
449:             * @caseblock Component Diagram
450:             * @usecase Check context menu of component diagram
451:             */
452:            public void testItemProperties() {
453:                lastTestCase = getCurrentTestMethodName();
454:                String itemName = DCMUtils.DiagramPopupConstants.PROPERTIES;
455:                JMenuItemOperator item = DCMUtils.checkDiagramPopupMenuItem(
456:                        diagram, itemName);
457:                if (item == null) {
458:                    fail("Diagram popum menu item '" + itemName + "' not found");
459:                } else if (!item.isEnabled()) {
460:                    fail("Diagram popum menu item '" + itemName
461:                            + "' is disabled but should not be");
462:                } else {
463:                    DCMUtils.pushDiagramPopupMenuItem(diagram, itemName);
464:                    if (!DCMUtils
465:                            .findAndCloseDialog(DCMUtils.DialogTitles.PROPERTIES)) {
466:                        fail("Dialog with title '" + itemName
467:                                + "' not found or not closed correctly");
468:                    }
469:                }
470:            }
471:
472:            /**
473:             * @caseblock Component Diagram
474:             * @usecase Check context menu of component diagram
475:             */
476:            public void testCheckUnnecessaryItems() {
477:                lastTestCase = getCurrentTestMethodName();
478:                String[] itemsNecessary = new String[] {
479:                        PopupConstants.EDIT + "|" + PopupConstants.COPY,
480:                        PopupConstants.EDIT + "|" + PopupConstants.CUT,
481:                        PopupConstants.EDIT + "|" + PopupConstants.DELETE,
482:                        PopupConstants.EDIT + "|" + PopupConstants.PASTE,
483:                        PopupConstants.EDIT + "|" + PopupConstants.SELECT_ALL,
484:                        PopupConstants.EDIT + "|"
485:                                + PopupConstants.SELECT_ALL_SIMILAR,
486:                        PopupConstants.EDIT + "|"
487:                                + PopupConstants.INVERT_SELECTION,
488:                        PopupConstants.EDIT + "|"
489:                                + PopupConstants.SET_DIMESIONS,
490:                        DCMUtils.DiagramPopupConstants.LAYOUT
491:                                + "|"
492:                                + DCMUtils.DiagramPopupConstants.LAYOUT_HIERARCHICAL,
493:                        DCMUtils.DiagramPopupConstants.LAYOUT
494:                                + "|"
495:                                + DCMUtils.DiagramPopupConstants.LAYOUT_ORTHOGONAL,
496:                        DCMUtils.DiagramPopupConstants.LAYOUT
497:                                + "|"
498:                                + DCMUtils.DiagramPopupConstants.LAYOUT_SYMMETRIC,
499:                        DCMUtils.DiagramPopupConstants.LAYOUT
500:                                + "|"
501:                                + DCMUtils.DiagramPopupConstants.LAYOUT_INCREMENTAL,
502:                        DCMUtils.DiagramPopupConstants.LAYOUT
503:                                + "|"
504:                                + DCMUtils.DiagramPopupConstants.LAYOUT_PROPERTIES,
505:                        DCMUtils.DiagramPopupConstants.ZOOM,
506:                        DCMUtils.DiagramPopupConstants.ZOOM_IN,
507:                        DCMUtils.DiagramPopupConstants.ZOOM_OUT,
508:                        DCMUtils.DiagramPopupConstants.SYNCHRONIZE,
509:                        DCMUtils.DiagramPopupConstants.ASSOCIATE_WITH,
510:                        DCMUtils.DiagramPopupConstants.APPLY_DESIGN_PATTERN,
511:                        DCMUtils.DiagramPopupConstants.PROPERTIES,
512:                        DCMUtils.DiagramPopupConstants.SELECT_IN_MODEL };
513:
514:                String result = DCMUtils.checkUnnecessaryItems(diagram,
515:                        itemsNecessary, getLog());
516:                if (!result.equals("")) {
517:                    fail("Diagram context menu contains unnecessary items (see log also): "
518:                            + result);
519:                }
520:            }
521:
522:            //------------------------------------------------------------------------------
523:
524:            public void setUp() throws FileNotFoundException {
525:                System.out.println("########  " + getName() + "  #######");
526:                JemmyProperties.setCurrentTimeout(
527:                        "DialogWaiter.WaitDialogTimeout", 1000);
528:                JemmyProperties.setCurrentTimeout("Waiter.WaitingTime", 1000);
529:                JemmyProperties.setCurrentTimeout(
530:                        "JMenuOperator.WaitPopupTimeout", 2000);
531:                JemmyProperties.setCurrentTimeout(
532:                        "ComponentOperator.WaitComponentTimeout", 2000);
533:                JemmyProperties.setCurrentTimeout(
534:                        "WindowWaiter.WaitWindowTimeout", 2000);
535:
536:                OUT_LOG_FILE = workDir + File.separator + "jout_" + getName()
537:                        + ".log";
538:                ERR_LOG_FILE = workDir + File.separator + "jerr_" + getName()
539:                        + ".log";
540:
541:                myOut = new PrintStream(new FileOutputStream(OUT_LOG_FILE),
542:                        true);
543:                myErr = new PrintStream(new FileOutputStream(ERR_LOG_FILE),
544:                        true);
545:                JemmyProperties.setCurrentOutput(new TestOut(System.in, myOut,
546:                        myErr));
547:
548:                diagram = DCMUtils.openDiagram(prName, cpdName,
549:                        NewDiagramWizardOperator.COMPONENT_DIAGRAM, workDir);
550:                if (diagram == null) {
551:                    fail("Can't open diagram '" + cpdName + "', project '"
552:                            + prName + "'.");
553:                }
554:            }
555:
556:            public void tearDown() throws FileNotFoundException, IOException,
557:                    InterruptedException {
558:                org.netbeans.test.umllib.util.Utils
559:                        .makeScreenShot(lastTestCase);
560:                //org.netbeans.test.umllib.util.Utils.tearDown();
561:                diagram.getDrawingArea().pushKey(
562:                        java.awt.event.KeyEvent.VK_ESCAPE);
563:                try {
564:                    JDialogOperator dlgError = new JDialogOperator(
565:                            "Unexpected Exception");
566:                    JTextAreaOperator textarea = new JTextAreaOperator(dlgError);
567:                    String str = textarea.getDisplayedText();
568:                    int pos = str.indexOf("\n");
569:                    if (pos != -1) {
570:                        str = str.substring(1, pos - 1);
571:                    }
572:                    dlgError.close();
573:                    fail(" " + str);
574:                } catch (TimeoutExpiredException e) {
575:                }
576:
577:                myIn = new BufferedReader(new FileReader(ERR_LOG_FILE));
578:                String line;
579:                do {
580:                    line = myIn.readLine();
581:                    if (line != null && line.indexOf("Exception") != -1) {
582:                        if ((line.indexOf("Unexpected Exception") == -1)
583:                                && (line.indexOf("TimeoutExpiredException") == -1)) {
584:                            //fail(line);
585:                        }
586:                    }
587:                } while (line != null);
588:            }
589:
590:            private DiagramOperator diagram = null;
591:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.