String newSessionId = ZkTestHelper.getSessionId(client);
Assert.assertEquals(newSessionId, oldSessionId);
}
client.unsubscribeStateChanges(listener);
// make sure participant is NOT disconnected
LiveInstance liveInstance = accessor.getProperty(keyBuilder.liveInstance(instanceName));
Assert.assertNotNull(liveInstance, "Live-instance should exist after " + n + " disconnects");
// trigger flapping
ZkTestHelper.simulateZkStateDisconnected(client);
// wait until we get invoked by zk state change to disconnected
boolean success = TestHelper.verify(new Verifier() {
@Override
public boolean verify() throws Exception {
return client.getShutdownTrigger();
}
}, 30 * 1000);
Assert.assertTrue(success, "The " + (n + 1)
+ "th disconnect event should trigger ZkHelixManager#disonnect");
// make sure participant is disconnected
success = TestHelper.verify(new TestHelper.Verifier() {
@Override
public boolean verify() throws Exception {
LiveInstance liveInstance = accessor.getProperty(keyBuilder.liveInstance(instanceName));
return liveInstance == null;
}
}, 3 * 1000);
Assert.assertTrue(success, "Live-instance should be gone after " + (n + 1) + " disconnects");