Package org.apache.tuscany.sca.invocation

Examples of org.apache.tuscany.sca.invocation.Interceptor


        List<InvocationChain> chains = endpoint.getInvocationChains();
        for (InvocationChain chain : chains) {
            Operation sourceOperation = chain.getSourceOperation();
            Operation targetOperation = chain.getTargetOperation();

            Interceptor interceptor = null;
            if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
                // Add the interceptor to the source side because multiple
                // references can be wired to the same service
                interceptor = new DataTransformationInterceptor(endpoint, sourceOperation, targetOperation, mediator);
            }
View Full Code Here


        List<InvocationChain> chains = endpointReference.getInvocationChains();
        for (InvocationChain chain : chains) {
            Operation sourceOperation = chain.getSourceOperation();
            Operation targetOperation = chain.getTargetOperation();

            Interceptor interceptor = null;
            if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
                // Add the interceptor to the source side because multiple
                // references can be wired to the same service
                interceptor = new DataTransformationInterceptor(endpointReference, sourceOperation, targetOperation, mediator);
            }
View Full Code Here

        // add the policy interceptors to the service binding wire
        List<PolicyProvider> pps = getPolicyProviders();
        if (pps != null) {
            for (PolicyProvider p : pps) {
                Interceptor interceptor = p.createBindingInterceptor();
                if (interceptor != null) {
                    bindingInvocationChain.addInterceptor(interceptor);
                } // end if
            } // end for
        } // end if
View Full Code Here

     */
    private void addServiceBindingInterceptor(InvocationChain chain, Operation operation) {
        List<PolicyProvider> pps = getPolicyProviders();
        if (pps != null) {
            for (PolicyProvider p : pps) {
                Interceptor interceptor = p.createInterceptor(operation);
                if (interceptor != null) {
                    chain.addInterceptor(interceptor);
                }
            }
        }
View Full Code Here

        }

        List<PolicyProvider> pps = ((RuntimeComponent)component).getPolicyProviders();
        if (pps != null) {
            for (PolicyProvider p : pps) {
                Interceptor interceptor = p.createInterceptor(operation);
                if (interceptor != null) {
                    chain.addInterceptor(interceptor);
                }
            }
        }
View Full Code Here

    @Test
    public void testInsertAtEnd() throws Exception {
        Operation op = newOperation("foo");
        InvocationChain chain = new InvocationChainImpl(op, op, true, new PhaseManager(new DefaultExtensionPointRegistry()), false);
        Interceptor inter2 = new MockInterceptor();
        Interceptor inter1 = new MockInterceptor();
        chain.addInterceptor(inter1);
        chain.addInterceptor(inter2);
        Interceptor head = (Interceptor)chain.getHeadInvoker();
        assertEquals(inter1, head);
        assertEquals(inter2, head.getNext());
    }
View Full Code Here

    @Test
    public void testAddByPhase() throws Exception {
        Operation op = newOperation("foo");
        InvocationChain chain = new InvocationChainImpl(op, op, false, new PhaseManager(new DefaultExtensionPointRegistry()), false);
        Interceptor inter1 = new MockInterceptor();
        Interceptor inter2 = new MockInterceptor();
        Interceptor inter3 = new MockInterceptor();
        Interceptor inter4 = new MockInterceptor();
        chain.addInterceptor(inter3); // SERVICE
        chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, inter4);
        chain.addInterceptor(Phase.SERVICE_POLICY, inter2);
        chain.addInterceptor(Phase.SERVICE_BINDING, inter1);
        Interceptor head = (Interceptor)chain.getHeadInvoker();
        assertEquals(inter1, head);
        assertEquals(inter2, inter1.getNext());
        assertEquals(inter3, inter2.getNext());
        assertEquals(inter4, inter3.getNext());
    }
View Full Code Here

        EasyMock.replay(context);
        ThreadMessageContext.setMessageContext(context);
        Message msg = createMock(Message.class);
        msg.setCorrelationID(null);
        msg.setConversationID(convID);
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
        EasyMock.replay(next);
        EasyMock.replay(msg);
        Interceptor interceptor = new NonBlockingInterceptor(scheduler, next);
        interceptor.invoke(msg);
        verify(context);
        verify(next);
        verify(msg);
    }
View Full Code Here

*/
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

*/
public class InvocationChainImplTestCase extends TestCase {

    public void testInsertAtEnd() throws Exception {
        InvocationChain chain = new InvocationChainImpl(new OperationImpl("foo"));
        Interceptor inter2 = new MockInterceptor();
        Interceptor inter1 = new MockInterceptor();
        chain.addInterceptor(inter1);
        chain.addInterceptor(inter2);
        Interceptor head = (Interceptor)chain.getHeadInvoker();
        assertEquals(inter1, head);
        assertEquals(inter2, head.getNext());
        assertEquals(inter2, chain.getTailInvoker());

    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.invocation.Interceptor

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.