Examples of OutboundInvocationChain


Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

        MockSyncInterceptor interceptor = new MockSyncInterceptor();
        List<Interceptor> interceptors = new ArrayList<Interceptor>();
        interceptors.add(interceptor);

        InboundInvocationChain inboundChain = setupInbound(interceptors);
        OutboundInvocationChain outboundChain = setupOutbound(null);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, interceptor.getCount());
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

        sourceInterceptors.add(sourceInterceptor);
        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        List<Interceptor> targetInterceptors = new ArrayList<Interceptor>();
        targetInterceptors.add(targetInterceptor);

        OutboundInvocationChain outboundChain = setupOutbound(sourceInterceptors);
        InboundInvocationChain inboundChain = setupInbound(targetInterceptors);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

    public void testInboundToOutboundChainConnect() {
        InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
        inboundChain.addInterceptor(EasyMock.isA(SynchronousBridgingInterceptor.class));
        EasyMock.replay(inboundChain);

        OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
        EasyMock.expect(outboundChain.getHeadInterceptor()).andReturn(headInterceptor);
        outboundChain.prepare();
        outboundChain.setTargetInterceptor(headInterceptor);
        EasyMock.replay(outboundChain);
        connector.connect(inboundChain, outboundChain);
        EasyMock.verify(inboundChain);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

        EasyMock.expect(targetWire.getContainer()).andReturn(target);
        EasyMock.replay(targetWire);

        // create the outbound wire and chain from the source component
        OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
        EasyMock.expect(outboundChain.getOperation()).andReturn(operation).atLeastOnce();
        outboundChain.setTargetInterceptor(EasyMock.isA(SynchronousBridgingInterceptor.class));
        outboundChain.setTargetInvoker(null);
        outboundChain.prepare();
        EasyMock.replay(outboundChain);
        Map<Operation<?>, OutboundInvocationChain> outboundChains =
            new HashMap<Operation<?>, OutboundInvocationChain>();
        outboundChains.put(operation, outboundChain);
        OutboundWire sourceWire = EasyMock.createMock(OutboundWire.class);
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

    /**
     * Tests basic wiring of a source to a target, including handlers and interceptors
     */
    public void testInvokeWithInterceptors() throws Exception {
        OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
        MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
        source.addInterceptor(sourceInterceptor);

        InboundInvocationChain target = new InboundInvocationChainImpl(operation);
        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        target.addInterceptor(targetInterceptor);
        target.addInterceptor(new InvokerInterceptor());

        // connect the source to the target
        source.setTargetInterceptor(target.getHeadInterceptor());
        source.prepare();
        target.prepare();
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        Message msg = new MessageImpl();
        msg.setBody("foo");
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        assertEquals("foo", response.getBody());
        assertEquals(1, sourceInterceptor.getCount());
        assertEquals(1, targetInterceptor.getCount());
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

public class OutboundToInboundConnectTestCase extends TestCase {

    public void testNoInterceptorsNoHandlers() throws Exception {
        ConnectorImpl connector = new ConnectorImpl();
        InboundInvocationChain inboundChain = setupTarget(null);
        OutboundInvocationChain outboundChain = setupSource(null);
        String[] val = new String[]{"foo"};
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invokeTarget(EasyMock.eq(val))).andReturn(val);
        replay(invoker);
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        assertEquals(val, outboundChain.getTargetInvoker().invokeTarget(val));
        verify(invoker);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

    public void testSourceInterceptor() throws Exception {
        ConnectorImpl connector = new ConnectorImpl();
        MockSyncInterceptor interceptor = new MockSyncInterceptor();
        List<Interceptor> interceptors = new ArrayList<Interceptor>();
        interceptors.add(interceptor);
        OutboundInvocationChain outboundChain = setupSource(interceptors);
        InboundInvocationChain inboundChain = setupTarget(null);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, interceptor.getCount());
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        msg.setTargetInvoker(outboundChain.getTargetInvoker());
        assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
        assertEquals(1, interceptor.getCount());
        verify(invoker);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

    public void testTargetInterceptor() throws Exception {
        ConnectorImpl connector = new ConnectorImpl();
        MockSyncInterceptor interceptor = new MockSyncInterceptor();
        List<Interceptor> interceptors = new ArrayList<Interceptor>();
        interceptors.add(interceptor);
        OutboundInvocationChain outboundChain = setupSource(null);
        InboundInvocationChain inboundChain = setupTarget(interceptors);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, interceptor.getCount());
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        msg.setTargetInvoker(outboundChain.getTargetInvoker());
        assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
        assertEquals(1, interceptor.getCount());
        verify(invoker);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

        List<Interceptor> sourceInterceptors = new ArrayList<Interceptor>();
        sourceInterceptors.add(sourceInterceptor);
        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        List<Interceptor> targetInterceptors = new ArrayList<Interceptor>();
        targetInterceptors.add(targetInterceptor);
        OutboundInvocationChain outboundChain = setupSource(sourceInterceptors);
        InboundInvocationChain inboundChain = setupTarget(targetInterceptors);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, sourceInterceptor.getCount());
        assertEquals(0, targetInterceptor.getCount());
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        msg.setTargetInvoker(outboundChain.getTargetInvoker());
        assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
        assertEquals(1, sourceInterceptor.getCount());
        assertEquals(1, targetInterceptor.getCount());
        verify(invoker);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain

        throws InvalidServiceContractException {
        Map<Operation<?>, OutboundInvocationChain> invocations = new HashMap<Operation<?>, OutboundInvocationChain>();
        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
        ServiceContract<?> contract = registry.introspect(interfaze);
        for (Operation operation : contract.getOperations().values()) {
            OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
            invocations.put(operation, chain);
        }
        return invocations;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.