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.NbDialogOperator; 17 import org.netbeans.jellytools.OutputTabOperator; 18 import org.netbeans.jellytools.nodes.Node; 19 import org.netbeans.jellytools.nodes.SourcePackagesNode; 20 import org.netbeans.jemmy.JemmyProperties; 21 import org.netbeans.jemmy.QueueTool; 22 import org.netbeans.jemmy.operators.JButtonOperator; 23 import org.netbeans.jemmy.operators.Operator; 24 import org.netbeans.jemmy.operators.Operator.DefaultStringComparator; 25 import org.netbeans.junit.NbTestSuite; 26 import org.netbeans.test.subversion.operators.CheckoutWizardOperator; 27 import org.netbeans.test.subversion.operators.RepositoryStepOperator; 28 import org.netbeans.test.subversion.operators.VersioningOperator; 29 import org.netbeans.test.subversion.operators.WorkDirStepOperator; 30 import org.netbeans.test.subversion.utils.RepositoryMaintenance; 31 import org.netbeans.test.subversion.utils.TestKit; 32 import org.netbeans.junit.ide.ProjectSupport; 33 34 38 public class AnnotationsTest extends JellyTestCase { 39 40 public static final String TMP_PATH = "/tmp"; 41 public static final String REPO_PATH = "repo"; 42 public static final String WORK_PATH = "work"; 43 public static final String PROJECT_NAME = "JavaApp"; 44 public File projectPath; 45 public PrintStream stream; 46 String os_name; 47 Operator.DefaultStringComparator comOperator; 48 Operator.DefaultStringComparator oldOperator; 49 50 51 public AnnotationsTest(String name) { 52 super(name); 53 } 54 55 protected void setUp() throws Exception { 56 os_name = System.getProperty("os.name"); 57 System.out.println("### "+getName()+" ###"); 59 60 } 61 62 protected boolean isUnix() { 63 boolean unix = false; 64 if (os_name.indexOf("Windows") == -1) { 65 unix = true; 66 } 67 return unix; 68 } 69 70 public static void main(String [] args) { 71 TestRunner.run(suite()); 73 } 74 75 public static NbTestSuite suite() { 76 NbTestSuite suite = new NbTestSuite(); 77 suite.addTest(new AnnotationsTest("testShowAnnotations")); 78 return suite; 79 } 80 81 public void testShowAnnotations() throws Exception { 82 try { 85 TestKit.closeProject(PROJECT_NAME); 86 87 stream = new PrintStream (new File (getWorkDir(), getName() + ".log")); 88 comOperator = new Operator.DefaultStringComparator(true, true); 89 oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator(); 90 Operator.setDefaultStringComparator(comOperator); 91 CheckoutWizardOperator co = CheckoutWizardOperator.invoke(); 92 Operator.setDefaultStringComparator(oldOperator); 93 RepositoryStepOperator rso = new RepositoryStepOperator(); 94 95 File work = new File (TMP_PATH + File.separator + WORK_PATH + File.separator + "w" + System.currentTimeMillis()); 97 new File (TMP_PATH).mkdirs(); 98 work.mkdirs(); 99 RepositoryMaintenance.deleteFolder(new File (TMP_PATH + File.separator + REPO_PATH)); 100 RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH); 102 RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump"); 103 rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false)); 104 105 rso.next(); 106 WorkDirStepOperator wdso = new WorkDirStepOperator(); 107 wdso.setRepositoryFolder("trunk/" + PROJECT_NAME); 108 wdso.setLocalFolder(work.getCanonicalPath()); 109 wdso.checkCheckoutContentOnly(false); 110 OutputTabOperator oto = new OutputTabOperator("file:///tmp/repo"); 111 oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 112 oto.clear(); 113 wdso.finish(); 114 oto.waitText("Checking out... finished."); 116 NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed"); 117 JButtonOperator open = new JButtonOperator(nbdialog, "Open Project"); 118 open.push(); 119 120 ProjectSupport.waitScanFinished(); 121 new QueueTool().waitEmpty(1000); 122 ProjectSupport.waitScanFinished(); 123 124 oto = new OutputTabOperator("file:///tmp/repo"); 125 oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000); 126 oto.clear(); 127 Node node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|Main.java"); 128 node.performPopupAction("Subversion|Show Annotations"); 129 oto.waitText("Annotating... finished."); 130 131 stream.flush(); 132 stream.close(); 133 } catch (Exception e) { 134 throw new Exception ("Test failed: " + e); 135 } finally { 136 TestKit.closeProject(PROJECT_NAME); 137 } 138 } 139 } 140 | Popular Tags |