1 19 20 package org.netbeans.modules.web.freeform; 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.ant.freeform.FreeformProject; 27 import org.openide.filesystems.FileObject; 28 import org.openide.filesystems.FileUtil; 29 import org.openide.modules.ModuleInfo; 30 import org.openide.util.Lookup; 31 32 33 37 abstract class TestBaseWeb extends NbTestCase { 38 39 static { 40 TestBaseWeb.class.getClassLoader().setDefaultAssertionStatus(true); 41 } 42 43 protected TestBaseWeb (String name) { 44 super(name); 45 } 46 47 protected File egdir; 48 protected FileObject buildProperties; 49 protected FreeformProject jakarta; 50 protected FileObject helloWorldServlet; 51 protected FileObject helloWorldJsp; 52 protected FileObject jakartaIndex; 53 54 protected void setUp() throws Exception { 55 Lookup.getDefault().lookup(ModuleInfo.class); 56 super.setUp(); 57 egdir = FileUtil.normalizeFile(new File (getDataDir(), "example-projects")); 58 assertTrue("example dir " + egdir + " exists", egdir.exists()); 59 FileObject jakartaDir = FileUtil.toFileObject(egdir).getFileObject("web_jakarta"); 60 assertNotNull("found projdir", jakartaDir); 61 Project _jakarta = ProjectManager.getDefault().findProject(jakartaDir); 62 assertNotNull("have a project", _jakarta); 63 jakarta = (FreeformProject)_jakarta; 64 helloWorldServlet = jakartaDir.getFileObject("src/mypackage/HelloWorld.java"); 65 assertNotNull("found HelloWorld.java", helloWorldServlet); 66 helloWorldJsp = jakartaDir.getFileObject("web/hello.jsp"); 67 assertNotNull("found hello.jsp", helloWorldJsp); 68 jakartaIndex = jakartaDir.getFileObject("web/index.html"); 69 assertNotNull("found index.html", jakartaIndex); 70 buildProperties = jakartaDir.getFileObject("build.properties"); 71 assertNotNull("found build.properties", buildProperties); 72 73 } 74 75 } 76 | Popular Tags |