Package org.switchyard.test

Examples of org.switchyard.test.MockHandler


        offer.setApplication(app);
        offer.setAmount(450.00);

        // configure our proxy for the service reference
        testKit.replaceService("DealLogger");
        MockHandler creditService = testKit.replaceService("CreditCheckService");
        Application reply = new Application();
        reply.setApproved(true);
        creditService.replyWithOut(reply);

        // Invoke the service
        Deal deal = service.operation("offer").sendInOut(offer)
            .getContent(Deal.class);
View Full Code Here


    @Test
    public void testXQueryRouting() throws Exception {
        _testKit.removeService("HelloService");
        _testKit.removeService("GoodbyeService");
        MockHandler helloService = _testKit.registerInOnlyService("HelloService");
        MockHandler goodbyeService = _testKit.registerInOnlyService("GoodbyeService");
        greet.sendInOnly(REQUEST_HELLO);
        greet.sendInOnly(REQUEST_GOODBYE);
        Thread.sleep(1000);

        LinkedBlockingQueue<Exchange> helloReceived = helloService.getMessages();
        Assert.assertNotNull(helloReceived);
        Exchange helloExchange = helloReceived.iterator().next();
        Assert.assertTrue(helloExchange.getMessage().getContent(String.class).matches(".*Douglas.*"));
        LinkedBlockingQueue<Exchange> goodbyeReceived = goodbyeService.getMessages();
        Assert.assertNotNull(goodbyeReceived);
        Exchange goodbyeExchange = goodbyeReceived.iterator().next();
        Assert.assertTrue(goodbyeExchange.getMessage().getContent(String.class).matches(".*Garfield.*"));
    }
View Full Code Here

        }
    }

    @Test
    public void testServiceBinding() throws Exception {
        MockHandler mock = _testKit.replaceService("StoreReference");
        MQTT mqtt = new MQTT();
        BlockingConnection connection = mqtt.blockingConnection();
       try {
           connection.connect();
           connection.publish(TOPIC_INPUT, MESSAGE_INPUT.getBytes(), QoS.AT_LEAST_ONCE, false);
           Thread.sleep(1000);

           LinkedBlockingQueue<Exchange> received = mock.getMessages();
           Assert.assertNotNull(received);
           Exchange exchange = received.iterator().next();
           Assert.assertEquals(MESSAGE_OUTPUT, exchange.getMessage().getContent(String.class));
       } finally {
           connection.disconnect();
View Full Code Here

TOP

Related Classes of org.switchyard.test.MockHandler

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.