Package org.apache.tuscany.spi.wire

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


        assertFalse(wire.isOptimizable());
    }

    public void testTargetWireInterceptorOptimization() throws Exception {
        InboundWire wire = new InboundWireImpl();
        InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
        chain.addInterceptor(new OptimizableInterceptor());
        wire.addInvocationChain(operation, chain);
        assertTrue(wire.isOptimizable());
    }
View Full Code Here


        assertTrue(wire.isOptimizable());
    }

    public void testTargetWireNonInterceptorOptimization() throws Exception {
        InboundWire wire = new InboundWireImpl();
        InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
        chain.addInterceptor(new NonOptimizableInterceptor());
        wire.addInvocationChain(operation, chain);
        assertFalse(wire.isOptimizable());
    }
View Full Code Here

        assertFalse(wire.isOptimizable());
    }

    public void testTargetWireNonTargetInvokerOptimization() throws Exception {
        InboundWire wire = new InboundWireImpl();
        InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
        TargetInvoker invoker = new StaticPojoTargetInvoker(m, new Object());
        invoker.setCacheable(false);
        chain.setTargetInvoker(invoker);
        wire.addInvocationChain(operation, chain);
        assertFalse(wire.isOptimizable());
    }
View Full Code Here

        Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
        ServiceContract<Type> inboundContract = new JavaServiceContract(null);
        inboundContract.setDataBinding(Node.class.getName());
        op2.setServiceContract(inboundContract);

        InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
        inboundChains.put(op2, inboundChain);
        expect(inboundWire.getInvocationChains()).andReturn(inboundChains);

        ServiceContract<Type> contract = new JavaServiceContract();
        Map<String, Operation<Type>> operations = Collections.emptyMap();
View Full Code Here

        Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
        ServiceContract<Type> inboundContract = new JavaServiceContract(null);
        inboundContract.setDataBinding(Node.class.getName());
        op2.setServiceContract(inboundContract);

        InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
        inboundChains.put(op2, inboundChain);
        expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();

        ServiceContract<Type> contract = new JavaServiceContract();
        Map<String, Operation<Type>> operations = Collections.emptyMap();
        contract.setCallbackOperations(operations);
        expect(inboundWire.getServiceContract()).andReturn(contract);
        expect(inboundChain.getTailInterceptor()).andReturn(null);

        EasyMock.replay(composite, reference, inboundWire, outboundWire, inboundChain, outboundChain);

        processor.process(inboundWire, outboundWire);
    }
View Full Code Here

        Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
        ServiceContract<Type> inboundContract = new JavaServiceContract(null);
        inboundContract.setDataBinding(Node.class.getName());
        op2.setServiceContract(inboundContract);

        InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
        inboundChains.put(op2, inboundChain);
        expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
        inboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)EasyMock.anyObject());

        ServiceContract<Type> contract = new JavaServiceContract();
        Map<String, Operation<Type>> operations = Collections.emptyMap();
        contract.setCallbackOperations(operations);
        expect(inboundWire.getServiceContract()).andReturn(contract);
View Full Code Here

        InboundWire inboundWire = createMock(InboundWire.class);
        AsyncJavaTargetInvoker invoker =
            new AsyncJavaTargetInvoker(method, inboundWire, component, null, context);
        InboundWire wire = createServiceWire("foo", AsyncTarget.class, null);
        Map<Operation<?>, InboundInvocationChain> chains = wire.getInvocationChains();
        InboundInvocationChain chain = chains.get(wire.getServiceContract().getOperations().get("invoke"));
        chain.setTargetInvoker(invoker);
        chain.prepare();
        MessageImpl msg = new MessageImpl();
        msg.setTargetInvoker(invoker);
        chain.getHeadInterceptor().invoke(msg);
        verify(target);
    }
View Full Code Here

        if (inboundWire != null) {
            // if null, the target side has no interceptors or handlers
            Map<Operation<?>, InboundInvocationChain> targetInvocationConfigs = inboundWire.getInvocationChains();
            for (OutboundInvocationChain outboundInvocationConfig : outboundWire.getInvocationChains().values()) {
                // match wire chains
                InboundInvocationChain inboundInvocationConfig =
                    targetInvocationConfigs.get(outboundInvocationConfig.getOperation());
                if (inboundInvocationConfig == null) {
                    BuilderConfigException e =
                        new BuilderConfigException("Incompatible source and target interface types for reference");
                    e.setIdentifier(outboundWire.getReferenceName());
                    throw e;
                }
                if (inboundInvocationConfig.getHeadInterceptor() == null) {
                    BuilderConfigException e =
                        new BuilderConfigException("No target handler or interceptor for operation");
                    e.setIdentifier(inboundInvocationConfig.getOperation().getName());
                    throw e;
                }
                if (!(outboundInvocationConfig.getTailInterceptor() instanceof InvokerInterceptor
                    && inboundInvocationConfig.getHeadInterceptor() instanceof InvokerInterceptor)) {
                    // check that we do not have the case where the only interceptors are invokers since we just
                    // need one
                    outboundInvocationConfig.setTargetInterceptor(inboundInvocationConfig.getHeadInterceptor());
                }
            }

            for (OutboundInvocationChain chain : outboundWire.getInvocationChains().values()) {
                //FIXME should use target method, not outboundInvocationConfig.getMethod()
View Full Code Here

        throws InvalidServiceContractException {

        Map<Operation<?>, InboundInvocationChain> invocations = new HashMap<Operation<?>, InboundInvocationChain>();
        ServiceContract<?> contract = REGISTRY.introspect(interfaze);
        for (Operation<?> method : contract.getOperations().values()) {
            InboundInvocationChain chain = new InboundInvocationChainImpl(method);
            if (interceptor != null) {
                chain.addInterceptor(interceptor);
            }
            // add tail interceptor
            chain.addInterceptor(new InvokerInterceptor());
            invocations.put(method, chain);
        }
        return invocations;
    }
View Full Code Here

        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
        Map<Operation<?>, InboundInvocationChain> invocations = new HashMap<Operation<?>, InboundInvocationChain>();
        ServiceContract<?> contract = registry.introspect(interfaze);

        for (Operation<?> operation : contract.getOperations().values()) {
            InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
            // add tail interceptor
            chain.addInterceptor(new InvokerInterceptor());
            invocations.put(operation, chain);
        }
        return invocations;
    }
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.