use of org.jgroups.protocols.relay.SiteUUID in project JGroups by belaban.
the class SizeTest method testRelay2Header.
public static void testRelay2Header() throws Exception {
Address dest = new SiteMaster("sfo");
RELAY2.Relay2Header hdr = new RELAY2.Relay2Header(RELAY2.Relay2Header.DATA, dest, null);
_testSize(hdr);
Address sender = new SiteUUID(UUID.randomUUID(), "dummy", "sfo");
hdr = new RELAY2.Relay2Header(RELAY2.Relay2Header.DATA, dest, sender);
_testSize(hdr);
}
use of org.jgroups.protocols.relay.SiteUUID in project JGroups by belaban.
the class ExtendedUUIDTest method testSiteUUID.
public void testSiteUUID() throws Exception {
UUID a = (UUID) Util.createRandomAddress("A"), b = (UUID) Util.createRandomAddress("B");
SiteUUID sa = new SiteUUID(a, "sm-a", "sfo");
SiteUUID sb = new SiteUUID(b, "b", "lon").put(Util.stringToBytes("id"), Util.objectToByteBuffer(322649)).setFlag(RELAY2.can_become_site_master_flag);
System.out.println("sb = " + sb);
assert sa.getName().equals("sm-a");
assert sa.getSite().equals("sfo");
SiteUUID copy = (SiteUUID) sb.copy();
assert copy.equals(sb);
assert copy.getName().equals(sb.getName());
assert copy.getSite().equals(sb.getSite());
}
use of org.jgroups.protocols.relay.SiteUUID in project JGroups by belaban.
the class Util method readAddress.
public static Address readAddress(DataInput in) throws Exception {
byte flags = in.readByte();
if (Util.isFlagSet(flags, Address.NULL))
return null;
Address addr;
if (Util.isFlagSet(flags, Address.UUID_ADDR)) {
addr = new UUID();
addr.readFrom(in);
} else if (Util.isFlagSet(flags, Address.SITE_UUID)) {
addr = new SiteUUID();
addr.readFrom(in);
} else if (Util.isFlagSet(flags, Address.SITE_MASTER)) {
addr = new SiteMaster();
addr.readFrom(in);
} else if (Util.isFlagSet(flags, Address.IP_ADDR)) {
addr = new IpAddress();
addr.readFrom(in);
} else if (Util.isFlagSet(flags, Address.IP_ADDR_UUID)) {
addr = new IpAddressUUID();
addr.readFrom(in);
} else {
addr = readOtherAddress(in);
}
return addr;
}
Aggregations