message.setMessageId(MessageId.from("Some unique message id"));
message.setResourceId(ResourceId.from("TestDB"));
message.setTgtName("localhost");
message.setStateModelDef(StateModelDefId.from("MasterSlave"));
message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
MockStateModelAnnotated stateModel = new MockStateModelAnnotated();
NotificationContext context;
MockManager manager = new MockManager("clusterName");
HelixDataAccessor accessor = manager.getHelixDataAccessor();
StateModelDefinition stateModelDef =
new StateModelDefinition(StateModelConfigGenerator.generateConfigForMasterSlave());
Builder keyBuilder = accessor.keyBuilder();
accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);
context = new NotificationContext(manager);
CurrentState currentStateDelta = new CurrentState("TestDB");
currentStateDelta.setState(PartitionId.from("TestDB_0"), State.from("OFFLINE"));
StateTransitionHandlerFactory<MockStateModelAnnotated> stateModelFactory =
new StateTransitionHandlerFactory<MockStateModelAnnotated>() {
@Override
public MockStateModelAnnotated createStateTransitionHandler(PartitionId partitionName) {
// TODO Auto-generated method stub
return new MockStateModelAnnotated();
}
};
HelixStateTransitionHandler stHandler =