1 19 package org.netbeans.test.j2ee.refactoring.changesignature; 20 21 import java.io.File ; 22 import java.lang.reflect.Modifier ; 23 import junit.framework.TestSuite; 24 import junit.textui.TestRunner; 25 import org.netbeans.junit.NbTestSuite; 26 import org.netbeans.test.j2ee.lib.J2eeProjectSupport; 27 import org.netbeans.test.j2ee.refactoring.WebAppConstants; 28 29 33 public class WebAppTest extends ChangeSignatureTestCase implements WebAppConstants { 34 35 private static boolean prjOpened = false; 36 37 38 public WebAppTest(String name) { 39 super(name); 40 } 41 42 public static TestSuite suite() { 43 NbTestSuite suite = new NbTestSuite(); 44 suite.addTest(new WebAppTest("testWsOperation")); 45 return suite; 47 } 48 49 public void testWsOperation() { 50 changeSignature(CLASS_NAME_1 , "callOtherWs", new String [0], 51 new String [][] {{"s", "java.lang.String", "\"\""}}, 52 Modifier.PUBLIC, false); 53 } 54 55 public void testServlet() { 56 String [] params = {"javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse"}; 57 String [][] newParams = { 58 {"request", "javax.servlet.http.HttpServletRequest", "request"}, 59 {"response", "javax.servlet.http.HttpServletResponse", "response"}, 60 {"par", "Object", "null"}, 61 }; 62 changeSignature(CLASS_NAME_2, "processRequest", params, newParams, 63 Modifier.PROTECTED, false); 64 } 65 66 71 public static void main(String [] args) { 72 TestRunner.run(suite()); 73 } 74 75 public void prepareProject() { 76 if (prjOpened) { 77 return; 78 } 79 J2eeProjectSupport.openProject(new File (getDataDir(), "projects/LoggingWS")); 80 classPathWorkDir = new File (getDataDir(), "projects.LoggingWS.src.java".replace('.', File.separatorChar)); 81 prjOpened = true; 82 } 83 84 } 85 | Popular Tags |