conf.set(OozieClient.USER_NAME, getTestUser());
final String jobId1 = engine.submitJob(conf, true);
final WorkflowJobGetJPAExecutor readCmd = new WorkflowJobGetJPAExecutor(jobId1);
waitFor(1 * 100, new Predicate() {
@Override
public boolean evaluate() throws Exception {
return jpaService.execute(readCmd).getStatus() == WorkflowJob.Status.SUCCEEDED;
}
});
assertEquals(2, queue.size());
assertEquals(EventStatus.STARTED, ((JobEvent)queue.poll()).getEventStatus());
assertEquals(EventStatus.SUCCESS, ((JobEvent)queue.poll()).getEventStatus());
queue.clear();
// test coordinator action events (failure case)
Date startTime = DateUtils.parseDateOozieTZ("2009-02-01T23:59Z");
Date endTime = DateUtils.parseDateOozieTZ("2009-02-02T23:59Z");
CoordinatorJobBean coord = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, startTime, endTime, false,
false, 0);
_modifyCoordForFailureAction(coord, "wf-invalid-fork.xml");
new CoordMaterializeTransitionXCommand(coord.getId(), 3600).call();
final CoordJobGetJPAExecutor readCmd1 = new CoordJobGetJPAExecutor(coord.getId());
waitFor(1 * 100, new Predicate() {
@Override
public boolean evaluate() throws Exception {
CoordinatorJobBean bean = jpaService.execute(readCmd1);
return bean.getStatus() == CoordinatorJob.Status.SUCCEEDED
|| bean.getStatus() == CoordinatorJob.Status.KILLED;
}
});
assertEquals(2, queue.size());
assertEquals(EventStatus.WAITING, ((JobEvent)queue.poll()).getEventStatus());
assertEquals(EventStatus.FAILURE, ((JobEvent)queue.poll()).getEventStatus());
// test coordinator action events (failure from ActionStartX)
ehs.getAppTypes().add("workflow_action");
coord = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, startTime, endTime, false, false, 0);
CoordinatorActionBean action = addRecordToCoordActionTable(coord.getId(), 1, CoordinatorAction.Status.RUNNING,
"coord-action-sla1.xml", 0);
WorkflowJobBean wf = addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING,
action.getId());
action.setExternalId(wf.getId());
CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION, action);
String waId = _createWorkflowAction(wf.getId(), "wf-action");
new ActionStartXCommand(waId, action.getType()).call();
final WorkflowJobGetJPAExecutor readCmd2 = new WorkflowJobGetJPAExecutor(jobId1);
waitFor(1 * 100, new Predicate() {
@Override
public boolean evaluate() throws Exception {
return jpaService.execute(readCmd2).getStatus() == WorkflowJob.Status.KILLED;
}
});