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.test.j2ee.*; 33 import org.netbeans.test.j2ee.lib.Utils; 34 35 39 public class AddOperationTest extends AddMethodTest { 40 41 42 43 public AddOperationTest(String name) { 44 super(name); 45 } 46 47 48 public static void main(java.lang.String [] args) { 49 junit.textui.TestRunner.run(new AddMethodTest("testAddOperation1")); 51 } 52 53 public void setUp() { 54 System.out.println("######## "+getName()+" #######"); 55 } 56 57 public void testAddOperation1() throws IOException { 58 beanName = "SampleWebService"; 59 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.websvc.core.webservices.action.Bundle", "LBL_OperationAction"); 61 dialogTitle = Bundle.getStringTrimmed("org.netbeans.modules.websvc.core.webservices.action.Bundle", "LBL_OperationAction"); 62 methodName = "operation1"; 63 returnType = "String"; 64 parameters = null; 65 exceptions = null; 66 isDDModified = false; 67 saveFile = true; 68 addMethod(); 69 } 70 71 public void testAddOperation2() throws IOException { 72 beanName = "SampleWebService"; 73 editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.websvc.core.webservices.action.Bundle", "LBL_OperationAction"); 75 dialogTitle = Bundle.getStringTrimmed("org.netbeans.modules.websvc.core.webservices.action.Bundle", "LBL_OperationAction"); 76 methodName = "operation2"; 77 returnType = "String"; 78 parameters = new String [][] {{"java.lang.String", "a"}, {"int", "b"}}; 79 exceptions = new String [] { "java.lang.Exception" }; 80 isDDModified = false; 81 saveFile = true; 82 addMethod(); 83 } 84 85 86 protected void addMethod() throws IOException { 87 Node openFile = new Node(new ProjectsTabOperator().getProjectRootNode(WSValidation.WEB_SAMPLE_PROJECT_NAME), 88 "Web Services|"+beanName); 89 new OpenAction().performAPI(openFile); 90 91 EditorOperator editor = new EditorWindowOperator().getEditor(beanName+"Impl.java"); 92 95 new ActionNoBlock(null,editorPopup).perform(openFile); 97 NbDialogOperator dialog = new NbDialogOperator(dialogTitle); 98 99 new JTextFieldOperator(dialog).setText(methodName); 100 if (returnType != null) { 101 new JTextFieldOperator(dialog,1).setText(returnType); 102 } 103 fillParameters(dialog); 104 fillExceptions(dialog); 105 106 dialog.ok(); 107 if (saveFile) { 108 editor.save(); 109 } 110 111 waitForEditorText(editor, methodName); 112 113 new org.netbeans.jemmy.EventTool().waitNoEvent(2000); 114 Utils utils = new Utils(this); 115 String beanNames[] = { beanName+"Impl.java", 116 beanName+"SEI.java", 117 beanName+"-config.xml", 118 }; 119 utils.assertFiles(new File (WSValidation.WEB_SAMPLE_PROJECT_PATH + File.separator + "src" + File.separator + "java" + File.separator + "sample"), beanNames, getName()+"_"); 120 String ddNames[] = { "web.xml", 121 "sun-web.xml", 122 "webservices.xml" 123 }; 124 utils.assertFiles(new File (WSValidation.WEB_SAMPLE_PROJECT_PATH + File.separator + "web" + File.separator + "WEB-INF"), ddNames, isDDModified?getName()+"_":""); 125 126 editor.closeDiscard(); 127 } 128 129 130 131 } 132 | Popular Tags |