@Test void loadFromFileSetsBaseDir() throws Exception { File file = File.createTempFile("redpen-conf", ".xml"); file.deleteOnExit(); try (OutputStream out = new FileOutputStream(file)) { out.write("<redpen-conf/>".getBytes()); } Configuration config = new ConfigurationLoader().load(file); assertEquals(file.getParentFile(), config.getBase()); }
public Configuration load(File configFile) throws RedPenException { LOG.info("Loading config from specified config file: \"{}\"", configFile.getAbsolutePath()); try (InputStream fis = new FileInputStream(configFile)) { return this.load(fis, configFile.getParentFile()); } catch (IOException e) { throw new RedPenException(e); } }
ConfigurationLoader { public Configuration load(File configFile) throws RedPenException { LOG.info("Loading config from specified config file: \"{}\"", configFile.getAbsolutePath()); try (InputStream fis = new FileInputStream(configFile)) { return this.load(fis, configFile.getParentFile()); } catch (IOException e) { throw new RedPenException(e); } } }
ConfigurationLoader { public Configuration load(File configFile) throws RedPenException { LOG.info("Loading config from specified config file: \"{}\"", configFile.getAbsolutePath()); try (InputStream fis = new FileInputStream(configFile)) { return this.load(fis, configFile.getParentFile()); } catch (IOException e) { throw new RedPenException(e); } }  }
ConfigurationLoader { public Configuration load(File configFile) throws RedPenException { LOG.info("Loading config from specified config file: \"{}\"", configFile.getAbsolutePath()); try (InputStream fis = new FileInputStream(configFile)) { return this.load(fis, configFile.getParentFile()); } catch (IOException e) { throw new RedPenException(e); } }  Configuration load(File configFile); Configuration loadFromResource(String resourcePath); Configuration loadFromResource(String resourcePath, File base); Configuration loadFromString(String configString); Configuration loadFromString(String configString, File base); Configuration load(InputStream stream); Configuration load(InputStream stream, File base); ConfigurationLoader secure(); }
ConfigurationLoader { public Configuration load(File configFile) throws RedPenException { LOG.info("Loading config from specified config file: \"{}\"", configFile.getAbsolutePath()); try (InputStream fis = new FileInputStream(configFile)) { return this.load(fis, configFile.getParentFile()); } catch (IOException e) { throw new RedPenException(e); } }  Configuration load(File configFile); Configuration loadFromResource(String resourcePath); Configuration loadFromResource(String resourcePath, File base); Configuration loadFromString(String configString); Configuration loadFromString(String configString, File base); Configuration load(InputStream stream); Configuration load(InputStream stream, File base); ConfigurationLoader secure();  }