camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ychawla <premiergenerat...@yahoo.com>
Subject Intercept - Log Message EIP for testing
Date Wed, 18 Jun 2014 15:56:25 GMT
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.

Mime
View raw message