"MasterSlave", true);
MockParticipant[] participants = new MockParticipant[5];
for (int i = 0; i < 5; i++) {
String instanceName = "localhost_" + (12918 + i);
participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
participants[i].syncStart();
}
MockController controller =
new MockController(_zkaddr, clusterName, "controller_0");
controller.syncStart();
boolean result;
result =
ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
_zkaddr, clusterName));
Assert.assertTrue(result);
// participant session expiry
MockParticipant 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");
_setupTool.addResourceToCluster(clusterName, "TestDB1", 10, "MasterSlave");