TestHelper.setupEmptyCluster(_gZkClient, clusterName);
int[] ids = {0,1,2,3, 4, 5};
setupInstances(clusterName, ids);
/////////////////////
ZKHelixManager manager = new ZKHelixManager(clusterName, "localhost_0",
InstanceType.PARTICIPANT,
ZK_ADDR);
manager.connect();
HelixDataAccessor accessor = manager.getHelixDataAccessor();
LiveInstance liveInstance = accessor.getProperty(accessor.keyBuilder().liveInstance("localhost_0"));
Assert.assertTrue(liveInstance.getRecord().getListFields().size() == 0);
Assert.assertTrue(liveInstance.getRecord().getMapFields().size() == 0);
Assert.assertTrue(liveInstance.getRecord().getSimpleFields().size() == 3);
manager = new ZKHelixManager(clusterName, "localhost_1",
InstanceType.PARTICIPANT,
ZK_ADDR);
manager.setLiveInstanceInfoProvider(new provider(false));
manager.connect();
accessor = manager.getHelixDataAccessor();
liveInstance = accessor.getProperty(accessor.keyBuilder().liveInstance("localhost_1"));
Assert.assertTrue(liveInstance.getRecord().getListFields().size() == 1);
Assert.assertTrue(liveInstance.getRecord().getMapFields().size() == 1);
Assert.assertTrue(liveInstance.getRecord().getSimpleFields().size() == 4);
manager = new ZKHelixManager(clusterName, "localhost_2",
InstanceType.PARTICIPANT,
ZK_ADDR);
manager.setLiveInstanceInfoProvider(new provider(true));
manager.connect();
accessor = manager.getHelixDataAccessor();
liveInstance = accessor.getProperty(accessor.keyBuilder().liveInstance("localhost_2"));
Assert.assertTrue(liveInstance.getRecord().getListFields().size() == 1);
Assert.assertTrue(liveInstance.getRecord().getMapFields().size() == 1);
Assert.assertTrue(liveInstance.getRecord().getSimpleFields().size() == 5);