Examples of addInvocationChain()


Examples of org.apache.tuscany.spi.wire.InboundWire.addInvocationChain()

    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());
    }

    public void testTargetWireNonTargetInvokerOptimization() throws Exception {
        InboundWire wire = new InboundWireImpl();
View Full Code Here

Examples of org.apache.tuscany.spi.wire.InboundWire.addInvocationChain()

        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());
    }

    protected void tearDown() throws Exception {
        super.tearDown();
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

    public void testCheckedException() throws Exception {
        OutboundWire wire = new OutboundWireImpl();
        ServiceContract<?> contract = registry.introspect(TestBean.class);
        wire.setServiceContract(contract);
        Operation operation = contract.getOperations().get("checkedException");
        wire.addInvocationChain(operation, createChain(checkedMethod, operation));
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        try {
            TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
                new Class[]{TestBean.class}, handler);
            proxy.checkedException();
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

        OutboundWire wire = new OutboundWireImpl();
        ServiceContract<?> contract = registry.introspect(TestBean.class);
        wire.setServiceContract(contract);
        Operation operation = contract.getOperations().get("runtimeException");
        OutboundInvocationChain chain = createChain(runtimeMethod, operation);
        wire.addInvocationChain(operation, chain);
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        try {
            TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
                new Class[]{TestBean.class}, handler);
            proxy.runtimeException();
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

        chain.setTargetInterceptor(new InvokerInterceptor());
        chain.setTargetInvoker(invoker);
        chain.prepare();
        //chains.put(echo, chain);
        OutboundWire wire = new OutboundWireImpl();
        wire.addInvocationChain(operation, chain);
        wire.setServiceContract(contract);
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        assertEquals("foo", handler.invoke(null, echo, new String[]{"foo"}));
        assertEquals(1, interceptor.getCount());
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

    }

    public void testBasicInvoke() throws Throwable {
        OutboundWire wire = new OutboundWireImpl();
        Operation operation = contract.getOperations().get("hello");
        wire.addInvocationChain(operation, createChain(operation));
        wire.setServiceContract(contract);
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        assertEquals("foo", handler.invoke(hello, new Object[]{"foo"}));
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

    }

    public void testErrorInvoke() throws Throwable {
        OutboundWire wire = new OutboundWireImpl();
        Operation operation = contract.getOperations().get("hello");
        wire.addInvocationChain(operation, createChain(operation));
        wire.setServiceContract(contract);
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        try {
            handler.invoke(hello, new Object[]{});
            fail("Expected " + IllegalArgumentException.class.getName());
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        OutboundWire wire = new OutboundWireImpl();
        wire.setServiceContract(contract);
        wire.addInvocationChain(operation, source);
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        try {
            assertEquals("foo", handler.invoke(hello, new Object[]{}));
            fail("Expected " + IllegalArgumentException.class.getName());
        } catch (IllegalArgumentException e) {
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        OutboundWire wire = new OutboundWireImpl();
        wire.setServiceContract(contract);
        wire.addInvocationChain(operation, source);
        JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
        assertEquals("foo", handler.invoke(hello, new Object[]{"foo"}));
    }

    private OutboundInvocationChain createChain(Operation operation) {
View Full Code Here

Examples of org.apache.tuscany.spi.wire.OutboundWire.addInvocationChain()

        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
        // to create a callback injector based on the callback reference member; a composite reference
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.