1 9 10 package org.netbeans.test.subversion.main.archeology; 11 12 import java.io.File ; 13 import java.io.PrintStream ; 14 import junit.textui.TestRunner; 15 import org.netbeans.jellytools.JellyTestCase; 16 import org.netbeans.jellytools.OutputTabOperator; 17 import org.netbeans.jemmy.JemmyProperties; 18 import org.netbeans.jemmy.operators.Operator; 19 import org.netbeans.jemmy.operators.Operator.DefaultStringComparator; 20 import org.netbeans.junit.NbTestSuite; 21 import org.netbeans.test.subversion.operators.CheckoutWizardOperator; 22 import org.netbeans.test.subversion.operators.RepositoryStepOperator; 23 import org.netbeans.test.subversion.operators.SearchRevisionsOperator; 24 import org.netbeans.test.subversion.operators.VersioningOperator; 25 import org.netbeans.test.subversion.operators.WorkDirStepOperator; 26 import org.netbeans.test.subversion.utils.RepositoryMaintenance; 27 import org.netbeans.test.subversion.utils.TestKit; 28 29 33 public class SearchRevisionsTest extends JellyTestCase { 34 35 public static final String TMP_PATH = "/tmp"; 36 public static final String REPO_PATH = "repo"; 37 public static final String WORK_PATH = "work"; 38 public static final String PROJECT_NAME = "JavaApp"; 39 public File projectPath; 40 public PrintStream stream; 41 String os_name; 42 Operator.DefaultStringComparator comOperator; 43 Operator.DefaultStringComparator oldOperator; 44 45 46 public SearchRevisionsTest(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 SearchRevisionsTest("testSearchRevisionsTest")); 73 return suite; 74 } 75 76 public void testSearchRevisionsTest() throws Exception { 77 try { 80 TestKit.closeProject(PROJECT_NAME); 81 82 stream = new PrintStream (new File (getWorkDir(), getName() + ".log")); 83 comOperator = new Operator.DefaultStringComparator(true, true); 84 oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator(); 85 Operator.setDefaultStringComparator(comOperator); 86 CheckoutWizardOperator co = CheckoutWizardOperator.invoke(); 87 Operator.setDefaultStringComparator(oldOperator); 88 RepositoryStepOperator rso = new RepositoryStepOperator(); 89 90 File work = new File (TMP_PATH + File.separator + WORK_PATH + File.separator + "w" + System.currentTimeMillis()); 92 new File (TMP_PATH).mkdirs(); 93 work.mkdirs(); 94 RepositoryMaintenance.deleteFolder(new File (TMP_PATH + File.separator + REPO_PATH)); 95 RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH); 97 RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump"); 98 rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false)); 99 100 rso.next(); 101 102 WorkDirStepOperator wdso = new WorkDirStepOperator(); 103 wdso.setRepositoryFolder("trunk/" + PROJECT_NAME); 104 wdso.setLocalFolder(work.getCanonicalPath()); 105 wdso.checkCheckoutContentOnly(false); 106 107 OutputTabOperator oto = new OutputTabOperator("file:///tmp/repo"); 108 oto.clear(); 109 SearchRevisionsOperator sro = wdso.search(); 110 sro.setFrom(""); 111 sro.list(); 112 oto.waitText("Searching revisions finished."); 113 sro.verify(); 114 sro.selectListItem(0); 115 sro.ok(); 116 assertEquals("Requested repository revision is not propagated!!!", "5", wdso.getRevisionNumber()); 117 wdso.cancel(); 118 119 stream.flush(); 120 stream.close(); 121 } catch (Exception e) { 122 throw new Exception ("Test failed: " + e); 123 } finally { 124 TestKit.closeProject(PROJECT_NAME); 125 } 126 } 127 } 128 | Popular Tags |