1 19 20 package org.netbeans.modules.j2ee.earproject; 21 22 import java.io.File ; 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 36 public class ProjectEarProviderTest extends NbTestCase { 37 38 private String serverID; 39 40 public ProjectEarProviderTest(String testName) { 41 super(testName); 42 } 43 44 protected void setUp() throws Exception { 45 super.setUp(); 46 TestUtil.makeScratchDir(this); 47 serverID = TestUtil.registerSunAppServer(this); 48 } 49 50 public void testFindEar() throws Exception { 51 File earDirF = new File (getWorkDir(), "testEA"); 52 String name = "Test EnterpriseApplication"; 53 String j2eeLevel = J2eeModule.JAVA_EE_5; 54 String 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 |