1 19 20 26 27 package validation; 28 29 import java.awt.Color ; 30 import java.awt.Container ; 31 import java.lang.reflect.Method ; 32 import java.io.*; 33 import java.util.Enumeration ; 34 import java.util.Properties ; 35 import java.util.Set ; 36 import javax.swing.text.Style ; 37 import javax.swing.text.StyledDocument ; 38 import javax.swing.text.StyleConstants.ColorConstants; 39 import javax.swing.tree.TreePath ; 40 import junit.framework.*; 41 42 import org.netbeans.jemmy.EventTool; 44 import org.netbeans.jemmy.JemmyProperties; 45 import org.netbeans.jemmy.TestOut; 46 import org.netbeans.jemmy.JemmyException; 47 import org.netbeans.jemmy.operators.*; 48 import org.netbeans.jemmy.util.PNGEncoder; 49 import org.netbeans.junit.*; 50 51 import org.netbeans.jellytools.*; 53 import org.netbeans.jellytools.actions.*; 54 import org.netbeans.jellytools.nodes.*; 55 import org.netbeans.jellytools.properties.*; 56 import org.netbeans.jellytools.modules.javacvs.actions.*; 57 import org.netbeans.jellytools.modules.javacvs.output.JCVSDiffOutputOperator; 58 import org.netbeans.jellytools.modules.javacvs.output.LogOutputOperator; 59 import org.netbeans.jellytools.modules.javacvs.output.StatusOutputOperator; 60 import org.netbeans.jellytools.modules.vcscore.actions.*; 61 import org.netbeans.jellytools.modules.vcscore.VCSGroupsFrameOperator; 62 import org.netbeans.jellytools.modules.vcscore.VersioningFrameOperator; 63 import org.netbeans.jellytools.modules.vcscore.GroupVerificationOperator; 64 import org.netbeans.jemmy.Waitable; 65 import org.netbeans.jemmy.Waiter; 66 67 70 import org.netbeans.test.oo.gui.jelly.vcscore.*; 75 import org.netbeans.test.oo.gui.jelly.javacvs.*; 77 78 import org.openide.options.SystemOption; 79 import org.netbeans.modules.cvsclient.JavaCvsSettings; 80 import org.openide.filesystems.FileSystem; 81 import org.openide.filesystems.Repository; 82 83 89 public class JavaCVSValidationTest extends JellyTestCase { 90 91 static util.History his; 92 static String path; 93 static String repositoryprefix; 94 static String CVSlbl = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel"); 95 static String filesystem; 96 static FileSystem testedJavaCVSFS; 97 98 99 final String SERVER = System.getProperty("SERVER"); 100 final String REPOSITORY = System.getProperty("REPOSITORY"); 101 final String SERVERTYPE = System.getProperty("SERVERTYPE"); 102 final String USER = System.getProperty("USER"); 103 final String PASSWORD = System.getProperty("PASSWORD"); 104 final String PORT = System.getProperty("PORT"); 105 final String MODULE = System.getProperty("MODULE"); 106 107 static final String WORKDIR = "JavaCVSwork"; 108 static final String TESTDIR = "testdir"; 109 static final String TESTFILE = "testfile"; 110 static final String TESTFILEPROPERTY = "javacvs.validation.test.file"; 111 112 static final String VERSIONINGMENU = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "Menu/Versioning"); 113 static final String MOUNTVCS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "CTL_MountActionName"); 114 static String CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 115 static String strCmdAction; 116 static File testFile = null; 117 static MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer(); 118 119 static final boolean capture = true; 120 PrintStream psRef; 121 PrintStream ps; 122 124 APIController api; 125 126 128 Operator.StringComparator oldComparator = Operator.getDefaultStringComparator(); 129 130 133 public JavaCVSValidationTest(String testName) { 134 super(testName); 135 } 136 137 164 public static junit.framework.Test suite() { 165 TestSuite suite = new NbTestSuite(); 166 suite.addTest(new JavaCVSValidationTest("testConnectionManager")); 167 suite.addTest(new JavaCVSValidationTest("testMount")); 168 suite.addTest(new JavaCVSValidationTest("testHistory")); 169 suite.addTest(new JavaCVSValidationTest("testCreateFile")); 170 suite.addTest(new JavaCVSValidationTest("testAdd")); 171 suite.addTest(new JavaCVSValidationTest("testCommit")); 172 suite.addTest(new JavaCVSValidationTest("testDiff")); 173 suite.addTest(new JavaCVSValidationTest("testVCSGroups")); 174 suite.addTest(new JavaCVSValidationTest("testVersioningExplorer")); 175 suite.addTest(new JavaCVSValidationTest("testBranch")); 176 suite.addTest(new JavaCVSValidationTest("testUpdateBranch")); 177 suite.addTest(new JavaCVSValidationTest("testCommitToBranch")); 178 suite.addTest(new JavaCVSValidationTest("testMerge")); 179 suite.addTest(new JavaCVSValidationTest("testStatus")); 180 suite.addTest(new JavaCVSValidationTest("testLog")); 181 suite.addTest(new JavaCVSValidationTest("testAnnotate")); 182 suite.addTest(new JavaCVSValidationTest("testUnmount")); 183 suite.addTest(new JavaCVSValidationTest("testUndock")); 184 return suite; 185 } 186 187 190 public static void main(java.lang.String [] args) throws IOException { 191 194 195 197 InputStream inStream = JavaCVSValidationTest.class.getResourceAsStream("/site-specific/JavaCVSValidationTest_home.properties"); 198 Properties pro = System.getProperties(); 199 pro.load(inStream); 200 Set set = pro.keySet(); 201 String [] str = (String []) set.toArray(new String [set.size ()]); 202 203 if (str != null) 204 for (int i = 0; i < str.length; i ++) 205 if (str[i].startsWith ("xtest.userdata")) 206 System.setProperty(str[i].substring (str[i].indexOf ('|') + 1), System.getProperty (str[i])); 207 pro.list(System.out); 208 209 junit.textui.TestRunner.run(suite()); 210 } 211 212 215 protected void setUp() { 216 new EventTool().waitNoEvent(2000); 217 System.out.println(getName()); 218 ((JavaCvsSettings)SystemOption.findObject(JavaCvsSettings.class, true)).setUiMode(1); 219 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout",20000); 221 api = new APIController(); 222 api.setOut (new PrintWriter (System.out, true)); 223 ps = getLog ("jemmy.log"); 225 psRef = getRef(); 226 227 JemmyProperties.getCurrentOutput().setAutoFlushMode(true); 229 230 234 log("setUp(DispatchModel)="+JemmyProperties.getCurrentDispatchingModel()); 237 238 244 if (testedJavaCVSFS != null ) 246 initHistory(testedJavaCVSFS); 247 248 } 249 250 253 protected void tearDown() { 254 JemmyProperties.setCurrentOutput(TestOut.getNullOutput()); 255 264 } 267 268 void fail(Exception e) { 269 e.printStackTrace(getLog()); 270 if (capture) { 271 try { 272 PNGEncoder.captureScreen(getWorkDirPath()+"/screen.png"); 273 } catch (IOException ioe) {} 274 } 275 throw new AssertionFailedErrorException(e); 276 } 277 278 283 protected void failNotify(Throwable reason) { 284 System.out.println("jsi v failNotify()"); 285 sbt.printStatusTextHistory(ps); 286 System.out.println(sbt.getStatusTextHistory().toString()); 287 if (his != null) 288 his.print (); 289 } 290 291 protected void dumpDiffGraphical (TopComponentOperator tco) { 292 JEditorPaneOperator p1 = new JEditorPaneOperator (tco, 0); 293 JEditorPaneOperator p2 = new JEditorPaneOperator (tco, 1); 294 psRef.println ("==== Text - Panel 1 ===="); 295 psRef.println (p1.getText ()); 296 psRef.println ("==== Text - Panel 2 ===="); 297 psRef.println (p2.getText ()); 298 StyledDocument sd1 = (StyledDocument ) p1.getDocument(); 299 StyledDocument sd2 = (StyledDocument ) p2.getDocument(); 300 psRef.println ("==== Colors - Panel 1 ===="); 301 dumpColors(sd1); 302 psRef.println ("==== Colors - Panel 2 ===="); 303 dumpColors(sd2); 304 } 305 306 protected static final Color annoWhite = new Color (254, 254, 254); 307 protected static final Color annoGreen = new Color (180, 255, 180); 308 protected static final Color annoBlue = new Color (160, 200, 255); 309 protected static final Color annoRed = new Color (255, 160, 180); 310 311 protected void dumpColors (StyledDocument sd) { 312 int b = sd.getLength(); for (int a = 0; a < b; a ++) { 315 Style st = sd.getLogicalStyle(a); 316 if (st == null) 317 continue; 318 Color col = (Color ) st.getAttribute(ColorConstants.Background); 319 String str; 320 if (annoWhite.equals (col)) 321 str = "White"; 322 else if (annoGreen.equals (col)) 323 str = "Green"; 324 else if (annoBlue.equals (col)) 325 str = "Blue"; 326 else if (annoRed.equals (col)) 327 str = "Red"; 328 else 329 str = col.toString (); 330 psRef.println ("Pos: " + a + " ---- " + str); 331 a ++; 332 } 333 } 334 335 File getJavaCVSWork() throws IOException { 336 return new File(getWorkDir().getParentFile(), WORKDIR); 337 } 338 339 File getTestFile() throws IOException { 340 return (testFile==null)?new File(System.getProperty(TESTFILEPROPERTY)):testFile; 341 } 342 343 void setTestFile(File f) { 344 testFile=f; 345 System.setProperty(TESTFILEPROPERTY, f.getAbsolutePath()); 346 } 347 348 void setClassVariable() { 349 try { 350 path = getJavaCVSWork().getAbsolutePath(); 351 } catch (IOException e) { 352 e.printStackTrace(); 353 } 354 filesystem = CVSlbl + path; 355 } 356 357 FileSystem getTestedJavaCVSFS(String filesystem) { 358 Enumeration enFS = Repository.getDefault().getFileSystems(); 360 FileSystem tmpFS; 361 while(enFS.hasMoreElements()) { 362 tmpFS = (FileSystem) enFS.nextElement(); 363 if (tmpFS.getDisplayName().equals(filesystem)) { 364 testedJavaCVSFS = tmpFS; 365 return tmpFS; 366 } 367 } 368 return null; 369 } 370 371 373 void initHistory(FileSystem testedJavaCVSFS) { 374 his = new util.History(testedJavaCVSFS, getLog ()); 375 his.setBreakpoint (null); 376 his.switchToJCVS(); 377 } 378 379 383 public void testConnectionManager() { 384 this.clearTestStatus(); 385 this.startTest(); 386 389 log("witchBRANCH", "This test suit was checkouted as the *release34*"); 390 try { 391 log("Trying to push Main Menu:\n"+VERSIONINGMENU+"|"+Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.login.Bundle", "LoginManagerAction.dialogTitle")+"\n"); 392 new JCVSConnectionManagerAction().perform(); 393 log("Trying to invoke CVS Connection Manager dialog\n"); 394 CVSConnectionDialog conn = new CVSConnectionDialog(); 395 396 conn.activate(); 397 log("Trying to find and click 'Add' button to open Login Manager Dialog\n"); 398 CVSConnectionDialog.AddNewRootDialog add = conn.add(); 399 log("Trying to fill-in the dialog:\n"+SERVERTYPE+","+ SERVER+","+ USER+","+ PORT+","+ REPOSITORY+"\n"); 400 add.setAddNewRootOptions(SERVERTYPE, SERVER, USER, PORT, REPOSITORY); 401 add.compareAddNewRootOptions(SERVERTYPE, SERVER, USER, PORT, REPOSITORY); 402 add.verify(); 403 log("Trying to find and click 'OK' button\n"); 404 add.ok(); 405 CVSConnectionDialog.LoginToPserverDialog login = new CVSConnectionDialog.LoginToPserverDialog(); 406 log("Trying to write PASSWD in to the textfield: "+PASSWORD+"\n"); 407 login.setJPasswordField(PASSWORD); 408 login.verify(); 409 log("Trying to find and click 'Login' button\n"); 410 login.login(); 411 int i=0; 412 while ((i++<30)&&(login.isVisible())) { 413 Thread.sleep(1000); 414 } 415 log("Trying to verify the login dialog\n"); 416 conn.verify(); 417 endTest(); 418 log("Trying to find 'Close' button\n"); 419 conn.close(); 420 } catch (Exception e) { 421 fail(e); 422 } 423 } 424 425 430 public void testMount() { 431 startTest(); 432 try { 433 log("JavaCVSWork dir is:\n"+getJavaCVSWork()+"\n"); 434 File f = getJavaCVSWork(); 435 assertTrue(f.mkdirs()); 436 437 log("Trying to push MainMenu:\n"+VERSIONINGMENU+"|"+MOUNTVCS+"|"+CVS+"\n"); 439 new JCVSMountAction().perform(); 440 441 467 468 482 483 484 NewWizardCVSDialog2 wizardPage1 = new NewWizardCVSDialog2(); 485 log("Trying to fill-in the first Panel of Wizard\n"); 486 wizardPage1.setWorkingDirectoryTxt(f.getAbsolutePath()); 487 wizardPage1.verify(); 488 wizardPage1.next(); 489 log("Trying to fill-in the second Panel of Wizard\n"); 490 NewWizardCVSDialog4 wizardPage2 = new NewWizardCVSDialog4(); 491 wizardPage2.setServerName(SERVER); 492 wizardPage2.setUserName(USER); 493 wizardPage2.setRepository(REPOSITORY); 494 wizardPage2.verify(); 495 wizardPage2.next(); 496 log("Trying to fill-in the third Panel of Wizard\n"); 497 NewWizardCVSDialog5 wizardPage3 = new NewWizardCVSDialog5(); 498 wizardPage3.verify(); 499 wizardPage3.next(); 500 log("Trying to fill-in the fourth Panel of Wizard\n"); 501 NewWizardCVSDialog6 wizardPage4 = new NewWizardCVSDialog6(SERVER); 502 wizardPage4.verify(); 503 wizardPage4.next(); 504 log("Trying to fill-in the fifth Panel of Wizard\n"); 505 NewWizardCVSDialog6a wizardPage5 = new NewWizardCVSDialog6a(); 506 log("Checking up Initial checkout!!!\n"); 507 wizardPage5.checkCheckOutACopyOfTheRepositoryFilesToYourWorkingDirectory(true); 508 wizardPage5.verify(); 509 wizardPage5.finish(); 510 511 log("now the Checkout dilaog should comes up...\n"); 512 CheckoutDialog checkout=new CheckoutDialog(); 513 514 log("DEADLOCK when invoking 'Select Module' dialog is fixed now,\n"+ 515 "see issue #29464\nhttp://www.netbeans.org/issues/show_bug.cgi?id=29464 ,\n"+ 516 "please if during automat test DEADLOCK occures again, please REOPEN this bug!"); 517 518 log("Trying to open ModuleSelector dialog\n"); 519 CheckoutDialog.ModuleChooserDialog chooser=checkout.selectModule(); 520 log("Trying to find desired module: "+MODULE); 521 int i=chooser.tabModulesTable().findCellRow(MODULE, new Operator.DefaultStringComparator (true, true)); 522 log("Desired module on line "+i+" has been found...selecting it\n"); 523 chooser.tabModulesTable().setRowSelectionInterval(i,i); 524 chooser.verify(); 525 chooser.ok(); 526 527 532 533 checkout.verify(); 534 535 log("The outpuWindow should open now...\n"); 536 537 541 TabbedOutputOfVCSCommandsFrame out; 542 try { 543 EventTool.removeListeners(); 544 log("Trying to find and click 'Run command' button\n"); 545 checkout.runCommand(); 546 out = new TabbedOutputOfVCSCommandsFrame(); 547 } finally { 548 EventTool.addListeners(); 549 } 550 552 553 endTest(); 554 setClassVariable(); 555 initHistory(getTestedJavaCVSFS(filesystem)); 557 out.verify(); 558 560 log("Trying to find 'Close' button"); 561 out.close(); 562 log("Closed...\n"); 563 } catch (Exception e) { 564 fail(e); 565 } 566 } 567 568 573 public void testHistory() { 574 startTest(); 575 String path; 576 String filesystem; 577 CVS = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel"); 578 String cmdStatus = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.commands.Bundle", "CTL_Status_Done"); 579 boolean isCommandSuccessed; 580 String status; 581 try { 582 path = getJavaCVSWork().getAbsolutePath(); 583 filesystem = CVS + path; 584 596 String command = "checkout " + MODULE; 597 598 log("Trying to switch to RunTime TAB via API\n"); 599 APICommandsHistory history = new APICommandsHistory(api); 600 601 log("Creating RunTime TAB Jemmy handler\n"); 602 CommandsHistory commandsHistory = new CommandsHistory(); 603 604 log("Verifying if command succeded..."); 605 isCommandSuccessed = history.isCommandSuccessed(filesystem, command, cmdStatus); 606 607 log("Checkin' if command:\n |"+command+"|\non this filesystem:\n "+filesystem+ 608 "\nsuccessed: "+isCommandSuccessed+"\n"); 609 Thread.sleep(500L); 610 assertTrue("\nError: cvs command:\n |"+command+ 611 "|\nnode hasn't been found in RunTime TAB under the specified FS:\n " 612 +filesystem+"|\n", isCommandSuccessed); 613 614 log("Comparin' command status:\n |" +command+ "|\n |"+ cmdStatus +"|\non this filesystem:\n "+filesystem+"\n"); 615 Thread.sleep(500L); 616 assertTrue("\nError: Wrong status of\n|" + command + "|\ncommand.", 617 commandsHistory.compareStatus(cmdStatus, filesystem, command)); 618 619 log("Comparin' command name:\n |" +command+ "|\non this filesystem:\n "+filesystem+"\n"); 620 Thread.sleep(500L); 621 assertTrue("\nError: command name of\n|" + command + "|\ncommand.", 622 commandsHistory.compareCommandName("Checkout", filesystem, command)); 623 624 625 629 TabbedOutputOfVCSCommandsFrame out; 630 try { 631 EventTool.removeListeners(); 632 log("Trying to open output of command..."); 633 out = commandsHistory.viewOutput(filesystem, command); 634 } finally { 635 EventTool.addListeners(); 636 } 637 639 log("succeeded, OPENED :)\n"); 640 641 status = Bundle.getString("org.netbeans.modules.vcscore.commands.Bundle", "CommandExitStatus.finished"); 642 log("Comparin' statuses in the textfiled:\n |" +status+ "|\n"); 643 Thread.sleep(500L); 644 assertTrue("\nError: command status is different from expected value:\n " 645 +status+"|\n", out.compareStatusTextFld(status)); 646 out.verify(); 647 648 log("Trying to find 'Close' button\n"); 649 out.close(); 650 endTest(); 651 } catch (Exception e) { 652 fail(e); 653 } 654 } 655 656 String getTestFileObjectName() throws IOException { 657 final String file=getTestFile().getName(); 658 return file.substring(0,file.lastIndexOf(".")); 659 } 660 661 String getTestDirNodePath() throws IOException { 662 return "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE+"|"+getTestFile().getParentFile().getName(); 663 } 664 665 String getTestDirObjectName() throws IOException { 666 return getTestFile().getParentFile().getName(); 667 } 668 669 674 public void testCreateFile() { 675 clearTestStatus(); 676 startTest(); 677 try { 678 680 log("Trying to find(create) a unique dir/file on a disk: \n"+TESTDIR+", "+getJavaCVSWork()+", "+MODULE+"\n"); 681 File f=File.createTempFile(TESTDIR, "", new File(getJavaCVSWork(), MODULE)); 682 assertTrue(f.delete()); 683 684 repositoryprefix = "/" + MODULE + "/" + f.getName(); 685 log("Trying to make directory: \n"+f.toString()+"\n"); 686 assertTrue(f.mkdir()); 687 688 log("Trying to create testing file: "+f+" ,"+TESTFILE+".java\n"); 689 setTestFile(new File(f, TESTFILE+".java")); 690 FileOutputStream out = new FileOutputStream(getTestFile()); 691 out.write(("class "+TESTFILE+" {}\n").getBytes()); 692 693 log("Trying to close the FileOutputStream\n"); 694 out.close(); 695 696 log("Trying to open new Explorer and imediately locate and switch to FS TAB...\n"); 697 Node rootNode = ExplorerOperator.invoke().repositoryTab().getRootNode(); 699 log("Creating a node on this filesystem:\n" + "CVS "+getJavaCVSWork().getAbsolutePath()+"\n"); 700 Node node = new Node(rootNode, "CVS "+getJavaCVSWork().getAbsolutePath()); 701 new JCVSRefreshAction().perform(node); 702 703 log("Creating a node on this filesystem:\n" + "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE+"\n"); 704 node = new Node(rootNode, "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE); 705 log("The node is:\n "+ node.getParentPath()+"\n "+node.getPath()+"\n "+node.getText()+"\n "+node.toString()+"\n"); 706 log("Trying to go to PopupMenu:\n"+"CVS|Refresh\non this filesystem:\n " + node.getPath() +"\n"); 707 717 718 724 sbt.start(); 725 System.out.println("===BACHA!!! REFRESHIM ==="); 726 new JCVSRefreshAction().perform(node); 727 sbt.waitText("CVS Client Running Command: Refresh", true); 728 sbt.waitText("Finished: Refresh", true); 729 730 731 734 log("Trying to select a node:\n "+rootNode.getPath() +"\n "+ 735 getTestDirNodePath()+" [Local]|"+getTestFileObjectName()+" [Local]\n"); 736 node = new Node(rootNode, getTestDirNodePath()+" [Local]|"+getTestFileObjectName()+" [Local]"); 737 node.select(); 738 739 endTest(); 741 } catch (Exception e) { 742 fail(e); 743 } 744 } 745 746 751 public void testAdd() { 752 startTest(); 753 try { 754 log("Explorer should be opened..\n switching to FS TAB\n"); 756 Node node = new Node(ExplorerOperator.invoke().repositoryTab().getRootNode(), 758 getTestDirNodePath()+" [Local]"); 759 760 log("Trying to push popup menu 'CVS|Add...' on the node: "+getTestDirNodePath()+" [Local]\n"); 761 new JCVSAddAction().perform(node); 762 763 764 log("Trying to open Add dialog\n"); 765 AddDialog add=new AddDialog(); 766 767 log("Checking up checkBox: 'Recursively'\n"); 768 add.check(add.cbRecursively(), true); 769 770 log("Verifiing the dialog\n"); 771 add.verify(); 772 773 log("Trying to push the 'Run Command=OK' buttonn\n"); 774 add.runCommand(); 775 776 OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame(); 777 log("Verifying the OutputOfCommand dialog\n"); 778 out.verify(); 779 780 log("Trying to push the 'Close' button\n"); 781 out.close(); 782 783 log("TCs which are founding nodes using fileStatuses will probably fails\n"+ 784 "BECAUSE OF P1 #25987 BUG IN OPENIDE, see http://www.netbeans.org/issues/show_bug.cgi?id=25987"); 785 log("Trying to select a file node:\n "+getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]"); 786 Thread.sleep(1000L); new Node((new RepositoryTabOperator()).getRootNode(), 788 getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]").select(); 789 log("Selected... :-)\n"); 791 endTest(); 792 } catch (Exception e) { 793 fail(e); 794 } 795 } 796 797 802 public void testCommit() { 803 startTest(); 804 try { 805 log("Trying to switch to FS TAB\n"); 807 Node node = new Node(ExplorerOperator.invoke().repositoryTab().getRootNode(), 808 getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]"); 809 811 log("Trying to push popup menu 'CVS|Commit...' on the node: "+getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]\n"); 812 new JCVSCommitAction().perform(node); 813 814 CommitDialog commit=new CommitDialog(); 815 log("verifiing Commit dialog\n"); 816 commit.verify(); 817 818 log("Trying to push 'Run Command' button\n"); 819 commit.runCommand(); 820 821 OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame(); 822 log("verifiing the OutputOfCVSCommand dialog\n"); 823 out.verify(); 824 825 log("Trying to push 'Close' button\n"); 826 out.close(); 827 828 log("Trying to select a node:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]"); 829 new Node((new RepositoryTabOperator()).getRootNode(), 830 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]").select(); 831 log("Selected... :-)\n"); 833 endTest(); 834 } catch (Exception e) { 835 fail(e); 836 } 837 } 838 839 844 public void testDiff() { 845 startTest(); 846 String path; 847 CVS = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel"); 848 String filesystem; 849 try { 850 path = getJavaCVSWork().getAbsolutePath(); 851 filesystem = CVS + path; 852 log("Trying to switch to FS TAB\n"); 854 Node rootNode = ExplorerOperator.invoke().repositoryTab().getRootNode(); 855 Node node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]"); 856 log("Trying to select a node:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]\n"); 858 node.select(); 860 861 log("Openning an FileOutputStream using this file:\n"+getTestFile()+"\n"); 862 FileOutputStream file = new FileOutputStream(getTestFile()); 863 log("Writing a text into it.\n"); 864 file.write(("//comment\nclass "+TESTFILE+" {}\n").getBytes()); 865 file.close(); 866 867 log("Trying to open PopupMenu:\n'CVS|Refresh' on a node:\n" + getTestDirNodePath()+"\n"); 868 node = new Node(rootNode, getTestDirNodePath()); 869 new JCVSRefreshAction().perform(node); 871 872 MainWindowOperator.getDefault().waitStatusText("Finished: Refresh"); 873 874 879 rootNode = ExplorerOperator.invoke().repositoryTab().getRootNode(); 880 node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()); 881 node.select(); 882 883 887 log("node je...:\n"+node.getPath()); 889 node.select(); 890 new JCVSDiffAction().perform(node); 891 892 log("Trying to open dialog for Diff command...\n"); 893 DiffDialog diff=new DiffDialog(); 894 diff.verify(); 895 log("Trying to click on 'Run Command' button...\n"); 896 diff.runCommand(); 897 898 log("TCs which are test 'Output Of VCS command [' dialogs will probably fails\n"+ 899 "BECAUSE OF P3 #26811 BUG IN CORE, see http://www.netbeans.org/issues/show_bug.cgi?id=26811"); 900 log("Opening Diff output window...\n"); 901 902 TopComponentOperator tco = new TopComponentOperator(new EditorWindowOperator (), "Diff testfile.java"); 903 dumpDiffGraphical(tco); 904 compareReferenceFiles(); 905 906 tco.undockView(); 907 JCVSDiffOutputOperator out = new JCVSDiffOutputOperator("Diff testfile.java", "1.1", "Working File"); 908 log("Verifiing if everything is allright on the diff output\n"); 909 out.verify(); 910 911 log("Trying to push 'Close' button\n"); 912 out.close(); 913 endTest(); 914 } catch (Exception e) { 915 fail(e); 916 } 917 } 918 919 void switchToTab(ExplorerOperator expO, String tab) throws Exception { 920 expO.invoke().selectPage(tab); 921 } 922 923 928 public void testVCSGroups() { 929 clearTestStatus(); 930 startTest(); 931 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 932 String strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JCommitAction") + 933 Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "ClusteringAction.DialogDots"); 934 final String DEFAULTGROUP = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_DefaultGroupName"); 935 final String vcsgrpT = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_MODE.title"); 936 final String vcsgrpM = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_VcsGroupMenuAction"); 937 final String addTovcsGrp = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "LBL_AddToGroupAction"); 938 final String verify = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_VerifyGroupAction"); 939 final String dialogTitle= Bundle.getStringTrimmed("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectTitle"); 940 try { 941 log("Trying to get an instance of MainFrame\n"); 942 MainWindowOperator main = MainWindowOperator.getDefault(); 944 ExplorerOperator exp = new ExplorerOperator(); 945 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 946 JTreeOperator jtro = null; 947 948 log("Trying to invoke PopupMenu:\n" + addTovcsGrp +"|"+ DEFAULTGROUP +", on\n"+ getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]\n"); 949 Node node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]"); 951 node.performPopupAction(addTovcsGrp +"|"+ DEFAULTGROUP); 952 953 log("Trying to push MainMenu:\n"+VERSIONINGMENU+"|" +vcsgrpM+ "\n"); 954 955 new VCSGroupsAction().perform(); 956 try { log("Realy trying to open VCSGroup Frame\n"); 958 VCSGroupsFrameOperator groups = new VCSGroupsFrameOperator(); 959 log("Verifying the VCSGroup dialog...\n"); 961 groups.makeComponentVisible(); 962 groups.verify(); 963 Thread.sleep(500); 964 965 log("Trying to invoke MainMenu:\n'Window|Dock View Into|Explorer|Center'\n"); 966 new DockingAction("Explorer|"+DockingAction.CENTER).perform(); 967 } catch (JemmyException ex) {log("Seems that VCSGroup's been already docked in Exp");} 969 970 log("Trying to switch to VCS Groups TAB\n"); 971 982 exp.selectPage(vcsgrpT); 983 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 984 exp.tbpExplorerTabPane().getSource (), vcsgrpT, true, true, 0)); 985 986 log("Trying to invoke PopupMenu:\n'Verify', "+" on the\n" + DEFAULTGROUP +"\n"); 987 new VerifyGroupAction().perform(new Node(jtro, DEFAULTGROUP)); 988 989 log("Trying to open GroupVerification Dialog....\n"); 990 GroupVerificationOperator out = new GroupVerificationOperator(); 991 992 log("Trying to verify the Group dialog...\n"); 993 out.verify(false, false, false, false); 994 log("Trying to click on 'Close' button\n"); 995 out.close(); 996 997 log("Invoking PopupMenu:\n'"+CVS+ "|" +strCmdAction+"', on "+DEFAULTGROUP+"\n"); 998 new JCVSCommitAction().perform(new Node(jtro, DEFAULTGROUP)); 999 1001 log("Commit dialog should appeare\n"); 1002 CommitDialog commit=new CommitDialog(); 1004 1005 log("Verifying the Commit dialog...\n"); 1006 commit.verify(); 1007 log("Trying to click on 'Run Command' button\n"); 1008 commit.runCommand(); 1009 1010 log("...an CommandOutputWindow should open NOW...\n"); 1011 OutputOfVCSCommandsFrame out2=new OutputOfVCSCommandsFrame(); 1013 1014 log("Verifying the Output dialog....\n"); 1015 out2.verify(); 1016 1017 log("Trying to click on 'Close' button\n"); 1018 out2.close(); 1019 1020 log("Trying to invoke PopupMenu:\n'Delete', "+ DEFAULTGROUP); 1021 strCmdAction = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete"); 1022 new DeleteAction().perform(new Node(jtro, DEFAULTGROUP)); 1023 1025 log("Answering YES! to the YesNoDialog 'Confirm Object Deletion'...\n"); 1026 new NbDialogOperator(dialogTitle).yes(); 1027 1029 log("...sleeping 1s...\n"); 1031 Thread.sleep(1000); 1032 1033 log("Trying to switch to FS's TAB\n"); 1034 rootNode = exp.invoke().repositoryTab().getRootNode(); 1036 log("Trying to select a node:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]\n"); 1037 node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]"); 1039 node.select(); 1040 endTest(); 1041 } catch (Exception e) { 1042 fail(e); 1043 } 1044 } 1045 1046 1051 public void testVersioningExplorer() { 1052 startTest(); 1053 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1054 final String verExplorer= Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "LBL_VersioningExplorer"); 1055 try { 1056 log("Trying to get MainFrame...\n"); 1057 MainWindowOperator main = MainWindowOperator.getDefault(); 1058 ExplorerOperator exp = new ExplorerOperator(); 1059 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1060 JTreeOperator jtro = null; 1061 1062 log("Trying to switch to FS's TAB\n"); 1063 exp.selectPageFilesystems(); 1064 1065 log("Invoking popup menu 'Versioning Explorer' on a node:\n"+getTestDirNodePath()+"\n"); 1066 new VersioningExplorerAction().perform(new Node(rootNode, getTestDirNodePath())); 1067 1068 try { new VersioningFrameOperator().verify(); 1070 log("Trying to dock the Explorer window into Explorer... pushing a MainMenu:\n'Window|Dock View Into|Explorer|Center'\n"); 1071 new DockingAction("Explorer|"+DockingAction.CENTER).perform(); 1072 } catch (JemmyException ex) {log("Seems that Versioning Expl.'s been already docked in Exp");} 1073 1074 Thread.sleep(1000); 1075 log("Trying to switch to Versioning TAB\n"); 1076 switchToTab(exp, versioning); 1077 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1078 exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0)); 1079 1080 log("Trying to select a node:\n" + getTestDirNodePath()+"\n"); 1081 Node node = new Node(jtro, getTestDirNodePath()); 1082 node.select(); 1083 1085 log("Trying to select a node:\n" + getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]\n"); 1086 node = new Node(node, getTestFileObjectName()+".java [Up-to-date; 1.2]"); 1088 node.select(); 1089 node.expand(); 1090 1091 1093 boolean isPlease = true; 1094 TreePath tp = jtro.findPath(getTestDirNodePath()+"|"+getTestFileObjectName()+".java", "|"); 1095 jtro.expandPath(tp); 1096 log("This is TreePath on VE node:\n"+tp+"\n"); 1097 while (isPlease) { 1098 for(int i = 0; i < jtro.getChildCount(tp); i++) { 1099 String please = jtro.getChildPath(tp, i).getLastPathComponent().toString().trim(); 1100 log("This is String node 'Please wait':\n"+please); 1101 if(please.equals("Please wait...") || please.indexOf("Please wait...")>-1){ 1102 log("There is still 'Please wait...' node.\nWe're waiting another second for refreshing nodes"); 1103 Thread.sleep(1000); 1104 } else { 1105 isPlease = false; 1106 } 1107 } 1108 } 1109 1110 log("Trying to select a node:\n" + getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.1 no message \n"); 1111 Node tmpNode = node; 1113 node = new Node(node, "1.1 no message "); 1114 node.select(); 1115 1117 1118 log("Trying to select a node:\n" + getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.2 <Default Group> \n"); 1119 node = new Node(tmpNode, "1.2 <Default Group> "); 1121 node.select(); 1122 endTest(); 1123 1124 log("Switching into FS TAB\n"); 1125 exp.selectPageFilesystems(); 1127 } catch (Exception e) { 1128 fail(e); 1129 } 1130 } 1131 1132 1137 public void testBranch() { 1138 startTest(); 1139 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JTagAction") +"..."; 1140 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1141 String refrRev = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.Bundle", "RefreshRevisionsAction_Name"); 1142 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1143 try { 1144 1145 ExplorerOperator exp = new ExplorerOperator(); 1148 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1149 JTreeOperator jtro = null; 1150 log("Trying to switch to FS TAB in Explorer\n"); 1151 exp.selectPageFilesystems(); 1152 1153 log("Trying to push PopupMe4nu:\n" + CVS +"|"+ strCmdAction +"\non this node:\n"+ 1154 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]\n"); 1155 new JCVSTagAction(true).perform(new Node(rootNode, 1156 getTestDirNodePath()+"|"+ getTestFileObjectName()+" [Up-to-date; 1.2]")); 1157 1158 log("Trying to open TAG dialog\n"); 1159 TagDialog tag=new TagDialog(); 1161 1162 log("Writing text 'vetev2' into tag textfield...\n"); 1163 tag.txtTag().setText("vetev2"); 1164 1165 log("Checking up check box for branch tag...\n"); 1166 tag.check(tag.cbBranch(), true); 1167 1168 1171 log("Trying to find known tag switches: '-b vetev2'\n"); 1172 assertTrue("Switches are different!", tag.compareSwitches("tag -")); 1173 assertTrue("Switches are different!", tag.compareSwitches(" -b vetev2")); 1174 1175 log("Verification TAG dialog....\n"); 1176 tag.verify(); 1177 1178 1179 1183 1185 1189 TabbedOutputOfVCSCommandsFrame out; 1190 try { 1191 EventTool.removeListeners(); 1192 log("Trying ot execute command => clickin' on OK button\n"); 1193 tag.runCommand(); 1194 log("The Output Of VCS Command window should be opened now...\n"); 1195 out = new TabbedOutputOfVCSCommandsFrame(); 1196 } finally { 1197 EventTool.addListeners(); 1198 } 1199 1201 1202 log("Trying to verify the dialog\n"); 1203 out.verify(); 1206 1207 log("Trying to close the dialog\n"); 1208 out.close(); 1209 1210 log("Trying to switch to 'Versioning' TAB in the Explorer\n"); 1212 switchToTab(exp, versioning); 1213 1214 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1215 exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0)); 1216 1217 sbt.start(); 1219 log("Trying to push PopupMenu:\n"+"Refresh Revisions\non the node:\n"+ 1220 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]\n"); 1221 1222 new RefreshRevisionsAction().perform(new Node(jtro, 1223 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]")); 1224 1225 log("Trying to find this String 'Finished: Log' in the status line of the MainFrame...\n"); 1226 sbt.contains("Finished: Log", true); 1228 sbt.stop(); 1229 1230 new EventTool().waitNoEvent(2000); 1231 log("Trying to select node in the Explorer:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+ 1232 ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)\n"); 1233 (new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+ 1234 ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)")).select(); 1235 1236 endTest(); 1237 log("Trying to switch to FS TAB\n"); 1238 exp.selectPageFilesystems(); 1239 } catch (Exception e) { 1240 fail(e); 1241 } 1242 } 1243 1244 1249 public void testUpdateBranch() { 1250 startTest(); 1251 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JUpdateAction") +"..."; 1252 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1253 try { 1254 ExplorerOperator exp = new ExplorerOperator(); 1255 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1256 1258 exp.selectPageFilesystems(); 1259 new Action(null, CVS +"|"+ strCmdAction).perform( 1260 new Node(rootNode,getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]")); 1261 1262 UpdateDialog update=new UpdateDialog(); 1264 update.check(update.cbRevisionTag(), true); 1265 update.txtRevisionTag().setText("vetev2"); 1266 update.check(update.cbRevisionTag(), false); 1267 update.check(update.cbRevisionTag(), true); 1268 1271 assertTrue("Switches are different!", update.compareSwitches("update -")); assertTrue("Switches are different!", update.compareSwitches(" -r vetev2")); 1272 1273 update.verify(); 1274 update.runCommand(); 1275 OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame(); 1277 out.verify(); 1278 out.close(); 1279 new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2] (vetev2)").select(); 1280 endTest(); 1281 } catch (Exception e) { 1282 fail(e); 1283 } 1284 } 1285 1286 1291 public void testCommitToBranch() { 1292 startTest(); 1293 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JRefreshAction"); 1294 String commitcmd= Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JCommitAction") + "..."; 1295 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1296 String refrRev = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.Bundle", "RefreshRevisionsAction_Name"); 1297 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1298 try { 1299 ExplorerOperator exp = new ExplorerOperator(); 1300 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1301 Node node = null; 1303 JTreeOperator jtro = null; 1304 1305 log("Trying to switch to FS Tab\n"); 1306 exp.selectPageFilesystems(); 1307 1308 log("Trying to select this node:\n"+ 1309 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2] (vetev2)"); 1310 new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2] (vetev2)").select(); 1311 1312 1313 FileOutputStream file = new FileOutputStream(getTestFile()); 1314 file.write(("//comment\nclass "+TESTFILE+" {\n//branch vetev2\n}\n").getBytes()); 1315 file.close(); 1316 1317 log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n"+ getTestDirNodePath()+"\n"); 1318 new JCVSRefreshAction().perform(new Node(rootNode, getTestDirNodePath())); 1319 1320 log("Trying to push PopupMenu:\n"+ CVS +"|"+ commitcmd +"\non the node:\n"+ 1321 getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.2] (vetev2)\n"); 1322 new JCVSCommitAction().perform( 1323 new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.2] (vetev2)")); 1324 1325 log("Opening the Commit dialog...\n"); 1326 CommitDialog commit=new CommitDialog(); 1328 1329 log("Trying to verify the dialog...\b"); 1330 commit.verify(); 1331 1332 log("Executing the command...\n"); 1333 commit.runCommand(); 1334 1335 log("Opening the 'Output of VCS Commands [' dialog...\n"); 1336 OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame(); 1337 1338 log("Verifying the dialog...\n"); 1339 out.verify(); 1340 1341 log("Closing t dialog...\n"); 1342 out.close(); 1343 1344 log("Trying to select a node:\n"+ 1345 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)\n"); 1346 new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)").select(); 1347 1348 log("Trying to switch to Verifying TAB\n"); 1349 switchToTab(exp, versioning); 1350 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1351 exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0)); 1352 1353 log("Selecting a node:\n" +getTestDirNodePath()); 1354 node = new Node(jtro, getTestDirNodePath()); 1355 node.select(); 1356 1357 sbt.start(); 1358 log("Trying to push PopupMenu:\n" + refrRev + "\non the node:\n"+ 1359 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2.2.1] (vetev2)+\n"); 1360 1361 node = new Node(node, getTestFileObjectName()+".java [Up-to-date; 1.2.2.1] (vetev2)"); 1362 1363 new RefreshRevisionsAction().perform(node); 1364 1365 log("Verifying status line in MainFrame...'Finished: Log'\n"); 1366 sbt.waitText("Finished: Log"); 1367 sbt.stop(); 1368 1369 1370 try { 1371 new Waiter(new Waitable() { 1372 public Object actionProduced(Object parent) { 1373 return new Node((Node)parent, "1.2|1.2.2 (vetev2)").isChildPresent("1.2.2.1") ? Boolean.TRUE: null; 1374 } 1375 public String getDescription() { 1376 return("Child '1.2.2 (vetev2)' present under parent '1.2 <Default Group> '"); 1377 } 1378 }).waitAction(node); 1379 } catch (InterruptedException e) { 1380 throw new JemmyException("Interrupted.", e); 1381 } 1382 1383 1384 log("Selecting node:\n"+ getTestDirNodePath()+"|"+getTestFileObjectName()+ 1385 ".java [Up-to-date; 1.2.2.1] (vetev2)|1.2 <Default Group> |1.2.2 (vetev2)|1.2.2.1 no message \n"); 1386 1387 1388 node = new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+ 1389 ".java [Up-to-date; 1.2.2.1] (vetev2)|1.2 <Default Group> |1.2.2 (vetev2)|1.2.2.1 no message "); 1390 log("Selected node should be:\n"+node.getPath()); 1391 1392 1393 node.select(); 1394 endTest(); 1395 1396 log("Trying to switch to FS TAB\n"); 1397 exp.selectPageFilesystems(); 1398 } catch (Exception e) { 1399 fail(e); 1400 } 1401 } 1402 1403 1408 public void testMerge() { 1409 startTest(); 1410 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JUpdateAction") +"..."; 1411 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1412 String merge = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.versioning.Bundle", "JavaCvsVersioningAction.merge"); 1413 String commitCmd = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JCommitAction") + "..."; 1414 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1415 try { 1416 ExplorerOperator exp = new ExplorerOperator(); 1417 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1418 JTreeOperator jtro = null; 1420 1421 log("Trying to switch to FS Tab\n"); 1422 exp.selectPageFilesystems(); 1423 1424 log("Trying to push PopupMenu:\n" +CVS+ "|" +strCmdAction+ "\non the node:\n"+ 1425 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)\n"); 1426 new JCVSUpdateAction().perform( 1427 new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)")); 1428 1429 log("Opening Update dialog...\n"); 1430 UpdateDialog update=new UpdateDialog(); 1432 1433 log("Trying to 'reset sticky tag'...\n"); 1434 update.check(update.cbResetSticky(), true); 1435 1436 log("Trying to verify the dialog...\n"); 1437 update.verify(); 1438 1439 log("Executing command....\n"); 1440 update.runCommand(); 1441 1442 log("The 'Output of VCS Commands [' should be opened...\n"); 1443 OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame(); 1445 log("Trying to verify the dialog\n"); 1446 out.verify(); 1447 log("Trying to close the dialog using 'Close' button\n"); 1448 out.close(); 1449 1450 log("Trying to select node in the explorer:\n"+ 1451 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]"); 1452 new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]").select(); 1453 1454 log("Trying to switch to Versioning TAB\n"); 1456 switchToTab(exp, versioning); 1457 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1458 exp.tbpExplorerTabPane().getSource(), versioning, true, true, 0)); 1459 1460 sbt.start(); 1461 log("Trying to push PopupMenu:\n" +merge+ "\non the node in VE:\n"+ getTestDirNodePath()+"|"+ 1462 getTestFileObjectName()+".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)"); 1463 new JCVSMergeWithRevisionAction().perform(new Node 1464 (jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+ ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)")); 1465 1466 log("WARNING TO DEVELOPERS:\nPlease correct 'mergre' text in status line o MainWindow!!!"); 1468 System.out.println("Jaky je text v Main Window status Line?"); 1469 System.out.println(sbt.getStatusTextHistory().toString()); 1470 sbt.contains("Merge:finished...", true); 1471 sbt.stop(); 1472 1473 log("Merge With Revision seems succeeded...\n"); 1474 1475 log("Trying to push PopupMenu:\n"+ CVS +"|"+ commitCmd +"\non the node:\n"+ 1476 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [LMod; 1.2]"); 1477 new JCVSCommitAction().perform(new Node 1478 (jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [LMod; 1.2]")); 1479 1480 log("Invoking Commit dialog"); 1481 CommitDialog commit=new CommitDialog(); 1483 1484 log("Typing a message:\nMerged with branch.\n"); 1485 commit.txtMessage().setText("Merged with branch."); 1486 1487 log("Trying to verify the dialog\n"); 1488 commit.verify(); 1489 1490 log("Trying to execute the command\n"); 1491 commit.runCommand(); 1492 1493 log("Invoking the 'Ouptut of VCS Commands [' dialog\n"); 1494 out=new OutputOfVCSCommandsFrame(); 1495 1496 log("Trying to verify the dialog\n"); 1497 out.verify(); 1498 1499 log("Closing the dialog\n"); 1500 out.close(); 1501 1502 log("Selecting a node:\n"+ 1503 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]\n"); 1504 new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]").select(); 1505 endTest(); 1506 1507 log("Trying to switch to FS Tab\n"); 1508 exp.selectPageFilesystems(); 1509 } catch (Exception e) { 1510 fail(e); 1511 } 1512 } 1513 1514 1519 public void testStatus() { 1520 startTest(); 1521 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JStatusAction") +"..."; 1522 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1523 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1524 try { 1525 ExplorerOperator exp=new ExplorerOperator(); 1526 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1527 Node node = null; 1529 JTreeOperator jtro = null; 1530 1531 log("Trying to switch to Versioning TAB\n"); 1532 switchToTab(exp, versioning); 1533 1534 log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n"+ 1535 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]\n"); 1536 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1537 exp.tbpExplorerTabPane().getSource(), versioning, true, true, 0)); 1538 new JCVSStatusAction().perform(new Node 1539 (jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]")); 1540 1541 log("Invoking command dialog...\n"); 1542 StatusDialog dlg=new StatusDialog(); 1544 1545 log("Verifying the dialog...\n"); 1546 dlg.verify(); 1547 1548 log("Executing the command...\n"); 1549 dlg.runCommand(); 1550 1551 log("Looking for 'CVS Output [Status - testfile.java]' dialog....\nbut sometimes it might happen"+ 1552 "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 #26842 bug at: "+ 1553 "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n"); 1554 StatusOutputOperator out=new StatusOutputOperator("testfile.java"); 1555 1556 log("Status output dialog contains:"); 1557 log(out.getStatus()); 1558 log(out.getFilename()); 1559 log(out.getRepositoryFile()); 1560 log(out.getWorkingRevision()); 1561 log(out.getRepositoryRevision()); 1562 log(out.getStickyTag()); 1563 log(out.getStickyOptions()+"\n"); 1564 1565 log("psRef="+psRef.toString()); 1566 log("repositoryprefix="+repositoryprefix); 1567 out.dumpFile(psRef, repositoryprefix); 1568 out.close(); 1569 compareReferenceFiles(); 1570 1571 log("Trying to switch to FS Tab\n"); 1572 exp.selectPageFilesystems(); 1573 endTest(); 1574 } catch (Exception e) { 1575 fail(e); 1576 } 1577 } 1578 1579 1584 public void testLog() { 1585 clearTestStatus(); 1586 startTest(); 1587 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JLogAction") +"..."; 1588 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1589 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1590 try { 1591 ExplorerOperator exp=new ExplorerOperator(); 1592 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1593 Node node = null; 1594 JTreeOperator jtro = null; 1595 1596 log("Trying to switch to Verifying TAB\n"); 1597 switchToTab(exp, versioning); 1598 1599 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1600 exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0)); 1601 node = new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]"); 1602 1603 log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n" + node.getPath()); 1604 new JCVSLogAction().perform(node); 1605 1606 log("Opening the input dialog for log command...\n"); 1607 LogDialog dlg=new LogDialog(); 1609 1610 log("Verifying the dialog...\n"); 1611 dlg.verify(); 1612 1613 log("Exception the command...\n"); 1614 dlg.runCommand(); 1615 1616 log("Looking for 'CVS Output [Log - testfile.java]' dialog....\nbut sometimes it might happen"+ 1617 "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 bug at: "+ 1618 "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n"); 1619 LogOutputOperator out=new LogOutputOperator("testfile.java", false, false); 1620 1621 log("Log output dialog contains:"); 1622 log(out.getFilename()); 1623 log(out.getLocks()); 1624 log(out.getRepositoryFile()); 1625 log(out.getHeadRevision()); 1626 log(out.getSelectedRevisions()); 1627 log(out.getOutOf()); 1628 log(out.getLogMessage()+"\n"); 1629 1630 log("psRef="+psRef.toString()); 1631 log("repositoryprefix="+repositoryprefix); 1632 out.dumpFile(psRef, repositoryprefix); 1633 compareReferenceFiles(); 1634 1635 log("Closing the dialog...\n"); 1636 out.close(); 1637 endTest(); 1638 1639 log("Trying to switch to FS TAB\n"); 1640 exp.selectPageFilesystems(); 1641 } catch (Exception e) { 1642 fail(e); 1643 } 1644 } 1645 1646 1651 public void testAnnotate() { 1652 clearTestStatus(); 1653 startTest(); 1654 strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JAnnotateAction") +"..."; 1655 String versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1656 CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings"); 1657 try { 1658 ExplorerOperator exp=new ExplorerOperator(); 1659 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1660 Node node = null; 1661 JTreeOperator jtro = null; 1662 1663 log("Trying to switch to Versioning TAB\n"); 1664 switchToTab(exp, versioning); 1665 1666 log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n"+ 1667 getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]"); 1668 1669 jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container ) 1670 exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0)); 1671 new JCVSAnnotateAction().perform( 1672 new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]")); 1673 1674 log("Opening the input command dialog...\n"); 1675 AnnotateDialog dlg=new AnnotateDialog(); 1677 1678 log("Trying to verify the dialog...\n"); 1679 dlg.verify(); 1680 1681 log("Explorer the log command...\n"); 1682 dlg.runCommand(); 1683 1684 log("Looking for 'CVS Output [Annotate - testfile.java]' dialog.... and traying it to close,\nbut sometimes it might happen"+ 1685 "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 bug at: "+ 1686 "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n"); 1687 new FrameOperator("CVS Output [Annotate testfile.java]").close(); 1688 endTest(); 1689 1690 log("Trying to switch to FS TAB\n"); 1691 exp.selectPageFilesystems(); 1692 } catch (Exception e) { 1693 fail(e); 1694 } 1695 } 1696 1697 1702 public void testUnmount() { 1703 clearTestStatus(); 1704 startTest(); 1705 CVS = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel"); 1706 String umountFS = Bundle.getStringTrimmed("org.netbeans.core.actions.Bundle", "UnmountFS"); 1707 try { 1708 ExplorerOperator exp=new ExplorerOperator(); 1709 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1710 Node node = null; 1711 1713 log("Trying to get focus to Explorer\n"); 1714 exp.getFocus(); 1715 1716 1719 node = new Node(rootNode, CVS + getJavaCVSWork().getAbsolutePath()); 1720 log("Trying to push PopupMenu:\n"+umountFS+"\non the node:\n"+node+"\n"); 1721 new UnmountFSAction().perform(node); 1722 log("DONE:)"); 1723 endTest(); 1724 } catch (Exception e) { 1725 fail(e); 1726 } 1727 } 1728 1729 1733 public void testUndock() { 1734 clearTestStatus(); 1735 startTest(); 1736 String vcsGrpTAB = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_MODE.title"); 1737 String versTAB = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName"); 1738 try { 1739 ExplorerOperator exp=new ExplorerOperator(); 1740 Node rootNode = exp.invoke().repositoryTab().getRootNode(); 1741 Node node = null; 1742 JFrameOperator jfo = null; 1744 1745 log("Trying to activate the Explorer...\n"); 1746 exp.getFocus(); 1747 Thread.sleep(2500); 1749 1750 log("Trying to switch to FS TAB\n"); 1751 exp.selectPageFilesystems(); 1752 Thread.sleep(2500); 1754 1755 log("Trying to switch to '" +vcsGrpTAB+ "' TAB\n"); 1756 switchToTab(exp, vcsGrpTAB); 1757 1758 log("Trying to push MainMenu:\"+ 'Window||Undock View'\n"); 1759 new UndockAction().perform(); 1761 1762 log("...now the VCSGroupFrame should be undock....and we'return closing it...\n"); 1763 new VCSGroupsFrameOperator().close(); 1764 1765 log("Trying to activate the Explorer...\n"); 1767 exp.getFocus(); 1769 1770 log("Trying to switch to '" +versTAB+ "' TAB\n"); 1771 switchToTab(exp, versTAB); 1772 new UndockAction().perform(); 1774 new VersioningFrameOperator().close(); 1775 endTest(); 1776 } catch (Exception e) { 1777 fail(e); 1778 } 1779 } 1780} 1781 | Popular Tags |