KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > earproject > ProjectEarProviderTest


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.earproject;
21
22 import java.io.File JavaDoc;
23 import org.netbeans.api.project.Project;
24 import org.netbeans.api.project.ProjectManager;
25 import org.netbeans.junit.NbTestCase;
26 import org.netbeans.modules.j2ee.api.ejbjar.Ear;
27 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
28 import org.netbeans.modules.j2ee.earproject.test.TestUtil;
29 import org.netbeans.modules.j2ee.earproject.ui.wizards.NewEarProjectWizardIteratorTest;
30 import org.openide.filesystems.FileObject;
31 import org.openide.filesystems.FileUtil;
32
33 /**
34  * @author Martin Krauskopf
35  */

36 public class ProjectEarProviderTest extends NbTestCase {
37     
38     private String JavaDoc serverID;
39     
40     public ProjectEarProviderTest(String JavaDoc testName) {
41         super(testName);
42     }
43     
44     protected void setUp() throws Exception JavaDoc {
45         super.setUp();
46         TestUtil.makeScratchDir(this);
47         serverID = TestUtil.registerSunAppServer(this);
48     }
49     
50     public void testFindEar() throws Exception JavaDoc {
51         File JavaDoc earDirF = new File JavaDoc(getWorkDir(), "testEA");
52         String JavaDoc name = "Test EnterpriseApplication";
53         String JavaDoc j2eeLevel = J2eeModule.JAVA_EE_5;
54         String JavaDoc ejbName = "testEA-ejb";
55         NewEarProjectWizardIteratorTest.generateEARProject(earDirF, name, j2eeLevel, serverID);
56         FileObject earDirFO = FileUtil.toFileObject(earDirF);
57         Project createdEjbJarProject = ProjectManager.getDefault().findProject(earDirFO);
58         assertNotNull("Ear found", Ear.getEar(earDirFO));
59         assertNotNull("Ear found", Ear.getEar(earDirFO.getFileObject("src")));
60         assertNotNull("Ear found", Ear.getEar(earDirFO.getFileObject("src/conf")));
61         assertNotNull("Ear found", Ear.getEar(earDirFO.getFileObject("src/conf/application.xml")));
62         assertNull("not Ear for parent", Ear.getEar(earDirFO.getParent()));
63     }
64     
65 }
66
Popular Tags