You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by horyna <ph...@centrum.cz> on 2013/04/18 17:18:59 UTC

How to set mock for inner route?

Hello,

have a route:
from('direct:start').routeId(route1ID).to(direct:anotherRoute)
from('direct:anotherRoute').to('http://...').id('httpToID').unmarshall

Making test who calls route1ID route and will to replace httpToID route. How
to do this? Code below dont work :(

getCamelContext().getRouteDefinition('route1ID').adviceWith(getCamelContext(),
new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveById("httpToID").replace().to("mock:test");
            }
        });

tHx.




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-mock-for-inner-route-tp5731085.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to set mock for inner route?

Posted by Raul Kripalani <ra...@evosent.com>.
Could you post the stacktrace, please?

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Thu, Apr 18, 2013 at 4:34 PM, horyna <ph...@centrum.cz> wrote:

> Ok, i gave the secont route routeId(route2ID) and replace:
>
>
> getCamelContext().getRouteDefinition('route2ID').adviceWith(getCamelContext(),
> new AdviceWithRouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 weaveById("httpToID").replace().to("mock:test");
>             }
>         });
>
> and now become a NullPointerException, but camel before logs:
>
> Route: route2ID started and consuming from: Endpoint[direct:anotherRoute]
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-set-mock-for-inner-route-tp5731085p5731091.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to set mock for inner route?

Posted by horyna <ph...@centrum.cz>.
Ok, i gave the secont route routeId(route2ID) and replace: 

getCamelContext().getRouteDefinition('route2ID').adviceWith(getCamelContext(),
new AdviceWithRouteBuilder() { 
            @Override 
            public void configure() throws Exception { 
                weaveById("httpToID").replace().to("mock:test"); 
            } 
        }); 

and now become a NullPointerException, but camel before logs: 

Route: route2ID started and consuming from: Endpoint[direct:anotherRoute]



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-mock-for-inner-route-tp5731085p5731091.html
Sent from the Camel - Users mailing list archive at Nabble.com.