I have the following route:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:topic:inbox" />
<log message="To: ${in.header.recipients}" />
<to uri="bean:myLogger" />
</route>
</camelContext>
bean:myLogger is my custom processor for formatting the log messages I am
getting. The process method in my custom processor simply calls a private
method that appends the type of message (e.g. CC) and the recipients' email.
I am struggling to see how to test the actual resulting logs. I am using
CamelSpringTestSupportand I am OK when it comes to testing the myLogger
endpoint:
@Produce(uri = "activemq:topic:inbox")
protected ProducerTemplate template;
@Override
protected AbstractApplicationContext createApplicationContext() {
return new
ClassPathXmlApplicationContext("file:src/main/resources/my-camel-context.xml");
}
@Test
public void testLogEndpoint() throws Exception {
String body = "Hello World";
template.sendBody("activemq:topic:inbox", body);
LOG.info("This is the message body we sent {} ", body);
}
However, I am not really sure how to test the format of the returned logs.
Do I send the email of the recipients in a similar fashion as the example
above? But then how do I check whether the format is the correct one? I am
really looking more for the approach than the actual solution.
Thank you so much for your help,
--
View this message in context:
http://camel.465427.n5.nabble.com/Help-in-testing-a-custom-processor-tp5789934.html
Sent from the Camel Development mailing list archive at Nabble.com.