@Test public void testSimpleArray() throws IOException { OutputStream out = new ByteArrayOutputStream(); RecordSet recordSet = getRecordWithSimpleArray(TestWriteXMLResultUtils.NullValues.WITHOUT_NULL); WriteXMLResult writer = new WriteXMLResult(Mockito.mock(ComponentLog.class), recordSet.getSchema(), new SchemaNameAsAttribute(), out, true, ALWAYS_SUPPRESS, NO_WRAPPING, null, "ROOT", "PERSON", "UTF-8", DATE_FORMAT, TIME_FORMAT, TIMESTAMP_FORMAT); writer.write(recordSet); writer.flush(); String xmlResult = "<ROOT><PERSON><CHILDREN>Tom</CHILDREN><CHILDREN>Anna</CHILDREN><CHILDREN>Ben</CHILDREN>" + "<NAME>Cleve Butler</NAME><AGE>42</AGE><COUNTRY>USA</COUNTRY></PERSON>" + "<PERSON><CHILDREN>Tom</CHILDREN><CHILDREN>Anna</CHILDREN><CHILDREN>Ben</CHILDREN>" + "<NAME>Ainslie Fletcher</NAME><AGE>33</AGE><COUNTRY>UK</COUNTRY></PERSON></ROOT>"; assertThat(xmlResult, CompareMatcher.isSimilarTo(out.toString()).ignoreWhitespace().withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); }
@Override public void flush() throws IOException { try { writer.flush(); } catch (XMLStreamException e) { throw new IOException(e.getMessage()); } }
WriteXMLResult extends AbstractRecordSetWriter implements RecordSetWriter, RawRecordWriter { @Override public void flush() throws IOException { try { writer.flush(); } catch (XMLStreamException e) { throw new IOException(e.getMessage()); } } }
WriteXMLResult extends AbstractRecordSetWriter implements RecordSetWriter, RawRecordWriter { @Override public void flush() throws IOException { try { writer.flush(); } catch (XMLStreamException e) { throw new IOException(e.getMessage()); } } WriteXMLResult(final ComponentLog logger, final RecordSchema recordSchema, final SchemaAccessWriter schemaAccess, final OutputStream out, final boolean prettyPrint,
                          final NullSuppression nullSuppression, final ArrayWrapping arrayWrapping, final String arrayTagName, final String rootTagName, final String recordTagName,
                          final String charSet, final String dateFormat, final String timeFormat, final String timestampFormat); }
WriteXMLResult extends AbstractRecordSetWriter implements RecordSetWriter, RawRecordWriter { @Override public void flush() throws IOException { try { writer.flush(); } catch (XMLStreamException e) { throw new IOException(e.getMessage()); } } WriteXMLResult(final ComponentLog logger, final RecordSchema recordSchema, final SchemaAccessWriter schemaAccess, final OutputStream out, final boolean prettyPrint,
                          final NullSuppression nullSuppression, final ArrayWrapping arrayWrapping, final String arrayTagName, final String rootTagName, final String recordTagName,
                          final String charSet, final String dateFormat, final String timeFormat, final String timestampFormat); @Override void close(); @Override void flush(); @Override WriteResult writeRawRecord(Record record); @Override String getMimeType(); }
WriteXMLResult extends AbstractRecordSetWriter implements RecordSetWriter, RawRecordWriter { @Override public void flush() throws IOException { try { writer.flush(); } catch (XMLStreamException e) { throw new IOException(e.getMessage()); } } WriteXMLResult(final ComponentLog logger, final RecordSchema recordSchema, final SchemaAccessWriter schemaAccess, final OutputStream out, final boolean prettyPrint,
                          final NullSuppression nullSuppression, final ArrayWrapping arrayWrapping, final String arrayTagName, final String rootTagName, final String recordTagName,
                          final String charSet, final String dateFormat, final String timeFormat, final String timestampFormat); @Override void close(); @Override void flush(); @Override WriteResult writeRawRecord(Record record); @Override String getMimeType();  }