KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > refactoring > test > J2EEMoveClassRefactoringTest


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.modules.j2ee.refactoring.test;
21
22 import junit.textui.TestRunner;
23 import org.netbeans.junit.NbTestSuite;
24 import org.netbeans.modules.refactoring.api.MoveClassRefactoring;
25 import org.netbeans.modules.refactoring.api.RefactoringSession;
26 import org.netbeans.modules.web.taglib.TLDDataObject;
27 import org.openide.cookies.EditorCookie;
28 import org.openide.cookies.OpenCookie;
29 import org.openide.filesystems.FileObject;
30 import org.openide.filesystems.FileStateInvalidException;
31 import org.openide.filesystems.FileUtil;
32 import org.openide.loaders.DataObject;
33
34 import java.io.IOException JavaDoc;
35
36 /**
37  *
38  * @author Martin Grebac
39  */

40 public class J2EEMoveClassRefactoringTest extends J2EERefactoringTest {
41     private static final String JavaDoc PROJECT_WEBAPP = "webapp";
42     private static final String JavaDoc PROJECT_WEBAPP2 = "webapp2";
43     private static final String JavaDoc PROJECT_EJBMOD2 = "ejbmod2";
44     private static final String JavaDoc PROJECT_WEBAPPEMPTY = "webapp-empty";
45
46     public J2EEMoveClassRefactoringTest(String JavaDoc testName) {
47         super(testName);
48     }
49
50     public static NbTestSuite suite() {
51         NbTestSuite suite = new NbTestSuite("J2EEMoveClassRefactoringTest");
52         suite.addTest(new J2EEMoveClassRefactoringTest("testPrepare"));
53         suite.addTest(new J2EEMoveClassRefactoringTest("testTldMoveClass"));
54         suite.addTest(new J2EEMoveClassRefactoringTest("testWebMoveClass"));
55         suite.addTest(new J2EEMoveClassRefactoringTest("testTldMoveClassOtherProject"));
56         suite.addTest(new J2EEMoveClassRefactoringTest("testWebMoveClassOtherProject"));
57         suite.addTest(new J2EEMoveClassRefactoringTest("testTldMoveClassOtherEmptyProject"));
58         suite.addTest(new J2EEMoveClassRefactoringTest("testEjbMoveClass"));
59         suite.addTest(new J2EEMoveClassRefactoringTest("testWebsvcMoveClass"));
60         suite.addTest(new J2EEMoveClassRefactoringTest("testCleanup"));
61         return suite;
62     }
63
64     /**
65      * Opens projects for tests
66      */

67     public void testPrepare() {
68         openProject(PROJECT_WEBAPP);
69         openProject(PROJECT_WEBAPP2);
70         openProject(PROJECT_WEBAPPEMPTY);
71         openProject(PROJECT_EJBMOD2);
72     }
73
74     /** Moves
75      * tag handler
76      * and checks moved files and mytld.tld for differences
77      */

78     public void testTldMoveClass() throws FileStateInvalidException, IOException JavaDoc {
79
80         // this part is here to test if the documents opened in editor are changed, too, which is a bug 55045
81
FileObject fo = FileUtil.toFileObject(getProjectFile(PROJECT_WEBAPP, "web/WEB-INF/tlds/mytld.tld"));
82         TLDDataObject tdo = ((TLDDataObject)DataObject.find(fo));
83         ((OpenCookie)tdo.getCookie(OpenCookie.class)).open();
84         // end of 55045 part
85

86         doMoveClassRefactoring(PROJECT_WEBAPP, "abc.NewTagHandler", null, "xyz.ccc", "move tag handler");
87
88         // another 55045 specific part
89
EditorCookie ec = (EditorCookie)tdo.getCookie(EditorCookie.class);
90         try {
91             ec.getDocument().insertString(0, " ", null);
92             ec.saveDocument();
93             ec.getDocument().remove(0, 1);
94             ec.saveDocument();
95         } catch (Exception JavaDoc e) {
96             fail(e.toString());
97         }
98         // end of 55045 specific part
99

100         // check modified files
101
try {
102             checkGoldenFile(PROJECT_WEBAPP, "src/java/xyz/ccc/NewTagHandler.java", "NewTagHandler.pass");
103
104             // check TLD
105
checkFile(PROJECT_WEBAPP, "web/WEB-INF/tlds/mytld.tld", new String JavaDoc[]{">xyz.ccc.NewTagHandler<"},
106                     new String JavaDoc[]{">abc.NewTagHandler<"});
107
108         } catch (FileStateInvalidException e) {
109             fail(e.getMessage());
110         } catch (IOException JavaDoc e) {
111             fail(e.getMessage());
112         }
113     }
114
115     /** Moves
116      * servlet
117      * filter
118      * listener
119      * and checks moved files and web.xml for differences
120      */

121     public void testWebMoveClass() throws FileStateInvalidException, IOException JavaDoc {
122
123         doMoveClassRefactoring(PROJECT_WEBAPP, "abc.NewServlet", "abc.NewSimpleFilter", "abc.NewServletListener", "xyz.ccc",
124                 "move classes", null);
125
126         // check modified files
127
try {
128             checkGoldenFile(PROJECT_WEBAPP, "src/java/xyz/ccc/NewServlet.java", "NewServlet.pass");
129             checkGoldenFile(PROJECT_WEBAPP, "src/java/xyz/ccc/NewSimpleFilter.java", "NewSimpleFilter.pass");
130             checkGoldenFile(PROJECT_WEBAPP, "src/java/xyz/ccc/NewServletListener.java", "NewServletListener.pass");
131             // check web.xml
132
checkFile(PROJECT_WEBAPP, "web/WEB-INF/web.xml",
133                     new String JavaDoc[]{">xyz.ccc.NewServlet<", ">xyz.ccc.NewSimpleFilter<", ">xyz.ccc.NewServletListener<"},
134                     new String JavaDoc[]{">abc.NewServlet<", ">abc.NewSimpleFilter<", ">abc.NewServletListener<"});
135         } catch (FileStateInvalidException e) {
136             fail(e.getMessage());
137         } catch (IOException JavaDoc e) {
138             fail(e.getMessage());
139         }
140     }
141
142     /** Moves
143      * tag handler
144      * to a different project and checks moved files and mytld.tld and tld2.tld for differences
145      */

146     public void testTldMoveClassOtherProject() throws FileStateInvalidException, IOException JavaDoc {
147
148
149         doMoveClassRefactoring(PROJECT_WEBAPP, "xyz.ccc.NewTagHandler", PROJECT_WEBAPP2, "pkg.subpkg", "move tag handler to other project"
150         );
151
152         // check modified files
153
try {
154             checkGoldenFile(PROJECT_WEBAPP2, "src/java/pkg/subpkg/NewTagHandler.java", "NewTagHandlerOtherProject.pass");
155
156             // check TLD in original project
157
checkFile(PROJECT_WEBAPP, "web/WEB-INF/tlds/mytld.tld", null,
158                     new String JavaDoc[]{">xyz.ccc.NewTagHandler<", "NewTagHandler"});
159
160             // check TLD in target project
161
checkFile(PROJECT_WEBAPP2, "web/WEB-INF/tlds/tld2.tld",
162                     new String JavaDoc[]{">pkg.subpkg.NewTagHandler<", "NewTagHandler<"}, null);
163         } catch (FileStateInvalidException e) {
164             fail(e.getMessage());
165         } catch (IOException JavaDoc e) {
166             fail(e.getMessage());
167         }
168     }
169
170     /** Checks move
171      * tag handler
172      * to different project without TLD file
173      */

174     public void testTldMoveClassOtherEmptyProject() throws FileStateInvalidException, IOException JavaDoc {
175         // move to other project without a tld file should warn user that the project doesn't contain tld
176
// and mappings cannot be moved
177
RefactoringSession result = RefactoringSession.create("move tag handler to other project where no tld exists");
178         MoveClassRefactoring refactoring = createMoveClassRefactoring(PROJECT_WEBAPP2, "pkg.subpkg.NewTagHandler", PROJECT_WEBAPPEMPTY,
179                 "pkg1.pkg2"
180         );
181         assertNotNull(refactoring.prepare(result));
182     }
183
184
185     /** Moves
186      * servlet
187      * filter
188      * listener
189      * to other project and checks moved files and web.xmls for differences
190      */

191     public void testWebMoveClassOtherProject() throws FileStateInvalidException, IOException JavaDoc {
192
193         doMoveClassRefactoring(PROJECT_WEBAPP, "xyz.ccc.NewServlet", "xyz.ccc.NewSimpleFilter", "xyz.ccc.NewServletListener",
194                 "pkg.subpkg", "move classes to other project", PROJECT_WEBAPP2);
195
196         // check modified files
197
try {
198             checkGoldenFile(PROJECT_WEBAPP2, "src/java/pkg/subpkg/NewServlet.java", "NewServletOtherProject.pass");
199             checkGoldenFile(PROJECT_WEBAPP2, "src/java/pkg/subpkg/NewSimpleFilter.java",
200                     "NewSimpleFilterOtherProject.pass");
201             checkGoldenFile(PROJECT_WEBAPP2, "src/java/pkg/subpkg/NewServletListener.java",
202                     "NewServletListenerOtherProject.pass");
203
204             // check web.xml in original project
205
checkFile(PROJECT_WEBAPP, "web/WEB-INF/web.xml", null, new String JavaDoc[]{">xyz.ccc.NewServlet<",
206                     ">xyz.ccc.NewSimpleFilter<", ">xyz.ccc.NewServletListener<", "NewSimpleFilter", "ServletContextListener",
207                     "NewServlet"});
208             // check web.xml in target project
209
checkFile(PROJECT_WEBAPP2, "web/WEB-INF/web.xml", new String JavaDoc[]{">pkg.subpkg.NewServlet<",
210                     ">pkg.subpkg.NewSimpleFilter<", ">pkg.subpkg.NewServletListener<", "NewSimpleFilter",
211                     "ServletContextListener", "NewServlet"}, null);
212         } catch (FileStateInvalidException e) {
213             fail(e.getMessage());
214         } catch (IOException JavaDoc e) {
215             fail(e.getMessage());
216         }
217     }
218
219     /** Moves
220      * session bean implementation class
221      * session bean local interface
222      * session bean local home interface
223      * session bean remote interface
224      * session bean remote home interface
225      * queue message bean impl class
226      * topic message bean impl class
227      * CMP entity bean impl class
228      * CMP entity bean local interface
229      * CMP entity bean local home interface
230      * BMP entity bean impl class
231      * BMP entity bean local interface
232      * BMP entity bean local home interface
233      * and checks renamed files and ejb-jar.xml for differences
234      */

235     public void testEjbMoveClass() throws FileStateInvalidException, IOException JavaDoc {
236
237 // File original;
238
// String golden;
239
//
240
// MoveClassRefactoring refactoring;
241
// RefactoringSession result;
242
//
243
// FileObject pkg = FileUtil.toFileObject(new File ( getDataDir().getAbsolutePath() + "/projects/webapp/src/java/xyz/ccc"));
244
//
245
// classDefinition = Helper.findClass("my.enterprise.beans.NewSessionBean");
246
// refactoring = new MoveClassRefactoring(classDefinition);
247
// refactoring.preCheck();
248
// refactoring.setTarget(pkg);
249
// refactoring.checkParameters();
250
// result = RefactoringSession.create("rename session bean");
251
// refactoring.prepare(result);
252
// assertNull(result.doRefactoring(true));
253
//
254
// classDefinition = Helper.findClass("my.enterprise.beans.NewSessionLocal");
255
// refactoring = new MoveClassRefactoring(classDefinition);
256
// refactoring.preCheck();
257
// refactoring.setTarget(pkg);
258
// refactoring.checkParameters();
259
// result = RefactoringSession.create("rename session bean's local interface");
260
// refactoring.prepare(result);
261
// assertNull(result.doRefactoring(true));
262
//
263
// classDefinition = Helper.findClass("my.enterprise.beans.NewSessionLocalHome");
264
// refactoring = new MoveClassRefactoring(classDefinition);
265
// refactoring.preCheck();
266
// refactoring.setTarget(pkg);
267
// refactoring.checkParameters();
268
// result = RefactoringSession.create("rename session bean's local home interface");
269
// refactoring.prepare(result);
270
// assertNull(result.doRefactoring(true));
271
//
272
// classDefinition = Helper.findClass("my.enterprise.beans.NewSessionRemote");
273
// refactoring = new MoveClassRefactoring(classDefinition);
274
// refactoring.preCheck();
275
// refactoring.setTarget(pkg);
276
// refactoring.checkParameters();
277
// result = RefactoringSession.create("rename session bean's remote interface");
278
// refactoring.prepare(result);
279
// assertNull(result.doRefactoring(true));
280
//
281
// classDefinition = Helper.findClass("my.enterprise.beans.NewSessionRemoteHome");
282
// refactoring = new MoveClassRefactoring(classDefinition);
283
// refactoring.preCheck();
284
// refactoring.setTarget(pkg);
285
// refactoring.checkParameters();
286
// result = RefactoringSession.create("rename session bean's remote home interface");
287
// refactoring.prepare(result);
288
// assertNull(result.doRefactoring(true));
289
//
290
// classDefinition = Helper.findClass("my.enterprise.beans.NewMessageBean");
291
// refactoring = new MoveClassRefactoring(classDefinition);
292
// refactoring.preCheck();
293
// refactoring.setTarget(pkg);
294
// refactoring.checkParameters();
295
// result = RefactoringSession.create("rename queue message bean");
296
// refactoring.prepare(result);
297
// assertNull(result.doRefactoring(true));
298
//
299
// classDefinition = Helper.findClass("my.enterprise.beans.NewMessageTopicBean");
300
// refactoring = new MoveClassRefactoring(classDefinition);
301
// refactoring.preCheck();
302
// refactoring.setTarget(pkg);
303
// refactoring.checkParameters();
304
// result = RefactoringSession.create("rename topic message bean");
305
// refactoring.prepare(result);
306
// assertNull(result.doRefactoring(true));
307
//
308
// classDefinition = Helper.findClass("my.enterprise.beans.NewEntityContainerBean");
309
// refactoring = new MoveClassRefactoring(classDefinition);
310
// refactoring.preCheck();
311
// refactoring.setTarget(pkg);
312
// refactoring.checkParameters();
313
// result = RefactoringSession.create("rename entity container bean");
314
// refactoring.prepare(result);
315
// assertNull(result.doRefactoring(true));
316
//
317
// classDefinition = Helper.findClass("my.enterprise.beans.NewEntityContainerLocal");
318
// refactoring = new MoveClassRefactoring(classDefinition);
319
// refactoring.preCheck();
320
// refactoring.setTarget(pkg);
321
// refactoring.checkParameters();
322
// result = RefactoringSession.create("rename entity container bean's local interface");
323
// refactoring.prepare(result);
324
// assertNull(result.doRefactoring(true));
325
//
326
// classDefinition = Helper.findClass("my.enterprise.beans.NewEntityContainerLocalHome");
327
// refactoring = new MoveClassRefactoring(classDefinition);
328
// refactoring.preCheck();
329
// refactoring.setTarget(pkg);
330
// refactoring.checkParameters();
331
// result = RefactoringSession.create("rename entity container bean's local home interface");
332
// refactoring.prepare(result);
333
// assertNull(result.doRefactoring(true));
334
//
335
// classDefinition = Helper.findClass("my.enterprise.beans.NewEntityBeanMPBean");
336
// refactoring = new MoveClassRefactoring(classDefinition);
337
// refactoring.preCheck();
338
// refactoring.setTarget(pkg);
339
// refactoring.checkParameters();
340
// result = RefactoringSession.create("rename entity bmp bean");
341
// refactoring.prepare(result);
342
// assertNull(result.doRefactoring(true));
343
//
344
// classDefinition = Helper.findClass("my.enterprise.beans.NewEntityBeanMPLocal");
345
// refactoring = new MoveClassRefactoring(classDefinition);
346
// refactoring.preCheck();
347
// refactoring.setTarget(pkg);
348
// refactoring.checkParameters();
349
// result = RefactoringSession.create("rename entity bmp bean's local interface");
350
// refactoring.prepare(result);
351
// assertNull(result.doRefactoring(true));
352
//
353
// classDefinition = Helper.findClass("my.enterprise.beans.NewEntityBeanMPLocalHome");
354
// refactoring = new MoveClassRefactoring(classDefinition);
355
// refactoring.preCheck();
356
// refactoring.setTarget(pkg);
357
// refactoring.checkParameters();
358
// result = RefactoringSession.create("rename entity bmp bean's local home interface");
359
// refactoring.prepare(result);
360
// assertNull(result.doRefactoring(true));
361
//
362
// classDefinition = Helper.findClass("my.ws.server.NewWebServiceBean");
363
// refactoring = new MoveClassRefactoring(classDefinition);
364
// refactoring.preCheck();
365
// refactoring.setTarget(pkg);
366
// refactoring.checkParameters();
367
// result = RefactoringSession.create("rename ws server impl bean");
368
// refactoring.prepare(result);
369
// assertNull(result.doRefactoring(true));
370
//
371
// classDefinition = Helper.findClass("my.ws.server.NewWebServiceSEI");
372
// refactoring = new MoveClassRefactoring(classDefinition);
373
// refactoring.preCheck();
374
// refactoring.setTarget(pkg);
375
// refactoring.checkParameters();
376
// result = RefactoringSession.create("rename ws server servlet endpoint interface");
377
// refactoring.prepare(result);
378
// assertNull(result.doRefactoring(true));
379
//
380
// // check modified files
381
// try {
382
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedSessionBean.java");
383
// golden = "RenamedSessionBean.pass";
384
// assertFile(original, getGoldenFile(golden), getWorkDir());
385
//
386
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedSessionLocal.java");
387
// golden = "RenamedSessionLocal.pass";
388
// assertFile(original, getGoldenFile(golden), getWorkDir());
389
//
390
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedSessionLocalHome.java");
391
// golden = "RenamedSessionLocalHome.pass";
392
// assertFile(original, getGoldenFile(golden), getWorkDir());
393
//
394
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedSessionRemote.java");
395
// golden = "RenamedSessionRemote.pass";
396
// assertFile(original, getGoldenFile(golden), getWorkDir());
397
//
398
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedSessionRemoteHome.java");
399
// golden = "RenamedSessionRemoteHome.pass";
400
// assertFile(original, getGoldenFile(golden), getWorkDir());
401
//
402
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedMessageBean.java");
403
// golden = "RenamedMessageBean.pass";
404
// assertFile(original, getGoldenFile(golden), getWorkDir());
405
//
406
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedMessageTopicBean.java");
407
// golden = "RenamedMessageTopicBean.pass";
408
// assertFile(original, getGoldenFile(golden), getWorkDir());
409
//
410
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedEntityContainerBean.java");
411
// golden = "RenamedEntityContainerBean.pass";
412
// assertFile(original, getGoldenFile(golden), getWorkDir());
413
//
414
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedEntityContainerLocal.java");
415
// golden = "RenamedEntityContainerLocal.pass";
416
// assertFile(original, getGoldenFile(golden), getWorkDir());
417
//
418
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedEntityContainerLocalHome.java");
419
// golden = "RenamedEntityContainerLocalHome.pass";
420
// assertFile(original, getGoldenFile(golden), getWorkDir());
421
//
422
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedEntityBeanMPBean.java");
423
// golden = "RenamedEntityBeanMPBean.pass";
424
// assertFile(original, getGoldenFile(golden), getWorkDir());
425
//
426
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedEntityBeanMPLocal.java");
427
// golden = "RenamedEntityBeanMPLocal.pass";
428
// assertFile(original, getGoldenFile(golden), getWorkDir());
429
//
430
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/enterprise/beans/RenamedEntityBeanMPLocalHome.java");
431
// golden = "RenamedEntityBeanMPLocalHome.pass";
432
// assertFile(original, getGoldenFile(golden), getWorkDir());
433
//
434
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/ws/server/RenamedWebServiceBean.java");
435
// golden = "RenamedWebServiceBean.pass";
436
// assertFile(original, getGoldenFile(golden), getWorkDir());
437
//
438
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/ws/server/RenamedWebServiceSEI.java");
439
// golden = "RenamedWebServiceSEI.pass";
440
// assertFile(original, getGoldenFile(golden), getWorkDir());
441
//
442
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/java/my/ws/server/NewWebService-config.xml");
443
// golden = "NewWebService-configxml.pass";
444
// assertFile(original, getGoldenFile(golden), getWorkDir());
445
//
446
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/conf/ejb-jar.xml");
447
// golden = "ejbjarxml.pass";
448
// assertFile(original, getGoldenFile(golden), getWorkDir());
449
//
450
// original = new File ( getDataDir().getAbsolutePath() + "/projects/ejbmod2/src/conf/webservices.xml");
451
// golden = "webservicesxml.pass";
452
// assertFile(original, getGoldenFile(golden), getWorkDir());
453
//
454
// } catch (FileStateInvalidException e) {
455
// fail(e.getMessage());
456
// } catch (IOException e) {
457
// fail(e.getMessage());
458
// }
459
}
460
461     /** Moves
462      * ws server impl
463      * ws SEI
464      * and checks moved files, web.xml, webservices.xml for differences
465      */

466     public void testWebsvcMoveClass() throws FileStateInvalidException, IOException JavaDoc {
467
468         doMoveClassRefactoring(PROJECT_EJBMOD2, "my.ws.server.NewWebServiceBean", null, "xyz.ccc", "move ws impl bean");
469
470         // check modified files
471
try {
472             checkGoldenFile(PROJECT_EJBMOD2, "src/java/xyz/ccc/NewWebServiceBean.java", "NewWebServiceBean.pass");
473
474             // check wscompile config file
475
checkFile(PROJECT_EJBMOD2, "src/java/my/ws/server/NewWebService-config.xml",
476                     new String JavaDoc[]{"xyz.ccc.NewWebServiceBean", "packageName=\"my.ws.server\""},
477                     new String JavaDoc[]{"my.ws.server.NewWebServiceBean"});
478
479             // check ejb-jar
480
checkFile(PROJECT_EJBMOD2, "src/conf/ejb-jar.xml", new String JavaDoc[]{">xyz.ccc.NewWebServiceBean<"},
481                     new String JavaDoc[]{">my.ws.server.NewWebServiceBean<"});
482
483         } catch (FileStateInvalidException e) {
484             fail(e.getMessage());
485         } catch (IOException JavaDoc e) {
486             fail(e.getMessage());
487         }
488
489         doMoveClassRefactoring(PROJECT_EJBMOD2, "my.ws.server.NewWebServiceSEI", null, "xyz.ccc", "move ws SEI");
490
491         // check modified files
492
try {
493             checkGoldenFile(PROJECT_EJBMOD2, "src/java/xyz/ccc/NewWebServiceSEI.java", "NewWebServiceSEI.pass");
494
495             // check wscompile config file
496
checkFile(PROJECT_EJBMOD2, "src/java/xyz/ccc/NewWebService-config.xml",
497                     new String JavaDoc[]{"xyz.ccc.NewWebServiceSEI", "packageName=\"xyz.ccc\""},
498                     new String JavaDoc[]{"my.ws.server.NewWebServiceSEI"});
499
500             // check webservices.xml
501
checkFile(PROJECT_EJBMOD2, "src/conf/webservices.xml", new String JavaDoc[]{">xyz.ccc.NewWebServiceSEI<"},
502                     new String JavaDoc[]{">my.ws.server.NewWebServiceSEI<"});
503
504         } catch (FileStateInvalidException e) {
505             fail(e.getMessage());
506         } catch (IOException JavaDoc e) {
507             fail(e.getMessage());
508         }
509
510     }
511
512     /**
513      * Opens projects for tests
514      */

515     public void testCleanup() {
516         closeProject(PROJECT_WEBAPP);
517         closeProject(PROJECT_WEBAPP2);
518         closeProject(PROJECT_WEBAPPEMPTY);
519         closeProject(PROJECT_EJBMOD2);
520     }
521
522     /**
523      * Used for running test from inside the IDE by internal execution.
524      *
525      * @param args the command line arguments
526      */

527     public static void main(String JavaDoc[] args) {
528         TestRunner.run(suite());
529     }
530 }
531
Popular Tags