@Test public void sampleConfig() { final StandaloneConfig config = ConfigReader.parse(ConfigReaderTest.class.getResourceAsStream("/simplepush-config.json")); assertThat(config.simplePushServerConfig().host(), equalTo("0.0.0.0")); assertThat(config.simplePushServerConfig().port(), is(7777)); assertThat(config.simplePushServerConfig().password(), is(notNullValue())); assertThat(config.dataStore(), is(instanceOf(InMemoryDataStore.class))); }
public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(); } } }
ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(); } } } }
ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(); } } } private  ConfigReader(); }
ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(); } } } private  ConfigReader(); static StandaloneConfig parse(final String fileName); static StandaloneConfig parse(final InputStream in); }
ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(); } } } private  ConfigReader(); static StandaloneConfig parse(final String fileName); static StandaloneConfig parse(final InputStream in);  }