} catch (HelixException e) {
// OK
}
ZNRecord stateModelRecord = new ZNRecord("id1");
try {
tool.addStateModelDef(clusterName, "id1", new StateModelDefinition(stateModelRecord));
path = PropertyPathConfig.getPath(PropertyType.STATEMODELDEFS, clusterName, "id1");
AssertJUnit.assertTrue(_gZkClient.exists(path));
Assert.fail("should fail");
} catch (HelixException e) {
// OK
} catch (IllegalArgumentException ex) {
// OK
}
tool.addStateModelDef(clusterName, "MasterSlave", new StateModelDefinition(
StateModelConfigGenerator.generateConfigForMasterSlave()));
stateModelRecord = StateModelConfigGenerator.generateConfigForMasterSlave();
try {
tool.addStateModelDef(clusterName, stateModelRecord.getId(), new StateModelDefinition(
stateModelRecord));
Assert.fail("should fail if add an already-existing state model");
} catch (HelixException e) {
// OK
}