Package org.switchyard

Examples of org.switchyard.Message


    private SwitchYardTestKit _testKit;

    @Test
    public void test_New_Way() {

        Message responseMsg = _testKit.newInvoker("BasicOrderManagementService.createOrder").
                                    sendInOut(new OrderRequest("D123", "ABCD"));

        OrderResponse response = (OrderResponse) responseMsg.getContent();

        Assert.assertEquals("D123", response.orderId);
    }
View Full Code Here


    @Test
    public void sendMessage() throws Exception {
       
        DOMSource domSource = new DOMSource(_testKit.readResourceDocument("/rpclit_request.xml"));
        Message responseMsg = consumerService.operation("submitPhantomOrder").sendInOut(toString(domSource.getNode()));
        String response = toString(responseMsg.getContent(Node.class));
        _testKit.compareXMLToResource(response, "/rpclit_response.xml");
       
    }
View Full Code Here

                    ExchangeProxy.setExchange(null);
                }
               
                if (exchangePattern == ExchangePattern.IN_OUT
                        && exchange.getPhase() != ExchangePhase.OUT) {
                    Message message = exchange.createMessage();
                    message.setContent(responseObject);
                    exchange.send(message);
                }
            } catch (Exception ex) {
                String errMsg = BeanMessages.MESSAGES.invocationOfOperationFailed(invocation.getMethod().getName(),
                        _serviceBean.getClass().getName());
View Full Code Here

        inOnly.sendInOnly("hello");
    }

    @Test
    public void consumeInOutServiceFromBean_new_way() {
        Message responseMsg = inOut.sendInOut("hello");

        Assert.assertEquals("hello", responseMsg.getContent());
    }
View Full Code Here

            PolicyUtil.provide(switchyardExchange, TransactionPolicy.MANAGED_TRANSACTION_GLOBAL);
        }
       
        // Message composition depends on whether this switchyard:// endpoint is called from
        // a Camel service implementation or a Camel gateway
        Message switchyardMessage;
        if (isGatewayRoute) {
            switchyardMessage = composeForGateway(composer, camelExchange, switchyardExchange);
        } else {
            switchyardMessage = ExchangeMapper.mapCamelToSwitchYard(
                    camelExchange, switchyardExchange, ExchangePhase.IN);
View Full Code Here

            inOut.sendInOut(new ConsumerException("throw me a remote exception please!!"));
            // if we got here, then our negative test failed
            Assert.fail("Exception thrown by bean but not turned into fault!");
        } catch (InvocationFaultException infEx) {
            System.out.println(infEx.getFaultMessage().getContent());
            Message faultMsg = infEx.getFaultMessage();
            Assert.assertTrue(faultMsg.getContent() instanceof ConsumerException);
            Assert.assertEquals("remote-exception-received", faultMsg.getContent(ConsumerException.class).getMessage());
        }
    }
View Full Code Here

            inOutRuntimeEx.sendInOut(new ConsumerException("throw me a remote exception please!!"));
            // if we got here, then our negative test failed
            Assert.fail("Exception thrown by bean but not turned into fault!");
        } catch (InvocationFaultException infEx) {
            System.out.println(infEx.getFaultMessage().getContent());
            Message faultMsg = infEx.getFaultMessage();
            Assert.assertTrue(faultMsg.getContent() instanceof HandlerException);
            Assert.assertEquals("throw me a remote exception please!!", faultMsg.getContent(HandlerException.class).getCause().getCause().getMessage());
        }
    }
View Full Code Here

    @Ignore // Can be tested offline
    @Test
    public void unknownHost() throws Exception {
        try {
            Message responseMsg = _proxyConsumerService1.operation(METHOD_NAME).sendInOut(input);
        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("UnknownHostException: unreachablehost"));
        }
View Full Code Here

    }

    @Test
    public void authenticationMissing() throws Exception {
        try {
            Message responseMsg = _proxyConsumerService2.operation(METHOD_NAME).sendInOut(input);
        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("407: Proxy Authentication Required"));
        }
View Full Code Here

        }
    }

    @Test
    public void allIsWell() throws Exception {
        Message responseMsg = _proxyConsumerService3.operation(METHOD_NAME).sendInOut(input);
        String response = XMLHelper.toString(responseMsg.getContent(Node.class));
        XMLAssert.assertXMLEqual(output, response);
    }
View Full Code Here

TOP

Related Classes of org.switchyard.Message

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.