Source Code Cross Referenced for AcceptanceTest.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » test » components » input » hiddenfield » 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.hiddenfield 
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.hiddenfield;
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.gravy.DocumentOutlineOperator;
058:        import org.netbeans.modules.visualweb.gravy.EditorOperator;
059:        import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
060:        import org.netbeans.modules.visualweb.test.components.util.ComponentUtils;
061:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
062:
063:        import org.netbeans.jemmy.operators.*;
064:        import org.netbeans.jemmy.drivers.text.SwingTextKeyboardDriver;
065:        import org.netbeans.jemmy.operators.JRadioButtonOperator;
066:
067:        import java.awt.Point;
068:        import javax.swing.JRadioButton;
069:
070:        import java.io.File;
071:        import java.io.IOException;
072:
073:        /**
074:         * @author Lark Fitzgerald (lark.fitzgerald@sun.com)
075:         */
076:        public class AcceptanceTest extends RaveTestCase {
077:
078:            //Project variables
079:            public String _sharedBundle = "org.netbeans.modules.visualweb.test.components.Component";
080:            public String _privateBundle = "org.netbeans.modules.visualweb.test.components.input.hiddenfield.Acceptance";
081:            public String _projectName = Bundle.getStringTrimmed(
082:                    _privateBundle, "projectName");
083:            public String _projectServer = Bundle.getStringTrimmed(
084:                    _sharedBundle, "projectServer");
085:            public String _logFileLocation = Bundle.getStringTrimmed(
086:                    _sharedBundle, "logFile");
087:            public String _logFile = System.getProperty("xtest.workdir")
088:                    + File.separator + _logFileLocation;
089:            public String _exception = Bundle.getStringTrimmed(_sharedBundle,
090:                    "Exception");
091:            public String _close = Bundle.getStringTrimmed(_sharedBundle,
092:                    "close");
093:            public String _run = Bundle.getStringTrimmed(_sharedBundle, "Run");
094:            public String _buildSuccess = Bundle.getStringTrimmed(
095:                    _sharedBundle, "buildSuccess");
096:            public String _true = Bundle
097:                    .getStringTrimmed(_sharedBundle, "true");
098:
099:            //Palette variables
100:            public String _basicPalette = Bundle.getStringTrimmed(
101:                    _sharedBundle, "basicPalette");
102:            public String _basicButton = Bundle.getStringTrimmed(_sharedBundle,
103:                    "basicButton");
104:            public String _basicHiddenField = Bundle.getStringTrimmed(
105:                    _sharedBundle, "basicHiddenField");
106:            public String _basicTextField = Bundle.getStringTrimmed(
107:                    _sharedBundle, "basicTextField");
108:            public String _basicMessage = Bundle.getStringTrimmed(
109:                    _sharedBundle, "basicMessage");
110:            public String _basicMessageGroup = Bundle.getStringTrimmed(
111:                    _sharedBundle, "basicMessageGroup");
112:
113:            //property variables
114:            public String _propertyFor = Bundle.getStringTrimmed(_sharedBundle,
115:                    "propertyFor");
116:            public String _propertyText = Bundle.getStringTrimmed(
117:                    _sharedBundle, "propertyText");
118:            public String _propertyRequired = Bundle.getStringTrimmed(
119:                    _sharedBundle, "propertyRequired");
120:            public String _propertyDisabled = Bundle.getStringTrimmed(
121:                    _sharedBundle, "propertyDisabled");
122:            public String _propertyRendered = Bundle.getStringTrimmed(
123:                    _sharedBundle, "propertyRendered");
124:            public String _propertyConverter = Bundle.getStringTrimmed(
125:                    _sharedBundle, "propertyConverter");
126:            public String _propertyImmediate = Bundle.getStringTrimmed(
127:                    _sharedBundle, "propertyImmediate");
128:
129:            public String _newDateTimeConverter = Bundle.getStringTrimmed(
130:                    _sharedBundle, "newDateTimeConverter");
131:
132:            //Menu variables
133:            public String _separator = Bundle.getStringTrimmed(_sharedBundle,
134:                    "separator");
135:            public String _propertySheet = Bundle.getStringTrimmed(
136:                    _sharedBundle, "propertySheet");
137:
138:            //Binding Variables
139:            public String _bindDialog = Bundle.getStringTrimmed(_privateBundle,
140:                    "bindDialog");
141:            public String _useBinding = Bundle.getStringTrimmed(_privateBundle,
142:                    "useBinding");
143:            public String _bindToObject = Bundle.getStringTrimmed(
144:                    _privateBundle, "bindToObject");
145:            public String _bindTextField1Path = Bundle.getStringTrimmed(
146:                    _privateBundle, "bindTextField1Path");
147:            public String _selectBindingTarget = Bundle.getStringTrimmed(
148:                    _privateBundle, "selectBindingTarget");
149:
150:            //Component variables
151:            public String _hiddenField1 = Bundle.getStringTrimmed(
152:                    _privateBundle, "hiddenField1");
153:
154:            //coordinate variables
155:            public int _x = Integer.parseInt(Bundle.getStringTrimmed(
156:                    _privateBundle, "x"));
157:            public int _button1y = Integer.parseInt(Bundle.getStringTrimmed(
158:                    _privateBundle, "button1y"));
159:            public int _textfield1y = Integer.parseInt(Bundle.getStringTrimmed(
160:                    _privateBundle, "textfield1y"));
161:            public int _message1y = Integer.parseInt(Bundle.getStringTrimmed(
162:                    _privateBundle, "message1y"));
163:            public int _messagegroup1y = Integer.parseInt(Bundle
164:                    .getStringTrimmed(_privateBundle, "messageGroup1y"));
165:            public int _hiddenfield1y = Integer.parseInt(Bundle
166:                    .getStringTrimmed(_privateBundle, "hiddenField1y"));
167:            public int _hiddenfield2y = Integer.parseInt(Bundle
168:                    .getStringTrimmed(_privateBundle, "hiddenField2y"));
169:            public int _hiddenfield3y = Integer.parseInt(Bundle
170:                    .getStringTrimmed(_privateBundle, "hiddenField3y"));
171:            public int _hiddenfield4y = Integer.parseInt(Bundle
172:                    .getStringTrimmed(_privateBundle, "hiddenField4y"));
173:            public int _hiddenfield5y = Integer.parseInt(Bundle
174:                    .getStringTrimmed(_privateBundle, "hiddenField5y"));
175:            public int _hiddenfield6y = Integer.parseInt(Bundle
176:                    .getStringTrimmed(_privateBundle, "hiddenField6y"));
177:
178:            //component values
179:            public String _hiddenValue1 = Bundle.getStringTrimmed(
180:                    _privateBundle, "hiddenValue1");
181:
182:            //undeployment
183:            public String _undeploy = Bundle.getStringTrimmed(_sharedBundle,
184:                    "undeploy");
185:            public String _refresh = Bundle.getStringTrimmed(_sharedBundle,
186:                    "refresh");
187:            public String _serverPath = Bundle.getStringTrimmed(_sharedBundle,
188:                    "serverPath");
189:            public String _deploymentPath = Bundle.getStringTrimmed(
190:                    _sharedBundle, "deploymentPathGlassfish");
191:
192:            Point clickPoint, dropPoint;
193:            public static DesignerPaneOperator designer;
194:            public static PaletteContainerOperator palette;
195:            public static DocumentOutlineOperator outline;
196:            public static SheetTableOperator sheet;
197:            public static DeploymentDialogOperator deploy;
198:            public static ServerNavigatorOperator explorer;
199:            public String _page1 = Bundle.getStringTrimmed(_sharedBundle,
200:                    "webPage1");
201:            public String _false = Bundle.getStringTrimmed(_sharedBundle,
202:                    "false");
203:
204:            public AcceptanceTest(String testName) {
205:                super (testName);
206:            }
207:
208:            public static Test suite() {
209:                TestSuite suite = new NbTestSuite();
210:
211:                try {
212:                    suite.addTest(new AcceptanceTest("testCreateWebProject"));
213:
214:                    suite.addTest(new AcceptanceTest("testAddTextfield1"));
215:                    suite.addTest(new AcceptanceTest("testAddButton1"));
216:                    suite.addTest(new AcceptanceTest("testAddMessageGroup1"));
217:                    suite.addTest(new AcceptanceTest("testAddHiddenField1"));
218:                    //            suite.addTest(new AcceptanceTest("testAddMessage1"));
219:                    //            suite.addTest(new AcceptanceTest("testAddHiddenField2"));
220:                    //            suite.addTest(new AcceptanceTest("testAddHiddenField3"));
221:                    //            suite.addTest(new AcceptanceTest("testAddHiddenField4"));
222:                    //DateTimeConverter missing from dropdown, need to DnD instead
223:                    //        suite.addTest(new AcceptanceTest("testAddHiddenField5"));
224:                    //            suite.addTest(new AcceptanceTest("testAddHiddenField6"));
225:                    //            suite.addTest(new AcceptanceTest("testAddButton1Action"));
226:
227:                    //            suite.addTest(new AcceptanceTest("testDeploy"));
228:                    //            suite.addTest(new AcceptanceTest("testCloseWebProject"));
229:                    //        suite.addTest(new AcceptanceTest("testUndeploy"));
230:                    //        suite.addTest(new AcceptanceTest("testCheckIDELog"));
231:
232:                } catch (Exception e) {
233:
234:                }
235:                return suite;
236:            }
237:
238:            /** method called before each testcase
239:             */
240:            protected void setUp() {
241:                System.out.println("########  " + getName() + "  #######");
242:                /*
243:                 //Project variables
244:                 log(_sharedBundle);
245:                 log(_privateBundle);
246:                 log(_projectName);
247:                 log(_projects);
248:                 log(_projectType);
249:                 log(_projectPath);
250:                 log(_projectCategory);
251:                 log(_logFileLocation);
252:                 log(_logFile);
253:                 log(_exception);
254:                 log(_close);
255:                
256:                 //Palette variables
257:                 log(_basicPalette);
258:                 log(_basicButton);
259:                 log(_basicHiddenField);
260:                 log(_basicTextField);
261:                 log(_basicMessage);
262:                 log(_basicMessageGroup);
263:                
264:                 //property variables
265:                 log(_propertyFor);
266:                 log(_propertyText);
267:                 log(_propertyRequired);
268:                 log(_propertyDisabled);
269:                 log(_propertyRendered);
270:                 log(_propertyConverter);
271:                 log(_propertyImmediate);
272:                
273:                 log(_newDateTimeConverter);
274:                
275:                 //Menu variables
276:                
277:                 //Component variables
278:                 log(_hiddenField1);
279:                
280:                 //coordinate variables
281:                 log("" + _x);
282:                 log("" + _button1y);
283:                 log("" + _textfield1y);
284:                 log("" + _message1y);
285:                 log("" + _messagegroup1y);
286:                 log("" + _hiddenfield1y);
287:                 log("" + _hiddenfield2y);
288:                 log("" + _hiddenfield3y);
289:                 log("" + _hiddenfield4y);
290:                 log("" + _hiddenfield5y);
291:                 log("" + _hiddenfield6y);
292:                
293:                 //component values
294:                 log(_hiddenValue1);
295:                
296:                 log(_page1);
297:                 log(_true);
298:                 log(_false);
299:                 */
300:            }
301:
302:            /** method called after each testcase
303:             */
304:            protected void tearDown() {
305:                System.out.println("########  " + getName()
306:                        + " Finished #######");
307:            }
308:
309:            /*
310:             *    Create Web Project
311:             *
312:             */
313:            public void testCreateWebProject() {
314:                startTest();
315:                log("**Creating Project");
316:                //Create Project
317:                try {
318:                    ComponentUtils.createNewProject(_projectName);
319:                } catch (Exception e) {
320:                    log(">> Project Creation Failed");
321:                    e.printStackTrace();
322:                    log(e.toString());
323:                    fail();
324:                }
325:                log("**Done");
326:                endTest();
327:            }
328:
329:            /*@Test
330:             * drag a textField onto designer
331:             */
332:            public void testAddTextfield1() {
333:                startTest();
334:
335:                log("**Initialize");
336:                designer = new DesignerPaneOperator(RaveWindowOperator
337:                        .getDefaultRave());
338:                PaletteContainerOperator palette = new PaletteContainerOperator(
339:                        _basicPalette);
340:                try {
341:                    Thread.sleep(5000);
342:                } catch (Exception e) {
343:                }
344:
345:                log("**Add textField1 to designer");
346:                clickPoint = palette.getClickPoint(_basicTextField);
347:                dropPoint = new Point(_x, _textfield1y);
348:                palette.dndPaletteComponent(_basicTextField, designer,
349:                        dropPoint);
350:                try {
351:                    Thread.sleep(2000);
352:                } catch (Exception e) {
353:                }
354:
355:                log("**Done.");
356:                endTest();
357:
358:            }
359:
360:            /*
361:             * drag a button onto designer
362:             */
363:            public void testAddButton1() {
364:
365:                startTest();
366:                log("**Initialize");
367:                designer = new DesignerPaneOperator(RaveWindowOperator
368:                        .getDefaultRave());
369:                PaletteContainerOperator palette = new PaletteContainerOperator(
370:                        _basicPalette);
371:                try {
372:                    Thread.sleep(5000);
373:                } catch (Exception e) {
374:                }
375:
376:                log("**Add Button to designer");
377:                Point clickPoint = palette.getClickPoint(_basicButton);
378:                Point dropPoint = new Point(_x, _button1y);
379:                palette.dndPaletteComponent(_basicButton, designer, dropPoint);
380:                try {
381:                    Thread.sleep(2000);
382:                } catch (Exception e) {
383:                }
384:
385:                log("**Done.");
386:                endTest();
387:            }
388:
389:            /*
390:             * add Message Group to designer
391:             */
392:            public void testAddMessageGroup1() {
393:                startTest();
394:                log("**Initialize");
395:                designer = new DesignerPaneOperator(RaveWindowOperator
396:                        .getDefaultRave());
397:                palette = new PaletteContainerOperator(_basicPalette);
398:                try {
399:                    Thread.sleep(5000);
400:                } catch (Exception e) {
401:                }
402:
403:                log("**Add message group to designer");
404:                clickPoint = palette.getClickPoint(_basicMessageGroup);
405:                dropPoint = new Point(_x, _messagegroup1y);
406:                palette.dndPaletteComponent(_basicMessageGroup, designer,
407:                        dropPoint);
408:                try {
409:                    Thread.sleep(2000);
410:                } catch (Exception e) {
411:                }
412:
413:                log("**Done.");
414:                endTest();
415:            }
416:
417:            /*
418:             * add hiddenfield to designer
419:             *   1. bind its text value to #{Page1.textField1.text}
420:             *   2. add a length validator to it max=8, min=2
421:             *   3. right click in outline and add a validation event:
422:             *      info("hiddenField1: validate method called");
423:             *   4. right click in outline and add a processValue change event
424:             *      info("hiddenField1: processValueChange method called");
425:             */
426:            public void testAddHiddenField1() {
427:                startTest();
428:                log("**Initialize");
429:                designer = new DesignerPaneOperator(RaveWindowOperator
430:                        .getDefaultRave());
431:                palette = new PaletteContainerOperator(_basicPalette);
432:                try {
433:                    Thread.sleep(5000);
434:                } catch (Exception e) {
435:                }
436:
437:                log("**Add hiddenfield to designer");
438:                clickPoint = palette.getClickPoint(_basicHiddenField);
439:                dropPoint = new Point(_x, _hiddenfield1y);
440:                palette.dndPaletteComponent(_basicHiddenField, designer,
441:                        dropPoint);
442:                try {
443:                    Thread.sleep(2000);
444:                } catch (Exception e) {
445:                }
446:
447:                log("make sure property sheet is visible");
448:                Util.getMainMenu().pushMenu(_propertySheet, _separator);
449:                try {
450:                    Thread.sleep(2000);
451:                } catch (Exception e) {
452:                }
453:
454:                log("**Start Bind text to #{Page1.textField1.text}");
455:                log("open dialog");
456:                sheet = new SheetTableOperator();
457:                sheet.pushDotted(_propertyText);
458:
459:                log("locate dialog");
460:                NbDialogOperator bindDialog = new NbDialogOperator(_bindDialog);
461:
462:                log("Click the bind to Object radio button");
463:                JRadioButtonOperator bindOption = new JRadioButtonOperator(
464:                        bindDialog, _useBinding);
465:                bindOption.doClick();
466:
467:                log("Select the " + _bindToObject + " tab");
468:                new JTabbedPaneOperator(bindDialog).selectPage(_bindToObject);
469:                TestUtils.wait(1000);
470:
471:                try {
472:                    log("get tree");
473:                    JTreeOperator bindPath = new JTreeOperator(bindDialog);
474:                    log("child count: "
475:                            + bindPath.getChildCount(bindPath.getRoot()));
476:                    log("get path " + _bindTextField1Path);
477:                    javax.swing.tree.TreePath tp = bindPath.findPath(
478:                            _bindTextField1Path, _separator);
479:                    log("Select path " + _bindTextField1Path);
480:                    bindPath.selectPath(tp);
481:                } catch (Exception e) {
482:                    log("Exception occured.");
483:                    log(e.toString());
484:                    e.printStackTrace();
485:                    fail();
486:                }
487:
488:                log("select #{Page1.textField1.text}");
489:
490:                log("Close dialog");
491:                bindDialog.btOK();
492:                try {
493:                    Thread.sleep(2000);
494:                } catch (Exception e) {
495:                }
496:
497:                /*
498:                 log("**Add length validator; max=8, min=2");
499:                 //select via outline window
500:                 log("**Set validator property to '(new lengthValidator)'");
501:                 row = sheet.findCellRow(_propertyValidator);
502:                 sheet.clickForEdit(row, 1);
503:                 sheet.setComboBoxValue(_propertyValidator, _newValidatorLength);
504:                
505:                 log("**Select lengthValidator1 from Outline window");
506:                 DocumentOutlineOperator doo = new DocumentOutlineOperator(Util.getMainWindow());
507:                 Util.wait(2000);
508:                 doo.verify();
509:                 doo.clickOnPath(_lengthValidator1);
510:                 doo.selectPath(_lengthValidator1);
511:                 Util.wait(5000);
512:                
513:                 log("**set its max value '6'");
514:                 row = sheet.findCellRow(_propertyMaximum);
515:                 sheet.clickForEdit(row, 1);
516:                 sheet.clickForEdit(row, 1);
517:                 new JTextComponentOperator(sheet).enterText(_six);
518:                
519:                 log("**set its min value '2'");
520:                 row = sheet.findCellRow(_propertyMinimum);
521:                 sheet.clickForEdit(row, 1);
522:                 sheet.clickForEdit(row, 1);
523:                 new JTextComponentOperator(sheet).enterText(_two);
524:                 */
525:
526:                log("add validation event");
527:
528:                log("add processValue change event");
529:                //use outline window
530:                /*
531:                 designer.clickMouse(25, 175, 1);
532:                 try { Thread.sleep(2000); } catch(Exception e) {}  //wait or sub-menu won't be present.
533:                 designer.clickForPopup(25, 175);
534:                 new JPopupMenuOperator().pushMenuNoBlock("Edit Event Handler|processValueChange", "|");
535:                 try { Thread.sleep(3000); } catch(Exception e) {}
536:                
537:                 log("**Add code to textfield4_processValueChange");
538:                 String code = "staticText1.setValue(textField4.getValue());\n";
539:                 EditorOperator editor = new EditorOperator(Util.getMainWindow(), _page1);
540:                 editor.requestFocus();
541:                 editor.txtEditorPane().setText("staticText1.setValue(textField4.getValue());\n");
542:                 try { Thread.sleep(2000); } catch(Exception e) {}
543:                 designer.switchToDesignerPane();
544:                 */
545:
546:                log("**Done.");
547:                endTest();
548:            }
549:
550:            /*
551:             *  drag a message component onto designer
552:             *  set its for property to hiddenField1
553:             */
554:            public void testAddMessage1() {
555:                startTest();
556:                log("**Initialize");
557:                designer = new DesignerPaneOperator(RaveWindowOperator
558:                        .getDefaultRave());
559:                palette = new PaletteContainerOperator(_basicPalette);
560:                try {
561:                    Thread.sleep(5000);
562:                } catch (Exception e) {
563:                }
564:
565:                log("**Drag Message onto designer");
566:                clickPoint = palette.getClickPoint(_basicMessage);
567:                dropPoint = new Point(_x, _message1y);
568:                palette.dndPaletteComponent(_basicMessage, designer, dropPoint);
569:                try {
570:                    Thread.sleep(2000);
571:                } catch (Exception e) {
572:                }
573:
574:                log("make sure property sheet is visible");
575:                Util.getMainMenu().pushMenu("Window|Properties", "|");
576:                try {
577:                    Thread.sleep(2000);
578:                } catch (Exception e) {
579:                }
580:
581:                log("**Set message for property via property sheet");
582:                sheet = new SheetTableOperator();
583:                sheet.clickCell(_propertyFor);
584:                sheet.setComboBoxValue(_propertyFor, _hiddenField1);
585:
586:                log("**Done.");
587:                endTest();
588:            }
589:
590:            /*
591:             *  drag hiddenField2 onto designer
592:             *  set its disabled property = true
593:             */
594:            public void testAddHiddenField2() {
595:                startTest();
596:                log("**Initialize");
597:                designer = new DesignerPaneOperator(RaveWindowOperator
598:                        .getDefaultRave());
599:                palette = new PaletteContainerOperator(_basicPalette);
600:                try {
601:                    Thread.sleep(5000);
602:                } catch (Exception e) {
603:                }
604:
605:                log("**Add hiddenfield to designer");
606:                clickPoint = palette.getClickPoint(_basicHiddenField);
607:                dropPoint = new Point(_x, _hiddenfield2y);
608:                palette.dndPaletteComponent(_basicHiddenField, designer,
609:                        dropPoint);
610:                try {
611:                    Thread.sleep(2000);
612:                } catch (Exception e) {
613:                }
614:
615:                log("**Set disabled option to true");
616:                sheet = new SheetTableOperator();
617:                sheet.clickCell(_propertyDisabled);
618:                sheet.setCheckBoxValue(_propertyDisabled, _true);
619:                try {
620:                    Thread.sleep(2000);
621:                } catch (Exception e) {
622:                }
623:
624:                log("**Done.");
625:                endTest();
626:            }
627:
628:            /*
629:             *  drag hiddenField3 onto designer
630:             *  set its rendered property = false
631:             */
632:            public void testAddHiddenField3() {
633:                startTest();
634:                log("**Initialize");
635:                designer = new DesignerPaneOperator(RaveWindowOperator
636:                        .getDefaultRave());
637:                palette = new PaletteContainerOperator(_basicPalette);
638:                try {
639:                    Thread.sleep(5000);
640:                } catch (Exception e) {
641:                }
642:
643:                log("**Add hiddenfield to designer");
644:                clickPoint = palette.getClickPoint(_basicHiddenField);
645:                dropPoint = new Point(_x, _hiddenfield3y);
646:                palette.dndPaletteComponent(_basicHiddenField, designer,
647:                        dropPoint);
648:                try {
649:                    Thread.sleep(2000);
650:                } catch (Exception e) {
651:                }
652:
653:                log("**set textfield rendered property to false");
654:                sheet = new SheetTableOperator();
655:                sheet.clickCell(_propertyRendered);
656:                sheet.setCheckBoxValue(_propertyRendered, _false);
657:
658:                log("**Done.");
659:                endTest();
660:            }
661:
662:            /*
663:             * drag hiddenField4 onto designer
664:             * and set its text to: Star light, star bright...
665:             */
666:            public void testAddHiddenField4() {
667:                startTest();
668:                log("**Initialize");
669:                designer = new DesignerPaneOperator(RaveWindowOperator
670:                        .getDefaultRave());
671:                palette = new PaletteContainerOperator(_basicPalette);
672:                try {
673:                    Thread.sleep(5000);
674:                } catch (Exception e) {
675:                }
676:
677:                log("**Add hiddenfield to designer");
678:                clickPoint = palette.getClickPoint(_basicHiddenField);
679:                dropPoint = new Point(_x, _hiddenfield4y);
680:                palette.dndPaletteComponent(_basicHiddenField, designer,
681:                        dropPoint);
682:                try {
683:                    Thread.sleep(2000);
684:                } catch (Exception e) {
685:                }
686:
687:                log("**set its value to 'I am disabled'");
688:                sheet = new SheetTableOperator();
689:                sheet.clickCell(_propertyText);
690:                new JTextComponentOperator(sheet).enterText(_hiddenValue1);
691:
692:                log("**Done.");
693:                endTest();
694:
695:            }
696:
697:            /*
698:             * drag hiddenField5 onto designer
699:             * set its converter to dateTimeConverter1
700:             */
701:            public void testAddHiddenField5() {
702:                startTest();
703:                log("**Initialize");
704:                designer = new DesignerPaneOperator(RaveWindowOperator
705:                        .getDefaultRave());
706:                palette = new PaletteContainerOperator(_basicPalette);
707:                try {
708:                    Thread.sleep(5000);
709:                } catch (Exception e) {
710:                }
711:
712:                log("**Add hiddenfield to designer");
713:                clickPoint = palette.getClickPoint(_basicHiddenField);
714:                dropPoint = new Point(_x, _hiddenfield5y);
715:                palette.dndPaletteComponent(_basicHiddenField, designer,
716:                        dropPoint);
717:                try {
718:                    Thread.sleep(2000);
719:                } catch (Exception e) {
720:                }
721:
722:                log("**Set converter property to '(new DateTimeConverter)'");
723:                sheet = new SheetTableOperator();
724:                sheet.clickCell(_propertyConverter);
725:                sheet.setComboBoxValue(_propertyConverter,
726:                        _newDateTimeConverter);
727:
728:                log("**Done.");
729:                endTest();
730:            }
731:
732:            /*
733:             *  drag hiddenField6 onto designer
734:             *  and set its immediate flag = true
735:             */
736:            public void testAddHiddenField6() {
737:                startTest();
738:                log("**Initialize");
739:                designer = new DesignerPaneOperator(RaveWindowOperator
740:                        .getDefaultRave());
741:                palette = new PaletteContainerOperator(_basicPalette);
742:                try {
743:                    Thread.sleep(5000);
744:                } catch (Exception e) {
745:                }
746:
747:                log("**Add hiddenfield to designer");
748:                clickPoint = palette.getClickPoint(_basicHiddenField);
749:                dropPoint = new Point(_x, _hiddenfield6y);
750:                palette.dndPaletteComponent(_basicHiddenField, designer,
751:                        dropPoint);
752:                try {
753:                    Thread.sleep(2000);
754:                } catch (Exception e) {
755:                }
756:
757:                log("**set hiddenfield immediate property to true");
758:                sheet = new SheetTableOperator();
759:                sheet.clickCell(_propertyImmediate);
760:                sheet.setCheckBoxValue(_propertyImmediate, _true);
761:
762:                log("**Done.");
763:                endTest();
764:            }
765:
766:            /*
767:             * double click button and add following source:
768:             *  info("hiddenField1 has validator: " + hiddenField1.getValidator().getExpressionString());
769:             *  info("hiddenField2 is disabled: " + hiddenField2.isDisabled());
770:             *  info("hiddenField3 is rendered: " + hiddenField3.isRendered());
771:             *  info("hiddenField4 has text: " + hiddenField4.getValue());
772:             *  info("hiddenField5 has converter: " + hiddenField5.getConverter().toString());
773:             *  info("hiddenField6 is immediate: " + hiddenField6.isImmediate());
774:             */
775:            public void testAddButton1Action() {
776:                startTest();
777:                log("**double click button to get to action method()");
778:                designer = new DesignerPaneOperator(RaveWindowOperator
779:                        .getDefaultRave());
780:                designer.clickMouse(_x, _button1y, 2);
781:
782:                log("**add source code to button1_action()");
783:                String code1 = "info(\"hiddenField1 has validator: \" + hiddenField1.getValidator().getExpressionString());\n";
784:                String code2 = "info(\"hiddenField2 is disabled: \" + hiddenField2.isDisabled());\n";
785:                String code3 = "info(\"hiddenField3 is rendered: \" + hiddenField3.isRendered());\n";
786:                String code4 = "info(\"hiddenField4 has text: \" + hiddenField4.getValue());\n";
787:                String code5 = "info(\"hiddenField5 has converter: \" + hiddenField5.getConverter().toString());\n";
788:                String code6 = "info(\"hiddenField6 is immediate: \" + hiddenField6.isImmediate());\n";
789:                //For some reason, doing all of them at once doesn't work
790:                //        String code = code1 + code2 + code3 + code4 + code5 + code6;
791:                EditorOperator editor = new EditorOperator(
792:                        Util.getMainWindow(), _page1);
793:                editor.txtEditorPane().setText(code1);
794:                editor.txtEditorPane().setText(code2);
795:                editor.txtEditorPane().setText(code3);
796:                editor.txtEditorPane().setText(code4);
797:                editor.txtEditorPane().setText(code5);
798:                editor.txtEditorPane().setText(code6);
799:
800:                log("**Go back to designer");
801:                try {
802:                    Thread.sleep(3000);
803:                } catch (Exception e) {
804:                }
805:                designer.switchToDesignerPane();
806:
807:                log("**Done.");
808:                endTest();
809:
810:            }
811:
812:            /*
813:             * Deploy application
814:             */
815:            public void testDeploy() {
816:                startTest();
817:                //need to wait responce
818:                Waiter deploymentWaiter = new Waiter(new Waitable() {
819:                    public Object actionProduced(Object output) {
820:                        String text = ((OutputOperator) output).getText();
821:                        if (text.indexOf(_buildSuccess) != -1)
822:                            return _true;
823:                        return null;
824:
825:                    }
826:
827:                    public String getDescription() {
828:                        return ("Waiting Project Deployed");
829:                    }
830:                });
831:                log("Deploy from menu");
832:                ProjectNavigatorOperator.pressPopupItemOnNode(_projectName,
833:                        _run);
834:                TestUtils.wait(2000);
835:                OutputOperator outputWindow = new OutputOperator();
836:                deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime",
837:                        240000);
838:                log("wait until " + _buildSuccess);
839:                try {
840:                    deploymentWaiter.waitAction(outputWindow);
841:                } catch (InterruptedException e) {
842:                    log(outputWindow.getText());
843:                    e.printStackTrace();
844:                    fail("Deployment error: " + e);
845:                }
846:                log("Deployment complete");
847:                endTest();
848:            }
849:
850:            /*
851:            
852:             o) Expected Results:
853:            
854:             1. enter a value in the field a press the button. (Note: validation does not get called)
855:             1. System Messages shows
856:             1. processValueChange
857:             2. hiddenField1 has validator: #{Page1.hiddenField1_validate}
858:             3. hiddenField2 is disabled: true
859:             4. hiddenField3 is rendered: false
860:             5. hiddenfield4 has text: Start light, Star bright...
861:             6. hiddenfield5 has converter: javax.faces.convert.DateTimeConverter@bb9819
862:             7. hiddenfield6 is immediate: true
863:            
864:             */
865:            /*
866:             * Close Project
867:             *
868:             */
869:            public void testCloseWebProject() {
870:                startTest();
871:                Util.saveAllAPICall();
872:                new ProjectNavigatorOperator().pressPopupItemOnNode(
873:                        _projectName, _close);
874:                //TestUtils.closeCurrentProject();
875:                TestUtils.wait(5000);
876:                endTest();
877:            }
878:
879:            /* Need to undeploy project to finish tests correctly */
880:            public void testUndeploy() {
881:                startTest();
882:                log("Initialize");
883:                explorer = ServerNavigatorOperator.showNavigatorOperator();
884:                String serverPath = _serverPath + _projectServer; //Current deployment server
885:                String deploymentPath = serverPath + _deploymentPath; //glassfish specific
886:                String applicationPath = deploymentPath + _separator
887:                        + _projectName; //project name
888:
889:                // Select the Server Navigator and set the JTreeOperator
890:                log("get explorer");
891:                new QueueTool().waitEmpty(100); //??
892:                explorer.requestFocus();
893:                JTreeOperator tree = explorer.getTree();
894:                try {
895:                    Thread.sleep(4000);
896:                } catch (Exception e) {
897:                } // Sleep 4 secs to make sure Server Navigator is in focus
898:
899:                // Need to refresh J2EE AppServer node
900:                log("refresh");
901:                explorer.pushPopup(tree, serverPath, _refresh);
902:                TestUtils.wait(1000);
903:
904:                log("refresh deployment path: " + deploymentPath);
905:                TestUtils.wait(1000);
906:                explorer.selectPath(deploymentPath);
907:                explorer.getTree().expandPath(
908:                        explorer.getTree().findPath(deploymentPath));
909:                explorer.pushPopup(tree, deploymentPath, _refresh);
910:                TestUtils.wait(1000);
911:
912:                log("undeploy Path: " + applicationPath);
913:                explorer.selectPath(applicationPath);
914:                TestUtils.wait(1000);
915:
916:                log("Push Menu Undeploy...");
917:                explorer.pushPopup(explorer.getTree(), applicationPath,
918:                        _undeploy);
919:                TestUtils.wait(5000);
920:                endTest();
921:            }
922:
923:            public void testCheckIDELog() {
924:                startTest();
925:                try {
926:                    String err = ComponentUtils.hasUnexpectedException();
927:                    String str = "";
928:                    if (!(err.equals(""))) {
929:                        assertTrue(
930:                                "Unexpected  exceptions found in message.log: "
931:                                        + err, str.equals(""));
932:                    }
933:                } catch (IOException ioe) {
934:                    ioe.printStackTrace();
935:                    fail("Failed to open message.log : " + ioe);
936:                }
937:                endTest();
938:            }
939:        }
w__w___w__.___j___a__v__a__2s__.___c_o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.