Details
Description
I have the following route definition:
from("direct:billing_" + operation) .routeId(getRouteId(operation)) .errorHandler(noErrorHandler()) // propagate exceptions to the parent route .validate(body().isInstanceOf( com.cleverlance.cleverbss.integration.modules.in.customer.model.Customer.class)) .beanRef(BILLING_CUSTOMER_ROUTE_BEAN, "createRequestFor" + WordUtils.capitalize(operation)) // SetCustomer -> XML .marshal(jaxbIn) .doTry() .to(uri + "?messageSender=#billingSender").id("toURI") .doCatch(AlreadyExistsException.class) .setProperty(exPropertyName, property(Exchange.EXCEPTION_CAUGHT)) .end() .choice() .when(property(exPropertyName).isNull()) // XML -> SetCustomerResponse .unmarshal(jaxbOut) .endChoice();
And I would like to replace TO in the tests:
getCamelContext().getRouteDefinition(BillingCustomerRoutes.ROUTE_ID_UPDATE_CUSTOMER) .adviceWith(getCamelContext(), new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { weaveByType(ToDefinition.class).replace().process(new Processor() { @Override public void process(Exchange exchange) throws Exception { throw new AlreadyExistsException("msg", new AlreadyExists()); } }); } });
When I use weaveById("toURI") or weaveByToString(), it doesn't work neither.