Source Code Cross Referenced for SQDDiagramTests.java in  » IDE-Netbeans » uml » org » netbeans » test » uml » sqd » 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.sqd 
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.sqd;
043:
044:        import java.awt.AWTException;
045:        import java.awt.event.KeyEvent;
046:        import java.io.File;
047:        import org.netbeans.jellytools.actions.SaveAllAction;
048:        import org.netbeans.jellytools.nodes.Node;
049:        import org.netbeans.jemmy.EventTool;
050:        import org.netbeans.jemmy.JemmyProperties;
051:        import org.netbeans.jemmy.operators.JButtonOperator;
052:        import org.netbeans.jemmy.operators.JDialogOperator;
053:        import org.netbeans.junit.NbTestSuite;
054:
055:        import org.netbeans.test.uml.sqd.utils.Util;
056:        import org.netbeans.test.umllib.DiagramOperator;
057:        import org.netbeans.test.umllib.project.Project;
058:        import org.netbeans.test.umllib.testcases.UMLTestCase;
059:
060:        public class SQDDiagramTests extends UMLTestCase {
061:
062:            private EventTool eventTool = new EventTool();
063:            private boolean failedByBug = false;
064:            private String lastTestCase = null;
065:
066:            public SQDDiagramTests(String name) {
067:                super (name);
068:            }
069:
070:            public static NbTestSuite suite() {
071:                NbTestSuite suite = new NbTestSuite(SQDDiagramTests.class);
072:                return suite;
073:            }
074:
075:            /******************const section*************************/
076:            private String PROJECT_NAME = "SQD_umlDT";
077:            private String JAVA_PROJECT_NAME = "SQD_java";
078:            private String EXCEPTION_DLG = "Exception";
079:            private String PKG_PATH = "Model|sqd";
080:            private String DIAGRAM = "EmptySequenceDiagram";
081:            final String PATH_TO_DIAGRAM = "Model|sqd|" + DIAGRAM;
082:            public final String OPEN_DIAGRAM = "Open";
083:            public final String DELETE_DIAGRAM = "Delete";
084:
085:            private final String CONFIRM_DELETION_DLG_TTL = "Confirm Object Deletion";
086:            private final String YES_BTN = "Yes";
087:            private final String PROJECT_PATH = System
088:                    .getProperty("xtest.workdir");
089:
090:            /********************************************************/
091:
092:            Util util = new Util(PROJECT_NAME);
093:
094:            private static boolean initialized = false;
095:
096:            protected void setUp() {
097:                if (!initialized) {
098:                    //util.closeStartupException();
099:                    Project.openProject(this .XTEST_PROJECT_DIR + File.separator
100:                            + "Project-SQD");
101:                    org.netbeans.test.umllib.Utils
102:                            .createUMLProjectFromJavaProject(PROJECT_NAME,
103:                                    JAVA_PROJECT_NAME, PROJECT_PATH);
104:                    eventTool.waitNoEvent(2000);
105:                    //setting up environment
106:                    util.addDiagram(DIAGRAM, PKG_PATH);
107:                    eventTool.waitNoEvent(2000);
108:                    initialized = true;
109:                    java.awt.Robot rbt;
110:                    try {
111:                        rbt = new java.awt.Robot();
112:                        rbt.keyRelease(KeyEvent.VK_SHIFT);
113:                        rbt.keyRelease(KeyEvent.VK_CONTROL);
114:                        rbt.keyRelease(KeyEvent.VK_ALT);
115:                    } catch (AWTException ex) {
116:                        ex.printStackTrace();
117:                    }
118:                }
119:                eventTool.waitNoEvent(2000);
120:            }
121:
122:            public void testCreateDiagram() {
123:                lastTestCase = getCurrentTestMethodName();
124:                ;
125:                final String DIAGRAM_NAME = "testCreateDiagram";
126:                util.addDiagram(DIAGRAM_NAME, PKG_PATH);
127:                DiagramOperator dia = new DiagramOperator(DIAGRAM_NAME);
128:            }
129:
130:            public void testOpenDiagramByContextMenu() {
131:                lastTestCase = getCurrentTestMethodName();
132:                ;
133:                Node diaNode = util.getNode(PATH_TO_DIAGRAM);
134:                diaNode.performPopupActionNoBlock(OPEN_DIAGRAM);
135:                new DiagramOperator(DIAGRAM);
136:            }
137:
138:            public void testOpenDiagramByDoubleClick() {
139:                lastTestCase = getCurrentTestMethodName();
140:                ;
141:                Node diaNode = util.getNode(PATH_TO_DIAGRAM);
142:                diaNode.tree().clickOnPath(diaNode.getTreePath(), 2);
143:                new DiagramOperator(DIAGRAM);
144:            }
145:
146:            public void testDeleteDiagramByButton() {
147:                lastTestCase = getCurrentTestMethodName();
148:                ;
149:                Node diaNode = util.getNode(PATH_TO_DIAGRAM);
150:                diaNode.select();
151:
152:                diaNode.tree().pushKey(KeyEvent.VK_DELETE);
153:
154:                new JButtonOperator(new JDialogOperator(
155:                        CONFIRM_DELETION_DLG_TTL), YES_BTN).push();
156:                eventTool.waitNoEvent(1000);
157:
158:                if (util.nodeExists(PATH_TO_DIAGRAM)) {
159:                    fail("Node exists");
160:                }
161:            }
162:
163:            public void testDeleteDiagramByContextMenu() {
164:                lastTestCase = getCurrentTestMethodName();
165:                ;
166:                final String DIAGRAM_NAME = "testDeleteDiagramByContextMenu";
167:
168:                //creating diagram first
169:                util.addDiagram(DIAGRAM_NAME, PKG_PATH);
170:                eventTool.waitNoEvent(1000);
171:                new DiagramOperator(DIAGRAM_NAME);
172:                Node diaNode = util.getNode(PKG_PATH + "|" + DIAGRAM_NAME);
173:                diaNode.performPopupActionNoBlock(DELETE_DIAGRAM);
174:
175:                //deleting it
176:                new JButtonOperator(new JDialogOperator(
177:                        CONFIRM_DELETION_DLG_TTL), YES_BTN).push();
178:                eventTool.waitNoEvent(1000);
179:
180:                if (util.nodeExists(PKG_PATH + "|" + DIAGRAM_NAME)) {
181:                    fail("testDeleteDiagramByContextMenu verification failed");
182:                }
183:            }
184:
185:            public void tearDown() {
186:                org.netbeans.test.umllib.util.Utils
187:                        .makeScreenShot(lastTestCase);
188:                long timeoutValDlg = JemmyProperties
189:                        .getCurrentTimeout("DialogWaiter.WaitDialogTimeout");
190:                try {
191:                    JemmyProperties.setCurrentTimeout(
192:                            "DialogWaiter.WaitDialogTimeout", 1000);
193:                    new JDialogOperator(EXCEPTION_DLG).close();
194:                    if (!failedByBug) {
195:                        fail("Unexpected Exception dialog was found");
196:                    }
197:                } catch (Exception excp) {
198:                } finally {
199:                    org.netbeans.test.umllib.util.Utils.saveAll();
200:                    closeAllModal();
201:                    if (failedByBug) {
202:                        failedByBug = false;
203:                    }
204:                    JemmyProperties.setCurrentTimeout(
205:                            "DialogWaiter.WaitDialogTimeout", timeoutValDlg);
206:                    //TODO: should be removed later
207:                    util.closeSaveDlg();
208:                }
209:            }
210:
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.