1 19 20 package validation; 21 22 import java.awt.Component ; 23 import java.awt.Toolkit ; 24 import java.awt.Window ; 25 import java.awt.datatransfer.DataFlavor ; 26 import java.awt.datatransfer.UnsupportedFlavorException ; 27 import java.awt.event.KeyEvent ; 28 import java.io.File ; 29 import java.io.IOException ; 30 import java.lang.Object ; 31 import javax.swing.JTextField ; 32 import javax.swing.KeyStroke ; 33 import javax.swing.tree.TreePath ; 34 import junit.textui.TestRunner; 35 import org.netbeans.jellytools.Bundle; 36 import org.netbeans.jellytools.EditorOperator; 37 import org.netbeans.jellytools.FavoritesOperator; 38 import org.netbeans.jellytools.FilesTabOperator; 39 import org.netbeans.jellytools.HelpOperator; 40 import org.netbeans.jellytools.JellyTestCase; 41 import org.netbeans.jellytools.MainWindowOperator; 42 import org.netbeans.jellytools.NbDialogOperator; 43 import org.netbeans.jellytools.NewFileNameLocationStepOperator; 44 import org.netbeans.jellytools.NewFileWizardOperator; 45 import org.netbeans.jellytools.NewProjectNameLocationStepOperator; 46 import org.netbeans.jellytools.NewProjectWizardOperator; 47 import org.netbeans.jellytools.OptionsOperator; 48 import org.netbeans.jellytools.OutputOperator; 49 import org.netbeans.jellytools.OutputTabOperator; 50 import org.netbeans.jellytools.ProjectsTabOperator; 51 import org.netbeans.jellytools.RuntimeTabOperator; 52 import org.netbeans.jellytools.TopComponentOperator; 53 import org.netbeans.jellytools.TreeTableOperator; 54 import org.netbeans.jellytools.WizardOperator; 55 import org.netbeans.jellytools.actions.Action; 56 import org.netbeans.jellytools.actions.ActionNoBlock; 57 import org.netbeans.jellytools.actions.AttachWindowAction; 58 import org.netbeans.jellytools.actions.CompileAction; 59 import org.netbeans.jellytools.actions.CopyAction; 60 import org.netbeans.jellytools.actions.CutAction; 61 import org.netbeans.jellytools.actions.DeleteAction; 62 import org.netbeans.jellytools.actions.NewFileAction; 63 import org.netbeans.jellytools.actions.PasteAction; 64 import org.netbeans.jellytools.actions.ViewAction; 65 import org.netbeans.jellytools.modules.debugger.actions.ContinueAction; 66 import org.netbeans.jellytools.modules.debugger.actions.DebugAction; 67 import org.netbeans.jellytools.modules.debugger.actions.FinishDebuggerAction; 68 import org.netbeans.jellytools.modules.debugger.actions.NewBreakpointAction; 69 import org.netbeans.jellytools.modules.debugger.actions.ToggleBreakpointAction; 70 import org.netbeans.jellytools.nodes.JavaNode; 71 import org.netbeans.jellytools.nodes.Node; 72 import org.netbeans.jellytools.nodes.SourcePackagesNode; 73 import org.netbeans.jellytools.properties.Property; 74 import org.netbeans.jellytools.properties.PropertySheetOperator; 75 76 import org.netbeans.jemmy.ComponentChooser; 77 import org.netbeans.jemmy.EventTool; 78 import org.netbeans.jemmy.JemmyException; 79 import org.netbeans.jemmy.JemmyProperties; 80 import org.netbeans.jemmy.QueueTool; 81 import org.netbeans.jemmy.TestOut; 82 import org.netbeans.jemmy.TimeoutExpiredException; 83 import org.netbeans.jemmy.Waitable; 84 import org.netbeans.jemmy.Waiter; 85 import org.netbeans.jemmy.operators.JButtonOperator; 86 import org.netbeans.jemmy.operators.JDialogOperator; 87 import org.netbeans.jemmy.operators.JLabelOperator; 88 import org.netbeans.jemmy.operators.JRadioButtonOperator; 89 import org.netbeans.jemmy.operators.JTableOperator; 90 import org.netbeans.jemmy.operators.JTextFieldOperator; 91 import org.netbeans.jemmy.operators.JTreeOperator; 92 import org.netbeans.jemmy.operators.Operator; 93 import org.netbeans.jemmy.operators.WindowOperator; 94 import org.netbeans.jemmy.util.PNGEncoder; 95 96 import org.netbeans.junit.NbTestSuite; 97 import org.netbeans.junit.ide.ProjectSupport; 98 import org.openide.windows.Mode; 99 import org.openide.windows.TopComponent; 100 import org.openide.windows.WindowManager; 101 102 107 public class IDEValidation extends JellyTestCase { 108 109 110 public IDEValidation(String name) { 111 super(name); 112 } 113 114 public static NbTestSuite suite() { 115 NbTestSuite suite = new NbTestSuite(); 116 suite.addTest(new IDEValidation("testMainMenu")); 117 suite.addTest(new IDEValidation("testHelp")); 118 suite.addTest(new IDEValidation("testOptions")); 119 suite.addTest(new IDEValidation("testOptionsClassicView")); 120 suite.addTest(new IDEValidation("testNewProject")); 121 suite.addTest(new IDEValidation("testShortcuts")); 123 suite.addTest(new IDEValidation("testNewFile")); 124 suite.addTest(new IDEValidation("testCVSLite")); 125 suite.addTest(new IDEValidation("testProjectsView")); 126 suite.addTest(new IDEValidation("testFilesView")); 127 suite.addTest(new IDEValidation("testEditor")); 128 suite.addTest(new IDEValidation("testBuildAndRun")); 129 suite.addTest(new IDEValidation("testDebugging")); 130 suite.addTest(new IDEValidation("testJUnit")); 131 suite.addTest(new IDEValidation("testXML")); 132 suite.addTest(new IDEValidation("testUpdateCenter")); 133 suite.addTest(new IDEValidation("testDb")); 134 suite.addTest(new IDEValidation("testWindowSystem")); 135 suite.addTest(new IDEValidation("testSeparateWindowsMode")); 136 suite.addTest(new IDEValidation("testModuleInstallation")); 137 return suite; 138 } 139 140 141 public static void main(java.lang.String [] args) { 142 TestRunner.run(suite()); 144 } 147 148 public void setUp() { 149 System.out.println("######## "+getName()+" #######"); 150 closeHelpWindow(); 153 } 154 155 public void tearDown() { 156 } 157 158 private static final String JAVA_CLASS_NAME = "Main"; private static final String SAMPLE_FRAME_NAME = "SampleFrame"; private static final String SAMPLE_PROJECT_NAME = "SampleProject"; private static final String SAMPLE1_PACKAGE_NAME = "sample1"; private static final String SAMPLE2_PACKAGE_NAME = "sample2"; private static final String SAMPLE1_CLASS_NAME = "SampleClass1"; private static final String SAMPLE1_FILE_NAME = SAMPLE1_CLASS_NAME+".java"; private static final String SAMPLE2_CLASS_NAME = "SampleClass2"; private static final String SAMPLE2_FILE_NAME = SAMPLE2_CLASS_NAME+".java"; private static final String SAMPLE_WEB_PROJECT_NAME = "SampleWebProject"; 179 187 public void testNewProject() { 188 NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke(); 189 String standardLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.wizards.Bundle", "Templates/Project/Standard"); 191 npwo.selectCategory(standardLabel); 192 String javaApplicationLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.wizards.Bundle", "Templates/Project/Standard/emptyJ2SE.xml"); 194 npwo.selectProject(javaApplicationLabel); 195 npwo.next(); 196 NewProjectNameLocationStepOperator npnlso = new NewProjectNameLocationStepOperator(); 197 npnlso.txtProjectName().setText(SAMPLE_PROJECT_NAME); 198 npnlso.txtProjectLocation().setText(System.getProperty("netbeans.user")); npnlso.finish(); 200 String openingProjectsTitle = Bundle.getString("org.netbeans.modules.project.ui.Bundle", "LBL_Opening_Projects_Progress"); 202 try { 203 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", 60000); 205 new NbDialogOperator(openingProjectsTitle).waitClosed(); 206 } catch (TimeoutExpiredException e) { 207 } 209 new ProjectsTabOperator().getProjectRootNode(SAMPLE_PROJECT_NAME); 211 ProjectSupport.waitScanFinished(); 213 } 214 215 227 public void testNewFile() { 228 String javaClassesLabel = Bundle.getString("org.netbeans.modules.java.project.Bundle", "Templates/Classes"); 231 String packageLabel = Bundle.getString("org.netbeans.modules.java.project.Bundle", "Templates/Classes/Package"); 233 NewFileWizardOperator.create(SAMPLE_PROJECT_NAME, javaClassesLabel, packageLabel, null, SAMPLE1_PACKAGE_NAME); 234 Node sample1Node = new Node(new SourcePackagesNode(SAMPLE_PROJECT_NAME), SAMPLE1_PACKAGE_NAME); 236 237 239 String mainClassLabel = Bundle.getString("org.netbeans.modules.java.project.Bundle", "Templates/Classes/Main.java"); NewFileWizardOperator.invoke(sample1Node, javaClassesLabel, mainClassLabel); 242 NewFileNameLocationStepOperator nameStepOper = new NewFileNameLocationStepOperator(); 243 nameStepOper.setObjectName(SAMPLE1_CLASS_NAME); 244 nameStepOper.finish(); 245 new EditorOperator(SAMPLE1_FILE_NAME); 247 NewFileWizardOperator.invoke(sample1Node, javaClassesLabel, mainClassLabel); 248 nameStepOper = new NewFileNameLocationStepOperator(); 249 nameStepOper.setObjectName(SAMPLE2_CLASS_NAME); 250 nameStepOper.finish(); 251 new EditorOperator(SAMPLE2_FILE_NAME).closeAllDocuments(); 253 } 254 255 265 public void testProjectsView() { 266 ProjectsTabOperator.invoke(); 267 JemmyProperties.setCurrentTimeout("JTreeOperator.WaitNextNodeTimeout", 30000); SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 270 Node sample1Node = new Node(sourcePackagesNode, SAMPLE1_PACKAGE_NAME); 271 Node sampleClass1Node = new Node(sample1Node, SAMPLE1_FILE_NAME); 272 CopyAction copyAction = new CopyAction(); 275 copyAction.perform(sampleClass1Node); 276 PasteAction pasteAction = new PasteAction(); 278 String refactorItem = Bundle.getStringTrimmed("org.netbeans.modules.refactoring.spi.impl.Bundle", "LBL_Action"); 280 String copyItem = Bundle.getStringTrimmed("org.netbeans.modules.refactoring.spi.impl.Bundle", "LBL_CopyAction"); 282 new ActionNoBlock(null, pasteAction.getPopupPath()+"|"+refactorItem+" "+copyItem).perform(sample1Node); 283 284 String copyClassTitle = Bundle.getString("org.netbeans.modules.refactoring.java.ui.Bundle", "LBL_CopyClass"); 285 NbDialogOperator copyClassDialog = new NbDialogOperator(copyClassTitle); 286 String refactorLabel = Bundle.getStringTrimmed("org.netbeans.modules.refactoring.spi.impl.Bundle", "CTL_Finish"); 288 new JButtonOperator(copyClassDialog, refactorLabel).push(); 289 290 Node newClassNode = new Node(sample1Node, "SampleClass11"); newClassNode.select(); 292 CutAction cutAction = new CutAction(); 294 cutAction.perform(newClassNode); 295 Node sampleProjectPackage = new Node(sourcePackagesNode, SAMPLE_PROJECT_NAME.toLowerCase()); 297 String moveItem = Bundle.getStringTrimmed("org.netbeans.modules.refactoring.spi.impl.Bundle", "LBL_MoveAction"); 299 new ActionNoBlock(null, pasteAction.getPopupPath()+"|"+refactorItem+" "+moveItem).perform(sampleProjectPackage); 300 String moveClassTitle = Bundle.getString("org.netbeans.modules.refactoring.java.ui.Bundle", "LBL_MoveClass"); 303 NbDialogOperator moveClassDialog = new NbDialogOperator(moveClassTitle); 304 new JButtonOperator(moveClassDialog, refactorLabel).push(); 305 newClassNode = new Node(sampleProjectPackage, "SampleClass11"); DeleteAction deleteAction = new DeleteAction(); 308 deleteAction.perform(newClassNode); 309 String confirmTitle = Bundle.getString("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectTitle"); new NbDialogOperator(confirmTitle).yes(); 312 } 313 314 318 public void testFilesView() { 319 FilesTabOperator filesTabOper = FilesTabOperator.invoke(); 320 JemmyProperties.setCurrentTimeout("JTreeOperator.WaitNextNodeTimeout", 30000); Node sourcePackagesNode = new Node(filesTabOper.getProjectNode(SAMPLE_PROJECT_NAME), "src"); Node sample1Node = new Node(sourcePackagesNode, SAMPLE1_PACKAGE_NAME); Node sampleClass1Node = new Node(sample1Node, SAMPLE1_FILE_NAME); 325 } 328 329 330 338 public void testDb() { 339 String databasesLabel = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "NDN_Databases"); 341 Node databasesNode = new Node(RuntimeTabOperator.invoke().getRootNode(), databasesLabel); 342 String waitNodeLabel = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "WaitNode"); 344 try { 348 databasesNode.waitChildNotPresent(waitNodeLabel); 349 } catch (JemmyException e) { 350 log("Timeout expired: "+e.getMessage()); 353 } 354 String driversLabel = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "NDN_Drivers"); 356 Node driversNode = new Node(RuntimeTabOperator.invoke().getRootNode(), databasesLabel+"|"+driversLabel); 357 String addDriverItem = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "AddNewDriver"); 359 new ActionNoBlock(null, addDriverItem).perform(driversNode); 361 String addDriverTitle = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "AddDriverDialogTitle"); 362 new NbDialogOperator(addDriverTitle).cancel(); 363 364 try { 368 driversNode.waitChildNotPresent(waitNodeLabel); 369 } catch (JemmyException e) { 370 log("Timeout expired: "+e.getMessage()); 373 } 374 if(System.getProperty("os.name").toLowerCase().indexOf("mac") == -1) { Node jdbcOdbcNode = new Node(driversNode, "JDBC-ODBC Bridge"); String connectUsingItem = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "ConnectUsing"); 379 new ActionNoBlock(null, connectUsingItem).perform(jdbcOdbcNode); 381 String newDatabaseConnectionTitle = Bundle.getString("org.netbeans.modules.db.resources.Bundle", "NewConnectionDialogTitle"); 382 new NbDialogOperator(newDatabaseConnectionTitle).cancel(); 383 } 384 } 385 386 389 public void testHelp() { 390 JemmyProperties.setCurrentTimeout("JMenuOperator.PushMenuTimeout", 60000); 392 HelpOperator helpOper = HelpOperator.invoke(); 394 helpOper.close(); 397 } 398 399 404 public void testMainMenu() { 405 String welcomeTitle = Bundle.getString("org.netbeans.modules.welcome.Bundle", "LBL_Tab_Title"); 408 new TopComponentOperator(welcomeTitle).close(); 409 int oldDispatchingModel = JemmyProperties.getCurrentDispatchingModel(); 411 try { 412 NewProjectWizardOperator.invoke().close(); 413 } catch (TimeoutExpiredException e) { 414 MainWindowOperator.getDefault().pushKey(KeyEvent.VK_ESCAPE); 417 JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK); 418 NewProjectWizardOperator.invoke().close(); 419 } finally { 420 JemmyProperties.setCurrentDispatchingModel(oldDispatchingModel); 422 } 423 String toolsItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Tools"); String javadocItem = Bundle.getStringTrimmed("org.netbeans.modules.javadoc.search.Bundle", "CTL_SEARCH_MenuItem"); 426 new Action(toolsItem+"|"+javadocItem, null).perform(); 427 String javadocTitle = Bundle.getString("org.netbeans.modules.javadoc.search.Bundle", "CTL_SEARCH_WindowTitle"); 429 new TopComponentOperator(javadocTitle).close(); 430 } 431 432 437 public void testShortcuts() { 438 Node node = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 441 MainWindowOperator.getDefault().pushKey(KeyEvent.VK_ESCAPE); 443 NewFileAction newFileAction = new NewFileAction(); 444 try { 445 newFileAction.performShortcut(node); 446 new NewFileWizardOperator().close(); 447 closeAllModal(); 451 } catch (TimeoutExpiredException e) { 452 node.select(); 455 MainWindowOperator.getDefault().pushKey( 456 newFileAction.getKeyStrokes()[0].getKeyCode(), 457 newFileAction.getKeyStrokes()[0].getModifiers()); 458 new NewFileWizardOperator().close(); 459 } 460 String javadocTitle = Bundle.getString("org.netbeans.modules.javadoc.search.Bundle", 463 "CTL_SEARCH_WindowTitle"); 464 Action searchAction = new Action(null, null, KeyStroke.getKeyStroke(KeyEvent.VK_F1, KeyEvent.SHIFT_MASK)); 465 try { 466 searchAction.perform(MainWindowOperator.getDefault()); 467 new TopComponentOperator(javadocTitle).close(); 468 } catch (TimeoutExpiredException e) { 469 MainWindowOperator.getDefault().pushKey(KeyEvent.VK_F1, KeyEvent.SHIFT_MASK); 472 new TopComponentOperator(javadocTitle).close(); 473 } 474 String newBreakpointTitle = Bundle.getString("org.netbeans.modules.debugger.ui.actions.Bundle", "CTL_Breakpoint_Title"); 476 NewBreakpointAction newBreakpointAction = new NewBreakpointAction(); 477 try { 478 newBreakpointAction.performShortcut(MainWindowOperator.getDefault()); 479 new NbDialogOperator(newBreakpointTitle).close(); 480 closeAllModal(); 484 } catch (TimeoutExpiredException e) { 485 MainWindowOperator.getDefault().pushKey( 488 newBreakpointAction.getKeyStrokes()[0].getKeyCode(), 489 newBreakpointAction.getKeyStrokes()[0].getModifiers()); 490 new NbDialogOperator(newBreakpointTitle).close(); 491 } 492 } 493 494 504 public void testEditor() { 505 SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 507 Node sample1Node = new Node(sourcePackagesNode, SAMPLE1_PACKAGE_NAME); 508 JavaNode sampleClass1Node = new JavaNode(sample1Node, SAMPLE1_FILE_NAME); 509 sampleClass1Node.open(); 510 EditorOperator eo = new EditorOperator(SAMPLE1_FILE_NAME); 512 eo.insert("\n", 27, 1); eo.setCaretPositionToLine(27); 516 eo.txtEditorPane().setVerification(false); 517 eo.txtEditorPane().typeText("sout"); eo.txtEditorPane().typeKey('\t'); 519 eo.txtEditorPane().setVerification(true); 520 eo.insert("Hello"); final String textToCopy = "System.out.println(\"Hello\");"; eo.select(textToCopy); 524 int oldDispatchingModel = JemmyProperties.getCurrentDispatchingModel(); 525 CopyAction copyAction = new CopyAction(); 527 try { 528 copyAction.perform(eo); 529 } catch (TimeoutExpiredException e) { 530 JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK); 532 copyAction.perform(eo); 533 } finally { 534 JemmyProperties.setCurrentDispatchingModel(oldDispatchingModel); 536 } 537 try { 539 new Waiter(new Waitable() { 540 public Object actionProduced(Object obj) { 541 try { 542 String text = Toolkit.getDefaultToolkit().getSystemClipboard(). 543 getContents(null).getTransferData(DataFlavor.stringFlavor).toString(); 544 return textToCopy.equals(text) ? Boolean.TRUE:null; 545 } catch (UnsupportedFlavorException e) { 546 return null; 551 } catch (IOException ioe) { 552 throw new JemmyException("Failed getting clipboard content.", ioe); 553 } 554 } 555 public String getDescription() { 556 return("Clipboard contains "+textToCopy); } 558 }).waitAction(null); 559 } catch (Exception ie) { 560 throw new JemmyException("Interrupted.", ie); 561 } 562 eo.insert("int xxxx;\n", 28, 1); eo.select("int xxxx;"); PasteAction pasteAction = new PasteAction(); 565 try { 566 pasteAction.perform(eo); 567 } catch (TimeoutExpiredException e) { 568 JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK); 570 pasteAction.perform(eo); 571 } finally { 572 JemmyProperties.setCurrentDispatchingModel(oldDispatchingModel); 574 } 575 eo.select("Hello", 1); DeleteAction deleteAction = new DeleteAction(); 578 deleteAction.performMenu(eo); 579 eo.txtEditorPane().waitText("System.out.println(\"\");"); eo.insert("Good bye"); eo.select(4); 584 CutAction cutAction = new CutAction(); 586 try { 587 cutAction.perform(eo); 588 } catch (TimeoutExpiredException e) { 589 JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK); 591 cutAction.perform(eo); 592 } finally { 593 JemmyProperties.setCurrentDispatchingModel(oldDispatchingModel); 595 } 596 new EventTool().waitNoEvent(500); 598 eo.select(3, 1, 2); 600 try { 601 pasteAction.perform(eo); 602 } catch (TimeoutExpiredException e) { 603 JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK); 605 pasteAction.perform(eo); 606 } finally { 607 JemmyProperties.setCurrentDispatchingModel(oldDispatchingModel); 609 } 610 } 611 612 623 public void testBuildAndRun() { 624 SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 625 Node sample1Node = new Node(sourcePackagesNode, SAMPLE1_PACKAGE_NAME); 626 JavaNode sampleClass1Node = new JavaNode(sample1Node, SAMPLE1_FILE_NAME); 627 MainWindowOperator.getDefault().getTimeouts().setTimeout("Waiter.WaitingTime", 60000); 629 MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer(); 631 stt.start(); 632 new CompileAction().perform(sampleClass1Node); 634 640 stt.waitText("compile-single", true); stt.waitText("compile-single", true); 645 String runItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "Menu/RunProject"); 647 String runOtherItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "Menu/RunProject/RunOther"); 649 String runFileItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle", 651 "LBL_RunSingleAction_Name", 652 new Object [] {new Integer (1), SAMPLE1_FILE_NAME}); 653 new Action(runItem+"|"+runOtherItem+"|"+runFileItem, null).perform(sampleClass1Node); 655 stt.waitText("run-single", true); stt.waitText("run-single", true); 661 OutputTabOperator outputOper = new OutputTabOperator("run-single"); outputOper.waitText("Hello"); outputOper.waitText("Good bye"); 665 String setAsMainProjectItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle", "LBL_SetAsMainProjectAction_Name"); 667 new Action(null, setAsMainProjectItem).perform(new ProjectsTabOperator().getProjectRootNode(SAMPLE_PROJECT_NAME)); 668 String buildItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Build"); 670 String buildMainProjectItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle", "LBL_BuildMainProjectAction_Name"); 672 new Action(buildItem+"|"+buildMainProjectItem, null).perform(); 674 stt.waitText("jar", true); stt.waitText("jar", true); 679 String runMainProjectItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle", "LBL_RunMainProjectAction_Name"); 681 new Action(runItem+"|"+runMainProjectItem, null).perform(); 683 stt.waitText("run", true); stt.waitText("run", true); 688 stt.stop(); 689 } 690 691 709 public void testJUnit() throws InterruptedException { 710 SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 712 Node sample1Node = new Node(sourcePackagesNode, SAMPLE1_PACKAGE_NAME); 713 JavaNode sampleClass2Node = new JavaNode(sample1Node, SAMPLE2_FILE_NAME); 714 sampleClass2Node.open(); 715 EditorOperator eo = new EditorOperator(SAMPLE2_FILE_NAME); 717 String publicMethod = "\n public void publicMethod() {\n }\n"; eo.insert(publicMethod, 29, 1); 720 String privateMethod = "\n private void privateMethod() {\n }\n"; eo.insert(privateMethod, 32, 1); 722 String protectedMethod = "\n protected void protectedMethod() {\n }\n"; eo.insert(protectedMethod, 35, 1); 724 String defaultMethod = "\n void defaultMethod() {\n }\n"; eo.insert(defaultMethod, 38, 1); 726 eo.save(); 727 728 String toolsItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Tools"); String createTestsItem = Bundle.getString("org.netbeans.modules.junit.Bundle", "LBL_Action_CreateTest"); ActionNoBlock createTestsAction = new ActionNoBlock(null, toolsItem+"|"+createTestsItem); 733 createTestsAction.perform(sampleClass2Node); 734 String createTestsTitle = Bundle.getString("org.netbeans.modules.junit.Bundle", "JUnitCfgOfCreate.Title"); 736 new NbDialogOperator(createTestsTitle).ok(); 737 String progressTitle = Bundle.getString("org.netbeans.modules.junit.Bundle", "LBL_generator_progress_title"); 739 new NbDialogOperator(progressTitle).waitClosed(); 741 String testPackagesLabel = Bundle.getString("org.netbeans.modules.java.j2seproject.Bundle", "NAME_test.src.dir"); 744 Node testPackagesNode = new Node(new ProjectsTabOperator().getProjectRootNode(SAMPLE_PROJECT_NAME), testPackagesLabel); 745 JavaNode testNode = new JavaNode(testPackagesNode, SAMPLE1_PACKAGE_NAME+"|"+SAMPLE2_CLASS_NAME+"Test.java"); 748 EditorOperator eoTest = new EditorOperator(SAMPLE2_CLASS_NAME+"Test.java"); new Waiter(new Waitable() { 752 public Object actionProduced(Object editorOper) { 753 return ((EditorOperator)editorOper).contains("testDefaultMethod") ? Boolean.TRUE : null; 754 } 755 public String getDescription() { 756 return("Created test should include test of default method."); } 758 }).waitAction(eoTest); 759 new Waiter(new Waitable() { 760 public Object actionProduced(Object editorOper) { 761 return ((EditorOperator)editorOper).contains("testProtectedMethod") ? Boolean.TRUE : null; 762 } 763 public String getDescription() { 764 return("Created test should include test of protected method."); } 766 }).waitAction(eoTest); 767 new Waiter(new Waitable() { 768 public Object actionProduced(Object editorOper) { 769 return ((EditorOperator)editorOper).contains("testPublicMethod") ? Boolean.TRUE : null; 770 } 771 public String getDescription() { 772 return("Created test should include test of public method."); } 774 }).waitAction(eoTest); 775 assertFalse("Created test should not include test of private method.", eoTest.contains("testPrivateMethod")); 777 779 String runItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "Menu/RunProject"); 781 String runOtherItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "Menu/RunProject/RunOther"); 783 String testFileItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle", 785 "LBL_TestSingleAction_Name", 786 new Object [] {new Integer (1), SAMPLE2_FILE_NAME}); 787 String testProjectItem = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.actions.Bundle", 789 "LBL_TestProjectAction_Name", 790 new Object [] {new Integer (1), SAMPLE_PROJECT_NAME}); 791 792 MainWindowOperator.getDefault().getTimeouts().setTimeout("Waiter.WaitingTime", 60000); MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer(); 796 stt.start(); 797 new Action(runItem+"|"+runOtherItem+"|"+testFileItem, null).perform(sampleClass2Node); 799 stt.waitText("test-single", true); stt.waitText("test-single", true); 804 new Action(runItem+"|"+testProjectItem, null).perform(sampleClass2Node); 806 stt.waitText("test", true); stt.waitText("test", true); stt.stop(); 811 812 createTestsAction.perform(sample1Node); 814 new NbDialogOperator(createTestsTitle).ok(); 815 new NbDialogOperator(progressTitle).waitClosed(); 817 JavaNode suiteNode = new JavaNode(testPackagesNode, SAMPLE1_PACKAGE_NAME+"|Suite.java"); String navigateItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/GoTo"); String goToTestItem = Bundle.getString("org.netbeans.modules.junit.Bundle", "LBL_Action_GoToTest"); Action gotoTestAction = new Action(navigateItem+"|"+goToTestItem, null); 827 gotoTestAction.perform(sample1Node); 828 assertTrue("Created suite should include test of public method.", 830 new EditorOperator("Suite").contains(SAMPLE2_CLASS_NAME+"Test")); EditorOperator.closeDiscardAll(); 832 } 833 834 844 public void testDebugging() throws Throwable { 845 MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer(); 847 SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 848 JavaNode sampleClass1Node = new JavaNode(sourcePackagesNode, SAMPLE1_PACKAGE_NAME+"|"+SAMPLE1_FILE_NAME); 849 try { 850 EditorOperator eo = new EditorOperator(SAMPLE1_FILE_NAME); 852 853 String brpText = "System.out.println(\"Hello\");"; if(!eo.contains(brpText)) { 856 eo.insert(brpText+"\n", 27, 1); 857 } 858 eo.select(brpText); 859 860 ToggleBreakpointAction toggleBreakpointAction = new ToggleBreakpointAction(); 861 toggleBreakpointAction.performShortcut(eo); 863 864 new Waiter(new Waitable() { 866 public Object actionProduced(Object editorOper) { 867 Object [] annotations = ((EditorOperator)editorOper).getAnnotations(27); 868 for (int i = 0; i < annotations.length; i++) { 869 if("Breakpoint".equals(((EditorOperator)editorOper).getAnnotationType(annotations[i]))) { return Boolean.TRUE; 871 } 872 } 873 return null; 874 } 875 public String getDescription() { 876 return("Wait breakpoint established on line 27"); } 878 }).waitAction(eo); 879 880 brpText = "System.out.println(\"Good bye\");"; if(!eo.contains(brpText)) { 883 eo.insert(brpText+"\n", 28, 1); 884 } 885 eo.select(brpText); 886 toggleBreakpointAction.perform(eo.txtEditorPane()); 891 new Waiter(new Waitable() { 893 public Object actionProduced(Object editorOper) { 894 Object [] annotations = ((EditorOperator)editorOper).getAnnotations(28); 895 for (int i = 0; i < annotations.length; i++) { 896 if("Breakpoint".equals(((EditorOperator)editorOper).getAnnotationType(annotations[i]))) { return Boolean.TRUE; 898 } 899 } 900 return null; 901 } 902 public String getDescription() { 903 return("Wait breakpoint established on line 28"); } 905 }).waitAction(eo); 906 stt.start(); 908 new DebugAction().performMenu(sampleClass1Node); 910 MainWindowOperator.getDefault().getTimeouts().setTimeout("Waiter.WaitingTime", 60000); 914 String label27 = Bundle.getString("org.netbeans.modules.debugger.jpda.ui.Bundle", 915 "CTL_Thread_stopped", 916 new String [] {"main", SAMPLE1_FILE_NAME, null, "27"}); stt.waitText(label27); 918 new ContinueAction().perform(); 920 String label28 = Bundle.getString("org.netbeans.modules.debugger.jpda.ui.Bundle", 923 "CTL_Thread_stopped", 924 new String [] {"main", SAMPLE1_FILE_NAME, null, "28"}); stt.waitText(label28); 926 OutputTabOperator oto = new OutputTabOperator("debug-single"); oto.waitText("Hello"); } catch (Throwable th) { 931 try { 932 PNGEncoder.captureScreen(getWorkDir().getAbsolutePath()+File.separator+"screenBeforeCleanup.png"); 934 } catch (Exception e1) { 935 } 937 throw th; 938 } finally { 939 new FinishDebuggerAction().perform(); 941 String outputTarget = Bundle.getString( 944 "org.apache.tools.ant.module.run.Bundle", 945 "TITLE_output_target", 946 new Object [] {SAMPLE_PROJECT_NAME, null, "debug-single"}); String finishedMessage = Bundle.getString( 949 "org.apache.tools.ant.module.run.Bundle", 950 "FMT_finished_target_status", 951 new Object [] {outputTarget}); 952 stt.waitText(finishedMessage); 953 stt.stop(); 954 sampleClass1Node.delete(); 956 String confirmTitle = Bundle.getString("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectTitle"); new NbDialogOperator(confirmTitle).yes(); 959 } 960 } 961 962 970 public void testOptions() { 971 OptionsOperator optionsOper = OptionsOperator.invoke(); 972 optionsOper.selectGeneral(); 973 String hTTPProxyLabel = Bundle.getStringTrimmed( 975 "org.netbeans.modules.options.general.Bundle", "CTL_Use_HTTP_Proxy"); 976 new JRadioButtonOperator(optionsOper, hTTPProxyLabel).push(); 977 String proxyHostLabel = Bundle.getStringTrimmed( 979 "org.netbeans.modules.options.general.Bundle", "CTL_Proxy_Host"); 980 JLabelOperator jloHost = new JLabelOperator(optionsOper, proxyHostLabel); 981 new JTextFieldOperator((JTextField )jloHost.getLabelFor()).typeText("webcache"); String proxyPortLabel = Bundle.getStringTrimmed( 984 "org.netbeans.modules.options.general.Bundle", "CTL_Proxy_Port"); 985 JLabelOperator jloPort = new JLabelOperator(optionsOper, proxyPortLabel); 986 new JTextFieldOperator((JTextField )jloPort.getLabelFor()).setText("8080"); optionsOper.ok(); 988 } 989 990 1000 public void testOptionsClassicView() { 1001 OptionsOperator optionsOper = OptionsOperator.invoke(); 1002 optionsOper.switchToClassicView(); 1003 optionsOper.treeTable().tree().setComparator(new Operator.DefaultStringComparator(true, true)); 1005 String printSettingsPath = Bundle.getString("org.netbeans.core.Bundle", "UI/Services/IDEConfiguration") + "|" + 1007 Bundle.getString("org.netbeans.core.Bundle", "UI/Services/IDEConfiguration/System")+"|"+ 1008 Bundle.getString("org.netbeans.core.Bundle", "Services/org-openide-text-PrintSettings.settings"); 1009 optionsOper.selectOption(printSettingsPath); 1010 PropertySheetOperator pso = new PropertySheetOperator(optionsOper); 1011 String footerALLabel = Bundle.getString("org.openide.text.Bundle", "PROP_FOOTER_ALIGNMENT"); 1013 String leftLabel = Bundle.getString("org.openide.util.Bundle", "LEFT"); 1015 new Property(pso, footerALLabel).setValue(leftLabel); 1016 String lineACLabel = Bundle.getString("org.openide.text.Bundle", "PROP_LINE_ASCENT_CORRECTION"); 1018 new Property(pso, lineACLabel).setValue("2.0"); 1019 String wrapLinesLabel = Bundle.getString("org.openide.text.Bundle", "PROP_WRAP"); 1021 new Property(pso, wrapLinesLabel).setValue("false"); 1022 optionsOper.close(); 1023 } 1024 1025 1034 public void testUpdateCenter() { 1035 String toolsItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Tools"); WizardOperator updateCenterWizardOper = null; 1038 long oldWaitStateTime = JemmyProperties.getCurrentTimeout("ComponentOperator.WaitStateTimeout"); 1039 try { 1040 String updateCenterItem = Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.Bundle", "CTL_Update"); 1042 new Action(toolsItem+"|"+updateCenterItem, null).perform(); 1043 String updateCenterTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Wizard"); 1045 updateCenterWizardOper = new WizardOperator(updateCenterTitle); 1046 JTableOperator oper = new JTableOperator(updateCenterWizardOper); 1048 for(int i=0;i<oper.getRowCount();i++) { 1050 if(oper.getValueAt(i, 1).toString().indexOf("Forte")>-1 && ((Boolean )oper.getValueAt(i, 0)).booleanValue()) { oper.clickOnCell(i, 0); 1053 } 1054 if(oper.getValueAt(i, 1).toString().indexOf("Sun")>-1 && ((Boolean )oper.getValueAt(i, 0)).booleanValue()) { oper.clickOnCell(i, 0); 1057 } 1058 } 1059 1060 1062 updateCenterWizardOper.btNext().pushNoBlock(); 1064 String connectingTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Connecting_Title"); 1067 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", 60000); 1069 new NbDialogOperator(connectingTitle).waitClosed(); 1070 new EventTool().waitNoEvent(500); 1072 JTreeOperator tree = new JTreeOperator(updateCenterWizardOper); 1074 String devUCLabel = Bundle.getString("org.netbeans.modules.updatecenters.resources.Bundle", "Services/AutoupdateType/autoupdate_xml_type.settings"); 1076 new Node(tree, devUCLabel+"|Infrastructure|Convertor").select(); String addLabel = Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.Bundle", "BTN_Add_2"); 1079 new JButtonOperator(updateCenterWizardOper, addLabel).push(); 1081 updateCenterWizardOper.btNext().pushNoBlock(); 1083 String licenceTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Licence_Title"); 1086 String acceptLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Licence_Accept"); 1088 new JButtonOperator(new NbDialogOperator(licenceTitle), acceptLabel).push(); 1089 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 30000); String doneLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "DownloadProgressPanel.jLabel1.doneText"); 1093 new JLabelOperator(updateCenterWizardOper, doneLabel); 1094 updateCenterWizardOper.next(); 1095 if(!updateCenterWizardOper.btFinish().isEnabled()) { 1097 String viewCertificateLable = Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.Bundle", "BTN_View"); 1099 new JButtonOperator(updateCenterWizardOper, viewCertificateLable).pushNoBlock(); 1100 String acceptCertificateLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Certificate_Accept"); 1102 String certificateTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Certificate_Title"); 1104 new JButtonOperator(new JDialogOperator(certificateTitle), acceptCertificateLabel).push(); 1105 } 1106 updateCenterWizardOper.btFinish().push(); 1108 } catch (JemmyException e) { 1109 String errorTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Error"); 1112 if(JDialogOperator.findJDialog(errorTitle, true, true) != null) { 1113 new NbDialogOperator(errorTitle).close(); 1114 } 1115 if(updateCenterWizardOper != null) { 1117 updateCenterWizardOper.close(); 1118 } 1119 throw e; 1120 } finally { 1121 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", oldWaitStateTime); 1123 } 1124 } 1125 1126 1131 public void testCVSLite() { 1133 String versioningItem = Bundle.getStringTrimmed("org.netbeans.modules.versioning.Bundle", "Menu/Window/Versioning"); 1135 String cvsItem = Bundle.getStringTrimmed( 1137 "org.netbeans.modules.versioning.system.cvss.ui.actions.Bundle", 1138 "CTL_MenuItem_CVSCommands_Label"); 1139 String checkoutItem = Bundle.getStringTrimmed( 1141 "org.netbeans.modules.versioning.system.cvss.ui.actions.checkout.Bundle", 1142 "CTL_MenuItem_Checkout_Label"); 1143 new ActionNoBlock(versioningItem+"|"+cvsItem+"|"+checkoutItem, null).perform(); 1144 1145 String checkoutTitle = Bundle.getString( 1146 "org.netbeans.modules.versioning.system.cvss.ui.wizards.Bundle", 1147 "BK0007"); 1148 NbDialogOperator checkoutOper = new NbDialogOperator(checkoutTitle); 1149 checkoutOper.close(); 1150 } 1151 1152 1157 public void testXML() { 1158 1160 String catalogsLabel = Bundle.getString("org.netbeans.modules.xml.catalog.Bundle", "TEXT_catalog_root"); 1162 String netbeansCatalogLabel = Bundle.getString("org.netbeans.modules.xml.catalog.impl.Bundle", "NAME_system_catalog"); 1164 String publicID = "-//DTD XMLCatalog//EN"; 1165 Node catalogNode = new Node(RuntimeTabOperator.invoke().getRootNode(), 1166 catalogsLabel+"|"+ 1167 netbeansCatalogLabel+"|"+ 1168 publicID); 1169 new ViewAction().perform(catalogNode); 1171 new EditorOperator(publicID).close(); 1172 1173 1175 Node sample1Node = new Node(new SourcePackagesNode(SAMPLE_PROJECT_NAME), SAMPLE1_PACKAGE_NAME); 1176 new SourcePackagesNode(SAMPLE_PROJECT_NAME).select(); 1179 String javaClassesLabel = Bundle.getString("org.netbeans.modules.java.project.Bundle", "Templates/Classes"); 1181 String packageLabel = Bundle.getString("org.netbeans.modules.java.project.Bundle", "Templates/Classes/Package"); 1183 NewFileWizardOperator.create(SAMPLE_PROJECT_NAME, javaClassesLabel, packageLabel, null, "xml"); Node xmlNode = new Node(new SourcePackagesNode(SAMPLE_PROJECT_NAME), "xml"); String xmlCategory = Bundle.getString("org.netbeans.api.xml.resources.Bundle", "Templates/XML"); 1187 String xmlDocument = Bundle.getString("org.netbeans.modules.xml.core.resources.Bundle", "Templates/XML/XMLDocument.xml"); 1189 NewFileWizardOperator.invoke(xmlNode, xmlCategory, xmlDocument); 1190 NewFileNameLocationStepOperator nameStepOper = new NewFileNameLocationStepOperator(); 1191 nameStepOper.setObjectName("XMLDocument"); nameStepOper.next(); 1193 nameStepOper.finish(); 1194 Node xmlDocumentNode = new Node(xmlNode, "XMLDocument.xml"); new EditorOperator("XMLDocument.xml").close(); 1199 1201 String checkXMLItem = Bundle.getStringTrimmed("org.netbeans.modules.xml.tools.actions.Bundle", "NAME_Check_XML"); 1202 new Action(null, checkXMLItem).perform(xmlDocumentNode); 1204 String xmlCheckTitle = Bundle.getString("org.netbeans.modules.xml.core.actions.Bundle", "TITLE_XML_check_window"); 1206 new OutputTabOperator(xmlCheckTitle).close(); 1208 1209 1211 String validateItem = Bundle.getStringTrimmed("org.netbeans.modules.xml.tools.actions.Bundle", "NAME_Validate_XML"); 1212 new Action(null, validateItem).perform(xmlDocumentNode); 1214 new OutputTabOperator(xmlCheckTitle).close(); 1216 1217 1219 String generateDTDItem = Bundle.getStringTrimmed("org.netbeans.modules.xml.tools.generator.Bundle", "PROP_GenerateDTD"); 1220 new ActionNoBlock(null, generateDTDItem).perform(xmlDocumentNode); 1221 String selectTitle = Bundle.getString("org.netbeans.modules.xml.tools.generator.Bundle", "PROP_fileNameTitle"); 1223 NbDialogOperator selectDialog = new NbDialogOperator(selectTitle); 1224 new JTextFieldOperator(selectDialog).setText("DTD"); 1226 String oKLabel = Bundle.getString("org.netbeans.core.windows.services.Bundle", "OK_OPTION_CAPTION"); 1227 new JButtonOperator(selectDialog, oKLabel).push(); 1228 new EditorOperator("DTD.dtd").close(); Node dtdNode = new Node(xmlNode, "DTD.dtd"); 1232 1234 String checkDTDItem = Bundle.getStringTrimmed("org.netbeans.modules.xml.tools.actions.Bundle", "NAME_Validate_DTD"); 1235 new Action(null, checkDTDItem).perform(dtdNode); 1236 new OutputTabOperator(xmlCheckTitle).close(); 1238 1239 1241 String generateScannerItem = Bundle.getStringTrimmed("org.netbeans.modules.xml.tools.generator.Bundle", "PROP_GenerateDOMScanner"); 1242 new ActionNoBlock(null, generateScannerItem).perform(dtdNode); 1243 selectDialog = new NbDialogOperator(selectTitle); 1244 new JButtonOperator(selectDialog, oKLabel).push(); 1245 new EditorOperator("DTDScanner.java").close(); Node scannerNode = new Node(xmlNode, "DTDScanner.java"); 1249 1251 DeleteAction deleteAction = new DeleteAction(); 1253 deleteAction.perform(xmlNode); 1254 String confirmTitle = Bundle.getString("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectTitle"); new NbDialogOperator(confirmTitle).yes(); 1257 xmlNode.waitNotPresent(); 1258 } 1259 1260 1272 public void testWindowSystem() { 1273 final ProjectsTabOperator projectsOper = ProjectsTabOperator.invoke(); 1274 final FavoritesOperator favoritesOper = FavoritesOperator.invoke(); 1275 1276 favoritesOper.attachTo(new OutputOperator(), AttachWindowAction.AS_LAST_TAB); 1278 favoritesOper.attachTo(projectsOper, AttachWindowAction.TOP); 1279 favoritesOper.attachTo(new OutputOperator(), AttachWindowAction.RIGHT); 1280 favoritesOper.attachTo(projectsOper, AttachWindowAction.AS_LAST_TAB); 1281 final TopComponent projectsTc = (TopComponent)projectsOper.getSource(); 1283 final TopComponent favoritesTc = (TopComponent)favoritesOper.getSource(); 1284 try { 1285 new Waiter(new Waitable() { 1286 public Object actionProduced(Object tc) { 1287 Mode mode1 = (Mode)projectsOper.getQueueTool().invokeSmoothly(new QueueTool.QueueAction("findMode") { public Object launch() { 1290 return WindowManager.getDefault().findMode(projectsTc); 1291 } 1292 }); 1293 Mode mode2 = (Mode)favoritesOper.getQueueTool().invokeSmoothly(new QueueTool.QueueAction("findMode") { public Object launch() { 1295 return WindowManager.getDefault().findMode(favoritesTc); 1296 } 1297 }); 1298 return (mode1==mode2 && favoritesTc.isShowing()) ? Boolean.TRUE : null; 1299 } 1300 public String getDescription() { 1301 return("Favorites TopComponent is next to Projects TopComponent."); } 1303 }).waitAction(null); 1304 } catch (InterruptedException e) { 1305 throw new JemmyException("Interrupted.", e); } 1307 favoritesOper.close(); 1308 1309 SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME); 1312 Node sample1Node = new Node(sourcePackagesNode, SAMPLE1_PACKAGE_NAME); 1313 JavaNode sampleClass2Node = new JavaNode(sample1Node, SAMPLE2_FILE_NAME); 1314 sampleClass2Node.open(); 1315 EditorOperator eo = new EditorOperator(SAMPLE2_FILE_NAME); 1317 eo.maximize(); 1318 eo.restore(); 1319 eo.closeDiscardAll(); 1320 } 1321 1322 1329 public void testSeparateWindowsMode() { 1330 try { 1331 MainWindowOperator.getDefault().setSeparateMode(); 1332 assertFalse("Projects has to be in separate frame.", new ProjectsTabOperator().getWindow() == MainWindowOperator.getDefault().getSource()); 1333 assertFalse("Output has to be in separate frame.", new OutputOperator().getWindow() == MainWindowOperator.getDefault().getSource()); 1334 } finally { 1335 MainWindowOperator.getDefault().setCompactMode(); 1337 } 1338 } 1339 1340 1349 public void testModuleInstallation() { 1350 String toolsItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Tools"); String moduleManagerLabel = Bundle.getString("org.netbeans.modules.autoupdate.catalog.Bundle", "LBL_ModuleCatalogName"); 1354 new Action(toolsItem+"|"+moduleManagerLabel, null).perform(); 1355 NbDialogOperator moduleManagerOper = new NbDialogOperator(moduleManagerLabel); 1356 String imageModulePath = 1358 Bundle.getString("org.netbeans.modules.image.Bundle", "OpenIDE-Module-Display-Category") + "|" + Bundle.getString("org.netbeans.modules.image.Bundle", "OpenIDE-Module-Name"); TreeTableOperator treeTableOper = new TreeTableOperator(moduleManagerOper); 1361 TreePath path = treeTableOper.tree().findPath(imageModulePath, "|"); 1362 if(!treeTableOper.tree().isPathSelected(path)) { 1363 treeTableOper.tree().selectPath(path); 1364 } 1365 int rowNumber = treeTableOper.tree().getRowForPath(path); 1366 treeTableOper.scrollToCell(rowNumber, 0); 1367 new EventTool().waitNoEvent(500); 1368 treeTableOper.clickOnCell(rowNumber, 1); 1370 String turningOffLabel = Bundle.getString("org.netbeans.core.startup.Bundle", "MSG_finish_disable_modules"); 1373 MainWindowOperator.getDefault().getTimeouts().setTimeout("Waiter.WaitingTime", 120000); 1375 MainWindowOperator.getDefault().waitStatusText(turningOffLabel); 1376 new EventTool().waitNoEvent(1000); 1377 treeTableOper.clickOnCell(rowNumber, 1); 1379 String turningOnLabel = Bundle.getString("org.netbeans.core.startup.Bundle", "MSG_finish_enable_modules"); 1382 MainWindowOperator.getDefault().getTimeouts().setTimeout("Waiter.WaitingTime", 120000); 1384 MainWindowOperator.getDefault().waitStatusText(turningOnLabel); 1385 moduleManagerOper.close(); 1386 } 1387 1388 1391 private static void closeHelpWindow() { 1392 Window helpWindow = WindowOperator.findWindow(new ComponentChooser() { 1393 public boolean checkComponent(Component comp) { 1394 WindowOperator winOper = new WindowOperator((Window )comp); 1395 winOper.setOutput(TestOut.getNullOutput()); 1396 return null != winOper.findSubComponent(new ComponentChooser() { 1397 public boolean checkComponent(Component comp) { 1398 return comp.getClass().getName().startsWith("javax.help.JHelp"); } 1400 public String getDescription() { 1401 return("any javax.help"); } 1403 }); 1404 } 1405 public String getDescription() { 1406 return "containing any javax.help.JHelp component"; } 1408 }); 1409 if(helpWindow != null) { 1410 new WindowOperator(helpWindow).close(); 1411 } 1412 } 1413} 1414
| Popular Tags
|