@Test public void testWriteIndexYaml() throws Exception { InputStream expected = getClass().getResourceAsStream("indexresult.yaml"); StringWriter writer = new StringWriter(); IOUtils.copy(expected, writer); String expectedResult = writer.toString(); OutputStream os = new ByteArrayOutputStream(); underTest.write(os, createChartIndex()); assertThat(os, is(notNullValue())); assertEquals(StringUtils.normalizeSpace(os.toString()), StringUtils.normalizeSpace(expectedResult)); }
public void write(final OutputStream os, final ChartIndex index) { try (OutputStreamWriter writer = new OutputStreamWriter(os)) { String result = getYamlContent(index); writer.write(result); } catch (IOException ex) { log.error("Unable to write to OutputStream for index.yaml", ex); } }
YamlParser extends ComponentSupport { public void write(final OutputStream os, final ChartIndex index) { try (OutputStreamWriter writer = new OutputStreamWriter(os)) { String result = getYamlContent(index); writer.write(result); } catch (IOException ex) { log.error("Unable to write to OutputStream for index.yaml", ex); } } }
YamlParser extends ComponentSupport { public void write(final OutputStream os, final ChartIndex index) { try (OutputStreamWriter writer = new OutputStreamWriter(os)) { String result = getYamlContent(index); writer.write(result); } catch (IOException ex) { log.error("Unable to write to OutputStream for index.yaml", ex); } }  }
YamlParser extends ComponentSupport { public void write(final OutputStream os, final ChartIndex index) { try (OutputStreamWriter writer = new OutputStreamWriter(os)) { String result = getYamlContent(index); writer.write(result); } catch (IOException ex) { log.error("Unable to write to OutputStream for index.yaml", ex); } }  Map<String, Object> load(InputStream is); String getYamlContent(final ChartIndex index); void write(final OutputStream os, final ChartIndex index); }
YamlParser extends ComponentSupport { public void write(final OutputStream os, final ChartIndex index) { try (OutputStreamWriter writer = new OutputStreamWriter(os)) { String result = getYamlContent(index); writer.write(result); } catch (IOException ex) { log.error("Unable to write to OutputStream for index.yaml", ex); } }  Map<String, Object> load(InputStream is); String getYamlContent(final ChartIndex index); void write(final OutputStream os, final ChartIndex index);  }