Package org.apache.tuscany.sca.core.invocation

Examples of org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor


        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : wire.getInvocationChains()) {
                    chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here


* @version $Rev: 537327 $ $Date: 2007-05-12 04:18:05 +0100 (Sat, 12 May 2007) $
*/
public class CallbackInterfaceInterceptorTestCase extends TestCase {

    public void testImplements() {
        CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true);
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
        EasyMock.replay(next);
        interceptor.setNext(next);
        interceptor.invoke(new MessageFactoryImpl().createMessage());
        EasyMock.verify(next);
    }
View Full Code Here

        interceptor.invoke(new MessageFactoryImpl().createMessage());
        EasyMock.verify(next);
    }

    public void testDoesNotImplement() {
        CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(false);
        try {
            interceptor.invoke(new MessageFactoryImpl().createMessage());
            fail();
        } catch (NoRegisteredCallbackException e) {
            // expected
        }
    }
View Full Code Here

        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getService().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : wire.getInvocationChains()) {
                    chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here

        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getService().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : epr.getInvocationChains()) {
                    chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here

        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : wire.getInvocationChains()) {
                    chain.addInterceptor(0, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here

* @version $Rev: 574648 $ $Date: 2007-09-11 10:45:36 -0700 (Tue, 11 Sep 2007) $
*/
public class CallbackInterfaceInterceptorTestCase extends TestCase {

    public void testHasCallbackObject() {
        CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
        EasyMock.replay(next);
        interceptor.setNext(next);
        Message msg = new MessageFactoryImpl().createMessage();
        msg.setFrom(new EndpointReferenceImpl("uri"));
        msg.getTo().getReferenceParameters().setCallbackObjectID("java:" + System.identityHashCode("ABC"));
        interceptor.invoke(msg);
        EasyMock.verify(next);
    }
View Full Code Here

        interceptor.invoke(msg);
        EasyMock.verify(next);
    }

    public void testNoCallbackObject() {
        CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
        Message msg = new MessageFactoryImpl().createMessage();
        msg.setFrom(new EndpointReferenceImpl("uri"));
        msg.getTo().getReferenceParameters().setCallbackObjectID(null);
        try {
            interceptor.invoke(msg);
            fail();
        } catch (NoRegisteredCallbackException e) {
            // expected
        }
    }
View Full Code Here

        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : wire.getInvocationChains()) {
                    chain.addInterceptor(0, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here

* @version $Rev: 574648 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
*/
public class CallbackInterfaceInterceptorTestCase extends TestCase {

    public void testHasCallbackObject() {
        CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
        EasyMock.replay(next);
        interceptor.setNext(next);
        Message msg = new MessageFactoryImpl().createMessage();
        msg.setFrom(new EndpointReferenceImpl("uri"));
        msg.getTo().getReferenceParameters().setCallbackObjectID("java:" + System.identityHashCode("ABC"));
        interceptor.invoke(msg);
        EasyMock.verify(next);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor

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.