1 9 10 package org.netbeans.test.subversion.main.branches; 11 12 import java.io.File ; 13 import junit.textui.TestRunner; 14 import org.netbeans.jellytools.JellyTestCase; 15 import org.netbeans.jellytools.ProjectsTabOperator; 16 import org.netbeans.jellytools.nodes.Node; 17 import org.netbeans.jemmy.JemmyProperties; 18 import org.netbeans.junit.NbTestSuite; 19 import org.netbeans.test.subversion.operators.CommitStepOperator; 20 import org.netbeans.test.subversion.operators.FolderToImportStepOperator; 21 import org.netbeans.test.subversion.operators.ImportWizardOperator; 22 import org.netbeans.test.subversion.operators.MergeOneRepoOperator; 23 import org.netbeans.test.subversion.operators.MergeOperator; 24 import org.netbeans.test.subversion.operators.MergeOriginOperator; 25 import org.netbeans.test.subversion.operators.MergeTwoRepoOperator; 26 import org.netbeans.test.subversion.operators.RepositoryBrowserImpOperator; 27 import org.netbeans.test.subversion.operators.RepositoryBrowserOperator; 28 import org.netbeans.test.subversion.operators.RepositoryStepOperator; 29 import org.netbeans.test.subversion.utils.RepositoryMaintenance; 30 import org.netbeans.test.subversion.utils.TestKit; 31 32 36 public class MergeUiTest extends JellyTestCase { 37 38 public static final String TMP_PATH = "/tmp"; 39 public static final String REPO_PATH = "repo"; 40 public static final String WORK_PATH = "work"; 41 public static final String PROJECT_NAME = "SVNApplication"; 42 public File projectPath; 43 44 String os_name; 45 46 public MergeUiTest(String name) { 47 super(name); 48 } 49 50 protected void setUp() throws Exception { 51 os_name = System.getProperty("os.name"); 52 System.out.println("### "+getName()+" ###"); 54 55 } 56 57 protected boolean isUnix() { 58 boolean unix = false; 59 if (os_name.indexOf("Windows") == -1) { 60 unix = true; 61 } 62 return unix; 63 } 64 65 public static void main(String [] args) { 66 TestRunner.run(suite()); 68 } 69 70 public static NbTestSuite suite() { 71 NbTestSuite suite = new NbTestSuite(); 72 suite.addTest(new MergeUiTest("testInvokeCloseMerge")); 73 return suite; 74 } 75 76 public void testInvokeCloseMerge() throws Exception { 77 try { 80 TestKit.closeProject(PROJECT_NAME); 81 82 new File (TMP_PATH).mkdirs(); 83 RepositoryMaintenance.deleteFolder(new File (TMP_PATH + File.separator + REPO_PATH)); 84 RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH); 85 RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump"); 86 projectPath = TestKit.prepareProject("General", "Java Application", PROJECT_NAME); 87 88 ImportWizardOperator iwo = ImportWizardOperator.invoke(ProjectsTabOperator.invoke().getProjectRootNode(PROJECT_NAME)); 89 RepositoryStepOperator rso = new RepositoryStepOperator(); 90 rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false)); 92 rso.next(); 93 Thread.sleep(1000); 94 95 FolderToImportStepOperator ftiso = new FolderToImportStepOperator(); 96 ftiso.setRepositoryFolder("trunk/" + PROJECT_NAME); 97 ftiso.setImportMessage("initial import"); 98 ftiso.next(); 99 Thread.sleep(1000); 100 CommitStepOperator cso = new CommitStepOperator(); 101 cso.finish(); 102 103 Node projNode = new Node(new ProjectsTabOperator().tree(), PROJECT_NAME); 104 MergeOperator mo = MergeOperator.invoke(projNode); 106 107 mo.cboMergeFrom().selectItem(0); 109 MergeOneRepoOperator moro = new MergeOneRepoOperator(); 110 moro.verify(); 111 RepositoryBrowserOperator rbo = moro.browseRepository(); 112 rbo.selectFolder("trunk"); 114 rbo.selectFolder("branches"); 115 rbo.selectFolder("tags"); 116 rbo.ok(); 117 assertEquals("Wrong folder selection!!!", "tags", moro.getRepositoryFolder()); 118 119 moro.cboMergeFrom().selectItem(1); 121 MergeTwoRepoOperator mtro = new MergeTwoRepoOperator(); 122 mtro.verify(); 123 rbo = mtro.browseRepositoryFolder1(); 124 rbo.selectFolder("trunk"); 125 rbo.selectFolder("branches"); 126 rbo.selectFolder("tags"); 127 rbo.ok(); 128 assertEquals("Wrong folder selection!!!", "tags", mtro.getRepositoryFolder1()); 129 rbo = mtro.browseRepositoryFolder2(); 130 rbo.selectFolder("tags"); 131 rbo.selectFolder("branches"); 132 rbo.selectFolder("trunk"); 133 rbo.ok(); 134 assertEquals("Wrong folder selection!!!", "trunk", mtro.getRepositoryFolder2()); 135 136 moro.cboMergeFrom().selectItem(2); 138 MergeOriginOperator moo = new MergeOriginOperator(); 139 moo.verify(); 140 rbo = moo.browseRepositoryFolder(); 141 rbo.selectFolder("trunk"); 142 rbo.selectFolder("branches"); 143 rbo.selectFolder("tags"); 144 rbo.ok(); 145 assertEquals("Wrong folder selection!!!", "tags", moo.getRepositoryFolder()); 146 moo.cancel(); 147 } catch (Exception e) { 148 throw new Exception ("Test failed: " + e); 149 } finally { 150 TestKit.closeProject(PROJECT_NAME); 151 } 152 } 153 } 154 | Popular Tags |