@Test public void testDocumentReportingTask() throws InitializationException, IOException { FullyDocumentedReportingTask reportingTask = new FullyDocumentedReportingTask(); ReportingTaskingInitializer initializer = new ReportingTaskingInitializer(); initializer.initialize(reportingTask); DocumentationWriter writer = new HtmlDocumentationWriter(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); writer.write(reportingTask, baos, false); initializer.teardown(reportingTask); String results = new String(baos.toByteArray()); XmlValidator.assertXmlValid(results); assertContains(results, "A helper reporting task to do..."); assertContains(results, "first, second, third"); assertContains(results, "Show Deltas"); assertContains(results, "Specifies whether or not to show the difference in values between the current status and the previous status"); assertContains(results, "true"); assertContains(results, "false"); assertContains(results, "reporting task restriction description"); Assert.assertEquals(0, reportingTask.getOnRemovedArgs()); Assert.assertEquals(0, reportingTask.getOnRemovedNoArgs()); Assert.assertEquals(1, reportingTask.getOnShutdownArgs()); Assert.assertEquals(1, reportingTask.getOnShutdownNoArgs()); }
@Override public void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo, final boolean includesAdditionalDocumentation) throws IOException { try { XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( streamToWriteTo, "UTF-8"); xmlStreamWriter.writeDTD("<!DOCTYPE html>"); xmlStreamWriter.writeStartElement("html"); xmlStreamWriter.writeAttribute("lang", "en"); writeHead(configurableComponent, xmlStreamWriter); writeBody(configurableComponent, xmlStreamWriter, includesAdditionalDocumentation); xmlStreamWriter.writeEndElement(); xmlStreamWriter.close(); } catch (XMLStreamException | FactoryConfigurationError e) { throw new IOException("Unable to create XMLOutputStream", e); } }
HtmlDocumentationWriter implements DocumentationWriter { @Override public void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo, final boolean includesAdditionalDocumentation) throws IOException { try { XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( streamToWriteTo, "UTF-8"); xmlStreamWriter.writeDTD("<!DOCTYPE html>"); xmlStreamWriter.writeStartElement("html"); xmlStreamWriter.writeAttribute("lang", "en"); writeHead(configurableComponent, xmlStreamWriter); writeBody(configurableComponent, xmlStreamWriter, includesAdditionalDocumentation); xmlStreamWriter.writeEndElement(); xmlStreamWriter.close(); } catch (XMLStreamException | FactoryConfigurationError e) { throw new IOException("Unable to create XMLOutputStream", e); } } }
HtmlDocumentationWriter implements DocumentationWriter { @Override public void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo, final boolean includesAdditionalDocumentation) throws IOException { try { XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( streamToWriteTo, "UTF-8"); xmlStreamWriter.writeDTD("<!DOCTYPE html>"); xmlStreamWriter.writeStartElement("html"); xmlStreamWriter.writeAttribute("lang", "en"); writeHead(configurableComponent, xmlStreamWriter); writeBody(configurableComponent, xmlStreamWriter, includesAdditionalDocumentation); xmlStreamWriter.writeEndElement(); xmlStreamWriter.close(); } catch (XMLStreamException | FactoryConfigurationError e) { throw new IOException("Unable to create XMLOutputStream", e); } }  }
HtmlDocumentationWriter implements DocumentationWriter { @Override public void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo, final boolean includesAdditionalDocumentation) throws IOException { try { XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( streamToWriteTo, "UTF-8"); xmlStreamWriter.writeDTD("<!DOCTYPE html>"); xmlStreamWriter.writeStartElement("html"); xmlStreamWriter.writeAttribute("lang", "en"); writeHead(configurableComponent, xmlStreamWriter); writeBody(configurableComponent, xmlStreamWriter, includesAdditionalDocumentation); xmlStreamWriter.writeEndElement(); xmlStreamWriter.close(); } catch (XMLStreamException | FactoryConfigurationError e) { throw new IOException("Unable to create XMLOutputStream", e); } }  @Override void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo,
            final boolean includesAdditionalDocumentation); }
HtmlDocumentationWriter implements DocumentationWriter { @Override public void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo, final boolean includesAdditionalDocumentation) throws IOException { try { XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( streamToWriteTo, "UTF-8"); xmlStreamWriter.writeDTD("<!DOCTYPE html>"); xmlStreamWriter.writeStartElement("html"); xmlStreamWriter.writeAttribute("lang", "en"); writeHead(configurableComponent, xmlStreamWriter); writeBody(configurableComponent, xmlStreamWriter, includesAdditionalDocumentation); xmlStreamWriter.writeEndElement(); xmlStreamWriter.close(); } catch (XMLStreamException | FactoryConfigurationError e) { throw new IOException("Unable to create XMLOutputStream", e); } }  @Override void write(final ConfigurableComponent configurableComponent, final OutputStream streamToWriteTo,
            final boolean includesAdditionalDocumentation); static final String ADDITIONAL_DETAILS_HTML; }