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.Bundle; 25 import org.netbeans.jellytools.EditorOperator; 26 import org.netbeans.jellytools.EditorWindowOperator; 27 import org.netbeans.jellytools.JellyTestCase; 28 import org.netbeans.jellytools.NbDialogOperator; 29 import org.netbeans.jellytools.ProjectsTabOperator; 30 import org.netbeans.jellytools.actions.ActionNoBlock; 31 import org.netbeans.jellytools.actions.OpenAction; 32 import org.netbeans.jellytools.nodes.Node; 33 import org.netbeans.jemmy.JemmyException; 34 import org.netbeans.jemmy.Waitable; 35 import org.netbeans.jemmy.Waiter; 36 import org.netbeans.jemmy.operators.JButtonOperator; 37 import org.netbeans.jemmy.operators.JCheckBoxOperator; 38 import org.netbeans.jemmy.operators.JComboBoxOperator; 39 import org.netbeans.jemmy.operators.JRadioButtonOperator; 40 import org.netbeans.jemmy.operators.JTabbedPaneOperator; 41 import org.netbeans.jemmy.operators.JTextAreaOperator; 42 import org.netbeans.jemmy.operators.JTextFieldOperator; 43 import org.netbeans.jemmy.util.PNGEncoder; 44 import org.netbeans.test.j2ee.*; 45 46 50 public class AddSelectMethodTest extends AddMethodTest { 51 52 protected String ejbql = null; 53 private String toSearchFile; 54 55 56 public AddSelectMethodTest(String name) { 57 super(name); 58 } 59 60 public void setUp() { 61 System.out.println("######## "+getName()+" #######"); 62 } 63 64 65 public static void main(java.lang.String [] args) { 66 junit.textui.TestRunner.run(new AddSelectMethodTest("testAddSelectMethod1InEB")); 68 } 69 70 71 public void testAddSelectMethod1InEB() throws IOException { 72 beanName = "TestingEntity"; 73 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_EJBActionGroup") 74 +"|"+Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_AddSelectMethodAction"); 75 dialogTitle = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_AddSelectMethodAction"); 76 methodName = "ejbSelectByTest1"; 77 returnType = "int"; 78 parameters = null; 79 ejbql = null; 80 isDDModified = true; 82 saveFile = true; 83 addMethod(); 84 } 85 86 public void testAddSelectMethod2InEB() throws IOException { 87 beanName = "TestingEntity"; 88 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_EJBActionGroup") 89 +"|"+Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_AddSelectMethodAction"); 90 dialogTitle = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_AddSelectMethodAction"); 91 methodName = "ejbSelectByTest2"; 92 returnType = "int"; 93 parameters = new String [][] {{"java.lang.String", "a"}}; 94 ejbql = null; 95 isDDModified = true; 97 saveFile = true; 98 addMethod(); 99 } 100 101 protected void addMethod() throws IOException { 102 EditorOperator editor = new EditorWindowOperator().getEditor(beanName+"Bean.java"); 103 editor.select(11); 104 105 new ActionNoBlock(null,editorPopup).perform(editor); 107 NbDialogOperator dialog = new NbDialogOperator(dialogTitle); 108 new JTextFieldOperator(dialog).setText(methodName); 109 if (returnType != null) { 110 new JTextFieldOperator(dialog,1).setText(returnType); 111 } 112 113 fillParameters(dialog); 114 115 if (ejbql != null) { 116 new JTextAreaOperator(dialog).setText(ejbql); 117 } 118 dialog.ok(); 119 120 if (saveFile) 121 editor.save(); 122 if (toSearchFile != null) { 123 waitForEditorText(editor, methodName); 124 } 125 126 compareFiles(); 127 } 128 129 } 130 | Popular Tags |