10, // partitions per resource
5, // number of nodes
3, // replicas
"MasterSlave", true); // do rebalance
MockParticipantManager participant =
new MockParticipantManager(ZK_ADDR, clusterName, "localhost_12918");
participant.syncStart();
// Logger.getRootLogger().setLevel(Level.INFO);
String lastSessionId = participant.getSessionId();
for (int i = 0; i < 3; i++) {
// System.err.println("curSessionId: " + lastSessionId);
ZkTestHelper.expireSession(participant.getZkClient());
String sessionId = participant.getSessionId();
Assert.assertTrue(sessionId.compareTo(lastSessionId) > 0,
"Session id should be increased after expiry");
lastSessionId = sessionId;
// make sure session id is not 0
Assert.assertFalse(sessionId.equals("0"),
"Hit race condition in zhclient.handleNewSession(). sessionId is not returned yet.");
// TODO: need to test session expiry during handleNewSession()
}
// Logger.getRootLogger().setLevel(Level.INFO);
System.out.println("Disconnecting ...");
participant.syncStop();
System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
}