"MasterSlave", true);
MockParticipantManager[] participants = new MockParticipantManager[5];
for (int i = 0; i < 5; i++) {
String instanceName = "localhost_" + (12918 + i);
participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
participants[i].syncStart();
}
ClusterControllerManager controller =
new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
controller.syncStart();
boolean result;
result =
ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
ZK_ADDR, clusterName));
Assert.assertTrue(result);
// participant session expiry
MockParticipantManager participantToExpire = participants[1];
System.out.println("Expire participant session");
String oldSessionId = participantToExpire.getSessionId();
ZkTestHelper.expireSession(participantToExpire.getZkClient());
String newSessionId = participantToExpire.getSessionId();
System.out.println("oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId);
Assert.assertTrue(newSessionId.compareTo(oldSessionId) > 0,
"Session id should be increased after expiry");
ClusterSetup setupTool = new ClusterSetup(ZK_ADDR);