use of javax.xml.transform.stream.StreamSource in project camel by apache.
the class XmlConverterTest method testToStreamSourceByByteArray.
public void testToStreamSourceByByteArray() throws Exception {
Exchange exchange = new DefaultExchange(context);
XmlConverter conv = new XmlConverter();
byte[] bytes = context.getTypeConverter().convertTo(byte[].class, "<foo>bar</foo>");
StreamSource out = conv.toStreamSource(bytes, exchange);
assertNotNull(out);
assertEquals("<foo>bar</foo>", conv.toString(out, null));
}
use of javax.xml.transform.stream.StreamSource in project camel by apache.
the class XmlConverterTest method testToStreamSourceBySaxSource.
public void testToStreamSourceBySaxSource() throws Exception {
XmlConverter conv = new XmlConverter();
SAXSource source = conv.toSAXSource("<foo>bar</foo>", null);
StreamSource out = conv.toStreamSource(source, null);
assertNotSame(source, out);
assertEquals("<foo>bar</foo>", conv.toString(out, null));
}
use of javax.xml.transform.stream.StreamSource in project camel by apache.
the class StreamCachingOnlyRouteTest method testStreamCachingPerRoute.
public void testStreamCachingPerRoute() throws Exception {
MockEndpoint c = getMockEndpoint("mock:c");
c.expectedMessageCount(1);
new StreamSource(new StringReader("A"));
template.sendBody("direct:c", new StreamSource(new StringReader("C")));
assertMockEndpointsSatisfied();
}
use of javax.xml.transform.stream.StreamSource in project camel by apache.
the class StreamSourceContentBasedRouterTest method testSendStreamSource.
public void testSendStreamSource() throws Exception {
x.expectedMessageCount(1);
y.expectedMessageCount(1);
sendBody("direct:start", new StreamSource(new StringReader("<message>xx</message>")));
sendBody("direct:start", new StreamSource(new StringReader("<message>yy</message>")));
assertMockEndpointsSatisfied();
}
use of javax.xml.transform.stream.StreamSource in project camel by apache.
the class JmsXMLRouteTest method testLondonWithFileStreamAsObject.
@Test
public void testLondonWithFileStreamAsObject() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:london");
mock.expectedMessageCount(1);
mock.message(0).body(String.class).contains("James");
Source source = new StreamSource(new FileInputStream(TEST_LONDON));
assertNotNull(source);
template.sendBody("direct:object", source);
assertMockEndpointsSatisfied();
}
Aggregations