Package org.apache.tuscany.spi.wire

Examples of org.apache.tuscany.spi.wire.Message


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

        Message msg = new MessageImpl();
        msg.setBody("foo");
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        assertEquals("foo", response.getBody());
        assertEquals(1, sourceInterceptor.getCount());
        assertEquals(1, targetInterceptor.getCount());
    }
View Full Code Here


    /**
     * Verfies an InvocationTargetException thrown when invoking the target is propagated to the client correctly and
     * the originating error is unwrapped
     */
    public void testThrowableTargetInvocation() throws Exception {
        Message response = invoker.invoke(message);
        assertTrue(response.isFault());
        Object body = response.getBody();
        assertTrue(SomeException.class.equals(body.getClass()));
        EasyMock.verify(wire);
        EasyMock.verify(context);
        EasyMock.verify(chain);
    }
View Full Code Here

        Object targetAddress = new Object();
        message = new MessageImpl();
        message.setMessageId(id);
        message.setCorrelationId(corrId);
        message.setBody("foo");
        Message response = new MessageImpl();
        response.setBody("response");
        Operation<Type> operation = new Operation<Type>("echo", null, null, null);
        Interceptor head = new ErrorInterceptor();
        chain = EasyMock.createMock(OutboundInvocationChain.class);
        EasyMock.expect(chain.getTargetInvoker()).andReturn(null);
        EasyMock.expect(chain.getHeadInterceptor()).andReturn(head);
View Full Code Here

        replay(target);
        JavaAtomicComponent component = createJavaComponent(target);
        AsyncMonitor monitor = createMock(AsyncMonitor.class);
        replay(monitor);

        Message msg = new MessageImpl();
        Object id = new Object();
        msg.setMessageId(id);

        WorkContext context = createMock(WorkContext.class);
        context.setCurrentMessageId(null);
        context.setCurrentCorrelationId(id);
        replay(context);
View Full Code Here

        Method method = AsyncTarget.class.getMethod("invoke");
        method.setAccessible(true);
        AsyncJavaTargetInvoker invoker =
            new AsyncJavaTargetInvoker(method, wire, component, monitor, context);
        AsyncJavaTargetInvoker clone = invoker.clone();
        Message msg = new MessageImpl();
        clone.invoke(msg);
        verify(target);
    }
View Full Code Here

        MockSyncInterceptor interceptor = new MockSyncInterceptor();
        List<Interceptor> interceptors = new ArrayList<Interceptor>();
        interceptors.add(interceptor);
        OutboundInvocationChain outboundChain = setupSource(interceptors);
        InboundInvocationChain inboundChain = setupTarget(null);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, interceptor.getCount());
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        msg.setTargetInvoker(outboundChain.getTargetInvoker());
        assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
        assertEquals(1, interceptor.getCount());
        verify(invoker);
    }
View Full Code Here

        MockSyncInterceptor interceptor = new MockSyncInterceptor();
        List<Interceptor> interceptors = new ArrayList<Interceptor>();
        interceptors.add(interceptor);
        OutboundInvocationChain outboundChain = setupSource(null);
        InboundInvocationChain inboundChain = setupTarget(interceptors);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, interceptor.getCount());
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        msg.setTargetInvoker(outboundChain.getTargetInvoker());
        assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
        assertEquals(1, interceptor.getCount());
        verify(invoker);
    }
View Full Code Here

        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        List<Interceptor> targetInterceptors = new ArrayList<Interceptor>();
        targetInterceptors.add(targetInterceptor);
        OutboundInvocationChain outboundChain = setupSource(sourceInterceptors);
        InboundInvocationChain inboundChain = setupTarget(targetInterceptors);
        Message msg = new MessageImpl();
        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
        replay(invoker);
        assertEquals(0, sourceInterceptor.getCount());
        assertEquals(0, targetInterceptor.getCount());
        connector.connect(outboundChain, inboundChain, invoker, false);
        inboundChain.prepare();
        msg.setTargetInvoker(outboundChain.getTargetInvoker());
        assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
        assertEquals(1, sourceInterceptor.getCount());
        assertEquals(1, targetInterceptor.getCount());
        verify(invoker);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.wire.Message

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.