Package org.apache.tuscany.spi.wire

Examples of org.apache.tuscany.spi.wire.OutboundInvocationChain.addInterceptor()


    }

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


     */
    public void testInvokeWithInterceptors() throws Exception {
        Operation operation = contract.getOperations().get("hello");
        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());
View Full Code Here

        ServiceContract<?> contract = registry.introspect(SimpleTarget.class);
        Operation<?> operation = contract.getOperations().get("echo");
        MockStaticInvoker invoker = new MockStaticInvoker(echo, new SimpleTargetImpl());
        OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
        MockSyncInterceptor interceptor = new MockSyncInterceptor();
        chain.addInterceptor(interceptor);
        chain.setTargetInterceptor(new InvokerInterceptor());
        chain.setTargetInvoker(invoker);
        chain.prepare();
        //chains.put(echo, chain);
        OutboundWire wire = new OutboundWireImpl();
View Full Code Here

    }

    private OutboundInvocationChain createChain(Operation operation) {
        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());
View Full Code Here

        }
        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

    }

    public void testSourceWireInterceptorOptimization() throws Exception {
        OutboundWire wire = new OutboundWireImpl();
        OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
        chain.addInterceptor(new OptimizableInterceptor());
        wire.addInvocationChain(operation, chain);
        assertTrue(wire.isOptimizable());
    }

    public void testSourceWireNonInterceptorOptimization() throws Exception {
View Full Code Here

    }

    public void testSourceWireNonInterceptorOptimization() throws Exception {
        OutboundWire wire = new OutboundWireImpl();
        OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
        chain.addInterceptor(new NonOptimizableInterceptor());
        wire.addInvocationChain(operation, chain);
        assertFalse(wire.isOptimizable());
    }

    public void testTargetWireInterceptorOptimization() throws Exception {
View Full Code Here

        op1.setServiceContract(outboundContract);

        OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
        outboundChains.put(op1, outboundChain);
        expect(outboundWire.getInvocationChains()).andReturn(outboundChains);
        outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)EasyMock.anyObject());

        Map<Operation<?>, InboundInvocationChain> inboundChains =
            new HashMap<Operation<?>, InboundInvocationChain>();
        DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
        List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
View Full Code Here

        op1.setServiceContract(outboundContract);

        OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
        outboundChains.put(op1, outboundChain);
        expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
        outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)EasyMock.anyObject());

        Map<Operation<?>, InboundInvocationChain> inboundChains =
            new HashMap<Operation<?>, InboundInvocationChain>();
        DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
        List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
View Full Code Here

        Map<Operation<?>, OutboundInvocationChain> invocations = new HashMap<Operation<?>, OutboundInvocationChain>();
        ServiceContract<?> contract = REGISTRY.introspect(interfaze);
        for (Operation<?> operation : contract.getOperations().values()) {
            OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
            if (interceptor != null) {
                chain.addInterceptor(interceptor);
            }
            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.