Package org.apache.tuscany.spi.wire

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


    public void testOutboundToInboundChainConnect() {

        TargetInvoker invoker = EasyMock.createMock(TargetInvoker.class);
        EasyMock.replay(invoker);

        InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
        EasyMock.expect(inboundChain.getHeadInterceptor()).andReturn(headInterceptor);
        EasyMock.replay(inboundChain);

        OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
        outboundChain.prepare();
        outboundChain.setTargetInterceptor(EasyMock.isA(SynchronousBridgingInterceptor.class));
View Full Code Here


        connector.connect(outboundChain, inboundChain, invoker, false);
        EasyMock.verify(outboundChain);
    }

    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();
View Full Code Here

    public void testOutboundWireToInboundReferenceTarget() {
        AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
        EasyMock.expect(component.getName()).andReturn("foo");
        EasyMock.replay(component);
        // create the inbound wire and chain
        InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
        EasyMock.expect(inboundChain.getOperation()).andReturn(operation).atLeastOnce();
        EasyMock.expect(inboundChain.getHeadInterceptor()).andReturn(headInterceptor);
        EasyMock.replay(inboundChain);
        Map<Operation<?>, InboundInvocationChain> inboundChains = new HashMap<Operation<?>, InboundInvocationChain>();
        inboundChains.put(operation, inboundChain);
        InboundWire targetWire = EasyMock.createMock(InboundWire.class);
        EasyMock.expect(targetWire.getServiceContract()).andReturn(contract).anyTimes();
View Full Code Here

        fail(InboundInvocationErrorTestCase.TestException.class.getName() + " should have been thrown");
    }

    private InboundInvocationChain createChain(Method m, Operation operation) {
        MockStaticInvoker invoker = new MockStaticInvoker(m, new InboundInvocationErrorTestCase.TestBeanImpl());
        InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
        chain.addInterceptor(new MockSyncInterceptor());
        chain.setTargetInvoker(invoker);
        chain.addInterceptor(new InvokerInterceptor());
        chain.prepare();
        return chain;
    }
View Full Code Here

    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");
View Full Code Here

    public void createWires(Reference reference, ServiceContract<?> contract) {
        InboundWire inboundWire = new InboundWireImpl();
        inboundWire.setServiceContract(contract);
        inboundWire.setContainer(reference);
        for (Operation<?> operation : contract.getOperations().values()) {
            InboundInvocationChain chain = createInboundChain(operation);
            inboundWire.addInvocationChain(operation, chain);
        }
        OutboundWire outboundWire = new OutboundWireImpl();

        // [rfeng] Check if the Reference has the binding contract
        ServiceContract<?> bindingContract = reference.getBindingServiceContract();
        if (bindingContract == null) {
            bindingContract = contract;
        }
        outboundWire.setServiceContract(bindingContract);
        outboundWire.setContainer(reference);
        for (Operation<?> operation : bindingContract.getOperations().values()) {
            OutboundInvocationChain chain = createOutboundChain(operation);
            chain.addInterceptor(new InvokerInterceptor());
            outboundWire.addInvocationChain(operation, chain);
        }

        // Notice that we skip inboundWire.setCallbackReferenceName
        // First, an inbound inboundWire's callbackReferenceName is only retrieved by JavaAtomicComponent
View Full Code Here

        }
        if (contract.getCallbackName() != null) {
            wire.setCallbackInterface(contract.getCallbackClass());
            for (Operation<?> operation : contract.getCallbackOperations().values()) {
                InboundInvocationChain callbackTargetChain = createInboundChain(operation);
                // TODO handle policy
                //TODO statement below could be cleaner
                callbackTargetChain.addInterceptor(new InvokerInterceptor());
                wire.addTargetCallbackInvocationChain(operation, callbackTargetChain);
            }
        }
        return wire;
    }
View Full Code Here

        InboundWire wire = new InboundWireImpl();
        ServiceContract<?> contract = service.getServiceContract();
        wire.setServiceContract(contract);
        wire.setServiceName(service.getName());
        for (Operation<?> operation : contract.getOperations().values()) {
            InboundInvocationChain chain = createInboundChain(operation);
            // TODO handle policy
            //TODO statement below could be cleaner
            chain.addInterceptor(new InvokerInterceptor());
            wire.addInvocationChain(operation, chain);
        }
        if (contract.getCallbackName() != null) {
            wire.setCallbackReferenceName(service.getCallbackReferenceName());
        }
View Full Code Here

            bindingContract = contract;
        }
        inboundWire.setServiceContract(bindingContract);
        inboundWire.setContainer(service);
        for (Operation<?> operation : bindingContract.getOperations().values()) {
            InboundInvocationChain inboundChain = createInboundChain(operation);
            inboundWire.addInvocationChain(operation, inboundChain);
        }

        OutboundWire outboundWire = new OutboundWireImpl();
        outboundWire.setServiceContract(contract);
        outboundWire.setTargetName(new QualifiedName(targetName));
        outboundWire.setContainer(service);

        for (Operation<?> operation : contract.getOperations().values()) {
            OutboundInvocationChain outboundChain = createOutboundChain(operation);
            outboundWire.addInvocationChain(operation, outboundChain);
        }

        // Add target callback chain to outbound wire, applicable to both bound and bindless services
        if (contract.getCallbackName() != null) {
            outboundWire.setCallbackInterface(contract.getCallbackClass());
            for (Operation<?> operation : contract.getCallbackOperations().values()) {
                InboundInvocationChain callbackTargetChain = createInboundChain(operation);
// TODO handle policy
//TODO statement below could be cleaner
                callbackTargetChain.addInterceptor(new InvokerInterceptor());
                outboundWire.addTargetCallbackInvocationChain(operation, callbackTargetChain);
            }
        }

        // Not clear in any case why this is done here and at the parent composite level as well
View Full Code Here

    private Map<Method, InboundInvocationChain> createInboundMapping(InboundWire wire, Method[] methods)
        throws NoMethodForOperationException {
        Map<Method, InboundInvocationChain> chains = new HashMap<Method, InboundInvocationChain>();
        for (Map.Entry<Operation<?>, InboundInvocationChain> entry : wire.getInvocationChains().entrySet()) {
            Operation<?> operation = entry.getKey();
            InboundInvocationChain chain = entry.getValue();
            Method method = findMethod(operation, methods);
            if (method == null) {
                NoMethodForOperationException e = new NoMethodForOperationException();
                e.setIdentifier(operation.getName());
            }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.wire.InboundInvocationChain

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.