Search in sources :

Example 1 with GossipData

use of org.jgroups.stack.GossipData in project JGroups by belaban.

the class SizeTest method testGossipData.

public void testGossipData() throws Exception {
    GossipData data;
    final Address own = org.jgroups.util.UUID.randomUUID();
    final Address coord = org.jgroups.util.UUID.randomUUID();
    NameCache.add(own, "own");
    NameCache.add(coord, "coord");
    PingData pd1 = new PingData(coord, true, "coord", new IpAddress(7400));
    PingData pd2 = new PingData(own, true, "own", new IpAddress(7500));
    final PhysicalAddress physical_addr_1 = new IpAddress("127.0.0.1", 7500);
    _testSize(new GossipData(GossipType.REGISTER));
    data = new GossipData(GossipType.REGISTER, "DemoCluster", own, (List<PingData>) null, null);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "DemoCluster", own, Arrays.asList(pd1, pd2), null);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "DemoCluster", own, Arrays.asList(pd2, pd1), physical_addr_1);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "demo", own, "logical_name", null);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "demo", own, new byte[] { 'b', 'e', 'l', 'a' });
    _testSize(data);
    byte[] buffer = new byte[10];
    buffer[2] = 'B';
    buffer[3] = 'e';
    buffer[4] = 'l';
    buffer[5] = 'a';
    data = new GossipData(GossipType.REGISTER, "demo", own, buffer, 2, 4);
    _testSize(data);
    buffer = "hello world".getBytes();
    data = new GossipData(GossipType.MESSAGE, "demo", null, buffer, 0, buffer.length);
    _testSize(data);
}
Also used : IpAddress(org.jgroups.stack.IpAddress) IpAddress(org.jgroups.stack.IpAddress) GossipData(org.jgroups.stack.GossipData)

Aggregations

GossipData (org.jgroups.stack.GossipData)1 IpAddress (org.jgroups.stack.IpAddress)1