_setupTool.rebalanceStorageCluster(clusterName, "TestDB0", 1);
MockParticipant[] participants = new MockParticipant[nodeNr];
for (int i = 0; i < nodeNr - 1; i++) {
String instanceName = "localhost_" + (12918 + i);
participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
participants[i].syncStart();
}
result =
ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
_zkaddr, clusterName));
Assert.assertTrue(result);
// check if controller_0 has message listener for localhost_12918
String msgPath =
PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, "localhost_12918");
int numberOfListeners = ZkTestHelper.numberOfListeners(_zkaddr, msgPath);
// System.out.println("numberOfListeners(" + msgPath + "): " + numberOfListeners);
Assert.assertEquals(numberOfListeners, 2); // 1 of participant, and 1 of controller
_setupTool.addInstanceToCluster(clusterName, "localhost_12919");
_setupTool.rebalanceStorageCluster(clusterName, "TestDB0", 2);
participants[nodeNr - 1] = new MockParticipant(_zkaddr, clusterName, "localhost_12919");
participants[nodeNr - 1].syncStart();
result =
ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
_zkaddr, clusterName));
Assert.assertTrue(result);