Package org.switchyard.component.camel.common.composer

Examples of org.switchyard.component.camel.common.composer.CamelMessageComposer


    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) {
            {
View Full Code Here


    @Test
    public void contextMapperMapToTest() throws InterruptedException {
        _mock.expectedBodiesReceived(PAYLOAD);
        _mock.expectedHeaderReceived(Mapper.PROPERTY, Mapper.VALUE);

        Exchange exchange = createExchange(new CamelMessageComposer().setContextMapper(new Mapper()));
        exchange.send(exchange.createMessage().setContent(PAYLOAD));
        _mock.assertIsSatisfied();
    }
View Full Code Here

TOP

Related Classes of org.switchyard.component.camel.common.composer.CamelMessageComposer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.