1 19 20 package org.netbeans.test.java.gui.customizers; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.PrintStream ; 25 import java.io.PrintWriter ; 26 import junit.textui.TestRunner; 27 import org.netbeans.jellytools.EditorOperator; 28 import org.netbeans.jellytools.JellyTestCase; 29 import org.netbeans.jellytools.ProjectsTabOperator; 30 import org.netbeans.jellytools.actions.OpenAction; 31 import org.netbeans.jellytools.modules.java.ClassCustomizerOperator; 32 import org.netbeans.jellytools.nodes.Node; 33 import org.netbeans.jellytools.properties.Property; 34 import org.netbeans.jellytools.properties.PropertySheetOperator; 35 import org.netbeans.jemmy.JemmyProperties; 36 import org.netbeans.jemmy.TestOut; 37 import org.netbeans.jemmy.operators.JEditorPaneOperator; 38 import org.netbeans.junit.NbTestSuite; 39 import org.netbeans.test.java.gui.GuiUtilities; 40 41 42 46 public class ConstructorCustomizer extends JellyTestCase { 47 48 private static final String TEST_PROJECT_NAME = "default"; 50 51 private static final String TEST_PACKAGE_PATH = 53 "org.netbeans.test.java.gui.customizers"; 54 55 private static final String TEST_PACKAGE_NAME = TEST_PACKAGE_PATH+".test"; 57 58 private static final String TEST_CLASS_NAME = "ConstructorCustomizer"; 60 61 64 protected static PrintStream err; 65 66 69 protected static PrintStream log; 70 71 private String workDir = "/tmp"; 73 74 private static String projectDir; 76 77 78 82 public ConstructorCustomizer(String name) { 83 super(name); 84 } 85 86 90 public static NbTestSuite suite() { 91 NbTestSuite suite = new NbTestSuite(); 92 suite.addTest(new ConstructorCustomizer("testCustomizeConstructor")); 93 return suite; 94 } 95 96 100 public static void main(java.lang.String [] args) { 101 TestRunner.run(suite()); 102 } 103 104 107 public void setUp() { 108 System.out.println("######## "+getName()+" #######"); 109 err = getLog(); 110 log = getRef(); 111 JemmyProperties.getProperties().setOutput(new TestOut(null, 112 new PrintWriter (err, true), new PrintWriter (err, false), null)); 113 try { 114 File wd = getWorkDir(); 115 workDir = wd.toString(); 116 } catch (IOException e) { } 117 } 118 119 122 public void testCreateProjectAndPackageAndClass() { 123 projectDir = GuiUtilities.createProjectAndPackageAndClass( 124 TEST_PROJECT_NAME, TEST_PACKAGE_NAME, TEST_CLASS_NAME, workDir); 125 } 126 127 130 public void testCustomizeConstructor() { 131 Node pn = new ProjectsTabOperator().getProjectRootNode( 132 TEST_PROJECT_NAME); 133 pn.select(); 134 135 Node n = new Node(pn, org.netbeans.jellytools.Bundle.getString( 136 "org.netbeans.modules.java.j2seproject.Bundle", 137 "NAME_src.dir")+"|"+TEST_PACKAGE_NAME+"|" 138 +TEST_CLASS_NAME); 139 140 n.select(); 141 new OpenAction().perform(); 142 143 GuiUtilities.waitForChildNode(TEST_PROJECT_NAME, 145 org.netbeans.jellytools.Bundle.getString( 146 "org.netbeans.modules.java.j2seproject.Bundle", 147 "NAME_src.dir")+"|" 148 +TEST_PACKAGE_NAME+"|"+TEST_CLASS_NAME+"|"+TEST_CLASS_NAME+"|" 149 +org.netbeans.jellytools.Bundle.getString( 150 "org.netbeans.modules.java.ui.nodes.elements.Bundle", 151 "Constructors"), TEST_CLASS_NAME+"()"); 152 153 Node n2 = new Node(pn, org.netbeans.jellytools.Bundle.getString( 154 "org.netbeans.modules.java.j2seproject.Bundle", 155 "NAME_src.dir")+"|"+TEST_PACKAGE_NAME+"|" 156 +TEST_CLASS_NAME+"|"+TEST_CLASS_NAME+"|" 157 +org.netbeans.jellytools.Bundle.getString( 158 "org.netbeans.modules.java.ui.nodes.elements.Bundle", 159 "Constructors")+"|"+TEST_CLASS_NAME+"()"); 160 161 n2.select(); 162 n2.performPopupActionNoBlock(org.netbeans.jellytools.Bundle.getString( 163 "org.netbeans.core.Bundle", "CTL_PropertiesWindow")); 164 165 ClassCustomizerOperator cco = new ClassCustomizerOperator( 166 TEST_CLASS_NAME+"() - " 167 +org.netbeans.jellytools.Bundle.getString( 168 "org.netbeans.core.Bundle", "CTL_PropertiesWindow")); 169 170 PropertySheetOperator pso = new PropertySheetOperator(TEST_CLASS_NAME 171 +"() - "+org.netbeans.jellytools.Bundle.getString( 172 "org.netbeans.core.Bundle", "CTL_PropertiesWindow")); 173 174 new Property(pso, "Modifiers").setValue("private"); 176 new Property(pso, "Exceptions").setValue("Exception"); 177 178 cco.btClose().clickMouse(); 179 180 ref(new EditorOperator(TEST_CLASS_NAME).getText()); 182 compareReferenceFiles(); 183 184 EditorOperator.closeDiscardAll(); 185 } 186 187 } 188 | Popular Tags |