You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@yahoo.com> on 2014/06/18 17:56:25 UTC
Intercept - Log Message EIP for testing
Hello All,
I am writing a Camel Context test and I want to intercept a logging endpoint
to verify that a message is being logged. Here is a snippet from my route:
<camel:choice>
<camel:when>
<camel:method bean="accessControlProcessor" method="authorize" />
<camel:log message="access control returned true"/>
</camel:when>
<camel:otherwise>
<camel:log message="access control returned false"/>
</camel:otherwise>
</camel:choice>
I want to intercept this log:
<camel:log message="access control returned true"/>
I tried this but couldn't get it to work:
context.getRouteDefinition("myRoute").adviceWith(context, new
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
interceptSendToEndpoint("log*").to("mock:accessControlLog");
}
});
However, my 'mock:accessControlLog' does not receive any messages. I know I
can call a 'direct' endpoint and then intercept that direct endpoint, but I
would prefer not to do that.
Is there any way to intercept or mock the log message instead?
Thanks,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Intercept-Log-Message-EIP-for-testing-tp5752513.html
Sent from the Camel - Users mailing list archive at Nabble.com.