Source Code Cross Referenced for CLD_InterfaceElementAttributesOperationsTests.java in  » IDE-Netbeans » uml » org » netbeans » test » uml » classdiagram » 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.classdiagram 
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:        /*
043:         * CLD_InterfaceTests.java
044:         *
045:         * Created on May 13, 2005, 10:41 AM
046:         *
047:         * To change this template, choose Tools | Options and locate the template under
048:         * the Source Creation and Management node. Right-click the template and choose
049:         * Open. You can then make changes to the template in the Source Editor.
050:         */
051:
052:        package org.netbeans.test.uml.classdiagram;
053:
054:        import java.awt.*;
055:        import java.awt.event.*;
056:        import java.io.*;
057:        import java.util.*;
058:        import javax.swing.*;
059:        import javax.swing.tree.*;
060:        import org.netbeans.junit.*;
061:        import org.netbeans.jemmy.*;
062:        import org.netbeans.jemmy.operators.*;
063:        import org.netbeans.jellytools.*;
064:        import org.netbeans.jellytools.nodes.Node;
065:        import org.netbeans.test.uml.classdiagram.utils.CLDUtils;
066:        import org.netbeans.test.umllib.CompartmentOperator;
067:        import org.netbeans.test.umllib.CompartmentTypes;
068:        import org.netbeans.test.umllib.DiagramElementOperator;
069:        import org.netbeans.test.umllib.DiagramOperator;
070:        import org.netbeans.test.umllib.ElementTypes;
071:        import org.netbeans.test.umllib.NewDiagramWizardOperator;
072:        import org.netbeans.test.umllib.customelements.ClassOperator;
073:        import org.netbeans.test.umllib.exceptions.NotFoundException;
074:        import org.netbeans.test.umllib.util.LabelsAndTitles;
075:        import org.netbeans.test.umllib.vrf.DiagramElementVerifier;
076:
077:        /**
078:         *
079:         * @author lvv
080:         */
081:        public class CLD_InterfaceElementAttributesOperationsTests extends
082:                ClassDiagramTestCase {
083:
084:            private static String prName = "UMLProjectForInterfaceAO";
085:            private static String dpdName = "ClassDiagramForInterfaceAO";
086:
087:            private static final String workDir = System
088:                    .getProperty("xtest.workdir");
089:            private static String OUT_LOG_FILE = "";
090:            private static String ERR_LOG_FILE = "";
091:            private static PrintStream myOut = null;
092:            private static PrintStream myErr = null;
093:            private static BufferedReader myIn = null;
094:
095:            EventTool eventTool = new EventTool();
096:
097:            /** Need to be defined because of JUnit */
098:            public CLD_InterfaceElementAttributesOperationsTests(String name) {
099:                super (name);
100:            }
101:
102:            public static NbTestSuite suite() {
103:                NbTestSuite suite = new NbTestSuite(
104:                        org.netbeans.test.uml.classdiagram.CLD_InterfaceElementAttributesOperationsTests.class);
105:                return suite;
106:            }
107:
108:            /**
109:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:34 
110:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:35 
111:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:36 
112:             */
113:
114:            // Huge TBD!!! to calls to attr/opCompartString
115:            String ATTR1_KY = "Attr1_KY";
116:            String ATTR1_KY_FQ = "public int Attr1_KY = 0";
117:            String ATTR2_KY = "Attr2_KY";
118:            String ATTR2_KY_FQ = "public int Attr2_KY = 0";
119:            String ATTR3_KY = "Attr3_KY";
120:            String ATTR3_KY_FQ = "public int Attr3_KY = 0";
121:
122:            public void testInterfaceInsertAttributeKeys() {
123:
124:                try {
125:                    String INT_NAME = "IntInsAttrKeys";
126:                    //  Plan_CLD_InterfaceSymbol:Diagram:34
127:                    DiagramElementOperator tInt = createElement(diagram,
128:                            ElementTypes.INTERFACE, INT_NAME);
129:                    CompartmentOperator attrs = new CompartmentOperator(tInt,
130:                            CompartmentTypes.ATTRIBUTE_LIST_COMPARTMENT);
131:                    diagram.pushKey(KeyEvent.VK_A, InputEvent.ALT_MASK
132:                            | InputEvent.SHIFT_MASK);
133:                    new ClassOperator.classOperatorUtil()
134:                            .attributeNaturalWayNaming(null, null, ATTR1_KY);
135:                    deFocusEls(diagram);
136:                    verifyElementFQInInterfaceSymbol(tInt, ATTR1_KY_FQ);
137:                    verifyAttributeFQInTree(prName, INT_NAME, ATTR1_KY_FQ);
138:
139:                    // Plan_CLD_InterfaceSymbol:Diagram:35
140:                    CompartmentOperator attr1 = selectCompartment(tInt,
141:                            ATTR1_KY_FQ, 0);
142:                    diagram.pushKey(KeyEvent.VK_A, InputEvent.ALT_MASK
143:                            | InputEvent.SHIFT_MASK);
144:                    new ClassOperator.classOperatorUtil()
145:                            .attributeNaturalWayNaming(null, null, ATTR2_KY);
146:                    deFocusEls(diagram);
147:                    verifyElementFQInInterfaceSymbol(tInt, ATTR2_KY_FQ);
148:                    verifyAttributeFQInTree(prName, INT_NAME, ATTR2_KY_FQ);
149:
150:                    // Plan_CLD_InterfaceSymbol:Diagram:36
151:                    attr1 = selectCompartment(tInt, ATTR1_KY_FQ, 0);
152:                    diagram.pushKey(KeyEvent.VK_INSERT);
153:                    new ClassOperator.classOperatorUtil()
154:                            .attributeNaturalWayNaming(null, null, ATTR3_KY);
155:                    deFocusEls(diagram);
156:                    verifyElementFQInInterfaceSymbol(tInt, ATTR3_KY_FQ);
157:                    verifyAttributeFQInTree(prName, INT_NAME, ATTR3_KY_FQ);
158:
159:                } catch (Exception e) {
160:                    e.printStackTrace();
161:                    fail("Test failed with exception: " + e.getMessage());
162:                } finally {
163:                    verifier.safeDeleteAllElements();
164:                }
165:
166:            }
167:
168:            /**
169:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:37 
170:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:38 
171:             */
172:
173:            // Huge TBD!!! to calls to attr/opCompartString
174:            String ATTR1 = "Attr1";
175:            String ATTR1_FQ = "public int Attr1 = 0";
176:            String ATTR2 = "Attr2";
177:            String ATTR2_FQ = "public int Attr2 = 0";
178:            String ATTR_DEF_FQ = "public static int Unnamed = 0";
179:
180:            public void testInterfaceInsertAttributeMenu() {
181:
182:                try {
183:                    String INT_NAME = "IntInsAttrMenu";
184:                    //  Plan_CLD_InterfaceSymbol:Diagram:37
185:                    DiagramElementOperator tInt = createElement(diagram,
186:                            ElementTypes.INTERFACE, INT_NAME);
187:                    CompartmentOperator attrs = new CompartmentOperator(tInt,
188:                            CompartmentTypes.ATTRIBUTE_LIST_COMPARTMENT);
189:                    attrs.getPopup().pushMenu(
190:                            LabelsAndTitles.POPUP_ADD_ATTRIBUTE);
191:                    new ClassOperator.classOperatorUtil()
192:                            .attributeNaturalWayNaming(null, null, ATTR1);
193:                    deFocusEls(diagram);
194:                    verifyElementFQInInterfaceSymbol(tInt, ATTR1_FQ);
195:                    verifyAttributeFQInTree(prName, INT_NAME, ATTR1_FQ);
196:
197:                    // Plan_CLD_InterfaceSymbol:Diagram:38
198:                    CompartmentOperator attr1 = selectCompartment(tInt,
199:                            ATTR1_FQ, 0);
200:                    attr1.getPopup().pushMenu(
201:                            LabelsAndTitles.POPUP_ADD_ATTRIBUTE);
202:                    new ClassOperator.classOperatorUtil()
203:                            .attributeNaturalWayNaming(null, null, ATTR2);
204:                    deFocusEls(diagram);
205:                    verifyElementFQInInterfaceSymbol(tInt, ATTR2_FQ);
206:                    verifyAttributeFQInTree(prName, INT_NAME, ATTR2_FQ);
207:
208:                } catch (Exception e) {
209:                    e.printStackTrace();
210:                    fail("Test failed with exception: " + e.getMessage());
211:                } finally {
212:                    verifier.safeDeleteAllElements();
213:                }
214:
215:            }
216:
217:            /**
218:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:42
219:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:43 
220:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:44 
221:             */
222:
223:            // Huge TBD!!! to calls to attr/opCompartString
224:            String OP1_KY = "Op1_KY";
225:            String OP1_KY_FQ = "public void  Op1_KY(  )";
226:            String OP2_KY = "Op2_KY";
227:            String OP2_KY_FQ = "public void  Op2_KY(  )";
228:            String OP3_KY = "Op3_KY";
229:            String OP3_KY_FQ = "public void  Op3_KY(  )";
230:
231:            public void testInterfaceInsertOperationKeys() {
232:
233:                try {
234:                    String INT_NAME = "IntInsOpsKeys";
235:                    //  Plan_CLD_InterfaceSymbol:Diagram:42
236:                    DiagramElementOperator tInt = createElement(diagram,
237:                            ElementTypes.INTERFACE, INT_NAME);
238:                    CompartmentOperator ops = new CompartmentOperator(tInt,
239:                            CompartmentTypes.OPERATION_LIST_COMPARTMENT);
240:                    diagram.pushKey(KeyEvent.VK_O, InputEvent.ALT_MASK
241:                            | InputEvent.SHIFT_MASK);
242:                    new ClassOperator.classOperatorUtil()
243:                            .operationNaturalWayNaming(null, null, OP1_KY,
244:                                    (String[]) null, (String[]) null, true);
245:                    verifyElementFQInInterfaceSymbol(tInt, OP1_KY_FQ);
246:                    verifyOperationFQInTree(prName, INT_NAME, OP1_KY_FQ);
247:
248:                    // Plan_CLD_InterfaceSymbol:Diagram:43
249:                    CompartmentOperator op1 = selectCompartment(tInt,
250:                            OP1_KY_FQ, 0);
251:                    diagram.pushKey(KeyEvent.VK_O, InputEvent.ALT_MASK
252:                            | InputEvent.SHIFT_MASK);
253:                    new ClassOperator.classOperatorUtil()
254:                            .operationNaturalWayNaming(null, null, OP2_KY,
255:                                    (String[]) null, (String[]) null, true);
256:                    verifyElementFQInInterfaceSymbol(tInt, OP2_KY_FQ);
257:                    verifyOperationFQInTree(prName, INT_NAME, OP2_KY_FQ);
258:
259:                    // Plan_CLD_InterfaceSymbol:Diagram:44
260:                    op1 = selectCompartment(tInt, OP1_KY_FQ, 0);
261:                    diagram.pushKey(KeyEvent.VK_INSERT);
262:                    new ClassOperator.classOperatorUtil()
263:                            .operationNaturalWayNaming(null, null, OP3_KY,
264:                                    (String[]) null, (String[]) null, true);
265:                    // workaround for delete all when there is only one interface with selected op
266:                    selectCompartment(tInt, INT_NAME, 0);
267:                    verifyElementFQInInterfaceSymbol(tInt, OP3_KY_FQ);
268:                    verifyOperationFQInTree(prName, INT_NAME, OP3_KY_FQ);
269:
270:                } catch (Exception e) {
271:                    e.printStackTrace();
272:                    fail("Test failed with exception: " + e.getMessage());
273:                } finally {
274:                    verifier.safeDeleteAllElements();
275:                }
276:
277:            }
278:
279:            /**
280:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:45
281:             * @Testcase_ID: Plan_CLD_InterfaceSymbol:Diagram:46 
282:             */
283:
284:            // Huge TBD!!! to calls to attr/opCompartString
285:            String OP1 = "Op1";
286:            String OP1_FQ = opCompartString("public", "void", OP1);
287:            String OP2 = "Op2";
288:            String OP2_FQ = opCompartString("public", "void", OP2);
289:
290:            public void testInterfaceInsertOperationMenu() {
291:
292:                try {
293:                    String INT_NAME = "IntInsOpsMenu";
294:                    //  Plan_CLD_InterfaceSymbol:Diagram:42
295:                    DiagramElementOperator tInt = createElement(diagram,
296:                            ElementTypes.INTERFACE, INT_NAME);
297:                    CompartmentOperator ops = new CompartmentOperator(tInt,
298:                            CompartmentTypes.OPERATION_LIST_COMPARTMENT);
299:                    pushMenuInPopup(ops.getPopup(),
300:                            LabelsAndTitles.POPUP_ADD_OPERATION);
301:                    new ClassOperator.classOperatorUtil()
302:                            .operationNaturalWayNaming(null, null, OP1,
303:                                    (String[]) null, (String[]) null, true);
304:                    verifyElementFQInInterfaceSymbol(tInt, OP1_FQ);
305:                    verifyOperationFQInTree(prName, INT_NAME, OP1_FQ);
306:
307:                    // Plan_CLD_InterfaceSymbol:Diagram:43
308:                    CompartmentOperator op1 = selectCompartment(tInt, OP1_FQ, 0);
309:                    pushMenuInPopup(op1.getPopup(),
310:                            LabelsAndTitles.POPUP_ADD_OPERATION);
311:                    new ClassOperator.classOperatorUtil()
312:                            .operationNaturalWayNaming(null, null, OP2,
313:                                    (String[]) null, (String[]) null, true);
314:                    // workaround for delete all when there is only one interface with selected op
315:                    selectCompartment(tInt, INT_NAME, 0);
316:                    verifyElementFQInInterfaceSymbol(tInt, OP2_FQ);
317:                    verifyOperationFQInTree(prName, INT_NAME, OP2_FQ);
318:
319:                } catch (Exception e) {
320:                    e.printStackTrace();
321:                    fail("Test failed with exception: " + e.getMessage());
322:                } finally {
323:                    verifier.safeDeleteAllElements();
324:                }
325:
326:            }
327:
328:            //various service calls, to be librarized
329:
330:            public static DiagramElementOperator createElement(
331:                    DiagramOperator diagram, ElementTypes elementType,
332:                    String name) throws NotFoundException {
333:                Point p = diagram.getDrawingArea().getFreePoint();
334:                DiagramElementOperator el = diagram.putElementOnDiagram(name,
335:                        elementType, p.x, p.y);
336:                new EventTool().waitNoEvent(500);
337:                return el;
338:            }
339:
340:            public static CompartmentOperator selectCompartment(
341:                    DiagramElementOperator interf, String elementFQ, int index)
342:                    throws NotFoundException {
343:                CompartmentOperator attr = getCompartment(interf, elementFQ, 0);
344:                attr.clickOnCenter();
345:                new EventTool().waitNoEvent(500);
346:                return attr;
347:            }
348:
349:            public static CompartmentOperator getCompartment(
350:                    DiagramElementOperator interf, String attrFQ, int index)
351:                    throws NotFoundException {
352:                CompartmentOperator attr = new CompartmentOperator(
353:                        interf,
354:                        CompartmentOperator
355:                                .waitForCompartment(
356:                                        interf,
357:                                        new CompartmentOperator.CompartmentByNameChooser(
358:                                                attrFQ), index));
359:                return attr;
360:            }
361:
362:            public static boolean verifyElementFQInInterfaceSymbol(
363:                    DiagramElementOperator interf, String attrFQ)
364:                    throws NotFoundException {
365:                CompartmentOperator attr = getCompartment(interf, attrFQ, 0);
366:                assertTrue("Element wasn't found in element [attrFQ=\""
367:                        + attrFQ + "\"]", attr != null);
368:                return attr != null;
369:            }
370:
371:            public static Node verifyAttributeFQInTree(String umlProjectName,
372:                    String classNameFQ, String attrFQ) {
373:                Node attr = getElementFQInTree(umlProjectName, classNameFQ,
374:                        "Attributes", attrFQ);
375:                assertTrue("The specified attribute wasn't found "
376:                        + "[attrFQ=\"" + attrFQ + "\" class=" + classNameFQ
377:                        + " project=" + umlProjectName + "]", attr != null);
378:                return attr;
379:            }
380:
381:            public static Node verifyOperationFQInTree(String umlProjectName,
382:                    String classNameFQ, String opFQ) {
383:                Node op = getElementFQInTree(umlProjectName, classNameFQ,
384:                        "Operations", opFQ);
385:                assertTrue("The specified operation wasn't found " + "[opFQ=\""
386:                        + opFQ + "\" class=" + classNameFQ + " project="
387:                        + umlProjectName + "]", op != null);
388:                return op;
389:            }
390:
391:            public static Node getElementFQInTree(String umlProjectName,
392:                    String classNameFQ, String subnode, String attrFQ) {
393:                String classTreePath = fqClassNameToTreePath(classNameFQ);
394:                String ctp = umlProjectName + "|Model|" + classTreePath;
395:                Node cnode = getPath(ctp);
396:                if (cnode.isChildPresent(subnode)) {
397:                    return getPath(ctp + "|" + subnode + "|" + attrFQ);
398:                } else {
399:                    return getPath(ctp + "|" + attrFQ);
400:                }
401:            }
402:
403:            public static String fqClassNameToTreePath(String classNameFQ) {
404:                StringTokenizer st = new StringTokenizer(classNameFQ, ".");
405:                String res = null;
406:                if (st.hasMoreTokens()) {
407:                    res = st.nextToken();
408:                    while (st.hasMoreTokens()) {
409:                        res += "|" + st.nextToken();
410:                    }
411:                }
412:                return res;
413:            }
414:
415:            public static Node getPath(String path) {
416:                ProjectsTabOperator pto = ProjectsTabOperator.invoke();
417:                JTreeOperator prTree = new JTreeOperator(pto);
418:                TreePath elementPath = prTree.findPath(path);
419:                Node n = null;
420:                if (elementPath != null) {
421:                    n = new Node(prTree, elementPath);
422:                }
423:                return n;
424:
425:            }
426:
427:            /* 
428:             * A bunch of methods will be here	
429:             *
430:             * For now Java notation only, standard UML to be done later
431:             */
432:            public static String attrCompartString(String visibility,
433:                    String type, String name) {
434:                // TBD!!! 
435:                return visibility + " " + type + " " + name;
436:
437:            }
438:
439:            public static String opCompartString(String visibility,
440:                    String retType, String name) {
441:                return opCompartString(visibility, retType, name, null, null);
442:            }
443:
444:            public static String opCompartString(String visibility,
445:                    String retType, String name, String parTypes[],
446:                    String parNames[]) {
447:                // TBD!!!
448:                String res = "";
449:                if (visibility != null && !visibility.equals("")) {
450:                    res += visibility + " ";
451:                }
452:                if (retType != null && !retType.equals("")) {
453:                    res += retType;
454:                }
455:                if (name != null && !name.equals("")) {
456:                    res += "  " + name + "(";
457:                }
458:                if (parTypes == null || parTypes.length == 0) {
459:                    res += "  )";
460:                } else {
461:                    // TBD!!!
462:                    ;
463:                }
464:                return res;
465:            }
466:
467:            public static void deFocusEls(DiagramOperator diagram) {
468:                Point a = diagram.getDrawingArea().getFreePoint();
469:                System.out.println("The deFocus point is " + a);
470:                diagram.clickMouse(a.x, a.y, 1);
471:                new EventTool().waitNoEvent(500);
472:            }
473:
474:            /*
475:             * Default implementation picks up child popup if already opened
476:             * (and it does open automatically just because the mouse was there)
477:             */
478:            public static void pushMenuInPopup(JPopupMenuOperator jpo,
479:                    String menuPath) {
480:                Container ppm = jpo.getSource().getParent();
481:                while (ppm.getParent() != null) {
482:                    ppm = ppm.getParent();
483:                }
484:                StringTokenizer st = new StringTokenizer(menuPath, "|");
485:                final String nt = st.nextToken();
486:
487:                JPopupMenuOperator pp = new JPopupMenuOperator(
488:                        JPopupMenuOperator.waitJPopupMenu(ppm,
489:                                new ComponentChooser() {
490:                                    public boolean checkComponent(Component comp) {
491:                                        if (comp instanceof  JPopupMenu) {
492:                                            ComponentSearcher searcher = new ComponentSearcher(
493:                                                    (Container) comp);
494:                                            return (searcher
495:                                                    .findComponent(new JMenuItemOperator.JMenuItemByLabelFinder(
496:                                                            nt)) != null);
497:                                        } else {
498:                                            return (false);
499:                                        }
500:                                    }
501:
502:                                    public String getDescription() {
503:                                        return ("Popup containing \"" + nt + "\" menu item");
504:                                    }
505:                                }));
506:
507:                //JMenuItemOperator mio = new JMenuItemOperator(pp, nt, 0);
508:                //mio.enterMouse();
509:                pp.pushMenu(menuPath);
510:            }
511:
512:            //------------------------------------------------------------------------------
513:
514:            protected void setUp() throws FileNotFoundException {
515:                System.out.println("########  " + getName() + "  #######");
516:                JemmyProperties.setCurrentTimeout(
517:                        "DialogWaiter.WaitDialogTimeout", 5000);
518:                JemmyProperties.setCurrentTimeout("Waiter.WaitingTime", 3000);
519:                JemmyProperties.setCurrentTimeout(
520:                        "DiagramElementOperator.WaitDiagramElementTime", 5000);
521:
522:                OUT_LOG_FILE = workDir + File.separator + "jout_" + getName()
523:                        + ".log";
524:                ERR_LOG_FILE = workDir + File.separator + "jerr_" + getName()
525:                        + ".log";
526:
527:                myOut = new PrintStream(new FileOutputStream(OUT_LOG_FILE),
528:                        true);
529:                myErr = new PrintStream(new FileOutputStream(ERR_LOG_FILE),
530:                        true);
531:                JemmyProperties.setCurrentOutput(new TestOut(System.in, myOut,
532:                        myErr));
533:
534:                diagram = CLDUtils.openDiagram(prName, dpdName,
535:                        NewDiagramWizardOperator.CLASS_DIAGRAM, workDir);
536:                if (diagram == null) {
537:                    fail("Can't open diagram '" + dpdName + "', project '"
538:                            + prName + "'.");
539:                }
540:                verifier = new DiagramElementVerifier(diagram,
541:                        ElementTypes.INTERFACE, "CLD_", getLog());
542:            }
543:
544:            private DiagramElementVerifier verifier = null;
545:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.