KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > j2ee > refactoring > move > 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
20 package org.netbeans.test.j2ee.refactoring.move;
21
22 import java.io.File 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 MoveTestCase 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("testMoveWsSei"));
45 // suite.addTest(new WebAppTest("testMoveWsImpl"));
46
// suite.addTest(new WebAppTest("testMoveServlet"));
47
suite.addTest(new WebAppTest("testMoveUsedHandler"));
48         suite.addTest(new WebAppTest("testMoveUnusedHandler"));
49         /*
50         suite.addTest(new WebAppTest("testUndoMoveWsSei"));
51         suite.addTest(new WebAppTest("testUndoMoveWsImpl"));
52         suite.addTest(new WebAppTest("testUndoMoveServlet"));
53         suite.addTest(new WebAppTest("testUndoMoveUsedHandler"));
54         suite.addTest(new WebAppTest("testUndoMoveUnusedHandler"));
55          */

56         return suite;
57     }
58     
59     public void testMoveWsSei() {
60         moveClass(IFACE_NAME_1, DESTINATION_PACKAGE_1, false);
61     }
62     
63     public void testMoveWsImpl() {
64         moveClass(CLASS_NAME_1, DESTINATION_PACKAGE_2, false);
65     }
66     
67     public void testMoveServlet() {
68         moveClass(CLASS_NAME_2, DESTINATION_PACKAGE_1, false);
69     }
70     
71     public void testMoveUsedHandler() {
72         moveClass(HANDLER_NAME_1, DESTINATION_PACKAGE_2, false);
73     }
74     
75     public void testMoveUnusedHandler() {
76         moveClass(HANDLER_NAME_2, DESTINATION_PACKAGE_1, false);
77     }
78     
79     //undo
80
public void testUndoMoveWsSei() {
81         moveClass(IFACE_NAME_1, DESTINATION_PACKAGE_2, true);
82     }
83     
84     public void testUndoMoveWsImpl() {
85         moveClass(CLASS_NAME_1, DESTINATION_PACKAGE_1, true);
86     }
87     
88     public void testUndoMoveServlet() {
89         moveClass(CLASS_NAME_2, DESTINATION_PACKAGE_2, true);
90     }
91     
92     public void testUndoMoveUsedHandler() {
93         assertTrue("See issue 59611.", false);
94         moveClass(HANDLER_NAME_1, DESTINATION_PACKAGE_1, true);
95     }
96     
97     public void testUndoMoveUnusedHandler() {
98         moveClass(HANDLER_NAME_2, DESTINATION_PACKAGE_2, true);
99     }
100     
101     /**
102      * Used for running test from inside the IDE by internal execution.
103      *
104      * @param args the command line arguments
105      */

106     public static void main(String JavaDoc[] args) {
107         TestRunner.run(suite());
108     }
109     
110     public void prepareProject() {
111         if (prjOpened) {
112             return;
113         }
114         J2eeProjectSupport.openProject(new File JavaDoc(getDataDir(), "projects/LoggingWS"));
115         classPathWorkDir = new File JavaDoc(getDataDir(), "projects.LoggingWS.src.java".replace('.', File.separatorChar));
116         prjOpened = true;
117     }
118     
119 }
120
Popular Tags