public void routeInOutToCamelUsingMessageComposer() throws Exception {
bindingModel = mock(CamelBindingModel.class);
when(bindingModel.getComponentURI()).thenReturn(URI.create("direct:MessageComposerService"));
when(bindingModel.getName()).thenReturn("mockOutputHandler");
when(bindingModel.getReference()).thenReturn(referenceModel);
MessageComposer<CamelBindingData> myMessageComposer = new CamelMessageComposer() {
@Override
public CamelBindingData decompose(Exchange exchange, CamelBindingData target) throws Exception {
exchange.getContext().setProperty("decomposeInvoked", true, Scope.EXCHANGE);
return super.decompose(exchange, target);
}
@Override
public Message compose(CamelBindingData source, Exchange exchange) throws Exception {
exchange.getContext().setProperty("composeInvoked", true, Scope.EXCHANGE);
return super.compose(source, exchange);
}
};
myMessageComposer.setContextMapper(new CamelContextMapper());
QName serviceName = new QName(_serviceDomain.getName().getNamespaceURI(), "MessageComposerService");
_serviceDomain.registerService(serviceName,
new InOutService(),
new OutboundHandler(bindingModel, (SwitchYardCamelContext) context, myMessageComposer, _serviceDomain) {
{