Not able to access route elements in test when using a camel filter

12 Views Asked by At

I have camel route definition as below:

  from(source).routeId("source processor")       
                .filter(liabilityMessageFilter)
                .log(LoggingLevel.INFO, LOGGER, "Some log")
                .process("myMessageProcessor");

and I have a test to check route defininiton:

@Test
public void myTest() {
    ModelCamelContext mcc = camelContext.adapt(ModelCamelContext.class);
    final List<RouteDefinition> routeDefinitions = mcc.getRouteDefinitions();
  

    assertThat(((LogDefinition) routeDefinitions.get(0).getOutputs().get(1)).getMessage(), is("some log"));
}

Problem is routeDefinitions.get(0).getOutputs() returns only filter object but not the rest. But if I change order of filter and log in route definition it works. I cannot reach rest of the route element with this given route definition above ? What is the reason for it and if I am doing something wrong ?

For ex: if I do not have filter, routeDefinitions.get(0).getOutputs() returns log and process elements.

0

There are 0 best solutions below