Hi,

I tried to run the test with the trunk code, the tests are passed without any 
issue. What's the issue that you meet?
If you want to interceptSendToEndpoint, you need to make sure the uri string 
that you passed should be same with the endpoint.


-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Saturday, December 1, 2012 at 4:11 AM, lleclerc wrote:

> Hi,
> 
> This time I tried using http instead of http4.
> No exception, but the intercept is not working, even with isUseAdviceWith()
> to return true.
> 
> What is going on ?
> 
> using camel 2.10.2, and http 4.2.2.
> 
> Thank you in advance,
> 
> import org.apache.camel.Exchange;
> import org.apache.camel.Processor;
> import org.apache.camel.builder.AdviceWithRouteBuilder;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
> 
> /**
> * Created with IntelliJ IDEA.
> * User: lleclerc
> * Date: 12-11-28
> * Time: 16:34
> * To change this template use File | Settings | File Templates.
> */
> public class IsUseAdviceWithJUnit4Test extends CamelTestSupport {
> 
> private String providerEndPointURI = "http://stackoverflow.com";;
> private String timerEndPointURI = "timer://myTimer";
> private String mockEndPointURI = "mock:myMock";
> private String directEndPointURI = "direct:myDirect";
> 
> @Override
> protected RouteBuilder createRouteBuilder() throws Exception {
> 
> return new RouteBuilder() {
> @Override
> public void configure() throws Exception {
> 
> from(timerEndPointURI +
> "?fixedRate=true&delay=1000&period=1000")
> .to(providerEndPointURI +
> "?throwExceptionOnFailure=false")
> .to(mockEndPointURI);
> }
> };
> }
> 
> @Test
> public void testIsUseAdviceWith() throws Exception {
> 
> context.getRouteDefinitions().get(0).adviceWith(context, new
> AdviceWithRouteBuilder() {
> @Override
> public void configure() throws Exception {
> 
> replaceFromWith(directEndPointURI);
> 
> mockEndpoints();
> 
> interceptSendToEndpoint(providerEndPointURI)
> .process(new Processor() {
> @Override
> public void process(Exchange exchange) throws
> Exception {
> System.out.println("INTERCEPTED");
> }
> })
> .skipSendToOriginalEndpoint();
> }
> });
> 
> // we must manually start when we are done with all the advice with
> context.start();
> 
> getMockEndpoint(mockEndPointURI).expectedMessageCount(1);
> 
> template.sendBody(directEndPointURI, "a trigger");
> 
> assertMockEndpointsSatisfied();
> 
> assertNotNull(context.hasEndpoint(directEndPointURI));
> assertNotNull(context.hasEndpoint("mock:" + directEndPointURI));
> 
> assertNotNull(context.hasEndpoint(mockEndPointURI));
> }
> 
> @Override
> public boolean isUseAdviceWith() {
> return true;
> }
> 
> @Override
> public boolean isUseRouteBuilder() {
> return true;
> }
> }
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Test-Intercept-with-adviceWith-and-http-tp5723473.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).



Reply via email to