@Test public void testLoadExists() { OverrideSource overrideSource = OverrideSources.file(getDir() + "io/helidon/config/overrides.properties") .build(); Optional<OverrideSource.OverrideData> configNode = overrideSource.load() .map(ConfigContent.OverrideContent::data); assertThat(configNode, notNullValue()); assertThat(configNode.isPresent(), is(true)); }
@Override public Optional<ConfigContent.OverrideContent> load() throws ConfigException { LOGGER.log(Level.FINE, String.format("Getting content from '%s'.", filePath)); return FileSourceHelper.readDataAndDigest(filePath) .map(dad -> ConfigContent.OverrideContent.builder() .data(OverrideData.create(new InputStreamReader(new ByteArrayInputStream(dad.data()), StandardCharsets.UTF_8))) .stamp(dad.digest()) .build()); }
FileOverrideSource extends AbstractSource implements OverrideSource, PollableSource<byte[]>, WatchableSource<Path> { @Override public Optional<ConfigContent.OverrideContent> load() throws ConfigException { LOGGER.log(Level.FINE, String.format("Getting content from '%s'.", filePath)); return FileSourceHelper.readDataAndDigest(filePath) .map(dad -> ConfigContent.OverrideContent.builder() .data(OverrideData.create(new InputStreamReader(new ByteArrayInputStream(dad.data()), StandardCharsets.UTF_8))) .stamp(dad.digest()) .build()); } }
FileOverrideSource extends AbstractSource implements OverrideSource, PollableSource<byte[]>, WatchableSource<Path> { @Override public Optional<ConfigContent.OverrideContent> load() throws ConfigException { LOGGER.log(Level.FINE, String.format("Getting content from '%s'.", filePath)); return FileSourceHelper.readDataAndDigest(filePath) .map(dad -> ConfigContent.OverrideContent.builder() .data(OverrideData.create(new InputStreamReader(new ByteArrayInputStream(dad.data()), StandardCharsets.UTF_8))) .stamp(dad.digest()) .build()); } FileOverrideSource(Builder builder); }
FileOverrideSource extends AbstractSource implements OverrideSource, PollableSource<byte[]>, WatchableSource<Path> { @Override public Optional<ConfigContent.OverrideContent> load() throws ConfigException { LOGGER.log(Level.FINE, String.format("Getting content from '%s'.", filePath)); return FileSourceHelper.readDataAndDigest(filePath) .map(dad -> ConfigContent.OverrideContent.builder() .data(OverrideData.create(new InputStreamReader(new ByteArrayInputStream(dad.data()), StandardCharsets.UTF_8))) .stamp(dad.digest()) .build()); } FileOverrideSource(Builder builder); @Override boolean exists(); @Override Optional<ConfigContent.OverrideContent> load(); @Override boolean isModified(byte[] stamp); @Override Optional<PollingStrategy> pollingStrategy(); @Override Path target(); @Override Optional<ChangeWatcher<Object>> changeWatcher(); @Override Class<Path> targetType(); static FileOverrideSource create(Config metaConfig); static Builder builder(); }
FileOverrideSource extends AbstractSource implements OverrideSource, PollableSource<byte[]>, WatchableSource<Path> { @Override public Optional<ConfigContent.OverrideContent> load() throws ConfigException { LOGGER.log(Level.FINE, String.format("Getting content from '%s'.", filePath)); return FileSourceHelper.readDataAndDigest(filePath) .map(dad -> ConfigContent.OverrideContent.builder() .data(OverrideData.create(new InputStreamReader(new ByteArrayInputStream(dad.data()), StandardCharsets.UTF_8))) .stamp(dad.digest()) .build()); } FileOverrideSource(Builder builder); @Override boolean exists(); @Override Optional<ConfigContent.OverrideContent> load(); @Override boolean isModified(byte[] stamp); @Override Optional<PollingStrategy> pollingStrategy(); @Override Path target(); @Override Optional<ChangeWatcher<Object>> changeWatcher(); @Override Class<Path> targetType(); static FileOverrideSource create(Config metaConfig); static Builder builder();  }