use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class ConfigurationDigesterTest method simpleXsdWithDefaultAndFixedAttributed.
@Test
public void simpleXsdWithDefaultAndFixedAttributed() throws Exception {
URL schemaURL = TestFileUtils.getTestFileURL("/Digester/resolveDefaultAttribute.xsd");
ValidatorHandler validatorHandler = XmlUtils.getValidatorHandler(schemaURL);
XmlWriter writer = new XmlWriter();
validatorHandler.setContentHandler(writer);
validatorHandler.setErrorHandler(new XmlErrorHandler());
Resource resource = Resource.getResource("/Digester/resolveAttributes.xml");
XmlUtils.parseXml(resource, validatorHandler);
assertEquals("<note one=\"1\" two=\"2\"/>", writer.toString().trim());
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class ConfigurationDigesterTest method stub4testtoolTest.
@Test
public void stub4testtoolTest() throws Exception {
String baseDirectory = "/ConfigurationUtils/stub4testtool/FullAdapter";
StringWriter target = new StringWriter();
XmlWriter xmlWriter = new XmlWriter(target);
Properties properties = new Properties();
properties.setProperty(STUB4TESTTOOL_CONFIGURATION_KEY, "true");
properties.setProperty(STUB4TESTTOOL_VALIDATORS_DISABLED_KEY, Boolean.toString(false));
String originalConfiguration = TestFileUtils.getTestFile(baseDirectory + "/original.xml");
ConfigurationDigester digester = new ConfigurationDigester();
ContentHandler filter = digester.getStub4TesttoolContentHandler(xmlWriter, properties);
XmlUtils.parseXml(originalConfiguration, filter);
String actual = new String(target.toString());
String expectedConfiguration = TestFileUtils.getTestFile(baseDirectory + "/expected.xml");
MatchUtils.assertXmlEquals(expectedConfiguration, actual);
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class SoapWrapperTest method replaceDynamicElements.
private String replaceDynamicElements(Message soapBody) throws Exception {
XmlWriter writer = new XmlWriter();
RemoveDynamicElements handler = new RemoveDynamicElements(writer);
XmlUtils.parseXml(soapBody.asInputSource(), handler);
return writer.toString();
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class XmlWriterTest method testToStream.
@Test
public void testToStream() throws Exception {
ByteArrayOutputStream target = new ByteArrayOutputStream();
XmlWriter xmlWriter = new XmlWriter(target);
sendEvents(xmlWriter);
String actual = new String(target.toString(StreamUtil.DEFAULT_INPUT_STREAM_ENCODING));
assertEquals(testString, actual);
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class XmlTapTest method testBasic.
@Test
public void testBasic() throws Exception {
String input = TestFileUtils.getTestFile("/Xslt/AnyXml/in.xml");
String expected = input;
XmlWriter xmlWriter = new XmlWriter();
XmlTap xmlTap = new XmlTap(xmlWriter);
XmlUtils.parseXml(input, xmlTap);
assertEquals(expected, xmlWriter.toString());
assertEquals(expected, xmlTap.getWriter().toString());
}
Aggregations