@Test void parseConfigFileProperties() throws URISyntaxException { val path = Paths.get(toUri("testdata/cli/correct.conf")); Properties properties = null; try { properties = Config.parseConfigFileProperties(path); } catch (RunnerException e) { fail(e); } assertEquals("keystore123.p12", properties.getProperty("keyStorePath")); assertEquals("example123", properties.getProperty("keyStorePass")); assertEquals("pass123", properties.getProperty("keyPass")); assertEquals("truststore123.p12", properties.getProperty("trustStorePath")); assertEquals("otherpass123", properties.getProperty("trustStorePass")); assertEquals("jks", properties.getProperty("keyStoreType")); assertEquals("other_alias", properties.getProperty("keyAlias")); assertEquals("unix:/tmp/test", properties.getProperty("spiffeSocketPath")); }
static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } private  Config(); }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } private  Config();  }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } private  Config();   }