KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > j2ee > refactoring > changesignature > WebAppTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.test.j2ee.refactoring.changesignature;
20
21 import java.io.File JavaDoc;
22 import java.lang.reflect.Modifier JavaDoc;
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 /**
30  * Find Usages simple tests
31  * @author jungi
32  */

33 public class WebAppTest extends ChangeSignatureTestCase implements WebAppConstants {
34
35     private static boolean prjOpened = false;
36
37     /** Creates a new instance of Signature1Test */
38     public WebAppTest(String JavaDoc name) {
39         super(name);
40     }
41     
42     public static TestSuite suite() {
43         NbTestSuite suite = new NbTestSuite();
44         suite.addTest(new WebAppTest("testWsOperation"));
45         //suite.addTest(new WebAppTest("testServlet"));
46
return suite;
47     }
48     
49     public void testWsOperation() {
50         changeSignature(CLASS_NAME_1 , "callOtherWs", new String JavaDoc[0],
51                 new String JavaDoc[][] {{"s", "java.lang.String", "\"\""}},
52                 Modifier.PUBLIC, false);
53     }
54     
55     public void testServlet() {
56         String JavaDoc[] params = {"javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse"};
57         String JavaDoc[][] 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     /**
67      * Used for running test from inside the IDE by internal execution.
68      *
69      * @param args the command line arguments
70      */

71     public static void main(String JavaDoc[] args) {
72         TestRunner.run(suite());
73     }
74     
75     public void prepareProject() {
76         if (prjOpened) {
77             return;
78         }
79         J2eeProjectSupport.openProject(new File JavaDoc(getDataDir(), "projects/LoggingWS"));
80         classPathWorkDir = new File JavaDoc(getDataDir(), "projects.LoggingWS.src.java".replace('.', File.separatorChar));
81         prjOpened = true;
82     }
83     
84 }
85
Popular Tags