camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ascetic <kamne...@gmail.com>
Subject How to mock a predicate in existing route?
Date Wed, 18 Jun 2014 08:08:34 GMT
Hello. I have a route

from("direct:slr").routeId("slr")
                        .choice()
                            .when(slrBookPredicate()).id("slrBookPredicate")
                                .process(slrDBLogger()).id("slrDBLogger")
                                .beanRef("jmsSlrLogger",
"handle").id("jmsSlrLogger")
                            .otherwise()
                                .process(setNotFacingUs(SLR))
                                .choice()
                                   
.when(tpmtTradeListPredicate(slrTradeListDAO))
                                        .process(slrDBLogger())
                                        .beanRef("jmsSlrLogger", "handle")
                                 .otherwise()
                                    .process(slrFilteredLogger())
                                .endChoice()
                        .endChoice()
                .end();

And i need to write a unit test to test the flow. Here a part of my test
code

ModelCamelContext tempModelCamelContext = (ModelCamelContext) camelContext;
        RouteDefinition tempRouteDefinition =
tempModelCamelContext.getRouteDefinition("slr");
        tempRouteDefinition.adviceWith(tempModelCamelContext, new
AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                //weaveById("slrBookPredicate").replace(); //with
what??????? 
                weaveById("slrDBLogger").replace().bean(slrDBLogger); //mock
                weaveById("jmsSlrLogger").replace().bean(jmsSlrLogger);
            }
        });

I want to mock all used processors and predicates.
With processors everything works fine - i'm just replacing them the the
mocks. But when it comes to predicates i have a problems. How can i do that?
May be i should not replace them, and where is another solution exists?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-mock-a-predicate-in-existing-route-tp5752491.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message