1 19 20 package org.netbeans.test.java.gui.synchronization; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.PrintStream ; 25 import java.io.PrintWriter ; 26 import org.netbeans.jellytools.EditorOperator; 27 import org.netbeans.jellytools.JellyTestCase; 28 import org.netbeans.jellytools.ProjectsTabOperator; 29 import org.netbeans.jellytools.actions.OpenAction; 30 import org.netbeans.jellytools.modules.java.SynchronizeOperator; 31 import org.netbeans.jellytools.nodes.Node; 32 import org.netbeans.jemmy.JemmyProperties; 33 import org.netbeans.jemmy.TestOut; 34 import org.netbeans.jemmy.operators.JDialogOperator; 35 import org.netbeans.jemmy.operators.JEditorPaneOperator; 36 import org.netbeans.junit.NbTestSuite; 37 import org.netbeans.test.java.Utilities; 38 import org.netbeans.test.java.gui.GuiUtilities; 39 40 41 45 public class SynchronizeDialog extends JellyTestCase { 46 47 private static final String TEST_PROJECT_NAME = "default"; 49 50 private static final String TEST_PACKAGE_PATH = 52 "org.netbeans.test.java.gui.synchronization"; 53 54 private static final String TEST_PACKAGE_NAME = TEST_PACKAGE_PATH+".test"; 56 57 private static final String TEST_CLASS_NAME = "TestClass"; 59 60 63 protected static PrintStream err; 64 67 protected static PrintStream log; 68 69 private String workDir = "/tmp"; 71 72 private static String projectDir; 74 75 78 public SynchronizeDialog(String name) { 79 super(name); 80 } 81 82 86 public static NbTestSuite suite() { 87 NbTestSuite suite = new NbTestSuite(); 88 suite.addTest(new SynchronizeDialog("testSynchronizeDialog")); 89 return suite; 90 } 91 92 96 public static void main(java.lang.String [] args) { 97 junit.textui.TestRunner.run(suite()); 98 } 99 100 public void setUp() { 101 System.out.println("######## "+getName()+" #######"); 102 err = getLog(); 103 log = getRef(); 104 JemmyProperties.getProperties().setOutput(new TestOut(null, 105 new PrintWriter (err, true), new PrintWriter (err, false), null)); 106 try { 107 File wd = getWorkDir(); 108 workDir = wd.toString(); 109 } catch (IOException e) { } 110 } 111 112 115 public void testCreateProjectAndPackageAndClass() { 116 projectDir = GuiUtilities.createProjectAndPackageAndClass( 117 TEST_PROJECT_NAME, TEST_PACKAGE_NAME, TEST_CLASS_NAME, workDir); 118 } 119 120 123 public void testSynchronizeDialog() { 124 Node pn = new ProjectsTabOperator().getProjectRootNode( 125 TEST_PROJECT_NAME); 126 pn.select(); 127 128 Node n = new Node(pn, org.netbeans.jellytools.Bundle.getString( 129 "org.netbeans.modules.java.j2seproject.Bundle", 130 "NAME_src.dir")+"|"+TEST_PACKAGE_NAME+"|" 131 +TEST_CLASS_NAME); 132 133 n.select(); 134 new OpenAction().perform(); 135 136 EditorOperator editor = new EditorOperator(TEST_CLASS_NAME); 138 editor.insert("implements Runnable ", 11, 24); 139 editor.save(); 140 141 Utilities.takeANap(1000); 142 143 pn.select(); 145 Node n2 = new Node(pn, org.netbeans.jellytools.Bundle.getString( 146 "org.netbeans.modules.java.j2seproject.Bundle", 147 "NAME_src.dir")+"|"+TEST_PACKAGE_NAME+"|" 148 +TEST_CLASS_NAME); 149 n2.select(); 150 n2.performPopupActionNoBlock( 151 org.netbeans.jellytools.Bundle.getString( 152 "org.netbeans.core.Bundle", "Actions/Tools")+"|"+ 153 org.netbeans.jellytools.Bundle.getString( 154 "org.netbeans.modules.java.Bundle", "LAB_SynchronizeAction")); 155 156 Utilities.takeANap(1000); 157 158 new JDialogOperator(org.netbeans.jellytools.Bundle.getString( 160 "org.netbeans.modules.java.Bundle", "LAB_ConfirmDialog")); 161 162 SynchronizeOperator sdo = new SynchronizeOperator(); 163 164 sdo.lstChangesList().selectItem(0); 165 sdo.btProcess().clickMouse(); 166 167 ref(editor.getText()); 168 169 compareReferenceFiles(); 170 171 EditorOperator.closeDiscardAll(); 172 } 173 174 } 175 | Popular Tags |