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 45 public class ClassCustomizer 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.customizers"; 53 54 private static final String TEST_PACKAGE_NAME = TEST_PACKAGE_PATH+".test"; 56 57 private static final String TEST_CLASS_NAME = "ClassCustomizer"; 59 60 63 protected static PrintStream err; 64 65 68 protected static PrintStream log; 69 70 private String workDir = "/tmp"; 72 73 private static String projectDir; 75 76 77 81 public ClassCustomizer(String name) { 82 super(name); 83 } 84 85 89 public static NbTestSuite suite() { 90 NbTestSuite suite = new NbTestSuite(); 91 suite.addTest(new ClassCustomizer("testCustomizeClass")); 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 testCustomizeClass() { 123 Node pn = new ProjectsTabOperator().getProjectRootNode( 124 TEST_PROJECT_NAME); 125 pn.select(); 126 127 GuiUtilities.waitForChildNode(TEST_PROJECT_NAME, 128 org.netbeans.jellytools.Bundle.getString( 129 "org.netbeans.modules.java.j2seproject.Bundle", 130 "NAME_src.dir") 131 +"|"+TEST_PACKAGE_NAME+"|"+TEST_CLASS_NAME, TEST_CLASS_NAME); 132 133 Node n = new Node(pn, org.netbeans.jellytools.Bundle.getString( 135 "org.netbeans.modules.java.j2seproject.Bundle", 136 "NAME_src.dir")+"|"+TEST_PACKAGE_NAME+"|" 137 +TEST_CLASS_NAME+"|"+TEST_CLASS_NAME); 138 139 n.select(); 140 new OpenAction().perform(); 141 142 n.select(); 143 n.performPopupActionNoBlock(org.netbeans.jellytools.Bundle.getString( 144 "org.netbeans.core.Bundle", "CTL_PropertiesWindow")); 145 146 ClassCustomizerOperator cco = new ClassCustomizerOperator( 147 TEST_CLASS_NAME+" - "+org.netbeans.jellytools.Bundle.getString( 148 "org.netbeans.core.Bundle", "CTL_PropertiesWindow")); 149 150 PropertySheetOperator pso = new PropertySheetOperator(TEST_CLASS_NAME 151 +" - "+org.netbeans.jellytools.Bundle.getString( 152 "org.netbeans.core.Bundle", "CTL_PropertiesWindow")); 153 154 new Property(pso, "Implements").setValue("Thread"); 156 new Property(pso, "Extends").setValue("java.lang.Object"); 157 158 cco.btClose().clickMouse(); 159 160 ref(new EditorOperator(TEST_CLASS_NAME).getText()); 162 compareReferenceFiles(); 163 164 EditorOperator.closeDiscardAll(); 165 } 166 } 167 | Popular Tags |