ProvideAndRegisterDocumentSet extends XdsCommon { static OMText getBinaryNode(OMElement document) { Iterator<OMNode> childrenIterator = document.getChildren(); while (childrenIterator.hasNext()) { OMNode container = childrenIterator.next(); if (container instanceof OMText && StringUtils.isNotBlank(((OMText)container).getText())) { return (OMText)container; } } return null; } ProvideAndRegisterDocumentSet(LogMessage log_message, short xds_version, MessageContext messageContext); OMElement provideAndRegisterDocumentSet(OMElement pnr, ContentValidationService validater); void setRegistryEndPoint(String endpoint);  }
@Test public void testWhitespaceBeforeDocument() throws IOException, XMLStreamException { String message = IOUtils.toString(ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/submit_document.xml")); String documentString = IOUtils.toString(ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/referral_summary.xml")); message = message.replace("$XDSDocumentEntry.uniqueId", "2.16.840.1.113883.3.65.2." + System.currentTimeMillis()); message = message.replace("$XDSSubmissionSet.uniqueId", "1.3.6.1.4.1.21367.2009.1.2.108." + System.currentTimeMillis()); for (Boolean includeWhitespace : new Boolean[] { false, true }) { OMElement request = OMUtil.xmlStringToOM(message); request = addOneDocument(request, documentString, "doc1", includeWhitespace); for (OMElement document : MetadataSupport.childrenWithLocalName(request, "Document")) { OMText text = ProvideAndRegisterDocumentSet.getBinaryNode(document); assertTrue("Blank document. Included whitespace: " + includeWhitespace, StringUtils.isNotBlank(text.getText())); } } }