1 9 10 package org.netbeans.test.cvsmodule; 11 12 import java.io.File ; 13 import javax.swing.JFileChooser ; 14 import javax.swing.JTextField ; 15 import junit.textui.TestRunner; 16 import org.netbeans.jellytools.EditorOperator; 17 import org.netbeans.jellytools.JellyTestCase; 18 import org.netbeans.jellytools.NbDialogOperator; 19 import org.netbeans.jellytools.OutputOperator; 20 import org.netbeans.jellytools.OutputTabOperator; 21 import org.netbeans.jellytools.ProjectsTabOperator; 22 import org.netbeans.jellytools.actions.ActionNoBlock; 23 import org.netbeans.jellytools.modules.javacvs.CVSRootStepOperator; 24 import org.netbeans.jellytools.modules.javacvs.CheckoutWizardOperator; 25 import org.netbeans.jellytools.modules.javacvs.CommitOperator; 26 import org.netbeans.jellytools.modules.javacvs.ModuleToCheckoutStepOperator; 27 import org.netbeans.jellytools.modules.javacvs.VersioningOperator; 28 import org.netbeans.jellytools.nodes.Node; 29 import org.netbeans.jellytools.nodes.SourcePackagesNode; 30 import org.netbeans.jemmy.Action; 31 import org.netbeans.jemmy.JemmyProperties; 32 import org.netbeans.jemmy.QueueTool; 33 import org.netbeans.jemmy.operators.JButtonOperator; 34 import org.netbeans.jemmy.operators.JFileChooserOperator; 35 import org.netbeans.jemmy.operators.JTextFieldOperator; 36 import org.netbeans.jemmy.operators.Operator; 37 import org.netbeans.jemmy.operators.Operator.DefaultStringComparator; 38 import org.netbeans.junit.NbTestSuite; 39 import org.netbeans.junit.ide.ProjectSupport; 40 41 45 public class UpdateTest extends JellyTestCase { 46 47 static final String PROJECT1 = "Project1"; 48 static final String PROJECT2 = "Project2"; 49 static final String cvsRoot1 = ":pserver:test@qa-linux-s6:/usr/local/CVSrepo"; 50 static final String cvsRoot2 = ":pserver:pvcs@peterp.czech.sun.com:/usr/cvsrepo"; 51 55 static final String [] nodes1 = new String [] {"aa|NewClass1.java", "aa|NewClass2.java"}; 56 57 String os_name; 58 static String sessionCVSroot; 59 boolean unix = false; 60 final String projectName = "CVS Client Library"; 61 Operator.DefaultStringComparator comOperator; 62 Operator.DefaultStringComparator oldOperator; 63 64 65 public UpdateTest(String name) { 66 super(name); 67 } 68 69 protected void setUp() throws Exception { 70 71 os_name = System.getProperty("os.name"); 72 System.out.println("### "+getName()+" ###"); 74 75 } 76 77 protected boolean isUnix() { 78 boolean unix = false; 79 if (os_name.indexOf("Windows") == -1) { 80 unix = true; 81 } 82 return unix; 83 } 84 85 public static void main(String [] args) { 86 TestRunner.run(suite()); 88 } 89 90 public static NbTestSuite suite() { 91 NbTestSuite suite = new NbTestSuite(); 92 suite.addTest(new UpdateTest("testBrokenUpdateModMer")); 94 suite.addTest(new UpdateTest("testBrokenUpdateModConf")); 95 suite.addTest(new UpdateTest("testBrokenUpdateModMod")); 96 suite.addTest(new UpdateTest("testBrokenUpdateMerMer")); 97 suite.addTest(new UpdateTest("testBrokenUpdateMerConf")); 98 suite.addTest(new UpdateTest("testBrokenUpdateConfMer")); 99 suite.addTest(new UpdateTest("testBrokenUpdateConfMod")); 100 suite.addTest(new UpdateTest("testBrokenUpdateModMerMer")); 101 suite.addTest(new UpdateTest("testBrokenUpdateModMerConf")); 102 suite.addTest(new UpdateTest("testBrokenUpdateModConfConf")); 103 suite.addTest(new UpdateTest("testBrokenUpdateMerModMer")); 104 suite.addTest(new UpdateTest("testBrokenUpdateConfModConf")); 105 suite.addTest(new UpdateTest("testBrokenUpdateConfConfMod")); 106 suite.addTest(new UpdateTest("testBrokenUpdateMerMerMod")); 107 return suite; 108 } 109 110 public void testOpen() throws Exception { 111 File loc = new File ("/tmp/work/w1153322002833"); 112 openProject(loc, PROJECT1); 115 } 116 117 public void testUpdate() throws Exception { 118 String cvsRoot = ":pserver:anoncvs@cvsnetbeansorg.sfbay.sun.com:/cvs"; 119 Node node; 120 org.openide.nodes.Node nodeIDE; 121 String color; 122 123 String [] nodes = new String [] { 124 "org.netbeans.lib.cvsclient|Bundle.properties", 125 "org.netbeans.lib.cvsclient|CVSRoot.java", 126 "org.netbeans.lib.cvsclient|Client.java", 127 "org.netbeans.lib.cvsclient|ClientServices.java", 128 "org.netbeans.lib.cvsclient.admin|AdminHandler.java", 129 "org.netbeans.lib.cvsclient.admin|DateComparator.java", 130 "org.netbeans.lib.cvsclient.admin|Entry.java", 131 "org.netbeans.lib.cvsclient.admin|StandardAdminHandler.java", 132 "org.netbeans.lib.cvsclient.command|BasicCommand.java", 133 "org.netbeans.lib.cvsclient.command|BinaryBuilder.java", 134 "org.netbeans.lib.cvsclient.command|BuildableCommand.java", 135 "org.netbeans.lib.cvsclient.command|Builder.java", 136 "org.netbeans.lib.cvsclient.command|Bundle.properties", 137 "org.netbeans.lib.cvsclient.command|Command.java", 138 "org.netbeans.lib.cvsclient.command|CommandAbortedException.java", 139 "org.netbeans.lib.cvsclient.command|CommandException.java", 140 "org.netbeans.lib.cvsclient.command|CommandUtils.java", 141 "org.netbeans.lib.cvsclient.command|DefaultFileInfoContainer.java", 142 "org.netbeans.lib.cvsclient.command|FileInfoContainer.java", 143 "org.netbeans.lib.cvsclient.command|GlobalOptions.java", 144 "org.netbeans.lib.cvsclient.command|KeywordSubstitutionOptions.java", 145 "org.netbeans.lib.cvsclient.command|PipedFileInformation.java", 146 "org.netbeans.lib.cvsclient.command|PipedFilesBuilder.java", 147 "org.netbeans.lib.cvsclient.command|RepositoryCommand.java", 148 "org.netbeans.lib.cvsclient.command|TemporaryFileCreator.java", 149 "org.netbeans.lib.cvsclient.command|Watch.java", 150 "org.netbeans.lib.cvsclient.command|WrapperUtils.java" 151 }; 152 VersioningOperator vo = VersioningOperator.invoke(); 153 OutputOperator oo = OutputOperator.invoke(); 154 OutputTabOperator oto = new OutputTabOperator(cvsRoot); 155 oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 156 oto.clear(); 157 node = new Node(new ProjectsTabOperator().tree(), projectName); 158 node.performPopupAction("CVS|Show Changes"); 159 oto.waitText("Refreshing CVS Status finished"); 160 Thread.sleep(1000); 161 162 assertEquals("Wrong files counts in Versioning view", nodes.length, vo.tabFiles().getRowCount()); 163 String [] actual = new String [vo.tabFiles().getRowCount()]; 164 String [] expected = new String [nodes.length]; 165 for (int i = 0; i < vo.tabFiles().getRowCount(); i++) { 166 actual[i] = vo.tabFiles().getModel().getValueAt(i, 0).toString(); 167 } 168 for (int i = 0; i < nodes.length; i++) { 169 expected[i] = getObjectName(nodes[i]); 170 } 171 172 int result = TestKit.compareThem(expected, actual, false); 173 assertEquals("Some files disappear!!!", expected.length, result); 174 175 for (int j = 0; j < 10; j ++) { 176 oto = new OutputTabOperator(cvsRoot); 177 oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 178 oto.clear(); 179 node = new Node(new ProjectsTabOperator().tree(), projectName); 180 node.performPopupAction("CVS|Update"); 181 oto.waitText("Updating \"CVS Client Library\" finished"); 182 Thread.sleep(1000); 183 for (int i = 0; i < nodes.length; i++) { 184 node = new Node(new SourcePackagesNode(projectName), nodes[i]); 185 nodeIDE = (org.openide.nodes.Node) node.getOpenideNode(); 186 color = TestKit.getColor(nodeIDE.getHtmlDisplayName()); 187 assertEquals("Wrong color of <" + nodes[i] + ">", TestKit.MODIFIED_COLOR, color); 188 } 189 vo = VersioningOperator.invoke(); 190 actual = new String [vo.tabFiles().getRowCount()]; 191 for (int i = 0; i < vo.tabFiles().getRowCount(); i++) { 192 actual[i] = vo.tabFiles().getModel().getValueAt(i, 0).toString(); 193 } 194 result = TestKit.compareThem(expected, actual, false); 195 assertEquals("Some files disappear!!!", expected.length, result); 196 } 197 } 198 199 String getObjectName(String value) { 200 int pos = value.lastIndexOf('|'); 201 return value.substring(pos + 1); 202 } 203 204 205 209 210 public void testBrokenUpdateModMer() throws Exception { 211 int j = 0; 212 long iter1 = 1; 213 long iter2 = 2; 214 File location1; 215 File location2; 216 File work = new File ("/tmp/work"); 217 work.mkdirs(); 218 closeProject(PROJECT1); 219 222 Node node1; 223 Node node2; 224 org.openide.nodes.Node nodeIDE1; 225 org.openide.nodes.Node nodeIDE2; 226 227 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 228 230 for (int i = 0; i < 1; i++) { 231 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 232 234 closeProject(PROJECT1); 235 237 checkOutProject(cvsRoot1, "test", PROJECT1); 238 240 editChosenFile(PROJECT1, "NewClass2.java", 7, iter1); 241 243 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 244 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 246 assertEquals("Wrong count of files to commit", 1, co.tabFiles().getRowCount()); 247 248 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 249 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 251 oto1.clear(); 252 co.commit(); 255 oto1.waitText("Committing"); 256 oto1.waitText("finished"); 257 closeProject(PROJECT1); 261 264 openProject(location1, PROJECT1); 265 267 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 268 270 updateProject(PROJECT1, cvsRoot1); 271 273 Thread.sleep(1000); 274 oto1 = new OutputTabOperator(cvsRoot1); 275 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 276 oto1.clear(); 277 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 278 node.performPopupAction("CVS|Show Changes"); 279 oto1.waitText("Refreshing CVS Status finished"); 280 281 VersioningOperator vo = VersioningOperator.invoke(); 282 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 283 String [] actual = new String [vo.tabFiles().getRowCount()]; 284 for (int k = 0; k < actual.length; k++) { 285 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 286 System.out.println(actual[k]); 287 } 288 int result = TestKit.compareThem(expected, actual, false); 289 assertEquals("Wrong records displayed in dialog", 2, result); 290 291 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 293 co = CommitOperator.invoke(new Node[] {node1}); 295 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 296 co.cancel(); 297 322 } 323 } 324 325 public void testBrokenUpdateModConf() throws Exception { 326 int j = 0; 327 long iter1 = 1; 328 long iter2 = 2; 329 File location1; 330 File location2; 331 File work = new File ("/tmp/work"); 332 work.mkdirs(); 333 closeProject(PROJECT1); 334 335 Node node1; 336 org.openide.nodes.Node nodeIDE1; 337 338 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 339 340 iter1 = System.currentTimeMillis(); 341 editChosenFile(PROJECT1, "NewClass3.java", 5, iter1); 343 344 closeProject(PROJECT1); 345 346 checkOutProject(cvsRoot1, "test", PROJECT1); 347 348 iter2 = System.currentTimeMillis(); 349 editChosenFile(PROJECT1, "NewClass3.java", 5, iter2); 350 351 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 352 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 353 assertEquals("Wrong count of files to commit", 1, co.tabFiles().getRowCount()); 354 355 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 356 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 358 oto1.clear(); 359 360 co.commit(); 361 oto1.waitText("Committing"); 362 oto1.waitText("finished"); 363 364 closeProject(PROJECT1); 365 366 openProject(location1, PROJECT1); 367 368 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 369 370 updateProject(PROJECT1, cvsRoot1); 371 372 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 373 JButtonOperator btnOk = new JButtonOperator(nbDialog); 374 btnOk.push(); 375 376 Thread.sleep(1000); 377 oto1 = new OutputTabOperator(cvsRoot1); 378 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 379 oto1.clear(); 380 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 381 node.performPopupAction("CVS|Show Changes"); 382 oto1.waitText("Refreshing CVS Status finished"); 383 nbDialog = new NbDialogOperator("Command"); 384 btnOk = new JButtonOperator(nbDialog); 385 btnOk.push(); 386 387 VersioningOperator vo = VersioningOperator.invoke(); 388 String [] expected = new String [] {"NewClass1.java", "NewClass3.java"}; 389 String [] actual = new String [vo.tabFiles().getRowCount()]; 390 for (int k = 0; k < actual.length; k++) { 391 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 392 } 393 int result = TestKit.compareThem(expected, actual, false); 394 assertEquals("Wrong records displayed in dialog", 2, result); 395 396 expected = new String [] {"Locally Modified", "Local Conflict"}; 397 actual = new String [vo.tabFiles().getRowCount()]; 398 for (int k = 0; k < actual.length; k++) { 399 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 400 } 401 result = TestKit.compareThem(expected, actual, false); 402 assertEquals("Wrong records displayed in dialog", 2, result); 403 404 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 406 407 co = CommitOperator.invoke(new Node[] {node1}); 408 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 409 co.cancel(); 410 } 411 412 public void testBrokenUpdateModMod() throws Exception { 413 int j = 0; 414 long iter; 415 File location1; 416 File location2; 417 File work = new File ("/tmp/work"); 418 work.mkdirs(); 419 closeProject(PROJECT1); 420 423 Node node1; 424 org.openide.nodes.Node nodeIDE1; 425 426 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 427 428 iter = System.currentTimeMillis(); 429 430 editChosenFile(PROJECT1, "NewClass1.java", 5, iter); 431 editChosenFile(PROJECT1, "NewClass2.java", 5, iter); 432 433 updateProject(PROJECT1, cvsRoot1); 434 435 Thread.sleep(1000); 436 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 437 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 438 oto1.clear(); 439 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 440 node.performPopupAction("CVS|Show Changes"); 441 oto1.waitText("Refreshing CVS Status finished"); 442 443 VersioningOperator vo = VersioningOperator.invoke(); 444 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 445 String [] actual = new String [vo.tabFiles().getRowCount()]; 446 for (int k = 0; k < actual.length; k++) { 447 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 448 } 449 int result = TestKit.compareThem(expected, actual, false); 450 assertEquals("Wrong records displayed in dialog", 2, result); 451 452 expected = new String [] {"Locally Modified", "Locally Modified"}; 453 actual = new String [vo.tabFiles().getRowCount()]; 454 for (int k = 0; k < actual.length; k++) { 455 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 456 } 457 result = TestKit.compareThem(expected, actual, false); 458 assertEquals("Wrong records displayed in dialog", 2, result); 459 460 461 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 463 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 464 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 465 co.cancel(); 466 } 467 468 public void testBrokenUpdateMerMer() throws Exception { 469 int j = 0; 470 long iter1 = 1; 471 long iter2 = 2; 472 File location1; 473 File location2; 474 File work = new File ("/tmp/work"); 475 work.mkdirs(); 476 closeProject(PROJECT1); 477 478 Node node1; 479 org.openide.nodes.Node nodeIDE1; 480 481 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 482 483 editChosenFile(PROJECT1, "NewClass1.java", 3, iter1); 484 editChosenFile(PROJECT1, "NewClass2.java", 3, iter1); 485 closeProject(PROJECT1); 486 487 checkOutProject(cvsRoot1, "test", PROJECT1); 488 489 editChosenFile(PROJECT1, "NewClass1.java", 5, iter2); 490 editChosenFile(PROJECT1, "NewClass2.java", 5, iter2); 491 492 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 493 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 494 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 495 496 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 497 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 498 oto1.clear(); 499 co.commit(); 500 oto1.waitText("Committing"); 501 oto1.waitText("finished"); 502 503 closeProject(PROJECT1); 504 505 openProject(location1, PROJECT1); 506 507 updateProject(PROJECT1, cvsRoot1); 508 509 Thread.sleep(1000); 510 oto1 = new OutputTabOperator(cvsRoot1); 511 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 512 oto1.clear(); 513 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 514 node.performPopupAction("CVS|Show Changes"); 515 oto1.waitText("Refreshing CVS Status finished"); 516 517 VersioningOperator vo = VersioningOperator.invoke(); 518 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 519 String [] actual = new String [vo.tabFiles().getRowCount()]; 520 for (int k = 0; k < actual.length; k++) { 521 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 522 System.out.println(actual[k]); 523 } 524 int result = TestKit.compareThem(expected, actual, false); 525 assertEquals("Wrong records displayed in dialog", 2, result); 526 527 expected = new String [] {"Locally Modified", "Locally Modified"}; 528 actual = new String [vo.tabFiles().getRowCount()]; 529 for (int k = 0; k < actual.length; k++) { 530 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 531 } 532 result = TestKit.compareThem(expected, actual, false); 533 assertEquals("Wrong records displayed in dialog", 2, result); 534 535 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 537 co = CommitOperator.invoke(new Node[] {node1}); 538 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 539 co.cancel(); 540 } 541 542 public void testBrokenUpdateConfConf() throws Exception { 543 int j = 0; 544 long iter1 = 1; 545 long iter2 = 2; 546 File location1; 547 File work = new File ("/tmp/work"); 548 work.mkdirs(); 549 closeProject(PROJECT1); 550 551 Node node1; 552 org.openide.nodes.Node nodeIDE1; 553 554 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 555 556 iter1 = System.currentTimeMillis(); 557 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 559 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 560 561 closeProject(PROJECT1); 562 563 checkOutProject(cvsRoot1, "test", PROJECT1); 564 565 iter2 = System.currentTimeMillis(); 566 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 567 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 568 569 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 570 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 571 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 572 573 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 574 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 575 oto1.clear(); 576 co.commit(); 577 oto1.waitText("Committing"); 578 oto1.waitText("finished"); 579 closeProject(PROJECT1); 580 581 openProject(location1, PROJECT1); 582 583 updateProject(PROJECT1, cvsRoot1); 584 585 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 586 JButtonOperator btnOk = new JButtonOperator(nbDialog); 587 btnOk.push(); 588 589 Thread.sleep(1000); 590 oto1 = new OutputTabOperator(cvsRoot1); 591 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 592 oto1.clear(); 593 594 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 595 node.performPopupAction("CVS|Show Changes"); 596 oto1.waitText("Refreshing CVS Status finished"); 597 nbDialog = new NbDialogOperator("Command"); 598 btnOk = new JButtonOperator(nbDialog); 599 btnOk.push(); 600 601 VersioningOperator vo = VersioningOperator.invoke(); 602 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 603 String [] actual = new String [vo.tabFiles().getRowCount()]; 604 for (int k = 0; k < actual.length; k++) { 605 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 606 System.out.println(actual[k]); 607 } 608 int result = TestKit.compareThem(expected, actual, false); 609 assertEquals("Wrong records displayed in dialog", 2, result); 610 611 expected = new String [] {"Local Conflict", "Local Conflict"}; 612 actual = new String [vo.tabFiles().getRowCount()]; 613 for (int k = 0; k < actual.length; k++) { 614 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 615 } 616 result = TestKit.compareThem(expected, actual, false); 617 assertEquals("Wrong records displayed in dialog", 2, result); 618 619 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 621 co = CommitOperator.invoke(new Node[] {node1}); 622 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 623 co.cancel(); 624 } 625 626 public void testBrokenUpdateMerConf() throws Exception { 627 int j = 0; 628 long iter1 = 1; 629 long iter2 = 2; 630 File location1; 631 File location2; 632 File work = new File ("/tmp/work"); 633 work.mkdirs(); 634 closeProject(PROJECT1); 635 636 Node node1; 637 org.openide.nodes.Node nodeIDE1; 638 639 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 640 641 iter1 = System.currentTimeMillis(); 642 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 643 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 644 645 closeProject(PROJECT1); 646 647 checkOutProject(cvsRoot1, "test", PROJECT1); 648 iter2 = System.currentTimeMillis(); 649 editChosenFile(PROJECT1, "NewClass1.java", 2, iter2); 650 editChosenFile(PROJECT1, "NewClass2.java", 5, iter2); 651 653 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 654 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 655 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 656 657 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 658 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 659 oto1.clear(); 660 co.commit(); 661 oto1.waitText("Committing"); 662 oto1.waitText("finished"); 663 closeProject(PROJECT1); 664 665 openProject(location1, PROJECT1); 666 updateProject(PROJECT1, cvsRoot1); 667 668 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 669 JButtonOperator btnOk = new JButtonOperator(nbDialog); 670 btnOk.push(); 671 672 Thread.sleep(1000); 673 oto1 = new OutputTabOperator(cvsRoot1); 674 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 675 oto1.clear(); 676 677 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 678 node.performPopupAction("CVS|Show Changes"); 679 oto1.waitText("Refreshing CVS Status finished"); 680 nbDialog = new NbDialogOperator("Command"); 681 btnOk = new JButtonOperator(nbDialog); 682 btnOk.push(); 683 684 VersioningOperator vo = VersioningOperator.invoke(); 685 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 686 String [] actual = new String [vo.tabFiles().getRowCount()]; 687 for (int k = 0; k < actual.length; k++) { 688 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 689 } 690 int result = TestKit.compareThem(expected, actual, false); 691 assertEquals("Wrong records displayed in dialog", 2, result); 692 693 expected = new String [] {"Locally Modified", "Local Conflict"}; 694 actual = new String [vo.tabFiles().getRowCount()]; 695 for (int k = 0; k < actual.length; k++) { 696 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 697 } 698 result = TestKit.compareThem(expected, actual, false); 699 assertEquals("Wrong records displayed in dialog", 2, result); 700 701 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 703 co = CommitOperator.invoke(new Node[] {node1}); 704 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 705 co.cancel(); 706 } 707 708 public void testBrokenUpdateConfMer() throws Exception { 709 int j = 0; 710 long iter1 = 1; 711 long iter2 = 2; 712 File location1; 713 File location2; 714 File work = new File ("/tmp/work"); 715 work.mkdirs(); 716 closeProject(PROJECT1); 717 718 Node node1; 719 org.openide.nodes.Node nodeIDE1; 720 721 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 722 iter1 = System.currentTimeMillis(); 723 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 725 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 726 closeProject(PROJECT1); 727 728 checkOutProject(cvsRoot1, "test", PROJECT1); 729 iter2 = System.currentTimeMillis(); 730 editChosenFile(PROJECT1, "NewClass1.java", 5, iter2); 731 editChosenFile(PROJECT1, "NewClass2.java", 2, iter2); 732 733 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 734 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 735 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 736 737 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 738 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 739 oto1.clear(); 740 co.commit(); 741 oto1.waitText("Committing"); 742 oto1.waitText("finished"); 743 744 closeProject(PROJECT1); 745 746 openProject(location1, PROJECT1); 747 748 updateProject(PROJECT1, cvsRoot1); 749 750 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 751 JButtonOperator btnOk = new JButtonOperator(nbDialog); 752 btnOk.push(); 753 754 Thread.sleep(1000); 755 oto1 = new OutputTabOperator(cvsRoot1); 756 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 757 oto1.clear(); 758 759 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 760 node.performPopupAction("CVS|Show Changes"); 761 oto1.waitText("Refreshing CVS Status finished"); 762 nbDialog = new NbDialogOperator("Command"); 763 btnOk = new JButtonOperator(nbDialog); 764 btnOk.push(); 765 766 VersioningOperator vo = VersioningOperator.invoke(); 767 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 768 String [] actual = new String [vo.tabFiles().getRowCount()]; 769 for (int k = 0; k < actual.length; k++) { 770 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 771 } 772 int result = TestKit.compareThem(expected, actual, false); 773 assertEquals("Wrong records displayed in dialog", 2, result); 774 775 expected = new String [] {"Local Conflict", "Locally Modified"}; 776 actual = new String [vo.tabFiles().getRowCount()]; 777 for (int k = 0; k < actual.length; k++) { 778 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 779 } 780 result = TestKit.compareThem(expected, actual, false); 781 assertEquals("Wrong records displayed in dialog", 2, result); 782 783 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 785 co = CommitOperator.invoke(new Node[] {node1}); 786 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 787 co.cancel(); 788 } 789 790 public void testBrokenUpdateConfMod() throws Exception { 791 int j = 0; 792 long iter1 = 1; 793 long iter2 = 2; 794 File location1; 795 File location2; 796 File work = new File ("/tmp/work"); 797 work.mkdirs(); 798 closeProject(PROJECT1); 799 800 Node node1; 801 org.openide.nodes.Node nodeIDE1; 802 803 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 804 805 iter1 = System.currentTimeMillis(); 806 807 editChosenFile(PROJECT1, "NewClass1.java", 5, iter1); 808 809 closeProject(PROJECT1); 810 811 checkOutProject(cvsRoot1, "test", PROJECT1); 812 813 iter2 = System.currentTimeMillis(); 814 editChosenFile(PROJECT1, "NewClass1.java", 5, iter2); 815 816 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 817 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 818 assertEquals("Wrong count of files to commit", 1, co.tabFiles().getRowCount()); 819 820 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 821 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 822 oto1.clear(); 823 co.commit(); 824 oto1.waitText("Committing"); 825 oto1.waitText("finished"); 826 closeProject(PROJECT1); 827 828 openProject(location1, PROJECT1); 829 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 830 831 updateProject(PROJECT1, cvsRoot1); 832 833 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 834 JButtonOperator btnOk = new JButtonOperator(nbDialog); 835 btnOk.push(); 836 837 Thread.sleep(1000); 838 oto1 = new OutputTabOperator(cvsRoot1); 839 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 840 oto1.clear(); 841 842 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 843 node.performPopupAction("CVS|Show Changes"); 844 oto1.waitText("Refreshing CVS Status finished"); 845 nbDialog = new NbDialogOperator("Command"); 846 btnOk = new JButtonOperator(nbDialog); 847 btnOk.push(); 848 849 VersioningOperator vo = VersioningOperator.invoke(); 850 String [] expected = new String [] {"NewClass1.java", "NewClass2.java"}; 851 String [] actual = new String [vo.tabFiles().getRowCount()]; 852 for (int k = 0; k < actual.length; k++) { 853 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 854 } 855 int result = TestKit.compareThem(expected, actual, false); 856 assertEquals("Wrong records displayed in dialog", 2, result); 857 858 expected = new String [] {"Local Conflict", "Locally Modified"}; 859 actual = new String [vo.tabFiles().getRowCount()]; 860 for (int k = 0; k < actual.length; k++) { 861 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 862 } 863 result = TestKit.compareThem(expected, actual, false); 864 assertEquals("Wrong records displayed in dialog", 2, result); 865 866 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 868 co = CommitOperator.invoke(new Node[] {node1}); 869 assertEquals("Wrong count of files to commit - issue #71488", 2, co.tabFiles().getRowCount()); 870 co.cancel(); 871 } 872 873 public void testBrokenUpdateModMerMer() throws Exception { 874 int j = 0; 875 long iter1 = 1; 876 long iter2 = 2; 877 File location1; 878 File work = new File ("/tmp/work"); 879 work.mkdirs(); 880 closeProject(PROJECT1); 881 882 Node node1; 883 org.openide.nodes.Node nodeIDE1; 884 885 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 886 iter1 = System.currentTimeMillis(); 887 888 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 889 editChosenFile(PROJECT1, "NewClass3.java", 5, iter1); 890 891 closeProject(PROJECT1); 892 893 checkOutProject(cvsRoot1, "test", PROJECT1); 894 iter2 = System.currentTimeMillis(); 895 editChosenFile(PROJECT1, "NewClass2.java", 3, iter2); 896 editChosenFile(PROJECT1, "NewClass3.java", 3, iter2); 897 898 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 899 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 900 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 901 902 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 903 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 904 oto1.clear(); 905 co.commit(); 906 oto1.waitText("Committing"); 907 oto1.waitText("finished"); 908 closeProject(PROJECT1); 909 910 openProject(location1, PROJECT1); 911 912 editChosenFile(PROJECT1, "NewClass1.java", 7, iter1); 913 914 updateProject(PROJECT1, cvsRoot1); 915 916 Thread.sleep(1000); 917 oto1 = new OutputTabOperator(cvsRoot1); 918 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 919 oto1.clear(); 920 921 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 922 node.performPopupAction("CVS|Show Changes"); 923 oto1.waitText("Refreshing CVS Status finished"); 924 925 VersioningOperator vo = VersioningOperator.invoke(); 926 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 927 String [] actual = new String [vo.tabFiles().getRowCount()]; 928 for (int k = 0; k < actual.length; k++) { 929 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 930 } 931 int result = TestKit.compareThem(expected, actual, false); 932 assertEquals("Wrong records displayed in dialog", 3, result); 933 934 expected = new String [] {"Locally Modified", "Locally Modified", "Locally Modified"}; 935 actual = new String [vo.tabFiles().getRowCount()]; 936 for (int k = 0; k < actual.length; k++) { 937 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 938 } 939 result = TestKit.compareThem(expected, actual, false); 940 assertEquals("Wrong records displayed in dialog", 3, result); 941 942 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 944 co = CommitOperator.invoke(new Node[] {node1}); 945 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 946 co.cancel(); 947 } 948 949 public void testBrokenUpdateModMerConf() throws Exception { 950 int j = 0; 951 long iter1 = 1; 952 long iter2 = 2; 953 File location1; 954 File work = new File ("/tmp/work"); 955 work.mkdirs(); 956 closeProject(PROJECT1); 957 958 Node node1; 959 org.openide.nodes.Node nodeIDE1; 960 961 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 962 963 iter1 = System.currentTimeMillis(); 964 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 965 editChosenFile(PROJECT1, "NewClass3.java", 5, iter1); 966 closeProject(PROJECT1); 967 968 checkOutProject(cvsRoot1, "test", PROJECT1); 969 iter2 = System.currentTimeMillis(); 970 editChosenFile(PROJECT1, "NewClass2.java", 3, iter2); 971 editChosenFile(PROJECT1, "NewClass3.java", 5, iter2); 972 973 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 974 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 975 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 976 977 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 978 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 979 oto1.clear(); 980 co.commit(); 981 oto1.waitText("Committing"); 982 oto1.waitText("finished"); 983 984 closeProject(PROJECT1); 985 986 openProject(location1, PROJECT1); 987 988 editChosenFile(PROJECT1, "NewClass1.java", 7, iter1); 989 990 updateProject(PROJECT1, cvsRoot1); 991 992 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 993 JButtonOperator btnOk = new JButtonOperator(nbDialog); 994 btnOk.push(); 995 996 Thread.sleep(1000); 997 oto1 = new OutputTabOperator(cvsRoot1); 998 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 999 oto1.clear(); 1000 1001 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1002 node.performPopupAction("CVS|Show Changes"); 1003 oto1.waitText("Refreshing CVS Status finished"); 1004 nbDialog = new NbDialogOperator("Command"); 1005 btnOk = new JButtonOperator(nbDialog); 1006 btnOk.push(); 1007 1008 VersioningOperator vo = VersioningOperator.invoke(); 1009 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1010 String [] actual = new String [vo.tabFiles().getRowCount()]; 1011 for (int k = 0; k < actual.length; k++) { 1012 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1013 } 1014 int result = TestKit.compareThem(expected, actual, false); 1015 assertEquals("Wrong records displayed in dialog", 3, result); 1016 1017 expected = new String [] {"Locally Modified", "Locally Modified", "Local Conflict"}; 1018 actual = new String [vo.tabFiles().getRowCount()]; 1019 for (int k = 0; k < actual.length; k++) { 1020 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1021 } 1022 result = TestKit.compareThem(expected, actual, false); 1023 assertEquals("Wrong records displayed in dialog", 3, result); 1024 1025 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1027 co = CommitOperator.invoke(new Node[] {node1}); 1028 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1029 co.cancel(); 1030 } 1031 1032 public void testBrokenUpdateModConfConf() throws Exception { 1033 int j = 0; 1034 long iter1 = 1; 1035 long iter2 = 2; 1036 File location1; 1037 File work = new File ("/tmp/work"); 1038 work.mkdirs(); 1039 closeProject(PROJECT1); 1040 1041 Node node1; 1042 Node node2; 1043 org.openide.nodes.Node nodeIDE1; 1044 org.openide.nodes.Node nodeIDE2; 1045 1046 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 1047 1048 iter1 = System.currentTimeMillis(); 1049 editChosenFile(PROJECT1, "NewClass2.java", 5, iter1); 1050 editChosenFile(PROJECT1, "NewClass3.java", 5, iter1); 1051 1052 closeProject(PROJECT1); 1053 1054 checkOutProject(cvsRoot1, "test", PROJECT1); 1055 iter2 = System.currentTimeMillis(); 1056 editChosenFile(PROJECT1, "NewClass2.java", 5, iter2); 1057 editChosenFile(PROJECT1, "NewClass3.java", 5, iter2); 1058 1059 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1060 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 1061 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 1062 1063 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 1064 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1065 oto1.clear(); 1066 co.commit(); 1067 oto1.waitText("Committing"); 1068 oto1.waitText("finished"); 1069 closeProject(PROJECT1); 1070 1071 openProject(location1, PROJECT1); 1072 1073 editChosenFile(PROJECT1, "NewClass1.java", 7, iter1); 1074 1075 updateProject(PROJECT1, cvsRoot1); 1076 1077 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 1078 JButtonOperator btnOk = new JButtonOperator(nbDialog); 1079 btnOk.push(); 1080 1081 Thread.sleep(1000); 1082 oto1 = new OutputTabOperator(cvsRoot1); 1083 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1084 oto1.clear(); 1085 1086 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1087 node.performPopupAction("CVS|Show Changes"); 1088 oto1.waitText("Refreshing CVS Status finished"); 1089 nbDialog = new NbDialogOperator("Command"); 1090 btnOk = new JButtonOperator(nbDialog); 1091 btnOk.push(); 1092 1093 VersioningOperator vo = VersioningOperator.invoke(); 1094 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1095 String [] actual = new String [vo.tabFiles().getRowCount()]; 1096 for (int k = 0; k < actual.length; k++) { 1097 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1098 } 1099 int result = TestKit.compareThem(expected, actual, false); 1100 assertEquals("Wrong records displayed in dialog", 3, result); 1101 1102 expected = new String [] {"Locally Modified", "Local Conflict", "Local Conflict"}; 1103 actual = new String [vo.tabFiles().getRowCount()]; 1104 for (int k = 0; k < actual.length; k++) { 1105 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1106 } 1107 result = TestKit.compareThem(expected, actual, false); 1108 assertEquals("Wrong records displayed in dialog", 3, result); 1109 1110 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1112 co = CommitOperator.invoke(new Node[] {node1}); 1113 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1114 co.cancel(); 1115 } 1116 1117 public void testBrokenUpdateMerModMer() throws Exception { 1118 int j = 0; 1119 long iter1 = 1; 1120 long iter2 = 2; 1121 File location1; 1122 File work = new File ("/tmp/work"); 1123 work.mkdirs(); 1124 closeProject(PROJECT1); 1125 1126 Node node1; 1127 org.openide.nodes.Node nodeIDE1; 1128 1129 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 1130 1131 iter1 = System.currentTimeMillis(); 1132 1133 editChosenFile(PROJECT1, "NewClass1.java", 3, iter1); 1134 editChosenFile(PROJECT1, "NewClass3.java", 3, iter1); 1135 1136 closeProject(PROJECT1); 1137 1138 checkOutProject(cvsRoot1, "test", PROJECT1); 1139 iter2 = System.currentTimeMillis(); 1140 editChosenFile(PROJECT1, "NewClass1.java", 5, iter2); 1141 editChosenFile(PROJECT1, "NewClass3.java", 5, iter2); 1142 1143 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1144 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 1145 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 1146 1147 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 1148 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1149 oto1.clear(); 1150 co.commit(); 1151 oto1.waitText("Committing"); 1152 oto1.waitText("finished"); 1153 closeProject(PROJECT1); 1154 1155 openProject(location1, PROJECT1); 1156 1157 editChosenFile(PROJECT1, "NewClass2.java", 7, iter1); 1158 updateProject(PROJECT1, cvsRoot1); 1159 1160 Thread.sleep(1000); 1161 oto1 = new OutputTabOperator(cvsRoot1); 1162 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1163 oto1.clear(); 1164 1165 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1166 node.performPopupAction("CVS|Show Changes"); 1167 oto1.waitText("Refreshing CVS Status finished"); 1168 1169 VersioningOperator vo = VersioningOperator.invoke(); 1170 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1171 String [] actual = new String [vo.tabFiles().getRowCount()]; 1172 for (int k = 0; k < actual.length; k++) { 1173 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1174 } 1175 int result = TestKit.compareThem(expected, actual, false); 1176 assertEquals("Wrong records displayed in dialog", 3, result); 1177 1178 expected = new String [] {"Locally Modified", "Locally Modified", "Locally Modified"}; 1179 actual = new String [vo.tabFiles().getRowCount()]; 1180 for (int k = 0; k < actual.length; k++) { 1181 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1182 } 1183 result = TestKit.compareThem(expected, actual, false); 1184 assertEquals("Wrong records displayed in dialog", 3, result); 1185 1186 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1188 co = CommitOperator.invoke(new Node[] {node1}); 1189 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1190 co.cancel(); 1191 } 1192 1193 public void testBrokenUpdateMerModConf() throws Exception { 1194 int j = 0; 1195 long iter1 = 1; 1196 long iter2 = 2; 1197 File location1; 1198 File work = new File ("/tmp/work"); 1199 work.mkdirs(); 1200 closeProject(PROJECT1); 1201 1202 Node node1; 1203 org.openide.nodes.Node nodeIDE1; 1204 1205 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 1206 1207 iter1 = System.currentTimeMillis(); 1208 1209 editChosenFile(PROJECT1, "NewClass1.java", 3, iter1); 1210 editChosenFile(PROJECT1, "NewClass3.java", 3, iter1); 1211 1212 closeProject(PROJECT1); 1213 1214 checkOutProject(cvsRoot1, "test", PROJECT1); 1215 iter2 = System.currentTimeMillis(); 1216 editChosenFile(PROJECT1, "NewClass1.java", 5, iter2); 1217 editChosenFile(PROJECT1, "NewClass3.java", 3, iter2); 1218 1219 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1220 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 1221 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 1222 1223 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 1224 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1225 oto1.clear(); 1226 co.commit(); 1227 oto1.waitText("Committing"); 1228 oto1.waitText("finished"); 1229 closeProject(PROJECT1); 1230 1231 openProject(location1, PROJECT1); 1232 1233 editChosenFile(PROJECT1, "NewClass2.java", 7, iter1); 1234 1235 updateProject(PROJECT1, cvsRoot1); 1236 1237 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 1238 JButtonOperator btnOk = new JButtonOperator(nbDialog); 1239 btnOk.push(); 1240 1241 Thread.sleep(1000); 1242 oto1 = new OutputTabOperator(cvsRoot1); 1243 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1244 oto1.clear(); 1245 1246 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1247 node.performPopupAction("CVS|Show Changes"); 1248 oto1.waitText("Refreshing CVS Status finished"); 1249 nbDialog = new NbDialogOperator("Command"); 1250 btnOk = new JButtonOperator(nbDialog); 1251 btnOk.push(); 1252 1253 Thread.sleep(1000); 1254 oto1 = new OutputTabOperator(cvsRoot1); 1255 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1256 oto1.clear(); 1257 1258 VersioningOperator vo = VersioningOperator.invoke(); 1259 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1260 String [] actual = new String [vo.tabFiles().getRowCount()]; 1261 for (int k = 0; k < actual.length; k++) { 1262 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1263 } 1264 int result = TestKit.compareThem(expected, actual, false); 1265 assertEquals("Wrong records displayed in dialog", 3, result); 1266 1267 expected = new String [] {"Locally Modified", "Locally Modified", "Local Conflict"}; 1268 actual = new String [vo.tabFiles().getRowCount()]; 1269 for (int k = 0; k < actual.length; k++) { 1270 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1271 } 1272 result = TestKit.compareThem(expected, actual, false); 1273 assertEquals("Wrong records displayed in dialog", 3, result); 1274 1275 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1277 co = CommitOperator.invoke(new Node[] {node1}); 1278 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1279 co.cancel(); 1280 } 1281 1282 public void testBrokenUpdateConfModConf() throws Exception { 1283 int j = 0; 1284 long iter1 = 1; 1285 long iter2 = 2; 1286 File location1; 1287 File work = new File ("/tmp/work"); 1288 work.mkdirs(); 1289 closeProject(PROJECT1); 1290 1291 Node node1; 1292 org.openide.nodes.Node nodeIDE1; 1293 1294 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 1295 1296 iter1 = System.currentTimeMillis(); 1297 editChosenFile(PROJECT1, "NewClass1.java", 3, iter1); 1298 editChosenFile(PROJECT1, "NewClass3.java", 3, iter1); 1299 1300 closeProject(PROJECT1); 1301 1302 checkOutProject(cvsRoot1, "test", PROJECT1); 1303 iter2 = System.currentTimeMillis(); 1304 editChosenFile(PROJECT1, "NewClass1.java", 3, iter2); 1305 editChosenFile(PROJECT1, "NewClass3.java", 3, iter2); 1306 1307 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1308 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 1309 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 1310 1311 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 1312 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1313 oto1.clear(); 1314 co.commit(); 1315 oto1.waitText("Committing"); 1316 oto1.waitText("finished"); 1317 closeProject(PROJECT1); 1318 1319 openProject(location1, PROJECT1); 1320 1321 editChosenFile(PROJECT1, "NewClass2.java", 7, iter1); 1322 1323 updateProject(PROJECT1, cvsRoot1); 1324 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 1325 JButtonOperator btnOk = new JButtonOperator(nbDialog); 1326 btnOk.push(); 1327 1328 Thread.sleep(1000); 1329 oto1 = new OutputTabOperator(cvsRoot1); 1330 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1331 oto1.clear(); 1332 1333 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1334 node.performPopupAction("CVS|Show Changes"); 1335 oto1.waitText("Refreshing CVS Status finished"); 1336 nbDialog = new NbDialogOperator("Command"); 1337 btnOk = new JButtonOperator(nbDialog); 1338 btnOk.push(); 1339 1340 Thread.sleep(1000); 1341 oto1 = new OutputTabOperator(cvsRoot1); 1342 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1343 oto1.clear(); 1344 1345 VersioningOperator vo = VersioningOperator.invoke(); 1346 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1347 String [] actual = new String [vo.tabFiles().getRowCount()]; 1348 for (int k = 0; k < actual.length; k++) { 1349 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1350 } 1351 int result = TestKit.compareThem(expected, actual, false); 1352 assertEquals("Wrong records displayed in dialog", 3, result); 1353 1354 expected = new String [] {"Local Conflict", "Locally Modified", "Local Conflict"}; 1355 actual = new String [vo.tabFiles().getRowCount()]; 1356 for (int k = 0; k < actual.length; k++) { 1357 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1358 } 1359 result = TestKit.compareThem(expected, actual, false); 1360 assertEquals("Wrong records displayed in dialog", 3, result); 1361 1362 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1364 co = CommitOperator.invoke(new Node[] {node1}); 1365 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1366 co.cancel(); 1367 } 1368 1369 public void testBrokenUpdateConfConfMod() throws Exception { 1370 int j = 0; 1371 long iter1 = 1; 1372 long iter2 = 2; 1373 File location1; 1374 File work = new File ("/tmp/work"); 1375 work.mkdirs(); 1376 closeProject(PROJECT1); 1377 1378 Node node1; 1379 Node node2; 1380 org.openide.nodes.Node nodeIDE1; 1381 org.openide.nodes.Node nodeIDE2; 1382 1383 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 1384 1385 iter1 = System.currentTimeMillis(); 1386 editChosenFile(PROJECT1, "NewClass1.java", 3, iter1); 1387 editChosenFile(PROJECT1, "NewClass2.java", 3, iter1); 1388 1389 closeProject(PROJECT1); 1390 1391 checkOutProject(cvsRoot1, "test", PROJECT1); 1392 1393 iter2 = System.currentTimeMillis(); 1394 editChosenFile(PROJECT1, "NewClass1.java", 3, iter2); 1395 editChosenFile(PROJECT1, "NewClass2.java", 3, iter2); 1396 1397 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1398 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 1399 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 1400 1401 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 1402 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1403 oto1.clear(); 1404 co.commit(); 1405 oto1.waitText("Committing"); 1406 oto1.waitText("finished"); 1407 closeProject(PROJECT1); 1408 1409 openProject(location1, PROJECT1); 1410 1411 editChosenFile(PROJECT1, "NewClass3.java", 7, iter1); 1412 1413 updateProject(PROJECT1, cvsRoot1); 1414 NbDialogOperator nbDialog = new NbDialogOperator("Warning"); 1415 JButtonOperator btnOk = new JButtonOperator(nbDialog); 1416 btnOk.push(); 1417 1418 Thread.sleep(1000); 1419 oto1 = new OutputTabOperator(cvsRoot1); 1420 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1421 oto1.clear(); 1422 1423 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1424 node.performPopupAction("CVS|Show Changes"); 1425 oto1.waitText("Refreshing CVS Status finished"); 1426 nbDialog = new NbDialogOperator("Command"); 1427 btnOk = new JButtonOperator(nbDialog); 1428 btnOk.push(); 1429 1430 Thread.sleep(1000); 1431 oto1 = new OutputTabOperator(cvsRoot1); 1432 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1433 oto1.clear(); 1434 1435 VersioningOperator vo = VersioningOperator.invoke(); 1436 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1437 String [] actual = new String [vo.tabFiles().getRowCount()]; 1438 for (int k = 0; k < actual.length; k++) { 1439 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1440 } 1441 int result = TestKit.compareThem(expected, actual, false); 1442 assertEquals("Wrong records displayed in dialog", 3, result); 1443 1444 expected = new String [] {"Local Conflict", "Local Conflict", "Locally Modified"}; 1445 actual = new String [vo.tabFiles().getRowCount()]; 1446 for (int k = 0; k < actual.length; k++) { 1447 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1448 } 1449 result = TestKit.compareThem(expected, actual, false); 1450 assertEquals("Wrong records displayed in dialog", 3, result); 1451 1452 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1454 co = CommitOperator.invoke(new Node[] {node1}); 1455 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1456 co.cancel(); 1457 } 1458 1459 public void testBrokenUpdateMerMerMod() throws Exception { 1460 int j = 0; 1461 long iter1 = 1; 1462 long iter2 = 2; 1463 File location1; 1464 File work = new File ("/tmp/work"); 1465 work.mkdirs(); 1466 closeProject(PROJECT1); 1467 1468 Node node1; 1469 org.openide.nodes.Node nodeIDE1; 1470 1471 location1 = checkOutProject(cvsRoot1, "test", PROJECT1); 1472 1473 iter1 = System.currentTimeMillis(); 1474 editChosenFile(PROJECT1, "NewClass1.java", 3, iter1); 1475 editChosenFile(PROJECT1, "NewClass2.java", 3, iter1); 1476 1477 closeProject(PROJECT1); 1478 1479 checkOutProject(cvsRoot1, "test", PROJECT1); 1480 iter2 = System.currentTimeMillis(); 1481 editChosenFile(PROJECT1, "NewClass1.java", 5, iter2); 1482 editChosenFile(PROJECT1, "NewClass2.java", 5, iter2); 1483 1484 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1485 CommitOperator co = CommitOperator.invoke(new Node[] {node1}); 1486 assertEquals("Wrong count of files to commit", 2, co.tabFiles().getRowCount()); 1487 1488 OutputTabOperator oto1 = new OutputTabOperator(cvsRoot1); 1489 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1490 oto1.clear(); 1491 co.commit(); 1492 oto1.waitText("Committing"); 1493 oto1.waitText("finished"); 1494 closeProject(PROJECT1); 1495 1496 openProject(location1, PROJECT1); 1497 1498 editChosenFile(PROJECT1, "NewClass3.java", 7, iter1); 1499 1500 updateProject(PROJECT1, cvsRoot1); 1501 1502 Thread.sleep(1000); 1503 oto1 = new OutputTabOperator(cvsRoot1); 1504 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1505 oto1.clear(); 1506 1507 Node node = new Node(new SourcePackagesNode(PROJECT1), ""); 1508 node.performPopupAction("CVS|Show Changes"); 1509 oto1.waitText("Refreshing CVS Status finished"); 1510 1511 Thread.sleep(1000); 1512 oto1 = new OutputTabOperator(cvsRoot1); 1513 oto1.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1514 oto1.clear(); 1515 1516 VersioningOperator vo = VersioningOperator.invoke(); 1517 String [] expected = new String [] {"NewClass1.java", "NewClass2.java", "NewClass3.java"}; 1518 String [] actual = new String [vo.tabFiles().getRowCount()]; 1519 for (int k = 0; k < actual.length; k++) { 1520 actual[k] = vo.tabFiles().getValueAt(k, 0).toString(); 1521 } 1522 int result = TestKit.compareThem(expected, actual, false); 1523 assertEquals("Wrong records displayed in dialog", 3, result); 1524 1525 expected = new String [] {"Locally Modified", "Locally Modified", "Locally Modified"}; 1526 actual = new String [vo.tabFiles().getRowCount()]; 1527 for (int k = 0; k < actual.length; k++) { 1528 actual[k] = vo.tabFiles().getValueAt(k, 1).toString(); 1529 } 1530 result = TestKit.compareThem(expected, actual, false); 1531 assertEquals("Wrong records displayed in dialog", 3, result); 1532 1533 node1 = new Node(new SourcePackagesNode(PROJECT1), ""); 1535 co = CommitOperator.invoke(new Node[] {node1}); 1536 assertEquals("Wrong count of files to commit - issue #71488", 3, co.tabFiles().getRowCount()); 1537 co.cancel(); 1538 } 1539 1540 public static void closeProject(String project_name) { 1541 try { 1542 Node rootNode = new ProjectsTabOperator().getProjectRootNode(project_name); 1543 rootNode.performPopupAction("Close Project"); 1544 } 1545 catch (Exception e) { 1546 1547 } 1548 } 1549 1550 public void updateProject(String project, String cvsRoot) throws Exception { 1551 OutputTabOperator oto = new OutputTabOperator(cvsRoot); 1552 oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1553 Node node = new Node(new ProjectsTabOperator().tree(), project); 1554 node.performPopupAction("CVS|Update"); 1555 oto.waitText("Updating"); 1556 oto.waitText("finished"); 1557 } 1558 1559 public File checkOutProject(String cvsRoot, String passwd, String project) throws Exception { 1560 File work = new File ("/tmp/work/w" + System.currentTimeMillis()); 1561 work.mkdir(); 1562 OutputOperator oo = OutputOperator.invoke(); 1563 comOperator = new Operator.DefaultStringComparator(true, true); 1564 oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator(); 1565 Operator.setDefaultStringComparator(comOperator); 1566 CheckoutWizardOperator cwo = CheckoutWizardOperator.invoke(); 1567 Operator.setDefaultStringComparator(oldOperator); 1568 CVSRootStepOperator crso = new CVSRootStepOperator(); 1569 crso.setCVSRoot(cvsRoot); 1571 crso.setPassword(passwd); 1573 crso.next(); 1574 ModuleToCheckoutStepOperator moduleCheck = new ModuleToCheckoutStepOperator(); 1575 moduleCheck.setModule(project); 1576 moduleCheck.setLocalFolder(work.getCanonicalPath()); 1577 moduleCheck.finish(); 1578 OutputTabOperator oto = new OutputTabOperator(cvsRoot); 1579 oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 1580 oto.waitText("Checking out finished"); 1581 NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed"); 1582 JButtonOperator open = new JButtonOperator(nbdialog, "Open Project"); 1583 open.push(); 1584 1585 ProjectSupport.waitScanFinished(); 1586 new QueueTool().waitEmpty(1000); 1587 ProjectSupport.waitScanFinished(); 1588 1589 return work; 1590 } 1591 1592 public void editChosenFile(String project, String name, int line, long iter) { 1593 Node node = new Node(new ProjectsTabOperator().tree(), project); 1594 node = new Node(new SourcePackagesNode(project), "aa|" + name); 1596 node.performPopupAction("Open"); 1597 EditorOperator eo = new EditorOperator(name); 1598 eo.insert("//" + name + " >iter< " + iter + "\n", line, 1); 1599 eo.save(); 1600 } 1601 1602 public void validateCheckout(String project, long iter, int[] indexes) throws Exception { 1603 Node node; 1604 EditorOperator eo; 1605 for (int i = nodes1.length - 1; i < nodes1.length; i++) { 1606 node = new Node(new SourcePackagesNode(project), nodes1[i]); 1607 node.performPopupAction("Open"); 1608 eo = new EditorOperator(getObjectName(nodes1[i])); 1609 for (int j = 0; j < indexes.length; j++) { 1610 String line = eo.getText(indexes[j]); 1611 System.out.println("line: " + line); 1612 assertEquals("Data was not committed!!!", "//" + nodes1[i] + " >iter< " + iter + "\n", line); 1613 1614 } 1615 if (i == nodes1.length - 1) 1616 eo.closeDiscardAll(); 1617 } 1618 1619 } 1620 1621 public void openProject(File location, String project) throws Exception { 1622 new ActionNoBlock("File|Open Project", null).perform(); 1623 NbDialogOperator nb = new NbDialogOperator("Open Project"); 1624 JFileChooserOperator fco = new JFileChooserOperator(nb); 1625 System.out.println(location.getCanonicalPath()); 1626 fco.setCurrentDirectory(new File (location, project)); 1627 fco.approve(); 1628 ProjectSupport.waitScanFinished(); 1629 } 1630} 1631 | Popular Tags |