Source Code Cross Referenced for AcceptanceTest.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » test » components » advanced » meta » 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 » visualweb.api.designer » org.netbeans.modules.visualweb.test.components.advanced.meta 
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.modules.visualweb.test.components.advanced.meta;
043:
044:        import junit.framework.Test;
045:        import junit.framework.TestSuite;
046:        import org.netbeans.junit.NbTestSuite;
047:        import org.netbeans.jellytools.OutputOperator;
048:        import org.netbeans.jemmy.Waiter;
049:        import org.netbeans.jemmy.Waitable;
050:        import org.netbeans.jemmy.QueueTool;
051:        import org.netbeans.jemmy.operators.JTreeOperator;
052:
053:        import org.netbeans.modules.visualweb.gravy.*;
054:        import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
055:        import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
056:        import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
057:        import org.netbeans.modules.visualweb.test.components.util.ComponentUtils;
058:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerExplorerOperator;
059:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
060:
061:        import java.io.File;
062:        import java.awt.Point;
063:        import java.io.IOException;
064:
065:        /**
066:         * @author Lark Fitzgerald (lark.fitzgerald@sun.com)
067:         */
068:        public class AcceptanceTest extends RaveTestCase {
069:
070:            //Project variables
071:            public String _sharedBundle = "org.netbeans.modules.visualweb.test.components.Component";
072:            public String _privateBundle = "org.netbeans.modules.visualweb.test.components.advanced.meta.Acceptance";
073:            public String _projectName = Bundle.getStringTrimmed(
074:                    _privateBundle, "projectName");
075:            public String _projectServer = Bundle.getStringTrimmed(
076:                    _sharedBundle, "projectServer");
077:            public String _logFileLocation = Bundle.getStringTrimmed(
078:                    _sharedBundle, "logFile");
079:            public String _logFile = System.getProperty("xtest.workdir")
080:                    + File.separator + _logFileLocation;
081:            public String _exception = Bundle.getStringTrimmed(_sharedBundle,
082:                    "Exception");
083:            public String _close = Bundle.getStringTrimmed(_sharedBundle,
084:                    "close");
085:            public String _run = Bundle.getStringTrimmed(_sharedBundle, "Run");
086:
087:            //Outline variables
088:            public String _outlineHead1 = Bundle.getStringTrimmed(
089:                    _sharedBundle, "outlineHead1");
090:
091:            //Palette variables
092:            public String _basicPalette = Bundle.getStringTrimmed(
093:                    _sharedBundle, "basicPalette");
094:            public String _basicButton = Bundle.getStringTrimmed(_sharedBundle,
095:                    "basicButton");
096:            public String _advancedPalette = Bundle.getStringTrimmed(
097:                    _sharedBundle, "advancedPalette");
098:            public String _advancedMeta = Bundle.getStringTrimmed(
099:                    _sharedBundle, "advancedMeta");
100:
101:            //drop points
102:            public int _x = Integer.parseInt(Bundle.getStringTrimmed(
103:                    _privateBundle, "x"));
104:            public int _meta1y = Integer.parseInt(Bundle.getStringTrimmed(
105:                    _privateBundle, "meta1y"));
106:            public int _button1y = Integer.parseInt(Bundle.getStringTrimmed(
107:                    _privateBundle, "button1y"));
108:
109:            public String _meta = Bundle.getStringTrimmed(_privateBundle,
110:                    "meta");
111:
112:            //undeployment
113:            public String _undeploy = Bundle.getStringTrimmed(_sharedBundle,
114:                    "undeploy");
115:            public String _refresh = Bundle.getStringTrimmed(_sharedBundle,
116:                    "refresh");
117:            public String _serverPath = Bundle.getStringTrimmed(_sharedBundle,
118:                    "serverPath");
119:            public String _deploymentPath = Bundle.getStringTrimmed(
120:                    _sharedBundle, "deploymentPathGlassfish");
121:            public String _separator = Bundle.getStringTrimmed(_sharedBundle,
122:                    "separator");
123:
124:            Point clickPoint, dropPoint;
125:            public static DesignerPaneOperator designer;
126:            public static PaletteContainerOperator palette;
127:            public static DocumentOutlineOperator outline;
128:            public static SheetTableOperator sheet;
129:            public static DeploymentDialogOperator deploy;
130:            public static ServerNavigatorOperator explorer;
131:            public int row;
132:
133:            public AcceptanceTest(String testName) {
134:                super (testName);
135:            }
136:
137:            public static Test suite() {
138:                TestSuite suite = new NbTestSuite();
139:                suite.addTest(new AcceptanceTest("testCreateWebProject"));
140:
141:                suite.addTest(new AcceptanceTest("testAddAdvancedMeta"));
142:                suite.addTest(new AcceptanceTest("testVerifyMeta"));
143:                //        suite.addTest(new AcceptanceTest("testAddTextField"));
144:                //        suite.addTest(new AcceptanceTest("testAddButton"));
145:
146:                suite.addTest(new AcceptanceTest("testDeploy"));
147:                suite.addTest(new AcceptanceTest("testCloseWebProject"));
148:                suite.addTest(new AcceptanceTest("testUndeploy"));
149:                suite.addTest(new AcceptanceTest("testCheckIDELog"));
150:
151:                return suite;
152:            }
153:
154:            /** method called before each testcase
155:             */
156:            protected void setUp() {
157:                log("setup()");
158:                System.out.println("########  " + getName() + "  #######");
159:            }
160:
161:            /** method called after each testcase
162:             */
163:            protected void tearDown() {
164:                log("teardown()");
165:                System.out.println("########  " + getName()
166:                        + " Finished #######");
167:            }
168:
169:            /*
170:             *    Create Web Project
171:             *
172:             */
173:            public void testCreateWebProject() {
174:                startTest();
175:                log("**Creating Project");
176:                //Create Project
177:                try {
178:                    ComponentUtils.createNewProject(_projectName);
179:                } catch (Exception e) {
180:                    log(">> Project Creation Failed");
181:                    e.printStackTrace();
182:                    log(e.toString());
183:                    fail();
184:                }
185:                log("**Done");
186:                endTest();
187:            }
188:
189:            /*
190:             *    Add a loadBundle to designer
191:             */
192:            public void testAddAdvancedMeta() {
193:                startTest();
194:                log("**Initialize");
195:                designer = new DesignerPaneOperator(RaveWindowOperator
196:                        .getDefaultRave());
197:                palette = new PaletteContainerOperator(_advancedPalette);
198:                try {
199:                    Thread.sleep(5000);
200:                } catch (Exception e) {
201:                }
202:
203:                log("**Add meta to designer");
204:                clickPoint = palette.getClickPoint(_advancedMeta);
205:                dropPoint = new Point(_x, _meta1y);
206:                palette.addComponent(_advancedMeta, designer, dropPoint);
207:                try {
208:                    Thread.sleep(2000);
209:                } catch (Exception e) {
210:                }
211:
212:                log("**Done.");
213:                endTest();
214:
215:            }
216:
217:            /*
218:             * Verify Meta in outline window
219:             */
220:            public void testVerifyMeta() {
221:                startTest();
222:                log("**Initialize");
223:                DocumentOutlineOperator doo = new DocumentOutlineOperator(Util
224:                        .getMainWindow());
225:                Util.wait(2000);
226:
227:                log("**Select " + _meta + " from Outline window");
228:                String path = _outlineHead1 + _meta;
229:                doo.verify();
230:                //        doo.clickOnPath(path);
231:                doo.selectPath(path);
232:                Util.wait(5000);
233:
234:                log("**Done.");
235:                endTest();
236:            }
237:
238:            /*
239:             * Change var name 
240:             */
241:
242:            /*
243:             *    Add a button to designer
244:             */
245:            public void testAddButton() {
246:                startTest();
247:                log("**Initialize");
248:                designer = new DesignerPaneOperator(RaveWindowOperator
249:                        .getDefaultRave());
250:                palette = new PaletteContainerOperator(_basicPalette);
251:                try {
252:                    Thread.sleep(5000);
253:                } catch (Exception e) {
254:                }
255:
256:                log("**Add Button to designer");
257:                clickPoint = palette.getClickPoint(_basicButton);
258:                dropPoint = new Point(_x, _button1y);
259:                palette.dndPaletteComponent(_basicButton, designer, dropPoint);
260:                try {
261:                    Thread.sleep(2000);
262:                } catch (Exception e) {
263:                }
264:
265:                log("**Done.");
266:                endTest();
267:            }
268:
269:            /*
270:             * Set button to get text value from bundle
271:             */
272:
273:            /*
274:             * Deploy application
275:             */
276:            public void testDeploy() {
277:                startTest();
278:                //need to wait responce
279:                Waiter deploymentWaiter = new Waiter(new Waitable() {
280:                    public Object actionProduced(Object output) {
281:                        String text = ((OutputOperator) output).getText();
282:                        if (text.indexOf("BUILD SUCCESSFUL") != -1)
283:                            return "true";
284:                        return null;
285:
286:                    }
287:
288:                    public String getDescription() {
289:                        return ("Waiting Project Deployed");
290:                    }
291:                });
292:                log("Deploy from menu");
293:                ProjectNavigatorOperator.pressPopupItemOnNode(_projectName,
294:                        _run);
295:                TestUtils.wait(2000);
296:                OutputOperator outputWindow = new OutputOperator();
297:                deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime",
298:                        240000);
299:                log("wait until BUILD SUCCESSFUL");
300:                try {
301:                    deploymentWaiter.waitAction(outputWindow);
302:                } catch (InterruptedException e) {
303:                    log(outputWindow.getText());
304:                    e.printStackTrace();
305:                    fail("Deployment error: " + e);
306:                }
307:                log("Deployment complete");
308:                endTest();
309:            }
310:
311:            /*
312:             * Close Project
313:             *
314:             */
315:            public void testCloseWebProject() {
316:                startTest();
317:                Util.saveAllAPICall();
318:                new ProjectNavigatorOperator().pressPopupItemOnNode(
319:                        _projectName, _close);
320:                //TestUtils.closeCurrentProject();
321:                TestUtils.wait(5000);
322:                endTest();
323:            }
324:
325:            /* Need to undeploy project to finish tests correctly */
326:            public void testUndeploy() {
327:                startTest();
328:                log("Initialize");
329:                explorer = ServerNavigatorOperator.showNavigatorOperator();
330:                String serverPath = _serverPath + _projectServer; //Current deployment server
331:                String deploymentPath = serverPath + _deploymentPath; //glassfish specific
332:                String applicationPath = deploymentPath + _separator
333:                        + _projectName; //project name
334:
335:                // Select the Server Navigator and set the JTreeOperator
336:                log("get explorer");
337:                new QueueTool().waitEmpty(100); //??
338:                explorer.requestFocus();
339:                JTreeOperator tree = explorer.getTree();
340:                try {
341:                    Thread.sleep(4000);
342:                } catch (Exception e) {
343:                } // Sleep 4 secs to make sure Server Navigator is in focus
344:
345:                // Need to refresh J2EE AppServer node
346:                log("refresh");
347:                explorer.pushPopup(tree, serverPath, _refresh);
348:                TestUtils.wait(1000);
349:
350:                log("refresh deployment path: " + deploymentPath);
351:                TestUtils.wait(1000);
352:                explorer.selectPath(deploymentPath);
353:                explorer.getTree().expandPath(
354:                        explorer.getTree().findPath(deploymentPath));
355:                explorer.pushPopup(tree, deploymentPath, _refresh);
356:                TestUtils.wait(1000);
357:
358:                log("undeploy Path: " + applicationPath);
359:                explorer.selectPath(applicationPath);
360:                TestUtils.wait(1000);
361:
362:                log("Push Menu Undeploy...");
363:                explorer.pushPopup(explorer.getTree(), applicationPath,
364:                        _undeploy);
365:                TestUtils.wait(5000);
366:                endTest();
367:            }
368:
369:            public void testCheckIDELog() {
370:                startTest();
371:                try {
372:                    String err = ComponentUtils.hasUnexpectedException();
373:                    String str = "";
374:                    if (!(err.equals(""))) {
375:                        assertTrue(
376:                                "Unexpected  exceptions found in message.log: "
377:                                        + err, str.equals(""));
378:                    }
379:                } catch (IOException ioe) {
380:                    ioe.printStackTrace();
381:                    fail("Failed to open message.log : " + ioe);
382:                }
383:                endTest();
384:            }
385:        }
w_w___w_.___j__av__a_2__s___.__c___o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.