1 19 20 package org.netbeans.test.j2ee.addmethod; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import org.netbeans.jellytools.*; 25 import org.netbeans.jellytools.actions.ActionNoBlock; 26 import org.netbeans.jellytools.actions.OpenAction; 27 import org.netbeans.jellytools.nodes.Node; 28 import org.netbeans.jemmy.JemmyException; 29 import org.netbeans.jemmy.Waitable; 30 import org.netbeans.jemmy.Waiter; 31 import org.netbeans.jemmy.operators.*; 32 import org.netbeans.jemmy.util.PNGEncoder; 33 import org.netbeans.test.j2ee.*; 34 35 39 public class UseDatabaseTest extends AddMethodBase { 40 41 private String name; 42 43 44 public UseDatabaseTest(String name) { 45 super(name); 46 } 47 48 49 public static void main(java.lang.String [] args) { 50 junit.textui.TestRunner.run(new SendMessageTest("testUseDatabase1InSB")); 52 } 53 54 public void setUp() { 55 System.out.println("######## "+getName()+" #######"); 56 } 57 58 public void testUseDatabase1InSB() throws IOException { 59 beanName = "TestingSession"; 60 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_EnterpriseActionGroup") 61 +"|"+Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_UseDbAction"); 62 name = "myTestingDatabase"; 63 toSearchInEditor = "getMyTestingDatabase"; 64 isDDModified = true; 65 saveFile = true; 66 addMethod(); 67 Node resources = new Node(new ProjectsTabOperator().getProjectRootNode(EJBValidation.EJB_PROJECT_NAME), 68 Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbjar.project.ui.Bundle", "LBL_Node_ResourceNode")); 69 new Node(resources,"derby_netPool.sun-resource"); 70 new Node(resources,"jdbc_"+name+".sun-resource"); 71 } 72 73 protected void addMethod() throws IOException { 74 EditorOperator editor = new EditorWindowOperator().getEditor(beanName+"Bean.java"); 75 editor.select(11); 76 77 new ActionNoBlock(null,editorPopup).perform(editor); 79 NbDialogOperator dialog = new NbDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_ChooseDatabase")); 80 if (name != null) { 81 new JTextFieldOperator(dialog).setText(name); 82 } 83 new JComboBoxOperator(dialog).selectItem("/sample"); 84 new JCheckBoxOperator(dialog).setSelected(true); 85 dialog.ok(); 86 87 if (saveFile) 88 editor.save(); 89 90 waitForEditorText(editor, toSearchInEditor); 91 92 compareFiles(); 93 } 94 95 } 96 | Popular Tags |