StateModelDefinition stateModelDef =
new StateModelDefinition(generator.generateConfigForMasterSlave());
Builder keyBuilder = accessor.keyBuilder();
accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);
MockHelixTaskExecutor executor = new MockHelixTaskExecutor();
MockStateModel stateModel = new MockStateModel();
NotificationContext context;
executor.registerMessageHandlerFactory(MessageType.TASK_REPLY.toString(),
new AsyncCallbackService());
// String clusterName =" testcluster";
context = new NotificationContext(manager);
CurrentState currentStateDelta = new CurrentState("TestDB");
currentStateDelta.setState("TestDB_0", "OFFLINE");
HelixStateTransitionHandler handler =
new HelixStateTransitionHandler(stateModel,
message,
context,
currentStateDelta,
executor);
executor.scheduleTask(message, handler, context);
while (!executor.isDone(msgId + "/" + message.getPartitionName()))
{
Thread.sleep(500);
}
AssertJUnit.assertTrue(stateModel.stateModelInvoked);
System.out.println("END TestCMTaskExecutor");