1 19 20 package org.netbeans.test.java.gui.copypaste; 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.JellyTestCase; 28 import org.netbeans.jellytools.ProjectsTabOperator; 29 import org.netbeans.jellytools.actions.CopyAction; 30 import org.netbeans.jellytools.actions.PasteAction; 31 import org.netbeans.jellytools.nodes.Node; 32 import org.netbeans.jemmy.JemmyProperties; 33 import org.netbeans.jemmy.TestOut; 34 import org.netbeans.junit.NbTestSuite; 35 import org.netbeans.test.java.Utilities; 36 import org.netbeans.test.java.gui.GuiUtilities; 37 38 39 43 public class PackageNodeTest extends JellyTestCase { 44 45 private static final String TEST_PROJECT_NAME = "default"; 47 48 private static final String TEST_PACKAGE_PATH = 50 "org.netbeans.test.java.gui.copypaste"; 51 52 private static final String TEST_PACKAGE_NAME = TEST_PACKAGE_PATH+".test"; 54 55 private static final String TEST_PACKAGE_NAME_2 = 57 TEST_PACKAGE_PATH+".test2"; 58 59 private static final String TEST_CLASS_NAME = "TestClass"; 61 62 65 protected static PrintStream err; 66 67 70 protected static PrintStream log; 71 72 private String workDir = "/tmp"; 74 75 private static String projectDir; 77 78 79 83 public PackageNodeTest(String name) { 84 super(name); 85 } 86 87 91 public static NbTestSuite suite() { 92 NbTestSuite suite = new NbTestSuite(); 93 suite.addTest(new PackageNodeTest("testCopyPaste")); 95 return suite; 96 } 97 98 102 public static void main(java.lang.String [] args) { 103 TestRunner.run(suite()); 104 } 105 106 109 public void setUp() { 110 System.out.println("######## "+getName()+" #######"); 111 err = getLog(); 112 log = getRef(); 113 JemmyProperties.getProperties().setOutput(new TestOut(null, 114 new PrintWriter (err, true), new PrintWriter (err, false), null)); 115 try { 116 File wd = getWorkDir(); 117 workDir = wd.toString(); 118 } catch (IOException e) { } 119 } 120 121 124 public void testCopyPaste() { 125 Node pn = new ProjectsTabOperator().getProjectRootNode( 126 TEST_PROJECT_NAME); 127 pn.select(); 128 129 Node n = new Node(pn, org.netbeans.jellytools.Bundle.getString( 131 "org.netbeans.modules.java.j2seproject.Bundle", 132 "NAME_src.dir")+"|"+TEST_PACKAGE_NAME); 133 n.select(); 134 Utilities.takeANap(3000); 135 new CopyAction().perform(); 136 137 Node n2 = new Node(pn, org.netbeans.jellytools.Bundle.getString( 139 "org.netbeans.modules.java.j2seproject.Bundle", 140 "NAME_test.src.dir")); 141 142 n2.select(); 143 new PasteAction().perform(); 144 145 Utilities.takeANap(1000); 146 147 GuiUtilities.waitForChildNode(TEST_PROJECT_NAME, 149 org.netbeans.jellytools.Bundle.getString( 150 "org.netbeans.modules.java.j2seproject.Bundle", 151 "NAME_test.src.dir"), TEST_PACKAGE_NAME); 152 Node n3 = new Node(pn, org.netbeans.jellytools.Bundle.getString( 153 "org.netbeans.modules.java.j2seproject.Bundle", 154 "NAME_test.src.dir")+"|"+TEST_PACKAGE_NAME); 155 n3.select(); 156 } 157 158 } 159 | Popular Tags |