Package org.apache.tuscany.spi.wire

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


                        args[i] = is.readObject();
                    }
                    Map<Operation<?>, InboundInvocationChain> chains = getInboundWire().getInvocationChains();
                    for (InboundInvocationChain chain : chains.values()) {
                        if (chain.getOperation().getName().equals(operation)) {
                            Message message = new MessageImpl();
                            message.setTargetInvoker(chain.getTargetInvoker());
                            message.setBody(args);
                            message = chain.getHeadInterceptor().invoke(message);
                            os = new ObjectOutputStream(clientSocket.getOutputStream());
                            os.writeObject(message.getBody());
                            os.flush();
                        }
                    }
                } catch (IOException e) {
                    throw new TestBindingRuntimeException(e);
View Full Code Here


                return null;
            }
        });
        replay(scheduler);
        WorkContext context = createMock(WorkContext.class);
        Message msg = new MessageImpl();
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
        EasyMock.replay(next);
        Interceptor interceptor = new NonBlockingBridgingInterceptor(scheduler, context, next);
        interceptor.invoke(msg);
View Full Code Here

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

        Message msg = new MessageImpl();
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        assertTrue(response.isFault());
        assertTrue(response.getBody() instanceof IllegalArgumentException);
        assertEquals(1, sourceInterceptor.getCount());
        assertEquals(1, targetInterceptor.getCount());
View Full Code Here

            Object messageId = workContext.getCurrentMessageId();
            workContext.setCurrentMessageId(null);
            Object correlationId = workContext.getCurrentCorrelationId();
            workContext.setCurrentCorrelationId(null);

            Message msg = new MessageImpl();
            msg.setTargetInvoker(chain.getTargetInvoker());
            msg.setFromAddress(getFromAddress());
            if (messageId == null) {
                messageId = new MessageId();
            }
            msg.setMessageId(messageId);
            msg.setCorrelationId(correlationId);
            msg.setBody(args);
            Message resp;
            // dispatch the wire down the chain and get the response
            // TODO http://issues.apache.org/jira/browse/TUSCANY-777
            ClassLoader oldtccl = Thread.currentThread().getContextClassLoader();
            try {
View Full Code Here

* @version $Rev: 451655 $ $Date: 2006-09-30 13:06:53 -0700 (Sat, 30 Sep 2006) $
*/
public class SynchronousBridgingInterceptorTestCase extends TestCase {

    public void testInvoke() throws Exception {
        Message msg = new MessageImpl();
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
        EasyMock.replay(next);
        Interceptor interceptor = new SynchronousBridgingInterceptor(next);
        interceptor.invoke(msg);
View Full Code Here

        WorkContext context = createMock(WorkContext.class);
        Method method = AsyncTarget.class.getMethod("invoke");
        method.setAccessible(true);
        InboundWire wire = createMock(InboundWire.class);
        AsyncGroovyInvoker invoker = new AsyncGroovyInvoker("invoke", wire, component, monitor, context);
        Message msg = new MessageImpl();
        invoker.invoke(msg);
        verify(instance);
    }
View Full Code Here

        OutboundWire wire = createOutboundWire("wire", Greeting.class);
        terminateWire(wire);

        TargetInvoker invoker = createMock(TargetInvoker.class);
        expect(invoker.isCacheable()).andReturn(false);
        Message response = new MessageImpl();
        response.setBody("foo");
        expect(invoker.invoke(eqMessage())).andReturn(response);
        replay(invoker);

        for (OutboundInvocationChain chain : wire.getInvocationChains().values()) {
            chain.setTargetInvoker(invoker);
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        Object id = new Object();
        Object corrId = new Object();
        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);
        head = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(head.invoke(EasyMock.isA(Message.class))).andStubAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                throw new InsidiousException();   // andThrow() does not seem to work here
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        Object id = new Object();
        Object corrId = new Object();
        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);
        head = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(head.invoke(EasyMock.isA(Message.class))).andReturn(response);
        EasyMock.replay(head);
        chain = EasyMock.createMock(OutboundInvocationChain.class);
View Full Code Here

        InboundWire wire = createServiceWire("foo", AsyncTarget.class, null);
        Map<Operation<?>, InboundInvocationChain> chains = wire.getInvocationChains();
        InboundInvocationChain chain = chains.get(wire.getServiceContract().getOperations().get("invoke"));
        chain.setTargetInvoker(invoker);
        chain.prepare();
        MessageImpl msg = new MessageImpl();
        msg.setTargetInvoker(invoker);
        chain.getHeadInterceptor().invoke(msg);
        verify(target);
    }
View Full Code Here

TOP

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

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.