Package org.switchyard.metadata

Examples of org.switchyard.metadata.InOnlyOperation


        final QName TEST_SERVICE = new QName("urn:test", "SCAInvokerTest");
        ServiceReference reference = _domain.createInOnlyService(TEST_SERVICE, _provider);
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(reference, new InOnlyOperation("Test"));
        ex.provider(_domain.getServices().get(0), new InOnlyOperation("Test"));
        invoker.handleMessage(ex);
       
        Assert.assertTrue(_provider.getMessages().size() == 1);
        Assert.assertEquals(msg.getContent(), _provider.getMessages().poll().getMessage().getContent());
    }
View Full Code Here


        _domain.registerService(SERVICE_B, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
        ex.provider(serviceA, new InOnlyOperation(null));
        invoker.handleMessage(ex);
       
        Assert.assertTrue(_provider.getMessages().size() == 1);
        Assert.assertEquals(msg.getContent(), _provider.getMessages().poll().getMessage().getContent());
    }
View Full Code Here

        domain2.registerService(SERVICE_B, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
        ex.provider(serviceA, new InOnlyOperation(null));
        invoker.handleMessage(ex);
       
        Assert.assertTrue(_provider.getMessages().size() == 1);
        Assert.assertEquals(msg.getContent(), _provider.getMessages().poll().getMessage().getContent());
    }
View Full Code Here

        _domain.registerService(SERVICE_A, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
        ex.provider(serviceA, new InOnlyOperation(null));
       
        // Should throw a Handler exception
        try {
            invoker.handleMessage(ex);
        } catch (HandlerException e) {
View Full Code Here

        _domain.registerService(SERVICE_B, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
        ex.provider(serviceA, new InOnlyOperation(null));
        invoker.handleMessage(ex);
       
        Assert.assertTrue(_provider.getMessages().size() == 1);
        Assert.assertEquals(msg.getContent(), _provider.getMessages().poll().getMessage().getContent());
    }
View Full Code Here

        ServiceReference reference = _domain.createInOnlyService(TEST_SERVICE, _provider);
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.getMessage().getContext().setProperty("message-prop", "abc");
        ex.consumer(reference, new InOnlyOperation("Test"));
        ex.provider(_domain.getServices().get(0), new InOnlyOperation("Test"));
        invoker.handleMessage(ex);
       
        Assert.assertTrue(_provider.getMessages().size() == 1);
        Exchange receivedEx = _provider.getMessages().poll();
        Assert.assertEquals("abc", receivedEx.getMessage().getContext().getPropertyValue("message-prop"));
View Full Code Here

                faultType = parts.get(getQName(tempEl.getAttribute(ATTR_MESSAGE), namespaces));
            }
            tempEl = XMLHelper.getNextSiblingElement(tempEl);
        }
        if (outputType == null) {
            return new InOnlyOperation(opEl.getAttribute(ATTR_NAME), inputType);
        } else {
            return new InOutOperation(opEl.getAttribute(ATTR_NAME), inputType, outputType, faultType);
        }
    }
View Full Code Here

        _chain.addLast("second", goodHandler);

        MockDomain domain = new MockDomain();
        ServiceReference reference = domain.createInOnlyService(new QName("bar"));
        Dispatcher dispatch = domain.getBus().createDispatcher(reference);
        Exchange ex = new ExchangeImpl(domain, dispatch).consumer(reference, new InOnlyOperation("foo"));
        _chain.handleFault(ex);
        Assert.assertNotNull(goodHandler.waitForFaultMessage());
    }
View Full Code Here

    }
   
    @Test
    public void testCreateExchange() {
        Exchange inOnly = _inOnlyReference.createExchange();
        inOnly.consumer(null, new InOnlyOperation("foo"));
        Assert.assertEquals(ExchangePattern.IN_ONLY, inOnly.getContract().getConsumerOperation().getExchangePattern());
        Exchange inOut = _inOutReference.createExchange(new MockHandler());
        inOut.consumer(null, new InOutOperation("foo"));
        Assert.assertEquals(ExchangePattern.IN_OUT, inOut.getContract().getConsumerOperation().getExchangePattern());
    }
View Full Code Here

        ServiceOperation operation = _serviceOperation;
        ServiceReference reference;
       
        if (operation == null) {
            if (ExchangePattern.IN_ONLY.equals(pattern)) {
                operation = new InOnlyOperation(_operationName, _inputType);
            } else {
                operation = new InOutOperation(_operationName, _inputType, _expectedOutputType, _expectedFaultType);
            }
        }
       
View Full Code Here

TOP

Related Classes of org.switchyard.metadata.InOnlyOperation

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.