use of org.apache.helix.mock.statemodel.MockTaskStateModelFactory in project helix by apache.
the class TestJobFailureTaskNotStarted method startParticipantsWithStuckTaskStateModelFactory.
protected void startParticipantsWithStuckTaskStateModelFactory() {
Map<String, TaskFactory> taskFactoryReg = new HashMap<String, TaskFactory>();
taskFactoryReg.put(MockTask.TASK_COMMAND, new TaskFactory() {
@Override
public Task createNewTask(TaskCallbackContext context) {
return new MockTask(context);
}
});
List<String> instances = _setupTool.getClusterManagementTool().getInstancesInCluster(CLUSTER_NAME);
_participants[0] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, instances.get(0));
StateMachineEngine stateMachine = _participants[0].getStateMachineEngine();
stateMachine.registerStateModelFactory("Task", new MockTaskStateModelFactory(_participants[0], taskFactoryReg));
_participants[0].syncStart();
_blockedParticipant = _participants[0];
_participants[1] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, instances.get(1));
stateMachine = _participants[1].getStateMachineEngine();
stateMachine.registerStateModelFactory("Task", new TaskStateModelFactory(_participants[1], taskFactoryReg));
_participants[1].syncStart();
_normalParticipant = _participants[1];
}
use of org.apache.helix.mock.statemodel.MockTaskStateModelFactory in project helix by apache.
the class TestJobTimeoutTaskNotStarted method startParticipantsWithStuckTaskStateModelFactory.
protected void startParticipantsWithStuckTaskStateModelFactory() {
Map<String, TaskFactory> taskFactoryReg = new HashMap<String, TaskFactory>();
taskFactoryReg.put(MockTask.TASK_COMMAND, new TaskFactory() {
@Override
public Task createNewTask(TaskCallbackContext context) {
return new MockTask(context);
}
});
// start dummy participants
for (int i = 0; i < _numNodes; i++) {
String instanceName = PARTICIPANT_PREFIX + "_" + (_startPort + i);
_participants[i] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, instanceName);
// Register a Task state model factory.
StateMachineEngine stateMachine = _participants[i].getStateMachineEngine();
stateMachine.registerStateModelFactory("Task", new MockTaskStateModelFactory(_participants[i], taskFactoryReg));
_participants[i].syncStart();
}
}
Aggregations