Package org.jgroups.debug

Examples of org.jgroups.debug.ProtocolTester




    public void testRegularMessages() throws Exception {
        FragReceiver frag_receiver=new FragReceiver(this);
        ProtocolTester t=new ProtocolTester("FRAG2(frag_size=" + FRAG_SIZE + ')', frag_receiver);
        Message big_msg;
        IpAddress local_addr=new IpAddress(5555);

        System.out.println("\nProtocol for protocol tester: " + t.getProtocolSpec() + '\n');

        for(int i=0; i < NUM_MSGS; i++) {
            big_msg=createBigMessage(MSG_SIZE);
            big_msg.setSrc(local_addr);
            System.out.println("sending msg #" + i + " [" + big_msg.getLength() + " bytes]");
            frag_receiver.down(new Event(Event.MSG, big_msg));
            Util.sleep(10);
        }
        t.stop();
    }
View Full Code Here


    }


    public void testMessagesWithOffsets() throws Exception {
        FragReceiver frag_receiver=new FragReceiver(this);
        ProtocolTester t=new ProtocolTester("FRAG2(frag_size=" + FRAG_SIZE + ')', frag_receiver);
        Message big_msg;
        IpAddress local_addr=new IpAddress(5555);

        System.out.println("\nProtocol for protocol tester: " + t.getProtocolSpec() + '\n');

        byte[] big_buffer=new byte[(int)(MSG_SIZE * NUM_MSGS)];

        int offset=0;

        for(int i=0; i < NUM_MSGS; i++) {
            big_msg=new Message(null, null, big_buffer, offset, MSG_SIZE);
            big_msg.setSrc(local_addr);
            System.out.println("sending msg #" + i + " [" + big_msg.getLength() + " bytes]");
            frag_receiver.down(new Event(Event.MSG, big_msg));
            Util.sleep(10);
            offset+=MSG_SIZE;
        }
        t.stop();
    }
View Full Code Here


    public void test0() throws Exception {
        Object mutex=new Object();
        FragReceiver frag_receiver=new FragReceiver(this, mutex);
        ProtocolTester t=new ProtocolTester("FRAG(frag_size=" + FRAG_SIZE + ')', frag_receiver);
        Message big_msg;
        IpAddress local_addr=new IpAddress(5555);

        System.out.println("\nProtocol for protocol tester: " + t.getProtocolSpec() + '\n');

        synchronized(mutex) {
            for(int i=0; i < NUM_MSGS; i++) {
                big_msg=createBigMessage(MSG_SIZE);
                big_msg.setSrc(local_addr);
                System.out.println("sending msg #" + i + " [" + big_msg.getLength() + " bytes]");
                frag_receiver.down(new Event(Event.MSG, big_msg));
                Util.sleep(10);
            }
        }
        t.stop();
    }
View Full Code Here


    public void test0() throws Exception {
        Object mutex=new Object();
        CheckNoGaps check=new CheckNoGaps(-1, this, mutex);
        ProtocolTester t=new ProtocolTester("pbcast.NAKACK", check);
        Address my_addr=new IpAddress("localhost", 10000);
        ViewId vid=new ViewId(my_addr, 322649);
        Vector mbrs=new Vector();
        View view;

        mbrs.addElement(my_addr);
        view=new View(vid, mbrs);

        t.start();
        check.down(new Event(Event.BECOME_SERVER));
        check.down(new Event(Event.VIEW_CHANGE, view));

        synchronized(mutex) {
            for(long i=0; i < NUM_MSGS; i++) {
                if(i % 1000 == 0 && i > 0)
                    System.out.println("sending msg #" + i);
                check.down(new Event(Event.MSG, new Message(null, my_addr, new Long(i))));
                num_msgs_sent++;
            }
            mutex.wait(WAIT_TIME);
        }
        System.out.println("\nMessages sent: " + num_msgs_sent + ", messages received: " + num_msgs_received);
        assertEquals(num_msgs_received, num_msgs_sent);
        t.stop();
    }
View Full Code Here


    public void test0() throws Exception {
        Object mutex=new Object();
        FragReceiver frag_receiver=new FragReceiver(this, mutex);
        ProtocolTester t=new ProtocolTester("FRAG(frag_size=" + FRAG_SIZE + ')', frag_receiver);
        Message big_msg;
        IpAddress local_addr=new IpAddress(5555);

        System.out.println("\nProtocol for protocol tester: " + t.getProtocolSpec() + '\n');

        synchronized(mutex) {
            for(int i=0; i < NUM_MSGS; i++) {
                big_msg=createBigMessage(MSG_SIZE);
                big_msg.setSrc(local_addr);
                System.out.println("sending msg #" + i + " [" + big_msg.getLength() + " bytes]");
                frag_receiver.down(new Event(Event.MSG, big_msg));
                Util.sleep(10);
            }
        }
        t.stop();
    }
View Full Code Here


    public void test0() throws Exception {
        Object mutex=new Object();
        CheckNoGaps check=new CheckNoGaps(1, this, mutex);
        ProtocolTester t=new ProtocolTester("pbcast.NAKACK", check);
        Address my_addr=new IpAddress("localhost", 10000);
        ViewId vid=new ViewId(my_addr, 322649);
        Vector mbrs=new Vector();
        View view;

        mbrs.addElement(my_addr);
        view=new View(vid, mbrs);

        t.start();
        t.getBottom().up(new Event(Event.SET_LOCAL_ADDRESS, my_addr));


        check.down(new Event(Event.BECOME_SERVER));
        check.down(new Event(Event.VIEW_CHANGE, view));

        for(long i=1; i <= NUM_MSGS; i++) {
            if(i % 1000 == 0)
                System.out.println("sending msg #" + i);
            check.down(new Event(Event.MSG, new Message(null, my_addr, new Long(i))));
            num_msgs_sent++;
        }

        synchronized(mutex) {
            while(!check.isDone())
                mutex.wait(WAIT_TIME);
        }
        System.out.println("\nMessages sent: " + num_msgs_sent + ", messages received: " + num_msgs_received);
        assertEquals(num_msgs_received, num_msgs_sent);
        t.stop();
    }
View Full Code Here

TOP

Related Classes of org.jgroups.debug.ProtocolTester

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.