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.textarea;
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.jemmy.operators.*;
054: import org.netbeans.jemmy.drivers.text.SwingTextKeyboardDriver;
055:
056: import org.netbeans.modules.visualweb.gravy.*;
057: import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
058: import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
059: import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
060: import org.netbeans.modules.visualweb.gravy.DocumentOutlineOperator;
061: import org.netbeans.modules.visualweb.gravy.EditorOperator;
062: import org.netbeans.modules.visualweb.test.components.util.ComponentUtils;
063: import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
064:
065: import java.io.File;
066: import java.io.IOException;
067: import java.awt.Point;
068:
069: /**
070: * @author Lark Fitzgerald (lark.fitzgerald@sun.com)
071: */
072: public class AcceptanceTest extends RaveTestCase {
073:
074: //Project variables
075: public String _sharedBundle = "org.netbeans.modules.visualweb.test.components.Component";
076: public String _privateBundle = "org.netbeans.modules.visualweb.test.components.input.textarea.Acceptance";
077: public String _projectName = Bundle.getStringTrimmed(
078: _privateBundle, "projectName");
079: public String _projectServer = Bundle.getStringTrimmed(
080: _sharedBundle, "projectServer");
081: public String _logFileLocation = Bundle.getStringTrimmed(
082: _sharedBundle, "logFile");
083: public String _logFile = System.getProperty("xtest.workdir")
084: + File.separator + _logFileLocation;
085: public String _exception = Bundle.getStringTrimmed(_sharedBundle,
086: "Exception");
087: public String _close = Bundle.getStringTrimmed(_sharedBundle,
088: "close");
089: public String _run = Bundle.getStringTrimmed(_sharedBundle, "Run");
090: public String _buildSuccess = Bundle.getStringTrimmed(
091: _sharedBundle, "buildSuccess");
092: public String _true = Bundle
093: .getStringTrimmed(_sharedBundle, "true");
094:
095: //Palette variables
096: public String _basicPalette = Bundle.getStringTrimmed(
097: _sharedBundle, "basicPalette");
098: public String _basicButton = Bundle.getStringTrimmed(_sharedBundle,
099: "basicButton");
100: public String _basicTextArea = Bundle.getStringTrimmed(
101: _sharedBundle, "basicTextArea");
102: public String _basicLabel = Bundle.getStringTrimmed(_sharedBundle,
103: "basicLabel");
104: public String _basicMessage = Bundle.getStringTrimmed(
105: _sharedBundle, "basicMessage");
106: public String _basicMessageGroup = Bundle.getStringTrimmed(
107: _sharedBundle, "basicMessageGroup");
108:
109: //components
110: public String _label1 = Bundle.getStringTrimmed(_sharedBundle,
111: "label1");
112: public String _button1 = Bundle.getStringTrimmed(_sharedBundle,
113: "button1");
114: public String _textarea1 = Bundle.getStringTrimmed(_sharedBundle,
115: "textarea1");
116: public String _textArea1 = Bundle.getStringTrimmed(_sharedBundle,
117: "textArea1");
118: public String _textarea2 = Bundle.getStringTrimmed(_sharedBundle,
119: "textarea2");
120: public String _textarea3 = Bundle.getStringTrimmed(_sharedBundle,
121: "textarea3");
122: public String _textarea4 = Bundle.getStringTrimmed(_sharedBundle,
123: "textarea4");
124: public String _textarea5 = Bundle.getStringTrimmed(_sharedBundle,
125: "textarea5");
126: public String _textarea6 = Bundle.getStringTrimmed(_sharedBundle,
127: "textarea6");
128: public String _messagegroup1 = Bundle.getStringTrimmed(
129: _sharedBundle, "messagegroup1");
130: public String _message1 = Bundle.getStringTrimmed(_sharedBundle,
131: "message1");
132:
133: //drop points
134: public int _x = Integer.parseInt(Bundle.getStringTrimmed(
135: _privateBundle, "x"));
136: public int _button1y = Integer.parseInt(Bundle.getStringTrimmed(
137: _privateBundle, "button1y"));
138: public int _label1y = Integer.parseInt(Bundle.getStringTrimmed(
139: _privateBundle, "label1y"));
140: public int _textarea1y = Integer.parseInt(Bundle.getStringTrimmed(
141: _privateBundle, "textarea1y"));
142: public int _message1y = Integer.parseInt(Bundle.getStringTrimmed(
143: _privateBundle, "message1y"));
144: public int _textarea2y = Integer.parseInt(Bundle.getStringTrimmed(
145: _privateBundle, "textarea2y"));
146: public int _textarea3y = Integer.parseInt(Bundle.getStringTrimmed(
147: _privateBundle, "textarea3y"));
148: public int _textarea4y = Integer.parseInt(Bundle.getStringTrimmed(
149: _privateBundle, "textarea4y"));
150: public int _textarea5y = Integer.parseInt(Bundle.getStringTrimmed(
151: _privateBundle, "textarea5y"));
152: public int _textarea6y = Integer.parseInt(Bundle.getStringTrimmed(
153: _privateBundle, "textarea6y"));
154: public int _messagegroup1y = Integer.parseInt(Bundle
155: .getStringTrimmed(_privateBundle, "messagegroup1y"));
156:
157: //property items
158: public String _propertyText = Bundle.getStringTrimmed(
159: _sharedBundle, "propertyText");
160: public String _propertyLabel = Bundle.getStringTrimmed(
161: _sharedBundle, "propertyLabel");
162: public String _propertyColumns = Bundle.getStringTrimmed(
163: _sharedBundle, "propertyColumns");
164: public String _propertyRows = Bundle.getStringTrimmed(
165: _sharedBundle, "propertyRows");
166: public String _propertyDisabled = Bundle.getStringTrimmed(
167: _sharedBundle, "propertyDisabled");
168: public String _propertyRequired = Bundle.getStringTrimmed(
169: _sharedBundle, "propertyRequired");
170: public String _propertyVisible = Bundle.getStringTrimmed(
171: _sharedBundle, "propertyVisible");
172: public String _propertyFor = Bundle.getStringTrimmed(_sharedBundle,
173: "propertyFor");
174:
175: //values
176: public String _labelValue1 = Bundle.getStringTrimmed(
177: _privateBundle, "labelValue1");
178: public String _labelValue2 = Bundle.getStringTrimmed(
179: _privateBundle, "labelValue2");
180: public String _buttonValue1 = Bundle.getStringTrimmed(
181: _privateBundle, "buttonValue1");
182: public String _textValue1 = Bundle.getStringTrimmed(_privateBundle,
183: "textValue1");
184: public String _textValue2 = Bundle.getStringTrimmed(_privateBundle,
185: "textValue2");
186: public String _textValue3 = Bundle.getStringTrimmed(_privateBundle,
187: "textValue3");
188: public String _textValue4 = Bundle.getStringTrimmed(_privateBundle,
189: "textValue4");
190: public String _columns = Bundle.getStringTrimmed(_privateBundle,
191: "columns");
192: public String _rows = Bundle.getStringTrimmed(_privateBundle,
193: "rows");
194:
195: //undeployment
196: public String _undeploy = Bundle.getStringTrimmed(_sharedBundle,
197: "undeploy");
198: public String _refresh = Bundle.getStringTrimmed(_sharedBundle,
199: "refresh");
200: public String _serverPath = Bundle.getStringTrimmed(_sharedBundle,
201: "serverPath");
202: public String _deploymentPath = Bundle.getStringTrimmed(
203: _sharedBundle, "deploymentPathGlassfish");
204: public String _separator = Bundle.getStringTrimmed(_sharedBundle,
205: "separator");
206:
207: Point clickPoint, dropPoint;
208: public static DesignerPaneOperator designer;
209: public static PaletteContainerOperator palette;
210: public static DocumentOutlineOperator outline;
211: public static SheetTableOperator sheet;
212: public static DeploymentDialogOperator deploy;
213: public static ServerNavigatorOperator explorer;
214: public int row;
215: public String _page1 = Bundle.getStringTrimmed(_sharedBundle,
216: "webPage1");
217: public String _false = Bundle.getStringTrimmed(_sharedBundle,
218: "false");
219:
220: public AcceptanceTest(String testName) {
221: super (testName);
222: }
223:
224: public static Test suite() {
225: TestSuite suite = new NbTestSuite();
226:
227: //Create the project
228: suite.addTest(new AcceptanceTest("createWebProject"));
229:
230: //Design the page
231: suite.addTest(new AcceptanceTest("testAddButton"));
232: suite.addTest(new AcceptanceTest("testTextArea1"));
233: suite.addTest(new AcceptanceTest("testTextArea2"));
234: suite.addTest(new AcceptanceTest("testTextArea3"));
235: suite.addTest(new AcceptanceTest("testTextArea4"));
236: suite.addTest(new AcceptanceTest("testTextArea5"));
237: suite.addTest(new AcceptanceTest("testTextArea6"));
238: suite.addTest(new AcceptanceTest("testAddMessageGroup"));
239:
240: suite.addTest(new AcceptanceTest("testDeploy"));
241: suite.addTest(new AcceptanceTest("testCloseWebProject"));
242: suite.addTest(new AcceptanceTest("testUndeploy"));
243: suite.addTest(new AcceptanceTest("testCheckIDELog"));
244:
245: return suite;
246: }
247:
248: /** method called before each testcase
249: */
250: protected void setUp() {
251: System.out.println("######## " + getName() + " #######");
252: }
253:
254: /** method called after each testcase
255: */
256: protected void tearDown() {
257: System.out.println("######## " + getName()
258: + " Finished #######");
259: }
260:
261: /*
262: * Create Web Project
263: *
264: */
265: public void createWebProject() {
266: startTest();
267: log("**Creating Project");
268: //Create Project
269: try {
270: ComponentUtils.createNewProject(_projectName);
271: } catch (Exception e) {
272: log(">> Project Creation Failed");
273: e.printStackTrace();
274: log(e.toString());
275: fail();
276: }
277: log("**Done");
278: endTest();
279: }
280:
281: /*
282: * Add a button
283: */
284: public void testAddButton() {
285: startTest();
286: log("**Initialize");
287: designer = new DesignerPaneOperator(RaveWindowOperator
288: .getDefaultRave());
289: palette = new PaletteContainerOperator(_basicPalette);
290: try {
291: Thread.sleep(5000);
292: } catch (Exception e) {
293: }
294:
295: log("**Add Button to designer");
296: clickPoint = palette.getClickPoint(_basicButton);
297: dropPoint = new Point(_x, _button1y);
298: palette.dndPaletteComponent(_basicButton, designer, dropPoint);
299: try {
300: Thread.sleep(2000);
301: } catch (Exception e) {
302: }
303:
304: log("**Set Button text inline");
305: JTextFieldOperator field = new JTextFieldOperator(designer);
306: SwingTextKeyboardDriver keyboard = new SwingTextKeyboardDriver();
307: keyboard.enterText(field, _buttonValue1);
308:
309: log("**Done.");
310: endTest();
311: }
312:
313: /*
314: * add textArea1
315: * set the label value to 'I am a text area label'
316: * set the text area required = true.
317: * add a message list set for textArea1
318: */
319: public void testTextArea1() {
320: startTest();
321: log("**Initialize");
322: designer = new DesignerPaneOperator(RaveWindowOperator
323: .getDefaultRave());
324: palette = new PaletteContainerOperator(_basicPalette);
325: try {
326: Thread.sleep(5000);
327: } catch (Exception e) {
328: }
329:
330: log("**Add textArea1 to designer");
331: clickPoint = palette.getClickPoint(_basicTextArea);
332: dropPoint = new Point(_x, _textarea1y);
333: palette
334: .dndPaletteComponent(_basicTextArea, designer,
335: dropPoint);
336: try {
337: Thread.sleep(2000);
338: } catch (Exception e) {
339: }
340:
341: //For some reason, the property sheet doesn't rise to top
342: log("make sure property sheet is visible");
343: Util.getMainMenu().pushMenu("Window|Properties", "|");
344:
345: log("**Set label value via property sheet");
346: sheet = new SheetTableOperator();
347: row = sheet.findCellRow(_propertyLabel);
348: sheet.clickForEdit(row, 1);
349: sheet.clickForEdit(row, 1);
350: new JTextComponentOperator(sheet).enterText(_labelValue1);
351:
352: log("**Set required option to true");
353: row = sheet.findCellRow(_propertyRequired);
354: sheet.clickForEdit(row, 1);
355: sheet.setCheckBoxValue(_propertyRequired, _true);
356: try {
357: Thread.sleep(2000);
358: } catch (Exception e) {
359: }
360:
361: log("**Drag Message onto designer");
362: // palette.select();
363: clickPoint = palette.getClickPoint(_basicMessage);
364: dropPoint = new Point(_x, _message1y);
365: palette.dndPaletteComponent(_basicMessage, designer, dropPoint);
366: try {
367: Thread.sleep(2000);
368: } catch (Exception e) {
369: }
370:
371: log("**Set message for property via property sheet");
372: row = sheet.findCellRow(_propertyFor);
373: sheet.clickForEdit(row, 1);
374: sheet.setComboBoxValue(_propertyFor, _textArea1);
375:
376: log("**Done.");
377: endTest();
378:
379: }
380:
381: /*
382: * add textArea2
383: * set the text value to 'columns = 20'
384: * set the columns value = 20.
385: */
386: public void testTextArea2() {
387: startTest();
388: log("**Initialize");
389: designer = new DesignerPaneOperator(RaveWindowOperator
390: .getDefaultRave());
391: palette = new PaletteContainerOperator(_basicPalette);
392: try {
393: Thread.sleep(5000);
394: } catch (Exception e) {
395: }
396:
397: log("**Add textArea to designer");
398: clickPoint = palette.getClickPoint(_basicTextArea);
399: dropPoint = new Point(_x, _textarea2y);
400: palette
401: .dndPaletteComponent(_basicTextArea, designer,
402: dropPoint);
403: try {
404: Thread.sleep(2000);
405: } catch (Exception e) {
406: }
407:
408: log("**Set the " + _propertyText + " to " + _textValue3);
409: sheet = new SheetTableOperator();
410: sheet.clickCell(_propertyText);
411: new JTextComponentOperator(sheet).enterText(_textValue3);
412:
413: log("**Set the columns to " + _columns);
414: row = sheet.findCellRow(_propertyColumns);
415: sheet.clickForEdit(row, 1);
416: sheet.clickForEdit(row, 1);
417: new JTextComponentOperator(sheet).enterText(_columns);
418:
419: log("**Done.");
420: endTest();
421:
422: }
423:
424: /*
425: * add textArea3
426: * set the text value to 'rows = 5
427: * set the rows = 5
428: */
429: public void testTextArea3() {
430: startTest();
431:
432: log("**Initialize");
433: designer = new DesignerPaneOperator(RaveWindowOperator
434: .getDefaultRave());
435: palette = new PaletteContainerOperator(_basicPalette);
436: try {
437: Thread.sleep(5000);
438: } catch (Exception e) {
439: }
440:
441: log("**Add textArea to designer");
442: clickPoint = palette.getClickPoint(_basicTextArea);
443: dropPoint = new Point(_x, _textarea3y);
444: palette
445: .dndPaletteComponent(_basicTextArea, designer,
446: dropPoint);
447: try {
448: Thread.sleep(2000);
449: } catch (Exception e) {
450: }
451:
452: log("**Set the text");
453: sheet = new SheetTableOperator();
454: sheet.clickCell(_propertyText);
455: new JTextComponentOperator(sheet).enterText(_textValue4);
456:
457: log("**Set the rows to " + _rows);
458: row = sheet.findCellRow(_propertyRows);
459: sheet.clickForEdit(row, 1);
460: sheet.clickForEdit(row, 1);
461: new JTextComponentOperator(sheet).enterText(_rows);
462:
463: log("**Done.");
464: endTest();
465:
466: }
467:
468: /*
469: * add textArea4
470: * set the text value to 'disabled'
471: * set disabled = true
472: */
473: public void testTextArea4() {
474: startTest();
475: log("**Initialize");
476: designer = new DesignerPaneOperator(RaveWindowOperator
477: .getDefaultRave());
478: palette = new PaletteContainerOperator(_basicPalette);
479: try {
480: Thread.sleep(5000);
481: } catch (Exception e) {
482: }
483:
484: log("**Add textArea to designer");
485: clickPoint = palette.getClickPoint(_basicTextArea);
486: dropPoint = new Point(_x, _textarea4y);
487: palette
488: .dndPaletteComponent(_basicTextArea, designer,
489: dropPoint);
490: try {
491: Thread.sleep(2000);
492: } catch (Exception e) {
493: }
494:
495: log("**Set text value via property sheet");
496: sheet = new SheetTableOperator();
497: sheet.clickCell(_propertyText);
498: new JTextComponentOperator(sheet).enterText(_textValue1);
499:
500: log("**Set disabled option to true");
501: row = sheet.findCellRow(_propertyDisabled);
502: sheet.clickForEdit(row, 1);
503: sheet.setCheckBoxValue(_propertyDisabled, _true);
504: try {
505: Thread.sleep(2000);
506: } catch (Exception e) {
507: }
508:
509: log("**Done.");
510: endTest();
511:
512: }
513:
514: /*
515: * add a label
516: * set its value to 'visible = false'.
517: * add textArea5
518: * set visible = false
519: */
520: public void testTextArea5() {
521: startTest();
522: log("**Initialize");
523: designer = new DesignerPaneOperator(RaveWindowOperator
524: .getDefaultRave());
525: palette = new PaletteContainerOperator(_basicPalette);
526: try {
527: Thread.sleep(5000);
528: } catch (Exception e) {
529: }
530:
531: log("**Add label to designer");
532: clickPoint = palette.getClickPoint(_basicLabel);
533: dropPoint = new Point(_x, _label1y);
534: palette.dndPaletteComponent(_basicLabel, designer, dropPoint);
535: try {
536: Thread.sleep(2000);
537: } catch (Exception e) {
538: }
539:
540: log("**Set Label text property");
541: sheet = new SheetTableOperator();
542: int row = sheet.findCellRow(_propertyText);
543: sheet.clickForEdit(row, 1);
544: sheet.clickForEdit(row, 1);
545: new JTextComponentOperator(sheet).enterText(_labelValue2);
546:
547: log("**Add textArea to designer");
548: clickPoint = palette.getClickPoint(_basicTextArea);
549: dropPoint = new Point(_x, _textarea5y);
550: palette
551: .dndPaletteComponent(_basicTextArea, designer,
552: dropPoint);
553: try {
554: Thread.sleep(2000);
555: } catch (Exception e) {
556: }
557:
558: log("**Set visible option to true");
559: row = sheet.findCellRow(_propertyVisible);
560: sheet.clickForEdit(row, 1);
561: sheet.setCheckBoxValue(_propertyVisible, _false);
562: try {
563: Thread.sleep(2000);
564: } catch (Exception e) {
565: }
566:
567: log("**Done.");
568: endTest();
569:
570: }
571:
572: /*
573: * add textArea6,
574: * set its text value to a couple of paragraphs of text
575: */
576: public void testTextArea6() {
577: startTest();
578: log("**Initialize");
579: designer = new DesignerPaneOperator(RaveWindowOperator
580: .getDefaultRave());
581: palette = new PaletteContainerOperator(_basicPalette);
582: try {
583: Thread.sleep(5000);
584: } catch (Exception e) {
585: }
586:
587: log("**Add textArea to designer");
588: clickPoint = palette.getClickPoint(_basicTextArea);
589: dropPoint = new Point(_x, _textarea6y);
590: palette
591: .dndPaletteComponent(_basicTextArea, designer,
592: dropPoint);
593: try {
594: Thread.sleep(2000);
595: } catch (Exception e) {
596: }
597:
598: log("**Set text property");
599: sheet = new SheetTableOperator();
600: sheet.clickCell(_propertyText);
601: new JTextComponentOperator(sheet).enterText(_textValue2);
602:
603: log("**Done.");
604: endTest();
605:
606: }
607:
608: /*
609: * Add a messageGroup to catch any other errors.
610: */
611: public void testAddMessageGroup() {
612: startTest();
613: log("**Initialize");
614: designer = new DesignerPaneOperator(RaveWindowOperator
615: .getDefaultRave());
616: palette = new PaletteContainerOperator(_basicPalette);
617: try {
618: Thread.sleep(5000);
619: } catch (Exception e) {
620: }
621:
622: log("**Add message group to designer");
623: clickPoint = palette.getClickPoint(_basicMessageGroup);
624: dropPoint = new Point(_x, _messagegroup1y);
625: palette.dndPaletteComponent(_basicMessageGroup, designer,
626: dropPoint);
627: try {
628: Thread.sleep(2000);
629: } catch (Exception e) {
630: }
631:
632: log("**Done.");
633: endTest();
634: }
635:
636: /*
637: * Deploy application
638: */
639: public void testDeploy() {
640: startTest();
641: //need to wait responce
642: Waiter deploymentWaiter = new Waiter(new Waitable() {
643: public Object actionProduced(Object output) {
644: String text = ((OutputOperator) output).getText();
645: if (text.indexOf(_buildSuccess) != -1)
646: return _true;
647: return null;
648:
649: }
650:
651: public String getDescription() {
652: return ("Waiting Project Deployed");
653: }
654: });
655: log("Deploy from menu");
656: ProjectNavigatorOperator.pressPopupItemOnNode(_projectName,
657: _run);
658: TestUtils.wait(2000);
659: OutputOperator outputWindow = new OutputOperator();
660: deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime",
661: 240000);
662: log("wait until " + _buildSuccess);
663: try {
664: deploymentWaiter.waitAction(outputWindow);
665: } catch (InterruptedException e) {
666: log(outputWindow.getText());
667: e.printStackTrace();
668: fail("Deployment error: " + e);
669: }
670: log("Deployment complete");
671: endTest();
672: }
673:
674: /*
675: * Close Project
676: *
677: */
678: public void testCloseWebProject() {
679: startTest();
680: Util.saveAllAPICall();
681: new ProjectNavigatorOperator().pressPopupItemOnNode(
682: _projectName, _close);
683: //TestUtils.closeCurrentProject();
684: TestUtils.wait(5000);
685: endTest();
686: }
687:
688: /* Need to undeploy project to finish tests correctly */
689: public void testUndeploy() {
690: startTest();
691: log("Initialize");
692: explorer = ServerNavigatorOperator.showNavigatorOperator();
693: String serverPath = _serverPath + _projectServer; //Current deployment server
694: String deploymentPath = serverPath + _deploymentPath; //glassfish specific
695: String applicationPath = deploymentPath + _separator
696: + _projectName; //project name
697:
698: // Select the Server Navigator and set the JTreeOperator
699: log("get explorer");
700: new QueueTool().waitEmpty(100); //??
701: explorer.requestFocus();
702: JTreeOperator tree = explorer.getTree();
703: try {
704: Thread.sleep(4000);
705: } catch (Exception e) {
706: } // Sleep 4 secs to make sure Server Navigator is in focus
707:
708: // Need to refresh J2EE AppServer node
709: log("refresh");
710: explorer.pushPopup(tree, serverPath, _refresh);
711: TestUtils.wait(1000);
712:
713: log("refresh deployment path: " + deploymentPath);
714: TestUtils.wait(1000);
715: explorer.selectPath(deploymentPath);
716: explorer.getTree().expandPath(
717: explorer.getTree().findPath(deploymentPath));
718: explorer.pushPopup(tree, deploymentPath, _refresh);
719: TestUtils.wait(1000);
720:
721: log("undeploy Path: " + applicationPath);
722: explorer.selectPath(applicationPath);
723: TestUtils.wait(1000);
724:
725: log("Push Menu Undeploy...");
726: explorer.pushPopup(explorer.getTree(), applicationPath,
727: _undeploy);
728: TestUtils.wait(5000);
729: endTest();
730: }
731:
732: public void testCheckIDELog() {
733: startTest();
734: try {
735: String err = ComponentUtils.hasUnexpectedException();
736: String str = "";
737: if (!(err.equals(""))) {
738: assertTrue(
739: "Unexpected exceptions found in message.log: "
740: + err, str.equals(""));
741: }
742: } catch (IOException ioe) {
743: ioe.printStackTrace();
744: fail("Failed to open message.log : " + ioe);
745: }
746: endTest();
747: }
748: }
|