Source Code Cross Referenced for PlaceFromProjectTree.java in  » IDE-Netbeans » uml » org » netbeans » test » uml » componentdiagram » 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.componentdiagram 
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.componentdiagram;
043:
044:        import java.awt.event.InputEvent;
045:        import java.awt.event.KeyEvent;
046:        import org.netbeans.jellytools.MainWindowOperator;
047:        import org.netbeans.jellytools.ProjectsTabOperator;
048:        import org.netbeans.jellytools.nodes.Node;
049:        import org.netbeans.jellytools.properties.PropertySheetOperator;
050:        import org.netbeans.jemmy.EventTool;
051:        import org.netbeans.jemmy.operators.JButtonOperator;
052:        import org.netbeans.jemmy.operators.JDialogOperator;
053:        import org.netbeans.jemmy.operators.JTreeOperator;
054:
055:        import org.netbeans.junit.NbTestSuite; //import qa.uml.UMLClassOperator;
056:        import org.netbeans.test.umllib.DiagramElementOperator;
057:        import org.netbeans.test.umllib.DiagramOperator;
058:        import org.netbeans.test.umllib.DrawingAreaOperator;
059:        import org.netbeans.test.umllib.ElementTypes;
060:        import org.netbeans.test.umllib.UMLPaletteOperator;
061:        import org.netbeans.test.umllib.exceptions.NotFoundException;
062:        import org.netbeans.test.umllib.testcases.UMLTestCase;
063:
064:        /**
065:         *
066:         * @author psb
067:         * @spec UML/ComponentDiagram.xml
068:         */
069:        public class PlaceFromProjectTree extends UMLTestCase {
070:
071:            //some system properties
072:            private static String contextPropItemName = "Properties";
073:            private static String umlPropertyWindowTitle = "Project Properties";
074:            private static String umlSourcePackagesLabel = "Source Packages";
075:            private static String umlSourcePackagesColumn = "Folder Label";
076:            private static String umlSourceUsageColumn = "Model?";
077:            private static String mainTreeTabName = "Projects";
078:            //common test properties
079:            private static String prName = "ComponentDiagramProjectFT";
080:            private static String project = prName + "|Model";
081:            private static String sourceProject = "source";
082:            private static boolean codeSync = false;
083:            private static String defaultNewElementName = org.netbeans.test.uml.componentdiagram.utils.Utils.defaultNewElementName;
084:            private static String defaultReturnType = org.netbeans.test.uml.componentdiagram.utils.Utils.defaultReturnType;
085:            private static String defaultAttributeType = org.netbeans.test.uml.componentdiagram.utils.Utils.defaultAttributeType;
086:            private static String defaultAttributeVisibility = org.netbeans.test.uml.componentdiagram.utils.Utils.defaultAttributeVisibility;
087:            private static String defaultOperationVisibility = org.netbeans.test.uml.componentdiagram.utils.Utils.defaultOperationVisibility;
088:            private ProjectsTabOperator pto = null;
089:            private Node lastDiagramNode = null;
090:            private JTreeOperator prTree = null;
091:            private static String workdir = System.getProperty("xtest.workdir");
092:            private String lastTestCase = null;
093:            //--
094:            private static String diagramName1 = "cpD1";
095:            private static String workPkg1 = "pkg1";
096:            private static String element1 = "Component";
097:            private static String elementName1 = defaultNewElementName;
098:            private static ElementTypes elementType1 = ElementTypes.COMPONENT;
099:            //--
100:            private static String diagramName2 = "cpD2";
101:            private static String workPkg2 = "pkg2";
102:            private static String element2 = "Class";
103:            private static String elementName2 = defaultNewElementName;
104:            private static ElementTypes elementType2 = ElementTypes.CLASS;
105:            //--
106:            private static String diagramName3 = "cpD3";
107:            private static String workPkg3 = "pkg3";
108:            private static String element3 = "Interface";
109:            private static String elementName3 = defaultNewElementName;
110:            private static ElementTypes elementType3 = ElementTypes.INTERFACE;
111:            //--
112:            private static String diagramName4 = "cpD4";
113:            private static String workPkg4 = "pkg4";
114:            private static String element4 = "Package";
115:            private static String elementName4 = defaultNewElementName;
116:            private static ElementTypes elementType4 = ElementTypes.PACKAGE;
117:            //--
118:            private static String diagramName5 = "cpD5";
119:            private static String workPkg5 = "pkg5";
120:            private static String element5 = "Artifact";
121:            private static String elementName5 = defaultNewElementName;
122:            private static ElementTypes elementType5 = ElementTypes.ARTIFACT;
123:            //--
124:            private static String diagramName6 = "cpD6";
125:            private static String workPkg6 = "pkg6";
126:            private static String element6 = "Assembly Connector";
127:            private static String elementName6 = defaultNewElementName;
128:            private static ElementTypes elementType6 = ElementTypes.INTERFACE;
129:            //--
130:            private static String diagramName7 = "cpD7";
131:            private static String workPkg7 = "pkg7";
132:            private static String element7 = "Template Class";
133:            private static String elementName7 = defaultNewElementName;
134:            private static ElementTypes elementType7 = ElementTypes.TEMPLATE_CLASS;
135:            //--
136:            private static String diagramName8 = "cpD8";
137:            private static String workPkg8 = "pkg8";
138:            private static String element8 = "Derivation Classifier";
139:            private static String elementName8 = defaultNewElementName;
140:            private static ElementTypes elementType8 = ElementTypes.DERIVATION_CLASSIFIER;
141:            //--
142:            private static String diagramName9 = "cpD9";
143:            private static String workPkg9 = "pkg9";
144:            private static String element9 = "Design Pattern";
145:            private static String elementName9 = defaultNewElementName;
146:            private static ElementTypes elementType9 = ElementTypes.DESIGN_PATTERN;
147:            //--
148:            private static String diagramName10 = "cpD10";
149:            private static String workPkg10 = "pkg10";
150:            private static String element10 = "Role";
151:            private static String elementName10 = defaultNewElementName;
152:            private static ElementTypes elementType10 = ElementTypes.ROLE;
153:            //--
154:            private static String diagramName11 = "cpD11";
155:            private static String workPkg11 = "pkg11";
156:            private static String element11 = "Interface Role";
157:            private static String elementName11 = defaultNewElementName;
158:            private static ElementTypes elementType11 = ElementTypes.INTERFACE_ROLE;
159:            //--
160:            private static String diagramName12 = "cpD12";
161:            private static String workPkg12 = "pkg12";
162:            private static String element12 = "Actor Role";
163:            private static String elementName12 = defaultNewElementName;
164:            private static ElementTypes elementType12 = ElementTypes.ACTOR_ROLE;
165:            //--
166:            private static String diagramName13 = "cpD13";
167:            private static String workPkg13 = "pkg13";
168:            private static String element13 = "Class Role";
169:            private static String elementName13 = defaultNewElementName;
170:            private static ElementTypes elementType13 = ElementTypes.CLASS_ROLE;
171:            //--
172:            private static String diagramName14 = "cpD14";
173:            private static String workPkg14 = "pkg14";
174:            private static String element14 = "Use Case Role";
175:            private static String elementName14 = defaultNewElementName;
176:            private static ElementTypes elementType14 = ElementTypes.USE_CASE_ROLE;
177:            //--
178:            private static String diagramName15 = "cpD15";
179:            private static String workPkg15 = "pkg15";
180:            private static String element15 = "Role Binding";
181:            private static String elementName15 = defaultNewElementName;
182:            private static ElementTypes elementType15 = ElementTypes.ROLE_BINDING;
183:            //--
184:            private static String diagramName16 = "cpD16";
185:            private static String workPkg16 = "pkg16";
186:            private static String element16 = "Comment";
187:            private static String elementName16 = "";
188:            private static ElementTypes elementType16 = ElementTypes.COMMENT;
189:            //--
190:            private static String diagramName17 = "cpD17";
191:            private static String workPkg17 = "pkg17";
192:            private static String element17 = "Link Comment";
193:            private static String elementName17 = "";
194:            private static ElementTypes elementType17 = ElementTypes.LINK_COMMENT;
195:
196:            //--
197:            /* private static String diagramName15 = "cpD15";
198:             private static String workPkg15 = "pkg15";
199:             private static String element15="Activity Edge";
200:             private static String treeNode15=element15;
201:             private static String elementName15="";
202:             private static LinkTypes elementType15=LinkTypes.ACTIVITY_EDGE;
203:             private static boolean eIO15=true;
204:             //--
205:             private static String diagramName16 = "cpD16";
206:             private static String workPkg16 = "pkg16";
207:             private static String element16="Dependency";
208:             private static String treeNode16=element16;
209:             private static String elementName16="";
210:             private static LinkTypes elementType16=LinkTypes.DEPENDENCY;
211:             private static boolean eIO16=false;
212:             //--
213:             private static String diagramName17 = "cpD17";
214:             private static String workPkg17 = "pkg17";
215:             private static String element17="Realize";
216:             private static String treeNode17="Realization";
217:             private static String elementName17="";
218:             private static LinkTypes elementType17=LinkTypes.REALIZE;
219:             private static boolean eIO17=false;
220:             //--
221:             private static String diagramName18 = "cpD18";
222:             private static String workPkg18 = "pkg18";
223:             private static String element18="Usage";
224:             private static String treeNode18=element18;
225:             private static String elementName18="";
226:             private static LinkTypes elementType18=LinkTypes.USAGE;
227:             private static boolean eIO18=false;
228:             //--
229:             private static String diagramName19 = "cpD19";
230:             private static String workPkg19 = "pkg19";
231:             private static String element19="Permission";
232:             private static String treeNode19=element19;
233:             private static String elementName19="";
234:             private static LinkTypes elementType19=LinkTypes.PERMISSION;
235:             private static boolean eIO19=false;
236:             //--
237:             private static String diagramName20 = "cpD20";
238:             private static String workPkg20 = "pkg20";
239:             private static String element20="Abstraction";
240:             private static String treeNode20=element20;
241:             private static String elementName20="";
242:             private static LinkTypes elementType20=LinkTypes.ABSTRACTION;
243:             private static boolean eIO20=false;*/
244:
245:            /** Need to be defined because of JUnit */
246:            public PlaceFromProjectTree(String name) {
247:                super (name);
248:            }
249:
250:            public static NbTestSuite suite() {
251:                NbTestSuite suite = new NbTestSuite(
252:                        org.netbeans.test.uml.componentdiagram.PlaceFromProjectTree.class);
253:                return suite;
254:            }
255:
256:            private DiagramOperator createOrOpenDiagram(String project,
257:                    String workPkg, String diagram) {
258:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
259:                        .createOrOpenDiagram(
260:                                project,
261:                                workPkg,
262:                                diagram,
263:                                org.netbeans.test.umllib.NewDiagramWizardOperator.COMPONENT_DIAGRAM);
264:                pto = rt.pto;
265:                prTree = new JTreeOperator(pto);
266:                lastDiagramNode = rt.lastDiagramNode;
267:                return rt.dOp;
268:            }
269:
270:            public void testPlaceFromTree1() {
271:                lastTestCase = getCurrentTestMethodName();
272:                testElementPlaceFromTree(workPkg1, diagramName1, element1,
273:                        elementName1, elementType1);
274:            }
275:
276:            public void testPlaceFromTree2() {
277:                lastTestCase = getCurrentTestMethodName();
278:                ;
279:                testElementPlaceFromTree(workPkg2, diagramName2, element2,
280:                        elementName2, elementType2);
281:            }
282:
283:            public void testPlaceFromTree3() {
284:                lastTestCase = getCurrentTestMethodName();
285:                ;
286:                testElementPlaceFromTree(workPkg3, diagramName3, element3,
287:                        elementName3, elementType3);
288:            }
289:
290:            public void testPlaceFromTree4() {
291:                lastTestCase = getCurrentTestMethodName();
292:                ;
293:                testElementPlaceFromTree(workPkg4, diagramName4, element4,
294:                        elementName4, elementType4);
295:            }
296:
297:            public void testPlaceFromTree5() {
298:                lastTestCase = getCurrentTestMethodName();
299:                ;
300:                testElementPlaceFromTree(workPkg5, diagramName5, element5,
301:                        elementName5, elementType5);
302:            }
303:
304:            public void testPlaceFromTree6() {
305:                lastTestCase = getCurrentTestMethodName();
306:                testElementPlaceFromTree(workPkg6, diagramName6, element6,
307:                        elementName6, elementType6);
308:            }
309:
310:            public void testPlaceFromTree7() {
311:                lastTestCase = getCurrentTestMethodName();
312:                testElementPlaceFromTree(workPkg7, diagramName7, element7,
313:                        elementName7, elementType7);
314:            }
315:
316:            public void testPlaceFromTree8() {
317:                lastTestCase = getCurrentTestMethodName();
318:                testElementPlaceFromTree(workPkg8, diagramName8, element8,
319:                        elementName8, elementType8);
320:            }
321:
322:            public void testPlaceFromTree9() {
323:                lastTestCase = getCurrentTestMethodName();
324:                testElementPlaceFromTree(workPkg9, diagramName9, element9,
325:                        elementName9, elementType9);
326:            }
327:
328:            public void testPlaceFromTree10() {
329:                lastTestCase = getCurrentTestMethodName();
330:                testElementPlaceFromTree(workPkg10, diagramName10, element10,
331:                        elementName10, elementType10);
332:            }
333:
334:            public void testPlaceFromTree11() {
335:                lastTestCase = getCurrentTestMethodName();
336:                testElementPlaceFromTree(workPkg11, diagramName11, element11,
337:                        elementName11, elementType11);
338:            }
339:
340:            public void testPlaceFromTree12() {
341:                lastTestCase = getCurrentTestMethodName();
342:                testElementPlaceFromTree(workPkg12, diagramName12, element12,
343:                        elementName12, elementType12);
344:            }
345:
346:            public void testPlaceFromTree13() {
347:                lastTestCase = getCurrentTestMethodName();
348:                testElementPlaceFromTree(workPkg13, diagramName13, element13,
349:                        elementName13, elementType13);
350:            }
351:
352:            public void testPlaceFromTree14() {
353:                lastTestCase = getCurrentTestMethodName();
354:                testElementPlaceFromTree(workPkg14, diagramName14, element14,
355:                        elementName14, elementType14);
356:            }
357:
358:            public void testPlaceFromTree15() {
359:                lastTestCase = getCurrentTestMethodName();
360:                testElementPlaceFromTree(workPkg15, diagramName15, element15,
361:                        elementName15, elementType15);
362:            }
363:
364:            public void testPlaceFromTree16() {
365:                lastTestCase = getCurrentTestMethodName();
366:                testElementPlaceFromTree(workPkg16, diagramName16, element16,
367:                        elementName16, elementType16);
368:            }
369:
370:            public void testPlaceFromTree17() {
371:                lastTestCase = getCurrentTestMethodName();
372:                testElementPlaceFromTree(workPkg17, diagramName17, element17,
373:                        elementName17, elementType17);
374:            }
375:
376:            public void setUp() {
377:                System.out.println("########  " + getName() + "  #######");
378:                pto = ProjectsTabOperator.invoke();
379:                if (!codeSync) {
380:                    org.netbeans.test.uml.componentdiagram.utils.Utils
381:                            .commonComponentDiagramSetup(workdir, prName);
382:                    //
383:                    codeSync = true;
384:                }
385:
386:            }
387:
388:            public void tearDown() {
389:                org.netbeans.test.umllib.util.Utils
390:                        .makeScreenShot(lastTestCase);
391:                //popup protection
392:                MainWindowOperator.getDefault().pushKey(KeyEvent.VK_ESCAPE);
393:                new EventTool().waitNoEvent(1000);
394:                //
395:                closeAllModal();
396:                org.netbeans.test.umllib.util.Utils.saveAll();
397:                if (lastDiagramNode != null) {
398:                    lastDiagramNode.collapse();
399:                    new Node(lastDiagramNode.tree(), lastDiagramNode
400:                            .getParentPath()).collapse();
401:                }
402:                try {
403:                    DiagramOperator d = new DiagramOperator("cpD");
404:                    d.closeAllDocuments();
405:                    d.waitClosed();
406:                    new EventTool().waitNoEvent(1000);
407:                } catch (Exception ex) {
408:                }
409:                ;
410:                closeAllModal();
411:                //save
412:                org.netbeans.test.umllib.util.Utils.tearDown();
413:            }
414:
415:            private void testElementPlaceAndName(String workPkg,
416:                    String diagramName, String element, String elementName,
417:                    ElementTypes elementType, String newName) {
418:                DiagramOperator d = createOrOpenDiagram(project, workPkg,
419:                        diagramName);
420:                //
421:                int numChild = new Node(prTree, lastDiagramNode.getParentPath())
422:                        .getChildren().length;
423:                //
424:                UMLPaletteOperator pl = new UMLPaletteOperator();
425:                //
426:                try {
427:                    pl.selectTool(element);
428:                } catch (NotFoundException ex) {
429:                    fail("BLOCKING: Can't find '" + element + "' in paletter");
430:                }
431:                //
432:                DrawingAreaOperator drAr = d.getDrawingArea();
433:                java.awt.Point a = drAr.getFreePoint();
434:                drAr.clickMouse(a.x, a.y, 1);
435:                new EventTool().waitNoEvent(500);
436:                //
437:                try {
438:                    DiagramElementOperator dEl = new DiagramElementOperator(d,
439:                            elementName, elementType, 0);
440:                } catch (Exception ex) {
441:                    try {
442:                        fail(element
443:                                + " wasn't added to diagram, but object with type:"
444:                                + new DiagramElementOperator(d, elementName)
445:                                        .getType()
446:                                + ": and element type :"
447:                                + new DiagramElementOperator(d, elementName)
448:                                        .getElementType()
449:                                + ": was added whyle type should be :"
450:                                + elementType + ": was added");
451:                    } catch (Exception ex2) {
452:
453:                    }
454:                    fail(element + " wasn't added to iagram.");
455:                }
456:                //
457:                new EventTool().waitNoEvent(500);
458:                PropertySheetOperator ps = new PropertySheetOperator();
459:                if (elementName.equals("")) {
460:                    assertTrue("Property sheet isn't for " + elementType
461:                            + ", but for " + ps.getName(),
462:                            (elementType + " - Properties")
463:                                    .equals(ps.getName()));
464:                } else {
465:                    assertTrue("Property sheet isn't for " + elementType
466:                            + " with " + elementName + " name, but for "
467:                            + ps.getName(), (elementName + " - Properties")
468:                            .equals(ps.getName()));
469:                }
470:                //
471:                int numChild2 = new Node(prTree, lastDiagramNode
472:                        .getParentPath()).getChildren().length;
473:
474:                org.netbeans.test.uml.componentdiagram.utils.Utils
475:                        .setTextProperty("Name", newName);
476:                //
477:                new EventTool().waitNoEvent(500);
478:                //
479:                try {
480:                    DiagramElementOperator dEl = new DiagramElementOperator(d,
481:                            newName, elementType, 0);
482:                } catch (Exception ex) {
483:                    fail("Can't find " + element + " with name \"" + newName
484:                            + "\" on diagram");
485:                }
486:                //
487:                assertTrue(
488:                        "No name propagated to node within diagram (in project tree)",
489:                        new Node(prTree, lastDiagramNode.getParentPath())
490:                                .isChildPresent(newName));
491:            }
492:
493:            private void testElementPlaceAndName(String workPkg,
494:                    String diagramName, String element, String elementName,
495:                    ElementTypes elementType) {
496:                testElementPlaceAndName(workPkg, diagramName, element,
497:                        elementName, elementType, "ElName");
498:            }
499:
500:            //
501:            private void testElementPlaceFromTree(String workPkg,
502:                    String diagramName, String element, String elementName,
503:                    ElementTypes elementType, String newName) {
504:                testElementPlaceAndName(workPkg, diagramName + "_first",
505:                        element, elementName, elementType, newName);
506:                Node de = new Node(prTree, lastDiagramNode.getParentPath()
507:                        + "|" + newName);
508:                try {
509:                    DiagramOperator dClose = new DiagramOperator("cpD");
510:                    DrawingAreaOperator drAr = dClose.getDrawingArea();
511:                    drAr.pushKey(KeyEvent.VK_ESCAPE);
512:                    java.awt.Point a = drAr.getFreePoint();
513:                    drAr.clickMouse(a.x, a.y, 1, InputEvent.BUTTON3_MASK);
514:                    drAr.pushKey(KeyEvent.VK_ESCAPE);
515:                    new Thread(new Runnable() {
516:                        public void run() {
517:                            new JButtonOperator(new JDialogOperator("Save"),
518:                                    "Save").push();
519:                        }
520:                    }).start();
521:                    dClose.closeAllDocuments();
522:                } catch (Exception ex) {
523:                }
524:                ;
525:                DiagramOperator d = createOrOpenDiagram(project, workPkg,
526:                        diagramName + "_second");
527:                //
528:                int numChild = new Node(prTree, lastDiagramNode.getParentPath())
529:                        .getChildren().length;
530:                d.createGenericElementOnDiagram(de);
531:                new EventTool().waitNoEvent(500);
532:                //
533:                try {
534:                    DiagramElementOperator dEl = new DiagramElementOperator(d,
535:                            newName, elementType, 0);
536:                } catch (Exception ex) {
537:                    try {
538:                        fail(element
539:                                + " wasn't added to diagram, but object with type:"
540:                                + new DiagramElementOperator(d, newName)
541:                                        .getType()
542:                                + ": and element type :"
543:                                + new DiagramElementOperator(d, newName)
544:                                        .getElementType()
545:                                + ": was added whyle type should be :"
546:                                + elementType + ": was added");
547:                    } catch (Exception ex2) {
548:
549:                    }
550:                    fail(element + " wasn't added to iagram.");
551:                }
552:                //
553:                new EventTool().waitNoEvent(500);
554:                //
555:                int numChild2 = new Node(prTree, lastDiagramNode
556:                        .getParentPath()).getChildren().length;
557:                assertTrue("No new nodes should be added to package",
558:                        (numChild2 - numChild) == 0);
559:            }
560:
561:            private void testElementPlaceFromTree(String workPkg,
562:                    String diagramName, String element, String elementName,
563:                    ElementTypes elementType) {
564:                testElementPlaceFromTree(workPkg, diagramName, element,
565:                        elementName, elementType, "nameEl");
566:            }
567:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.