action = jpaService.execute(coordGetCmd);
WorkflowJobBean wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(action.getExternalId()));
wfJob.setStatus(WorkflowJob.Status.SUCCEEDED);
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
action.setStatus(CoordinatorAction.Status.RUNNING);
jpaService.execute(new CoordActionUpdateJPAExecutor(action));
new CoordActionCheckXCommand(action.getId(), 0).call();
action = jpaService.execute(coordGetCmd);
assertEquals(CoordinatorAction.Status.SUCCEEDED, action.getStatus());
List<Event> list = queue.pollBatch();
event = (JobEvent)list.get(list.size()-1);
assertEquals(EventStatus.SUCCESS, event.getEventStatus());
assertEquals(AppType.COORDINATOR_ACTION, event.getAppType());
assertEquals(action.getId(), event.getId());
assertEquals(action.getJobId(), event.getParentId());
assertEquals(action.getNominalTime(), ((CoordinatorActionEvent) event).getNominalTime());
assertEquals(wfJob.getStartTime(), event.getStartTime());
assertEquals(coord.getUser(), event.getUser());
assertEquals(coord.getAppName(), event.getAppName());
// Action Failure
action.setStatus(CoordinatorAction.Status.RUNNING);
jpaService.execute(new CoordActionUpdateJPAExecutor(action));
wfJob.setStatus(WorkflowJob.Status.FAILED);
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
new CoordActionCheckXCommand(action.getId(), 0).call();
action = jpaService.execute(coordGetCmd);
assertEquals(CoordinatorAction.Status.FAILED, action.getStatus());
event = (JobEvent) queue.poll();
assertEquals(EventStatus.FAILURE, event.getEventStatus());
assertEquals(AppType.COORDINATOR_ACTION, event.getAppType());
assertEquals(action.getId(), event.getId());
assertEquals(action.getJobId(), event.getParentId());
assertEquals(action.getNominalTime(), ((CoordinatorActionEvent) event).getNominalTime());
assertEquals(wfJob.getStartTime(), event.getStartTime());
assertEquals(coord.getUser(), event.getUser());
assertEquals(coord.getAppName(), event.getAppName());
// Action start on Coord Resume
coord.setStatus(CoordinatorJobBean.Status.SUSPENDED);
jpaService.execute(new CoordJobUpdateJPAExecutor(coord));
action.setStatus(CoordinatorAction.Status.SUSPENDED);
jpaService.execute(new CoordActionUpdateJPAExecutor(action));
wfJob.setStatus(WorkflowJob.Status.SUSPENDED);
WorkflowInstance wfInstance = wfJob.getWorkflowInstance();
((LiteWorkflowInstance) wfInstance).setStatus(WorkflowInstance.Status.SUSPENDED);
wfJob.setWorkflowInstance(wfInstance);
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
new CoordResumeXCommand(coord.getId()).call();
Thread.sleep(5000);
CoordinatorActionEvent cevent = (CoordinatorActionEvent) queue.poll();
assertEquals(EventStatus.STARTED, cevent.getEventStatus());
assertEquals(AppType.COORDINATOR_ACTION, cevent.getAppType());
assertEquals(action.getId(), cevent.getId());
assertEquals(action.getJobId(), cevent.getParentId());
assertEquals(action.getNominalTime(), cevent.getNominalTime());
assertEquals(wfJob.getStartTime(), cevent.getStartTime());
// Action going to WAITING on Coord Rerun
action.setStatus(CoordinatorAction.Status.SUCCEEDED);
jpaService.execute(new CoordActionUpdateJPAExecutor(action));
queue.clear();
new CoordRerunXCommand(coord.getId(), RestConstants.JOB_COORD_RERUN_ACTION, "1", false, true)
.call();
waitFor(3 * 100, new Predicate() {
@Override