public void start() throws Exception { webRoot = FileUtil.createTempDirectory("jodd-http", "test"); webRoot.deleteOnExit(); // web-inf File webInfFolder = new File(webRoot, "WEB-INF"); webInfFolder.mkdir(); // web.xml URL webXmlUrl = TestServer.class.getResource("web.xml"); File webXmlFile = FileUtil.toFile(webXmlUrl); FileUtil.copy(webXmlFile, webInfFolder); // lib folder File libFolder = new File(webInfFolder, "lib"); libFolder.mkdir(); // classes File classes = new File(webInfFolder, "classes/jodd/http"); classes.mkdirs(); URL echoServletUrl = TestServer.class.getResource("EchoServlet.class"); File echoServletFile = FileUtil.toFile(echoServletUrl); FileUtil.copyFileToDir(echoServletFile, classes); echoServletUrl = TestServer.class.getResource("Echo2Servlet.class"); echoServletFile = FileUtil.toFile(echoServletUrl); FileUtil.copyFileToDir(echoServletFile, classes); }
protected void prepareWebApplication() throws Exception { webRoot = FileUtil.createTempDirectory("jodd-madvoc", "test-int"); webRoot.deleteOnExit(); // web-inf File webInfFolder = new File(webRoot, "WEB-INF"); webInfFolder.mkdir(); // web.xml URL webXmlUrl = TestServer.class.getResource("web-test-int.xml"); File webXmlFile = FileUtil.toFile(webXmlUrl); FileUtil.copyFile(webXmlFile, new File(webInfFolder, "web.xml")); // jsp File jspFolder = new File(webXmlFile.getParent(), "jsp"); FileUtil.copyDir(jspFolder, webRoot); // lib folder File libFolder = new File(webInfFolder, "lib"); libFolder.mkdir(); // classes File classes = new File(webInfFolder, "classes"); classes.mkdirs(); // classes/madvoc.props URL madvocPropsUrl = TestServer.class.getResource("madvoc.props"); File madvocPropsFile = FileUtil.toFile(madvocPropsUrl); FileUtil.copyFileToDir(madvocPropsFile, classes); }