Source Code Cross Referenced for AcceptanceTest.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » test » components » input » fileupload » 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.input.fileupload 
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.input.fileupload;
043:
044:        import junit.framework.Test;
045:        import junit.framework.TestSuite;
046:        import org.netbeans.jemmy.operators.JEditorPaneOperator;
047:        import org.netbeans.junit.NbTestSuite;
048:        import org.netbeans.jellytools.OutputOperator;
049:        import org.netbeans.jemmy.Waiter;
050:        import org.netbeans.jemmy.Waitable;
051:        import org.netbeans.jemmy.QueueTool;
052:        import org.netbeans.jemmy.operators.JTreeOperator;
053:
054:        import org.netbeans.modules.visualweb.gravy.*;
055:        import org.netbeans.modules.visualweb.gravy.TestUtils;
056:        import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
057:        import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
058:        import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
059:        import org.netbeans.modules.visualweb.gravy.actions.ActionNoBlock;
060:        import org.netbeans.modules.visualweb.test.components.util.ComponentUtils;
061:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
062:
063:        import java.awt.Point;
064:        import java.awt.event.KeyEvent;
065:        import java.io.File;
066:        import java.io.IOException;
067:        import org.netbeans.jellytools.WizardOperator;
068:        import org.netbeans.jemmy.drivers.text.SwingTextKeyboardDriver;
069:        import org.netbeans.jemmy.operators.JButtonOperator;
070:        import org.netbeans.jemmy.operators.JLabelOperator;
071:        import org.netbeans.jemmy.operators.JTextComponentOperator;
072:        import org.netbeans.jemmy.operators.JTextFieldOperator;
073:
074:        import javax.swing.JTextField;
075:        import org.netbeans.jemmy.operators.JPopupMenuOperator;
076:
077:        /**
078:         * @author Lark Fitzgerald (lark.fitzgerald@sun.com)
079:         */
080:        public class AcceptanceTest extends RaveTestCase {
081:
082:            //Project variables
083:            public String _sharedBundle = "org.netbeans.modules.visualweb.test.components.Component";
084:            public String _privateBundle = "org.netbeans.modules.visualweb.test.components.input.fileupload.Acceptance";
085:            public String _projectName = Bundle.getStringTrimmed(
086:                    _privateBundle, "projectName");
087:            public String _projectServer = Bundle.getStringTrimmed(
088:                    _sharedBundle, "projectServer");
089:            public String _logFileLocation = Bundle.getStringTrimmed(
090:                    _sharedBundle, "logFile");
091:            public String _logFile = System.getProperty("xtest.workdir")
092:                    + File.separator + _logFileLocation;
093:            public String _exception = Bundle.getStringTrimmed(_sharedBundle,
094:                    "Exception");
095:            public String _close = Bundle.getStringTrimmed(_sharedBundle,
096:                    "close");
097:            public String _run = Bundle.getStringTrimmed(_sharedBundle, "Run");
098:            public String _buildSuccess = Bundle.getStringTrimmed(
099:                    _sharedBundle, "buildSuccess");
100:            public String _true = Bundle
101:                    .getStringTrimmed(_sharedBundle, "true");
102:
103:            //Palette variables
104:            public String _basicPalette = Bundle.getStringTrimmed(
105:                    _sharedBundle, "basicPalette");
106:            public String _basicButton = Bundle.getStringTrimmed(_sharedBundle,
107:                    "basicButton");
108:            public String _basicTextArea = Bundle.getStringTrimmed(
109:                    _sharedBundle, "basicTextArea");
110:            public String _basicLabel = Bundle.getStringTrimmed(_sharedBundle,
111:                    "basicLabel");
112:            public String _basicFileUpload = Bundle.getStringTrimmed(
113:                    _sharedBundle, "basicFileUpload");
114:            public String _basicMessageGroup = Bundle.getStringTrimmed(
115:                    _sharedBundle, "basicMessageGroup");
116:
117:            //components
118:            public String _label1 = Bundle.getStringTrimmed(_sharedBundle,
119:                    "label1");
120:            public String _fileupload1 = Bundle.getStringTrimmed(_sharedBundle,
121:                    "fileupload1");
122:            public String _button1 = Bundle.getStringTrimmed(_sharedBundle,
123:                    "button1");
124:            public String _textarea1 = Bundle.getStringTrimmed(_sharedBundle,
125:                    "textarea1");
126:            public String _messagegroup1 = Bundle.getStringTrimmed(
127:                    _sharedBundle, "messagegroup1");
128:
129:            //drop points
130:            public int _x = Integer.parseInt(Bundle.getStringTrimmed(
131:                    _privateBundle, "x"));
132:            public int _label1y = Integer.parseInt(Bundle.getStringTrimmed(
133:                    _privateBundle, "label1y"));
134:            public int _fileupload1y = Integer.parseInt(Bundle
135:                    .getStringTrimmed(_privateBundle, "fileupload1y"));
136:            public int _button1y = Integer.parseInt(Bundle.getStringTrimmed(
137:                    _privateBundle, "button1y"));
138:            public int _textarea1y = Integer.parseInt(Bundle.getStringTrimmed(
139:                    _privateBundle, "textarea1y"));
140:            public int _messagegroup1y = Integer.parseInt(Bundle
141:                    .getStringTrimmed(_privateBundle, "messagegroup1y"));
142:
143:            //property items
144:            public String _propertyText = Bundle.getStringTrimmed(
145:                    _sharedBundle, "propertyText");
146:            public String _propertyLabel = Bundle.getStringTrimmed(
147:                    _sharedBundle, "propertyLabel");
148:            public String _propertyColumns = Bundle.getStringTrimmed(
149:                    _sharedBundle, "propertyColumns");
150:            public String _propertyRows = Bundle.getStringTrimmed(
151:                    _sharedBundle, "propertyRows");
152:
153:            //values
154:            public String _labelValue1 = Bundle.getStringTrimmed(
155:                    _privateBundle, "labelValue1");
156:            public String _buttonValue1 = Bundle.getStringTrimmed(
157:                    _privateBundle, "buttonValue1");
158:            public String _textAreaValue1 = Bundle.getStringTrimmed(
159:                    _privateBundle, "textAreaValue1");
160:            public String _columns = Bundle.getStringTrimmed(_privateBundle,
161:                    "columns");
162:            public String _rows = Bundle.getStringTrimmed(_privateBundle,
163:                    "rows");
164:
165:            //undeployment
166:            public String _undeploy = Bundle.getStringTrimmed(_sharedBundle,
167:                    "undeploy");
168:            public String _refresh = Bundle.getStringTrimmed(_sharedBundle,
169:                    "refresh");
170:            public String _serverPath = Bundle.getStringTrimmed(_sharedBundle,
171:                    "serverPath");
172:            public String _deploymentPath = Bundle.getStringTrimmed(
173:                    _sharedBundle, "deploymentPathGlassfish");
174:            public String _separator = Bundle.getStringTrimmed(_sharedBundle,
175:                    "separator");
176:
177:            Point clickPoint, dropPoint;
178:            public static DesignerPaneOperator designer;
179:            public static PaletteContainerOperator palette;
180:            public static DocumentOutlineOperator outline;
181:            public static SheetTableOperator sheet;
182:            public static DeploymentDialogOperator deploy;
183:            public static ServerNavigatorOperator explorer;
184:            public int row;
185:            public String _page1 = Bundle.getStringTrimmed(_sharedBundle,
186:                    "webPage1");
187:
188:            public AcceptanceTest(String testName) {
189:                super (testName);
190:            }
191:
192:            public static Test suite() {
193:                TestSuite suite = new NbTestSuite();
194:                suite.addTest(new AcceptanceTest("createWebProject"));
195:                suite.addTest(new AcceptanceTest("testAddLabel"));
196:                suite.addTest(new AcceptanceTest("testAddFileupload"));
197:                suite.addTest(new AcceptanceTest("testAddButton"));
198:                suite.addTest(new AcceptanceTest("testAddMessageGroup"));
199:                suite.addTest(new AcceptanceTest("testAddTextArea"));
200:                suite.addTest(new AcceptanceTest("testAddButtonAction"));
201:                suite.addTest(new AcceptanceTest("testDeploy"));
202:                suite.addTest(new AcceptanceTest("testCloseWebProject"));
203:                suite.addTest(new AcceptanceTest("testUndeploy"));
204:                suite.addTest(new AcceptanceTest("testCheckIDELog"));
205:
206:                return suite;
207:            }
208:
209:            /** method called before each testcase
210:             */
211:            protected void setUp() {
212:                System.out.println("########  " + getName() + "  #######");
213:            }
214:
215:            /** method called after each testcase
216:             */
217:            protected void tearDown() {
218:                System.out.println("########  " + getName()
219:                        + " Finished #######");
220:            }
221:
222:            /*
223:             *    Create Web Project
224:             *
225:             */
226:            public void createWebProject() {
227:                startTest();
228:                log("**Creating Project");
229:                //Create Project
230:                try {
231:                    ComponentUtils.createNewProject(_projectName);
232:                } catch (Exception e) {
233:                    log(">> Project Creation Failed");
234:                    e.printStackTrace();
235:                    log(e.toString());
236:                    fail();
237:                }
238:                log("**Done");
239:                endTest();
240:            }
241:
242:            /*
243:             *    Add a label to designer
244:             *    set text value to 'Select a file to download:"
245:             *
246:             */
247:            public void testAddLabel() {
248:                startTest();
249:                log("**Initialize");
250:                designer = new DesignerPaneOperator(RaveWindowOperator
251:                        .getDefaultRave());
252:                palette = new PaletteContainerOperator(_basicPalette);
253:                try {
254:                    Thread.sleep(5000);
255:                } catch (Exception e) {
256:                }
257:
258:                log("**Add label to designer");
259:                clickPoint = palette.getClickPoint(_basicLabel);
260:                dropPoint = new Point(_x, _label1y);
261:                palette.dndPaletteComponent(_basicLabel, designer, dropPoint);
262:                try {
263:                    Thread.sleep(2000);
264:                } catch (Exception e) {
265:                }
266:
267:                //For some reason, the property sheet doesn't rise to top for label
268:                log("make sure property sheet is visible");
269:                Util.getMainMenu().pushMenu("Window|Properties", "|");
270:
271:                log("**Set Label text property");
272:                sheet = new SheetTableOperator();
273:                int row = sheet.findCellRow(_propertyText);
274:                sheet.clickForEdit(row, 1);
275:                sheet.clickForEdit(row, 1);
276:                new JTextComponentOperator(sheet).enterText(_labelValue1);
277:
278:                log("**Done");
279:                endTest();
280:            }
281:
282:            /*
283:             *    Add a fileUpload to designer
284:             *
285:             */
286:            public void testAddFileupload() {
287:                startTest();
288:
289:                log("**Initialize");
290:                designer = new DesignerPaneOperator(RaveWindowOperator
291:                        .getDefaultRave());
292:                palette = new PaletteContainerOperator(_basicPalette);
293:                try {
294:                    Thread.sleep(5000);
295:                } catch (Exception e) {
296:                }
297:
298:                log("**Add file upload to designer");
299:                clickPoint = palette.getClickPoint(_basicFileUpload);
300:                dropPoint = new Point(_x, _fileupload1y);
301:                palette.dndPaletteComponent(_basicFileUpload, designer,
302:                        dropPoint);
303:                try {
304:                    Thread.sleep(2000);
305:                } catch (Exception e) {
306:                }
307:
308:                log("**Done");
309:                endTest();
310:            }
311:
312:            /*
313:             *    Add a button to designer
314:             *    label it 'Upload File Now'
315:             */
316:            public void testAddButton() {
317:                startTest();
318:                log("**Initialize");
319:                designer = new DesignerPaneOperator(RaveWindowOperator
320:                        .getDefaultRave());
321:                palette = new PaletteContainerOperator(_basicPalette);
322:                try {
323:                    Thread.sleep(5000);
324:                } catch (Exception e) {
325:                }
326:
327:                log("**Add Button to designer");
328:                clickPoint = palette.getClickPoint(_basicButton);
329:                dropPoint = new Point(_x, _button1y);
330:                palette.dndPaletteComponent(_basicButton, designer, dropPoint);
331:                try {
332:                    Thread.sleep(2000);
333:                } catch (Exception e) {
334:                }
335:
336:                log("**Set Button text inline");
337:                JTextFieldOperator field = new JTextFieldOperator(designer);
338:                SwingTextKeyboardDriver keyboard = new SwingTextKeyboardDriver();
339:                keyboard.enterText(field, _buttonValue1);
340:
341:                log("**Done.");
342:                endTest();
343:            }
344:
345:            /*
346:             *    Add a MessageGroup to designer
347:             */
348:            public void testAddMessageGroup() {
349:                startTest();
350:                log("**Initialize");
351:                designer = new DesignerPaneOperator(RaveWindowOperator
352:                        .getDefaultRave());
353:                palette = new PaletteContainerOperator(_basicPalette);
354:                try {
355:                    Thread.sleep(5000);
356:                } catch (Exception e) {
357:                }
358:
359:                log("**Add message group to designer");
360:                clickPoint = palette.getClickPoint(_basicMessageGroup);
361:                dropPoint = new Point(_x, _messagegroup1y);
362:                palette.dndPaletteComponent(_basicMessageGroup, designer,
363:                        dropPoint);
364:                try {
365:                    Thread.sleep(2000);
366:                } catch (Exception e) {
367:                }
368:
369:                log("**Done.");
370:                endTest();
371:
372:            }
373:
374:            /*
375:             *    Add a textArea to designer
376:             *    label it 'Contents of File:'
377:             *    set the columns to 60
378:             *    set the rows to 5
379:             */
380:            public void testAddTextArea() {
381:                startTest();
382:                log("**Initialize");
383:                designer = new DesignerPaneOperator(RaveWindowOperator
384:                        .getDefaultRave());
385:                palette = new PaletteContainerOperator(_basicPalette);
386:                try {
387:                    Thread.sleep(5000);
388:                } catch (Exception e) {
389:                }
390:
391:                log("**Add textArea1 to designer");
392:                clickPoint = palette.getClickPoint(_basicTextArea);
393:                dropPoint = new Point(_x, _textarea1y);
394:                palette
395:                        .dndPaletteComponent(_basicTextArea, designer,
396:                                dropPoint);
397:                try {
398:                    Thread.sleep(2000);
399:                } catch (Exception e) {
400:                }
401:
402:                log("**Set label value via property sheet");
403:                sheet = new SheetTableOperator();
404:                row = sheet.findCellRow(_propertyLabel);
405:                sheet.clickForEdit(row, 1);
406:                sheet.clickForEdit(row, 1);
407:                new JTextComponentOperator(sheet).enterText(_textAreaValue1);
408:
409:                log("**Set the columns to 60");
410:                row = sheet.findCellRow(_propertyColumns);
411:                sheet.clickForEdit(row, 1);
412:                sheet.clickForEdit(row, 1);
413:                new JTextComponentOperator(sheet).enterText(_columns);
414:
415:                log("**Set the rows to 5");
416:                row = sheet.findCellRow(_propertyRows);
417:                sheet.clickForEdit(row, 1);
418:                sheet.clickForEdit(row, 1);
419:                new JTextComponentOperator(sheet).enterText(_rows);
420:
421:                log("**Done.");
422:                endTest();
423:
424:            }
425:
426:            /*
427:             * Add button action1 with the following source:
428:             * log(\"Upload action performed\");
429:             */
430:            public void testAddButtonAction() {
431:                startTest();
432:                log("**double click button to get to action method()");
433:                designer = new DesignerPaneOperator(RaveWindowOperator
434:                        .getDefaultRave());
435:                designer.clickMouse(_x, _button1y, 2);
436:                JEditorPaneOperator editor = new JEditorPaneOperator(Util
437:                        .getMainWindow(), "Page1");
438:                //For some reason, doing all of them at once doesn't work
439:                editor.pushKey(KeyEvent.VK_END);
440:                editor.setText("\nlog(\"Upload action performed\");\n");
441:                log("Editor Dump:");
442:                log(editor.getText());
443:                log("**Go back to designer");
444:                try {
445:                    Thread.sleep(3000);
446:                } catch (Exception e) {
447:                }
448:                designer.switchToDesignerPane();
449:                log("**Done.");
450:                endTest();
451:            }
452:
453:            /*
454:             *    Configure web server
455:             */
456:            public void configureServer() {
457:                startTest();
458:                log("Open Server manager");
459:                ActionNoBlock srv = new ActionNoBlock("Tools|Server Manager",
460:                        "", "");
461:                srv.performMenu();
462:
463:                log("Find Server manager dialog");
464:                NbDialogOperator serverManager = new NbDialogOperator(
465:                        "Server Manager");
466:
467:                log("Press add server button");
468:                JButtonOperator addServer = new JButtonOperator(serverManager,
469:                        "Add Server...");
470:                addServer.pushNoBlock();
471:
472:                log("locate server instance wizard");
473:                WizardOperator serverInstance = new WizardOperator(
474:                        "Add Server Instance");
475:                log("Wizard initial step = "
476:                        + serverInstance.stepsGetSelectedIndex() + ": "
477:                        + serverInstance.stepsGetSelectedValue());
478:
479:                log("Take defaults and continue");
480:                serverInstance.next();
481:                log("Wizard step = " + serverInstance.stepsGetSelectedIndex()
482:                        + ": " + serverInstance.stepsGetSelectedValue());
483:
484:                log("Browse for location");
485:                JButtonOperator browse = new JButtonOperator(serverInstance,
486:                        "Browse...");
487:                browse.press();
488:                browse.release();
489:
490:                log("get install location dialog");
491:                NbDialogOperator installLocation = new NbDialogOperator(
492:                        "Choose Application Server's Install Location");
493:
494:                log("Set location");
495:                //There's only 1 textField on page so this works.
496:                JTextFieldOperator fileName = new JTextFieldOperator(
497:                        installLocation);
498:                fileName.enterText("C:\\sun\\glassfish");
499:
500:                log("Close dialog");
501:                JButtonOperator choose = new JButtonOperator(installLocation,
502:                        "Choose");
503:                choose.pushNoBlock();
504:                try {
505:                    Thread.sleep(2000);
506:                } catch (Exception e) {
507:                }
508:
509:                //confirm location?
510:
511:                log("go to next wizard page");
512:                serverInstance.next();
513:                try {
514:                    Thread.sleep(2000);
515:                } catch (Exception e) {
516:                }
517:                log("Wizard step = " + serverInstance.stepsGetSelectedIndex()
518:                        + ": " + serverInstance.stepsGetSelectedValue());
519:
520:                log("Set the password");
521:                JLabelOperator la = new JLabelOperator(serverInstance,
522:                        "Admin Password:");
523:                java.awt.Component c = la.getLabelFor();
524:                JTextField jtf = (JTextField) c;
525:                JTextFieldOperator adminPassword = new JTextFieldOperator(jtf);
526:                adminPassword.setText("adminadmin");
527:
528:                log("finish wizard");
529:                serverInstance.finish();
530:
531:                log("press close for server manager");
532:                JButtonOperator close = new JButtonOperator(serverManager,
533:                        "Close");
534:                //        serverManager.closeByButton();
535:                close.pushNoBlock();
536:
537:                endTest();
538:            }
539:
540:            /*
541:             * Deploy application
542:             */
543:            public void testDeploy() {
544:                startTest();
545:                //need to wait responce
546:                Waiter deploymentWaiter = new Waiter(new Waitable() {
547:                    public Object actionProduced(Object output) {
548:                        String text = ((OutputOperator) output).getText();
549:                        if (text.indexOf(_buildSuccess) != -1)
550:                            return _true;
551:                        return null;
552:
553:                    }
554:
555:                    public String getDescription() {
556:                        return ("Waiting Project Deployed");
557:                    }
558:                });
559:                log("Deploy from menu");
560:                ProjectNavigatorOperator.pressPopupItemOnNode(_projectName,
561:                        _run);
562:                TestUtils.wait(2000);
563:                OutputOperator outputWindow = new OutputOperator();
564:                deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime",
565:                        240000);
566:                log("wait until " + _buildSuccess);
567:                try {
568:                    deploymentWaiter.waitAction(outputWindow);
569:                } catch (InterruptedException e) {
570:                    log(outputWindow.getText());
571:                    e.printStackTrace();
572:                    fail("Deployment error: " + e);
573:                }
574:                log("Deployment complete");
575:                endTest();
576:            }
577:
578:            /*
579:            
580:             *Runtime
581:             10. browse and select a file
582:             1. Be sure to test files with space in path, space in name, as well as ones without.
583:             2. The src folder under this folder contains a series of files that can be used.
584:             11. press the Upload File Now button
585:            
586:             */
587:
588:            /*
589:             * Close Project
590:             *
591:             */
592:            public void testCloseWebProject() {
593:                startTest();
594:                Util.saveAllAPICall();
595:                new ProjectNavigatorOperator().pressPopupItemOnNode(
596:                        _projectName, _close);
597:                //TestUtils.closeCurrentProject();
598:                TestUtils.wait(5000);
599:                endTest();
600:            }
601:
602:            /* Need to undeploy project to finish tests correctly */
603:            public void testUndeploy() {
604:                startTest();
605:                log("Initialize");
606:                explorer = ServerNavigatorOperator.showNavigatorOperator();
607:                String serverPath = _serverPath + _projectServer; //Current deployment server
608:                String deploymentPath = serverPath + _deploymentPath; //glassfish specific
609:                String applicationPath = deploymentPath + _separator
610:                        + _projectName; //project name
611:
612:                // Select the Server Navigator and set the JTreeOperator
613:                log("get explorer");
614:                new QueueTool().waitEmpty(100); //??
615:                explorer.requestFocus();
616:                JTreeOperator tree = explorer.getTree();
617:                try {
618:                    Thread.sleep(4000);
619:                } catch (Exception e) {
620:                } // Sleep 4 secs to make sure Server Navigator is in focus
621:
622:                // Need to refresh J2EE AppServer node
623:                log("refresh");
624:                explorer.pushPopup(tree, serverPath, _refresh);
625:                TestUtils.wait(1000);
626:
627:                log("refresh deployment path: " + deploymentPath);
628:                TestUtils.wait(1000);
629:                explorer.selectPath(deploymentPath);
630:                explorer.getTree().expandPath(
631:                        explorer.getTree().findPath(deploymentPath));
632:                explorer.pushPopup(tree, deploymentPath, _refresh);
633:                TestUtils.wait(1000);
634:
635:                log("undeploy Path: " + applicationPath);
636:                explorer.selectPath(applicationPath);
637:                TestUtils.wait(1000);
638:
639:                log("Push Menu Undeploy...");
640:                explorer.pushPopup(explorer.getTree(), applicationPath,
641:                        _undeploy);
642:                TestUtils.wait(5000);
643:                endTest();
644:            }
645:
646:            public void testCheckIDELog() {
647:                startTest();
648:                try {
649:                    String err = ComponentUtils.hasUnexpectedException();
650:                    String str = "";
651:                    if (!(err.equals(""))) {
652:                        assertTrue(
653:                                "Unexpected  exceptions found in message.log: "
654:                                        + err, str.equals(""));
655:                    }
656:                } catch (IOException ioe) {
657:                    ioe.printStackTrace();
658:                    fail("Failed to open message.log : " + ioe);
659:                }
660:                endTest();
661:            }
662:        }
ww__w__.j__a__v__a2___s.___c___om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.