bg1.addConnector(live1);
bg2.addConnector(live2);
bg3.addConnector(live3);
DiscoveryGroup dg1 = new DiscoveryGroupImpl("group-1::" + RandomUtil.randomString(),
"group-1::" + RandomUtil.randomString(),
null,
groupAddress1,
groupPort1,
timeout);
dg1.start();
DiscoveryGroup dg2 = new DiscoveryGroupImpl("group-2::" + RandomUtil.randomString(),
"group-2::" + RandomUtil.randomString(),
null,
groupAddress2,
groupPort2,
timeout);
dg2.start();
DiscoveryGroup dg3 = new DiscoveryGroupImpl("group-3::" + RandomUtil.randomString(),
"group-3::" + RandomUtil.randomString(),
null,
groupAddress3,
groupPort3,
timeout);
dg3.start();
bg1.broadcastConnectors();
bg2.broadcastConnectors();
bg3.broadcastConnectors();
boolean ok = dg1.waitForBroadcast(timeout);
Assert.assertTrue(ok);
List<DiscoveryEntry> entries = dg1.getDiscoveryEntries();
assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);
ok = dg2.waitForBroadcast(timeout);
Assert.assertTrue(ok);
entries = dg2.getDiscoveryEntries();
assertEqualsDiscoveryEntries(Arrays.asList(live2), entries);
ok = dg3.waitForBroadcast(timeout);
Assert.assertTrue(ok);
entries = dg3.getDiscoveryEntries();
assertEqualsDiscoveryEntries(Arrays.asList(live3), entries);
bg1.stop();
bg2.stop();
bg3.stop();
dg1.stop();
dg2.stop();
dg3.stop();
}