@Test public void testLoadExists() { OverrideSource overrideSource = OverrideSources.classpath("io/helidon/config/overrides.properties") .build(); Optional<OverrideContent> overrideContent = overrideSource.load(); Optional<OverrideSource.OverrideData> objectNode = overrideContent.map(OverrideContent::data); assertThat(objectNode, notNullValue()); assertThat(objectNode.isPresent(), is(true)); }
@Override public Optional<OverrideContent> load() throws ConfigException { if (null == resourceUrl) { return Optional.empty(); } InputStream inputStream; try { inputStream = resourceUrl.openStream(); } catch (IOException e) { throw new ConfigException("Failed to read configuration from classpath, resource: " + resource, e); } OverrideData data = OverrideData.create(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); return Optional.of(OverrideContent.builder() .data(data) .build()); }
ClasspathOverrideSource extends AbstractSource implements OverrideSource { @Override public Optional<OverrideContent> load() throws ConfigException { if (null == resourceUrl) { return Optional.empty(); } InputStream inputStream; try { inputStream = resourceUrl.openStream(); } catch (IOException e) { throw new ConfigException("Failed to read configuration from classpath, resource: " + resource, e); } OverrideData data = OverrideData.create(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); return Optional.of(OverrideContent.builder() .data(data) .build()); } }
ClasspathOverrideSource extends AbstractSource implements OverrideSource { @Override public Optional<OverrideContent> load() throws ConfigException { if (null == resourceUrl) { return Optional.empty(); } InputStream inputStream; try { inputStream = resourceUrl.openStream(); } catch (IOException e) { throw new ConfigException("Failed to read configuration from classpath, resource: " + resource, e); } OverrideData data = OverrideData.create(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); return Optional.of(OverrideContent.builder() .data(data) .build()); } ClasspathOverrideSource(Builder builder); }
ClasspathOverrideSource extends AbstractSource implements OverrideSource { @Override public Optional<OverrideContent> load() throws ConfigException { if (null == resourceUrl) { return Optional.empty(); } InputStream inputStream; try { inputStream = resourceUrl.openStream(); } catch (IOException e) { throw new ConfigException("Failed to read configuration from classpath, resource: " + resource, e); } OverrideData data = OverrideData.create(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); return Optional.of(OverrideContent.builder() .data(data) .build()); } ClasspathOverrideSource(Builder builder); @Override Optional<OverrideContent> load(); static ClasspathOverrideSource create(Config config); static Builder builder(); }
ClasspathOverrideSource extends AbstractSource implements OverrideSource { @Override public Optional<OverrideContent> load() throws ConfigException { if (null == resourceUrl) { return Optional.empty(); } InputStream inputStream; try { inputStream = resourceUrl.openStream(); } catch (IOException e) { throw new ConfigException("Failed to read configuration from classpath, resource: " + resource, e); } OverrideData data = OverrideData.create(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); return Optional.of(OverrideContent.builder() .data(data) .build()); } ClasspathOverrideSource(Builder builder); @Override Optional<OverrideContent> load(); static ClasspathOverrideSource create(Config config); static Builder builder();  }