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.jemmy.TimeoutExpiredException; 19 import org.netbeans.junit.NbTestSuite; 20 import org.netbeans.test.subversion.operators.CommitStepOperator; 21 import org.netbeans.test.subversion.operators.CopyToOperator; 22 import org.netbeans.test.subversion.operators.CreateNewFolderOperator; 23 import org.netbeans.test.subversion.operators.FolderToImportStepOperator; 24 import org.netbeans.test.subversion.operators.ImportWizardOperator; 25 import org.netbeans.test.subversion.operators.RepositoryBrowserImpOperator; 26 import org.netbeans.test.subversion.operators.RepositoryStepOperator; 27 import org.netbeans.test.subversion.utils.RepositoryMaintenance; 28 import org.netbeans.test.subversion.utils.TestKit; 29 30 34 public class CopyUiTest extends JellyTestCase{ 35 36 public static final String TMP_PATH = "/tmp"; 37 public static final String REPO_PATH = "repo"; 38 public static final String WORK_PATH = "work"; 39 public static final String PROJECT_NAME = "SVNApplication"; 40 public File projectPath; 41 42 String os_name; 43 44 45 public CopyUiTest(String name) { 46 super(name); 47 } 48 49 protected void setUp() throws Exception { 50 os_name = System.getProperty("os.name"); 51 System.out.println("### "+getName()+" ###"); 53 54 } 55 56 protected boolean isUnix() { 57 boolean unix = false; 58 if (os_name.indexOf("Windows") == -1) { 59 unix = true; 60 } 61 return unix; 62 } 63 64 public static void main(String [] args) { 65 TestRunner.run(suite()); 67 } 68 69 public static NbTestSuite suite() { 70 NbTestSuite suite = new NbTestSuite(); 71 suite.addTest(new CopyUiTest("testInvokeCloseCopy")); 72 return suite; 73 } 74 75 public void testInvokeCloseCopy() throws Exception { 76 try { 79 TestKit.closeProject(PROJECT_NAME); 80 81 new File (TMP_PATH).mkdirs(); 82 RepositoryMaintenance.deleteFolder(new File (TMP_PATH + File.separator + REPO_PATH)); 83 RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH); 84 RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump"); 85 projectPath = TestKit.prepareProject("General", "Java Application", PROJECT_NAME); 86 87 ImportWizardOperator iwo = ImportWizardOperator.invoke(ProjectsTabOperator.invoke().getProjectRootNode(PROJECT_NAME)); 88 RepositoryStepOperator rso = new RepositoryStepOperator(); 89 rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false)); 91 rso.next(); 92 Thread.sleep(1000); 93 94 FolderToImportStepOperator ftiso = new FolderToImportStepOperator(); 95 ftiso.setRepositoryFolder("trunk/" + PROJECT_NAME); 96 ftiso.setImportMessage("initial import"); 97 ftiso.next(); 98 Thread.sleep(1000); 99 CommitStepOperator cso = new CommitStepOperator(); 100 cso.finish(); 101 102 Node projNode = new Node(new ProjectsTabOperator().tree(), PROJECT_NAME); 103 CopyToOperator cto = CopyToOperator.invoke(projNode); 104 cto.verify(); 105 RepositoryBrowserImpOperator rbio = cto.browseRepository(); 106 rbio.verify(); 107 rbio.selectFolder("tags"); 108 rbio.selectFolder("trunk"); 109 rbio.selectFolder("branches"); 110 CreateNewFolderOperator cnfo = rbio.createNewFolder(); 111 cnfo.setFolderName("release01-" + PROJECT_NAME); 112 cnfo.cancel(); 113 TimeoutExpiredException tee = null; 115 try { 116 rbio.selectFolder("branches|release01-" + PROJECT_NAME); 117 } catch (Exception e) { 118 tee = (TimeoutExpiredException) e; 119 } 120 assertNotNull(tee); 121 122 rbio.selectFolder("branches"); 123 cnfo = rbio.createNewFolder(); 124 cnfo.setFolderName("release01-" + PROJECT_NAME); 125 cnfo.ok(); 126 rbio.selectFolder("branches|release01-" + PROJECT_NAME); 127 rbio.ok(); 128 assertEquals("New folder for copy purpose wasn't created", "branches/release01-" + PROJECT_NAME, cto.getRepositoryFolder()); 129 130 cto.cancel(); 131 } catch (Exception e) { 132 throw new Exception ("Test failed: " + e); 133 } finally { 134 TestKit.closeProject(PROJECT_NAME); 135 } 136 } 137 } 138 | Popular Tags |