KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > j2ee > refactoring > move > 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.move;
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 MoveTestCase 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("testMoveWsSei"));
46         suite.addTest(new EjbModTest("testMoveWsImpl"));
47         suite.addTest(new EjbModTest("testMoveSessionBean"));
48         suite.addTest(new EjbModTest("testMoveSessionBeanRemote"));
49         suite.addTest(new EjbModTest("testMoveSessionBeanRemoteHome"));
50         suite.addTest(new EjbModTest("testMoveUsedHandler"));
51         suite.addTest(new EjbModTest("testMoveUnusedHandler"));
52         suite.addTest(new EjbModTest("testMoveCMPEntityBean"));
53         suite.addTest(new EjbModTest("testMoveCMPEntityBeanLocal"));
54         suite.addTest(new EjbModTest("testMoveCMPEntityBeanLocalHome"));
55         suite.addTest(new EjbModTest("testMoveTopicMdb"));
56         /*
57         suite.addTest(new EjbModTest("testUndoMoveWsSei"));
58         suite.addTest(new EjbModTest("testUndoMoveWsImpl"));
59         suite.addTest(new EjbModTest("testUndoMoveSessionBean"));
60         suite.addTest(new EjbModTest("testUndoMoveUsedHandler"));
61         suite.addTest(new EjbModTest("testUndoMoveUnusedHandler"));
62         suite.addTest(new EjbModTest("testUndoMoveQueueMdb"));
63          */

64         return suite;
65     }
66     
67     /**
68      * Used for running test from inside the IDE by internal execution.
69      *
70      * @param args the command line arguments
71      */

72     public static void main(String JavaDoc[] args) {
73         TestRunner.run(suite());
74     }
75     
76     public void prepareProject() {
77         if (prjOpened) {
78             return;
79         }
80         J2eeProjectSupport.openProject(new File JavaDoc(getDataDir(), "projects/League-util"));
81         J2eeProjectSupport.openProject(new File JavaDoc(getDataDir(), "projects/League-ejb"));
82         classPathWorkDir = new File JavaDoc(getDataDir(), "projects.League-ejb.src.java".replace('.', File.separatorChar));
83         prjOpened = true;
84     }
85     
86     public void testMoveWsSei() {
87         moveClass(INTERFACE_WS_1, DESTINATION_PACKAGE_1, false);
88     }
89     
90     public void testMoveWsImpl() {
91         moveClass(CLASS_WS_1, DESTINATION_PACKAGE_2, false);
92     }
93     
94     public void testMoveSessionBean() {
95         moveClass(CLASS_SESSION_1, DESTINATION_PACKAGE_1, false);
96     }
97     
98     public void testMoveSessionBeanRemote() {
99         moveClass(INTERFACE_SESSION_REMOTE_1, DESTINATION_PACKAGE_1, false);
100     }
101     
102     public void testMoveSessionBeanRemoteHome() {
103         moveClass(INTERFACE_SESSION_REMOTE_HOME_1, DESTINATION_PACKAGE_1, false);
104     }
105     
106     public void testMoveUsedHandler() {
107         moveClass(CLASS_HANDLER_1, DESTINATION_PACKAGE_2, false);
108     }
109     
110     public void testMoveUnusedHandler() {
111         moveClass(CLASS_HANDLER_2, DESTINATION_PACKAGE_1, false);
112     }
113     
114     public void testMoveCMPEntityBean() {
115         moveClass(CLASS_CMP_ENTITY_1, DESTINATION_PACKAGE_2, false);
116     }
117     
118     public void testMoveCMPEntityBeanLocal() {
119         moveClass(INTERFACE_CMP_ENTITY_LOCAL_2, DESTINATION_PACKAGE_1, false);
120     }
121     
122     public void testMoveCMPEntityBeanLocalHome() {
123         moveClass(INTERFACE_CMP_ENTITY_LOCAL_HOME_3, DESTINATION_PACKAGE_2, false);
124     }
125     
126     public void testMoveTopicMdb() {
127         moveClass(MDB_TOPIC, DESTINATION_PACKAGE_1, false);
128     }
129     
130     public void testUndoMoveQueueMdb() {
131         moveClass(MDB_QUEUE, DESTINATION_PACKAGE_2, false);
132     }
133     
134     //undo
135
public void testUndoMoveWsSei() {
136         moveClass(INTERFACE_WS_1, DESTINATION_PACKAGE_1, true);
137     }
138     
139     public void testUndoMoveWsImpl() {
140         moveClass(CLASS_WS_1, DESTINATION_PACKAGE_2, true);
141     }
142     
143     public void testUndoMoveSessionBean() {
144         moveClass(CLASS_SESSION_1, DESTINATION_PACKAGE_1, true);
145     }
146     
147     public void testUndoMoveUsedHandler() {
148         assertTrue("See issue 59611.", false);
149         moveClass(CLASS_HANDLER_1, DESTINATION_PACKAGE_2, true);
150     }
151     
152     public void testUndoMoveUnusedHandler() {
153         moveClass(CLASS_HANDLER_2, DESTINATION_PACKAGE_1, true);
154     }
155     
156     
157 }
158
Popular Tags