KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > j2ee > refactoring > rename > EjbModTest


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.rename;
20
21 import java.io.File JavaDoc;
22 import junit.framework.TestSuite;
23 import junit.textui.TestRunner;
24 import org.netbeans.junit.NbTestSuite;
25 import org.netbeans.test.j2ee.lib.J2eeProjectSupport;
26 import org.netbeans.test.j2ee.refactoring.EjbModConstants;
27
28 /**
29  *
30  * @author jungi
31  */

32 public class EjbModTest extends RenameTestCase implements EjbModConstants {
33     
34     private static boolean prjOpened = false;
35
36     //_name_Bean, _name_Local, _name_LocalHome, _name_Remote, _name_RemoteHome, MDB
37

38     /** Creates a new instance of EjbModTest */
39     public EjbModTest(String JavaDoc name) {
40         super(name);
41     }
42     
43     public static TestSuite suite() {
44         NbTestSuite suite = new NbTestSuite();
45         suite.addTest(new EjbModTest("testRenameCMPBean"));
46         suite.addTest(new EjbModTest("testRenameCMPLocal"));
47         suite.addTest(new EjbModTest("testRenameCMPLocalHome"));
48         suite.addTest(new EjbModTest("testRenameSessionRemote"));
49         suite.addTest(new EjbModTest("testRenameSessionRemoteHome"));
50         suite.addTest(new EjbModTest("testRenameSessionBean"));
51         suite.addTest(new EjbModTest("testRenameTopicMDB"));
52         suite.addTest(new EjbModTest("testRenameQueueMDB"));
53         suite.addTest(new EjbModTest("testRenameWsInterface"));
54         suite.addTest(new EjbModTest("testRenameWsClass"));
55         suite.addTest(new EjbModTest("testRenameUsedMsgHandler"));
56         suite.addTest(new EjbModTest("testRenameUnusedMsgHandler"));
57         suite.addTest(new EjbModTest("testRenameClass"));
58         //suite.addTest(new EjbModTest("testRenameWsPackage"));
59
//suite.addTest(new EjbModTest("testRenameEjbPackage"));
60
return suite;
61     }
62     
63     public void testRenameCMPBean() {
64         renameClass(CLASS_CMP_ENTITY_1, "TeamRenamedBean", false, false);
65     }
66     
67     public void testRenameCMPLocal() {
68         renameClass(INTERFACE_CMP_ENTITY_LOCAL_3, "ResultRenamedLocal", false, false);
69     }
70     
71     public void testRenameCMPLocalHome() {
72         renameClass(INTERFACE_CMP_ENTITY_LOCAL_HOME_4, "MatchRenamedLocalHome", false, false);
73     }
74     
75     public void testRenameSessionBean() {
76         renameClass(CLASS_SESSION_1, "SessionRenamedBean", false, false);
77     }
78     
79     public void testRenameSessionRemote() {
80         renameClass(INTERFACE_SESSION_REMOTE_1, "SessionRenamed1Remote", false, false);
81     }
82     
83     public void testRenameSessionRemoteHome() {
84         renameClass(INTERFACE_SESSION_REMOTE_HOME_1, "SessionRenamed1RemoteHome", false, false);
85     }
86     
87     public void testRenameClass() {
88         renameClass(CLASS_JAVA_1, "CSLocatorRenamed", false, false);
89     }
90     
91     public void testRenameWsInterface() {
92         renameClass(INTERFACE_WS_1, "WsSEIRenamed", false, false);
93     }
94     
95     public void testRenameWsClass() {
96         renameClass(CLASS_WS_1, "LeagueWebServiceRenamedBean", false, false);
97     }
98     
99     public void testRenameTopicMDB() {
100         renameClass(MDB_TOPIC, "TopicMessageRenamedBean", false, false);
101     }
102     
103     public void testRenameQueueMDB() {
104         renameClass(MDB_QUEUE, "QueueMessageRenamedBean", false, false);
105     }
106
107     public void testRenameUsedMsgHandler() {
108         renameClass(CLASS_HANDLER_1, "UsedHandlerRenamed", false, false);
109     }
110     
111     public void testRenameUnusedMsgHandler() {
112         renameClass(CLASS_HANDLER_2, "UnusedHandlerRenamed", false, false);
113     }
114
115     /*
116     public void testRenameWsPackage() {
117         renamePackage("league.ws", "league.websvc", "league.ws.UnusedHandlerRenamed", false);
118     }
119     
120     public void testRenameEjbPackage() {
121         renamePackage("league.ejb.entity", "league.beans", CLASS_JAVA_2, false);
122     }
123      */

124     
125
126     /**
127      * Used for running test from inside the IDE by internal execution.
128      *
129      * @param args the command line arguments
130      */

131     public static void main(String JavaDoc[] args) {
132         TestRunner.run(suite());
133     }
134
135     public void prepareProject() {
136         if (prjOpened) {
137             return;
138         }
139         J2eeProjectSupport.openProject(new File JavaDoc(getDataDir(), "projects/League-util"));
140         J2eeProjectSupport.openProject(new File JavaDoc(getDataDir(), "projects/League-ejb"));
141         classPathWorkDir = new File JavaDoc(getDataDir(), "projects.League-ejb.src.java".replace('.', File.separatorChar));
142         prjOpened = true;
143     }
144
145 }
146
Popular Tags