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 AddCMPFieldTest extends AddMethodBase { 40 41 protected String methodName; 42 protected String returnType; 43 private String description; 44 private Boolean localGetter; 45 private Boolean localSetter; 46 private Boolean remoteGetter; 47 private Boolean remoteSetter; 48 49 50 public AddCMPFieldTest(String name) { 51 super(name); 52 } 53 54 55 public static void main(java.lang.String [] args) { 56 junit.textui.TestRunner.run(new AddCMPFieldTest("testAddCMPField1InEB")); 58 } 59 60 public void setUp() { 61 System.out.println("######## "+getName()+" #######"); 62 } 63 64 public void testAddCMPField1InEB() throws IOException { 65 beanName = "TestingEntity"; 66 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_EJBActionGroup") 67 +"|"+Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_AddCmpFieldAction"); 68 methodName = "cmpTestField1x"; 69 description = null; 70 returnType = "String"; 71 isDDModified = true; 72 saveFile = true; 73 addMethod(); 74 } 75 76 public void testAddCMPField2InEB() throws IOException { 77 beanName = "TestingEntity"; 78 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_EJBActionGroup") 79 +"|"+Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle", "LBL_AddCmpFieldAction"); 80 methodName = "cmpTestField2x"; 81 description = "Test Field"; 82 returnType = "int"; 83 localGetter = Boolean.TRUE; 84 localSetter = Boolean.FALSE; 85 remoteGetter = Boolean.TRUE; 86 remoteSetter = Boolean.TRUE; 87 isDDModified = true; 88 saveFile = true; 89 addMethod(); 90 } 91 92 protected void addMethod() throws IOException { 93 EditorOperator editor = new EditorWindowOperator().getEditor(beanName+"Bean.java"); 94 editor.select(11); 95 96 new ActionNoBlock(null,editorPopup).perform(editor); 98 AddCMPFieldDialog dialog = new AddCMPFieldDialog(); 99 dialog.setName(methodName); 100 if (description != null) { 101 dialog.setDescription(description); 102 } 103 if (returnType != null) { 104 dialog.setType(returnType); 105 } 106 107 108 if (localGetter != null) 109 dialog.checkLocalGetter(localGetter.booleanValue()); 110 if (localSetter != null) 111 dialog.checkLocalSetter(localSetter.booleanValue()); 112 if (remoteGetter != null) 113 dialog.checkRemoteGetter(remoteGetter.booleanValue()); 114 if (remoteSetter != null) 115 dialog.checkRemoteSetter(remoteSetter.booleanValue()); 116 dialog.ok(); 117 118 if (saveFile) 119 editor.save(); 120 121 waitForEditorText(editor, methodName); 122 123 compareFiles(); 124 } 125 126 } 127 | Popular Tags |