Package org.gradle.messaging.dispatch

Examples of org.gradle.messaging.dispatch.MethodInvocation


            RemoteMethodInvocation remoteMethodInvocation = (RemoteMethodInvocation) message;
            Method method = methods.get(remoteMethodInvocation.getKey());
            if (method == null) {
                throw new IllegalStateException("Received a method invocation message for an unknown method.");
            }
            MethodInvocation methodInvocation = new MethodInvocation(method,
                    remoteMethodInvocation.getArguments());
            dispatch.dispatch(methodInvocation);
        } else {
            throw new IllegalStateException(String.format("Received an unknown message %s.", message));
        }
View Full Code Here


        }});

        broadcast.add(listener1);
        broadcast.add(listener2);

        MethodInvocation invocation = new MethodInvocation(TestListener.class.getMethod("event1", String.class), new Object[] { "param" });
        broadcast.dispatch(invocation);
    }
View Full Code Here

    @Test
    public void canUseDispatchToReceiveNotifications() throws NoSuchMethodException {
        final Dispatch<MethodInvocation> dispatch1 = context.mock(Dispatch.class, "listener1");
        final Dispatch<MethodInvocation> dispatch2 = context.mock(Dispatch.class, "listener2");
        final MethodInvocation invocation = new MethodInvocation(TestListener.class.getMethod("event1", String.class), new Object[] { "param" });

        context.checking(new Expectations() {{
            one(dispatch1).dispatch(invocation);
            one(dispatch2).dispatch(invocation);
        }});
View Full Code Here

        }});

        broadcast.add(listener);

        try {
            broadcast.dispatch(new MethodInvocation(TestListener.class.getMethod("event1", String.class), new Object[]{"param"}));
            fail();
        } catch (ListenerNotificationException e) {
            assertThat(e.getMessage(), equalTo("Failed to notify test listener."));
            assertThat(e.getCause(), sameInstance((Throwable) failure));
        }
View Full Code Here

            one(target).dispatch(new RemoteMethodInvocation(0, new Object[]{12}));
            inSequence(sequence);
        }});

        dispatch.dispatch(new MethodInvocation(method, new Object[]{17}));
        dispatch.dispatch(new MethodInvocation(method, new Object[]{12}));
    }
View Full Code Here

    @Test
    public void transformsRemoteMethodInvocationMessage() throws Exception {
        final Method method = String.class.getMethod("charAt", Integer.TYPE);

        context.checking(new Expectations() {{
            one(target).dispatch(new MethodInvocation(method, new Object[]{17}));
        }});

        dispatch.dispatch(new MethodMetaInfo(1, method));
        dispatch.dispatch(new RemoteMethodInvocation(1, new Object[]{17}));
    }
View Full Code Here

    @Test
    public void deliversMethodInvocationsOnOutgoingObjectToHandlerDispatch() throws Exception {
        final Dispatch<MethodInvocation> handler = context.mock(Dispatch.class);
        context.checking(new Expectations() {{
            one(handler).dispatch(new MethodInvocation(TestRemote.class.getMethod("doStuff", String.class),
                    new Object[]{"param"}));
        }});
        receiver.addIncoming(TestRemote.class, handler);

        TestRemote proxy = sender.addOutgoing(TestRemote.class);
View Full Code Here

        }});

        broadcast.add(listener1);
        broadcast.add(listener2);

        MethodInvocation invocation = new MethodInvocation(TestListener.class.getMethod("event1", String.class), new Object[]{"param"});
        broadcast.dispatch(invocation);
    }
View Full Code Here

    @Test
    public void canUseDispatchToReceiveNotifications() throws NoSuchMethodException {
        final Dispatch<MethodInvocation> dispatch1 = context.mock(Dispatch.class, "listener1");
        final Dispatch<MethodInvocation> dispatch2 = context.mock(Dispatch.class, "listener2");
        final MethodInvocation invocation = new MethodInvocation(TestListener.class.getMethod("event1", String.class), new Object[]{"param"});

        context.checking(new Expectations() {{
            one(dispatch1).dispatch(invocation);
            one(dispatch2).dispatch(invocation);
        }});
View Full Code Here

        }

        public MethodInvocation read() throws Exception {
            Method method = readMethod();
            Object[] args = readArguments();
            return new MethodInvocation(method, args);
        }
View Full Code Here

TOP

Related Classes of org.gradle.messaging.dispatch.MethodInvocation

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.