1 19 20 package org.netbeans.modules.j2ee.earproject.ui; 21 22 import java.io.File ; 23 import java.util.Arrays ; 24 import java.util.HashSet ; 25 import java.util.Set ; 26 import org.netbeans.api.project.Project; 27 import org.netbeans.api.project.ProjectManager; 28 import org.netbeans.junit.NbTestCase; 29 import org.netbeans.modules.j2ee.earproject.EarProject; 30 import org.netbeans.modules.j2ee.earproject.EarProjectTest; 31 import org.netbeans.modules.j2ee.earproject.test.TestUtil; 32 import org.netbeans.modules.j2ee.earproject.ui.J2eeArchiveLogicalViewProvider.ArchiveLogicalViewRootNode; 33 import org.netbeans.modules.j2ee.earproject.ui.wizards.NewEarProjectWizardIteratorTest; 34 import org.openide.filesystems.FileObject; 35 import org.openide.filesystems.FileUtil; 36 37 42 public class J2eeArchiveLogicalViewProviderTest extends NbTestCase { 43 44 private String serverInstanceID; 45 46 public J2eeArchiveLogicalViewProviderTest(String testName) { 47 super(testName); 48 } 49 50 protected void setUp() throws Exception { 51 clearWorkDir(); 52 serverInstanceID = TestUtil.registerSunAppServer(this); 53 } 54 55 public void testProjectFiles() throws Exception { 56 File prjDirF = new File (getWorkDir(), "testEA"); 57 String name = "Test EnterpriseApplication"; 58 String j2eeLevel = "1.4"; 59 String jarName = "testEA-ejb"; 60 61 NewEarProjectWizardIteratorTest.generateEARProject(prjDirF, name, j2eeLevel, 63 serverInstanceID, null, null, jarName, null, null, null); 64 Project earProject = ProjectManager.getDefault().findProject(FileUtil.toFileObject(prjDirF)); 65 EarProjectTest.openProject((EarProject) earProject); 66 J2eeArchiveLogicalViewProvider.ArchiveLogicalViewRootNode rootNode = (ArchiveLogicalViewRootNode) 67 ((LogicalViewProvider) earProject.getLookup().lookup(LogicalViewProvider.class)).createLogicalView(); 68 Set <FileObject> expected = new HashSet <FileObject>(Arrays.asList( 69 new FileObject[] { 70 earProject.getProjectDirectory().getFileObject("nbproject"), 71 earProject.getProjectDirectory().getFileObject("build.xml"), 72 earProject.getProjectDirectory().getFileObject("src") 73 } 74 )); 75 assertEquals("right project files", expected, rootNode.getProjectFiles()); 76 } 77 78 } 79 | Popular Tags |