use of org.apache.oozie.executor.jpa.CoordActionGetForCheckJPAExecutor in project oozie by apache.
the class TestCoordActionsKillXCommand method testActionKillCommandActionNumbers.
/**
* Test the working of CoordActionKillXCommand by passing range
* as action ids
*
* @throws Exception
*/
public void testActionKillCommandActionNumbers() throws Exception {
JPAService jpaService = services.get(JPAService.class);
String[] ids = createDBRecords();
new CoordActionsKillXCommand(ids[0], "action", "1,3").call();
CoordinatorActionBean action = jpaService.execute(new CoordActionGetForCheckJPAExecutor(ids[1]));
assertEquals(CoordinatorAction.Status.KILLED, action.getStatus());
sleep(100);
WorkflowJobBean wf = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_FOR_SLA, ids[3]);
assertEquals(WorkflowJob.Status.KILLED, wf.getStatus());
CoordinatorJobBean job = jpaService.execute(new CoordJobGetJPAExecutor(ids[0]));
assertEquals(CoordinatorJob.Status.RUNNING, job.getStatus());
Runnable runnable = new StatusTransitRunnable();
runnable.run();
job = jpaService.execute(new CoordJobGetJPAExecutor(ids[0]));
assertEquals(CoordinatorJob.Status.RUNNINGWITHERROR, job.getStatus());
}
use of org.apache.oozie.executor.jpa.CoordActionGetForCheckJPAExecutor in project oozie by apache.
the class CoordActionCheckXCommand method loadState.
/* (non-Javadoc)
* @see org.apache.oozie.command.XCommand#loadState()
*/
@Override
protected void loadState() throws CommandException {
try {
jpaService = Services.get().get(JPAService.class);
if (jpaService != null) {
coordAction = jpaService.execute(new CoordActionGetForCheckJPAExecutor(actionId));
coordJob = jpaService.execute(new CoordinatorJobGetForUserAppnameJPAExecutor(coordAction.getJobId()));
workflowJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_FOR_SLA, coordAction.getExternalId());
LogUtils.setLogInfo(coordAction);
} else {
throw new CommandException(ErrorCode.E0610);
}
} catch (XException ex) {
throw new CommandException(ex);
}
}
use of org.apache.oozie.executor.jpa.CoordActionGetForCheckJPAExecutor in project oozie by apache.
the class TestCoordActionsKillXCommand method testActionKillCommandDate.
/**
* Test the working of CoordActionKillXCommand by passing range
* as date
*
* @throws Exception
*/
public void testActionKillCommandDate() throws Exception {
JPAService jpaService = services.get(JPAService.class);
String[] ids = createDBRecords();
System.out.println(DateUtils.parseDateOozieTZ("2009-12-15T01:00Z"));
System.out.println(DateUtils.parseDateOozieTZ("2009-12-15T02:00Z"));
new CoordActionsKillXCommand(ids[0], "date", "2009-12-15T01:00Z::2009-12-15T02:00Z").call();
CoordinatorActionBean action = jpaService.execute(new CoordActionGetForCheckJPAExecutor(ids[1]));
System.out.println(action.getNominalTime());
assertEquals(CoordinatorAction.Status.KILLED, action.getStatus());
action = jpaService.execute(new CoordActionGetForCheckJPAExecutor(ids[2]));
System.out.println(action.getNominalTime());
assertEquals(CoordinatorAction.Status.KILLED, action.getStatus());
sleep(100);
WorkflowJobBean wf = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_FOR_SLA, ids[3]);
assertEquals(WorkflowJob.Status.KILLED, wf.getStatus());
CoordinatorJobBean job = jpaService.execute(new CoordJobGetJPAExecutor(ids[0]));
assertEquals(CoordinatorJob.Status.RUNNING, job.getStatus());
Runnable runnable = new StatusTransitRunnable();
runnable.run();
job = jpaService.execute(new CoordJobGetJPAExecutor(ids[0]));
assertEquals(CoordinatorJob.Status.KILLED, job.getStatus());
}
Aggregations