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: 608822 $ $Date: 2008-01-04 12:59:56 +0000 (Fri, 04 Jan 2008) $
*/
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.getFrom().getReferenceParameters().setCallbackObjectID("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.getFrom().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(Phase.REFERENCE, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here

* @version $Rev: 608822 $ $Date: 2008-01-04 04:59:56 -0800 (Fri, 04 Jan 2008) $
*/
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.getFrom().getReferenceParameters().setCallbackObjectID("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.getFrom().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(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

* @version $Rev: 537327 $ $Date: 2007-05-12 08:48:05 +0530 (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

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.