Package org.apache.tuscany.core.wire.jdk

Examples of org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler


        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();
        } catch (TestException e) {
View Full Code Here


        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();
        } catch (TestRuntimeException e) {
View Full Code Here

        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

    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

    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());
        } catch (IllegalArgumentException e) {
            // should throw
        }
    }
View Full Code Here

        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) {
            // should throw
        }
    }
View Full Code Here

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

TOP

Related Classes of org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler

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.