Package org.switchyard.internal

Examples of org.switchyard.internal.DefaultContext


    @Test
    public void mapToTest() throws Exception {
        RESTEasyContextMapper rcm = new RESTEasyContextMapper();
        RESTEasyBindingData rbd = new RESTEasyBindingData();

        Context context = new DefaultContext();
        context.setProperty("one", Integer.valueOf(1));
       
        rcm.mapTo(context, rbd);
        Iterator<Map.Entry<String, List<String>>> entries = rbd.getHeaders().entrySet().iterator();
        while (entries.hasNext()) {
            Map.Entry<String, List<String>> entry = entries.next();
            List<String> values = entry.getValue();
            Assert.assertTrue(values.size() == 1);
            Assert.assertTrue(entry.getKey().equals("one"));
            Assert.assertTrue(values.get(0).equals("1"));
        }
       
        RESTEasyBindingData rbd2 = new RESTEasyBindingData();
        context.removeProperties();
        List<Integer> list = new ArrayList<Integer>();
        list.add(Integer.valueOf(1));
        list.add(Integer.valueOf(2));
        list.add(Integer.valueOf(3));
        context.setProperty("numbers", list);
        rcm.mapTo(context, rbd2);
        entries = rbd2.getHeaders().entrySet().iterator();
        while (entries.hasNext()) {
            Map.Entry<String, List<String>> entry = entries.next();
            List<String> values = entry.getValue();
View Full Code Here


     * @return exchange
     */
    private org.switchyard.Exchange createSwitchYardExchange() {
        org.switchyard.Exchange switchYardExchange = mock(org.switchyard.Exchange.class);
        Message message = mock(org.switchyard.Message.class);
        when(message.getContext()).thenReturn(new DefaultContext(Scope.MESSAGE));
        when(message.getContent(Integer.class)).thenReturn(10);
        when(switchYardExchange.getMessage()).thenReturn(message);
        when(switchYardExchange.createMessage()).thenReturn(message);
        return switchYardExchange;
    }
View Full Code Here

        final ServiceReference serviceReference = createMockServiceRef();
        final org.switchyard.Exchange switchYardExchange = createMockExchangeWithBody(new MessageCreator() {
            @Override
            public Message create() {
                Message message = mock(Message.class);
                when(message.getContext()).thenReturn(new DefaultContext(Scope.MESSAGE));
                when(message.getContent(Integer.class)).thenReturn(10);
                return message;
            }
        });
        final CamelResponseHandler responseHandler = new CamelResponseHandler(camelExchange, serviceReference, _messageComposer);
View Full Code Here

        final ServiceReference serviceReference = createMockServiceRef();
        final org.switchyard.Exchange switchYardExchange = createMockExchangeWithBody(new MessageCreator() {
            @Override
            public Message create() {
                Message message = mock(Message.class);
                when(message.getContext()).thenReturn(new DefaultContext(Scope.MESSAGE));
                when(message.getContent()).thenReturn(fault);
                return message;
            }
        });
        final CamelResponseHandler responseHandler = new CamelResponseHandler(camelExchange, serviceReference, _messageComposer);
View Full Code Here

        return target;
    }

    private CompositeContext newContext() {
        CompositeContext source = new CompositeContext();
        source.setContext(Scope.MESSAGE, new DefaultContext(Scope.MESSAGE));
        source.setContext(Scope.EXCHANGE, new DefaultContext());
        return source;
    }
View Full Code Here

TOP

Related Classes of org.switchyard.internal.DefaultContext

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.