Package org.jgroups

Examples of org.jgroups.Message


        // give time to reconnect
        Util.sleep(3000);

       

        channel.send(new Message(null, null, "payload"));

        View view = coordinator.getView();
        assert view.size() == 2;
        assert view.containsMember(coordinator.getLocalAddress());
        assert view.containsMember(channel.getLocalAddress());

        view = channel.getView();
        assert view.size() == 2;
        assert view.containsMember(coordinator.getLocalAddress());
        assert view.containsMember(channel.getLocalAddress());

        Message msg = msgPromise.getResult(20000);
        assert msg != null;
        assert "payload".equals(msg.getObject());
    }
View Full Code Here


        gr1.start();
        // give time to reconnect
        Util.sleep(6000);
      

        channel.send(new Message(null, null, "payload"));

        View view = coordinator.getView();
        assert view.size() == 2;
        assert view.containsMember(coordinator.getLocalAddress());
        assert view.containsMember(channel.getLocalAddress());

        view = channel.getView();
        assert view.size() == 2;
        assert view.containsMember(coordinator.getLocalAddress());
        assert view.containsMember(channel.getLocalAddress());

        Message msg = msgPromise.getResult(20000);
        assert msg != null;
        assert "payload".equals(msg.getObject());
    }
View Full Code Here

        modifyChannel(channel);
        channel.connect("testConnectSendMessageFirstGRDown");
        Util.sleep(1000);
        gr1.stop();

        channel.send(new Message(null, null, "payload"));
        View view = coordinator.getView();
        assert view.size() == 2;
        assert view.containsMember(coordinator.getLocalAddress());
        assert view.containsMember(channel.getLocalAddress());

        view = channel.getView();
        assert view.size() == 2;
        assert view.containsMember(coordinator.getLocalAddress());
        assert view.containsMember(channel.getLocalAddress());

        Message msg = msgPromise.getResult(20000);
        assert msg != null;
        assert "payload".equals(msg.getObject());

    }
View Full Code Here

    }

    public void testNullMessageToSelf() {
        MyHandler handler=new MyHandler(null);
        d1.setRequestHandler(handler);
        RspList rsps=d1.castMessage(null, new Message(), new RequestOptions(Request.GET_ALL, 0));
        System.out.println("rsps:\n" + rsps);
        assertNotNull(rsps);
        Assert.assertEquals(1, rsps.size());
        Object obj=rsps.getFirst();
        assert obj == null;
View Full Code Here

        Assert.assertEquals(2, c2.getView().size());
        System.out.println("view: " + c2.getView());

        System.out.println("casting message");
        start=System.currentTimeMillis();
        RspList rsps=d1.castMessage(null, new Message(), new RequestOptions(Request.GET_ALL, 0));
        stop=System.currentTimeMillis();
        System.out.println("rsps:\n" + rsps);
        System.out.println("call took " + (stop - start) + " ms");
        assertNotNull(rsps);
        Assert.assertEquals(2, rsps.size());
View Full Code Here

    private void sendMessage(int size) {
        long start, stop;
        MyHandler handler=new MyHandler(new byte[size]);
        d1.setRequestHandler(handler);
        start=System.currentTimeMillis();
        RspList rsps=d1.castMessage(null, new Message(), new RequestOptions(Request.GET_ALL, 0));
        stop=System.currentTimeMillis();
        System.out.println("rsps:\n" + rsps);
        System.out.println("call took " + (stop - start) + " ms");
        assertNotNull(rsps);
        Assert.assertEquals(1, rsps.size());
View Full Code Here

        c2.connect("MessageDispatcherUnitTest");
        Assert.assertEquals(2, c2.getView().size());

        System.out.println("casting message");
        start=System.currentTimeMillis();
        RspList rsps=d1.castMessage(null, new Message(), new RequestOptions(Request.GET_ALL, 0));
        stop=System.currentTimeMillis();
        System.out.println("rsps:\n" + rsps);
        System.out.println("call took " + (stop - start) + " ms");
        assertNotNull(rsps);
        Assert.assertEquals(2, rsps.size());
View Full Code Here

        win.reset();
    }


    public void testAdd() {
        Message m;
        win.reset(); // use a different window for this test method
        win=new AckReceiverWindow(10);
        Assert.assertEquals(0, win.size());
        win.add(9, msg());
        Assert.assertEquals(0, win.size());
View Full Code Here

        assert win.size() == 1;
    }

    public void testRemove() {
        win.add(2, msg());
        Message msg=win.remove();
        assert msg == null;
        assert win.size() == 1;
        win.add(1, msg());
        assert win.size() == 2;
        assert win.remove() != null;
View Full Code Here

    }


    public static void testSmallerThanNextToRemove() {
        AckReceiverWindow win=new AckReceiverWindow(1);
        Message msg;
        for(long i=1; i <= 5; i++)
            win.add(i, msg());
        System.out.println("win = " + win);
        boolean added=win.add(3, msg());
        assert !added;
View Full Code Here

TOP

Related Classes of org.jgroups.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.