/** * This template method called from the {@link #setUp()} to populate virtual server content. * The default implementation tries to load web content from directory pointed by the System property * "webroot" or same property from the "/webapp.properties" file. */ protected void setupWebContent() { String webappDirectory = System.getProperty("webroot"); File webFile = null; if (null == webappDirectory) { URL resource = this.getClass().getResource("/webapp.properties"); if (null != resource && "file".equals(resource.getProtocol())) { Properties webProperties = new Properties(); try { InputStream inputStream = resource.openStream(); webProperties.load(inputStream); inputStream.close(); webFile = new File(resource.getPath()); webFile = new File(webFile.getParentFile(), webProperties.getProperty("webroot")).getAbsoluteFile(); facesServer.addResourcesFromDirectory("/", webFile); } catch (IOException e) { throw new TestException(e); } } } else { webFile = new File(webappDirectory); facesServer.addResourcesFromDirectory("/", webFile); } }
/** * This template method called from the {@link #setUp()} to populate virtual server content. * The default implementation tries to load web content from directory pointed by the System property * "webroot" or same property from the "/webapp.properties" file. */ protected void setupWebContent() { String webappDirectory = System.getProperty("webroot"); File webFile = null; if (null == webappDirectory) { URL resource = this.getClass().getResource("/webapp.properties"); if (null != resource && "file".equals(resource.getProtocol())) { Properties webProperties = new Properties(); try { InputStream inputStream = resource.openStream(); webProperties.load(inputStream); inputStream.close(); webFile = new File(resource.getPath()); webFile = new File(webFile.getParentFile(), webProperties.getProperty("webroot")).getAbsoluteFile(); facesServer.addResourcesFromDirectory("/", webFile); } catch (IOException e) { throw new TestException(e); } } } else { webFile = new File(webappDirectory); facesServer.addResourcesFromDirectory("/", webFile); } }