@Test
public void testReplication() throws Exception {
System.out.println("Starting reg1");
HazelcastDomainRegistry reg1 = new HazelcastDomainRegistry(extensionPoints, (Properties)null, "tuscany:foo?bind=127.0.0.1:9876&multicast=off", "bar");
reg1.start();
System.out.println("Adding ep1");
RuntimeEndpoint ep1 = createEndpoint("ep1uri");
ep1.bind(extensionPoints, reg1);
reg1.addEndpoint(ep1);
System.out.println("Starting reg3");
HazelcastDomainRegistry reg2 = new HazelcastDomainRegistry(extensionPoints, (Properties)null, "tuscany:foo?bind=127.0.0.1:9877&multicast=off&wka=127.0.0.1:9876", "bar");
reg2.start();
System.out.println("Starting reg2");
HazelcastDomainRegistry reg3 = new HazelcastDomainRegistry(extensionPoints, (Properties)null, "tuscany:foo?bind=127.0.0.1:9878&multicast=off&wka=127.0.0.1:9877", "bar");
reg3.start();
assertExists(reg1, "ep1uri");
assertExists(reg2, "ep1uri");
assertExists(reg3, "ep1uri");
System.out.println("Adding ep2");
RuntimeEndpoint ep2 = createEndpoint("ep2uri");
ep2.bind(extensionPoints, reg2);
reg2.addEndpoint(ep2);
assertExists(reg2, "ep2uri");
assertExists(reg1, "ep2uri");
assertExists(reg3, "ep2uri");
System.out.println("Stopping reg1");
reg1.stop();
System.out.println("Stopped reg1");
Thread.sleep(500);
Assert.assertNull(reg2.getEndpoint("ep1uri"));
Assert.assertNull(reg3.getEndpoint("ep1uri"));
assertExists(reg2, "ep2uri");
assertExists(reg3, "ep2uri");
System.out.println("Starting reg1");
reg1.start();
ep1.bind(extensionPoints, reg1);
System.out.println("adding ep1");
reg1.addEndpoint(ep1);
assertExists(reg1, "ep1uri");
assertExists(reg2, "ep1uri");
assertExists(reg3, "ep1uri");
System.out.println("Stopping reg1");
reg1.stop();
System.out.println("Stopping reg2");
reg2.stop();
System.out.println("Stopping reg3");
reg3.stop();
System.out.println("done");
}