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 

        final Predicate successPredicate = createMock(Predicate.class);
       
expect(successPredicate.matches(anyObject(Exchange.class))).andReturn(true);

        final Processor slrDBLogger = createMock(Processor.class);
        slrDBLogger.process(anyObject(Exchange.class));

        final IMessageHandler<DocumentMessage> jmsSlrLogger =
createMock(IMessageHandler.class);
        jmsSlrLogger.handle(message);
.........
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/Mocking-predicate-in-existing-camel-route-tp5752497.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to