String instanceName = "localhost_" + (12918 + i);
participants[i] = new MockParticipant(clusterName, instanceName, ZK_ADDR);
new Thread(participants[i]).start();
}
ZkHelixTestManager controller =
new ZkHelixTestManager(clusterName,
"controller_0",
InstanceType.CONTROLLER,
ZK_ADDR);
controller.connect();
boolean result;
result =
ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
clusterName));
Assert.assertTrue(result);
String msgPath = PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, "localhost_12918");
result = checkHandlers(controller.getHandlers(), msgPath);
Assert.assertTrue(result);
_gSetupTool.addInstanceToCluster(clusterName, "localhost:12922");
_gSetupTool.rebalanceStorageCluster(clusterName, "TestDB0", 3);
participants[nodeNr - 1] =
new MockParticipant(clusterName, "localhost_12922", ZK_ADDR);
new Thread(participants[nodeNr - 1]).start();
result =
ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
clusterName));
Assert.assertTrue(result);
msgPath = PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, "localhost_12922");
result = checkHandlers(controller.getHandlers(), msgPath);
Assert.assertTrue(result);
// clean up
controller.disconnect();
for (int i = 0; i < nodeNr; i++)
{
participants[i].syncStop();
}