use of org.apache.camel.StringSource in project camel by apache.
the class LogDebugBodyStreamsTest method testLogBodyStreamStringSourceEnabled.
public void testLogBodyStreamStringSourceEnabled() throws Exception {
context.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true");
StringSource body = new StringSource("<?xml version=\"1.0\"?><person><name>Claus</name></person>");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("direct:start", body);
assertMockEndpointsSatisfied();
// should be logged anyway
TraceExchangeFormatter myFormatter = context.getRegistry().lookupByNameAndType("logFormatter", TraceExchangeFormatter.class);
String msg = myFormatter.getMessage();
assertTrue(msg.endsWith("Body: <?xml version=\"1.0\"?><person><name>Claus</name></person>]"));
}
use of org.apache.camel.StringSource in project camel by apache.
the class MultiCastParallelAndStreamCachingTest method testSourceCache.
public void testSourceCache() throws Exception {
String input = "<A>a</A>";
MockEndpoint mock = getMockEndpoint("mock:resulta");
mock.expectedBodiesReceived(input);
mock = getMockEndpoint("mock:resultb");
mock.expectedBodiesReceived(input);
StringSource ss = new StringSource(input);
SAXSource saxSource = new SAXSource(SAXSource.sourceToInputSource(ss));
template.sendBody("direct:start", saxSource);
assertMockEndpointsSatisfied();
}
use of org.apache.camel.StringSource in project camel by apache.
the class ValidatingProcessorTest method testStringSourceMessage.
public void testStringSourceMessage() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:valid");
mock.expectedMessageCount(1);
String xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" + "<user xmlns=\"http://foo.com/bar\">" + " <id>1</id>" + " <username>davsclaus</username>" + "</user>";
template.sendBody("direct:start", new StringSource(xml));
assertMockEndpointsSatisfied();
}
use of org.apache.camel.StringSource in project camel by apache.
the class StreamSourceContentBasedRouterTest method testSendStringSource.
public void testSendStringSource() throws Exception {
x.expectedMessageCount(1);
y.expectedMessageCount(1);
sendBody("direct:start", new StringSource("<message>xx</message>"));
sendBody("direct:start", new StringSource("<message>yy</message>"));
assertMockEndpointsSatisfied();
}
Aggregations