use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class TestCoordKillXCommand method testCoordKillFailedOnAction.
/**
* Test : kill job successfully but failed to kill an already successful action
*
* @throws Exception
*/
public void testCoordKillFailedOnAction() throws Exception {
CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, true);
CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordJobGetJPAExecutor coordJobGetCmd = new CoordJobGetJPAExecutor(job.getId());
CoordActionGetJPAExecutor coordActionGetCmd = new CoordActionGetJPAExecutor(action.getId());
job = jpaService.execute(coordJobGetCmd);
action = jpaService.execute(coordActionGetCmd);
assertEquals(job.getStatus(), CoordinatorJob.Status.SUCCEEDED);
assertEquals(action.getStatus(), CoordinatorAction.Status.SUCCEEDED);
new CoordKillXCommand(job.getId()).call();
job = jpaService.execute(coordJobGetCmd);
action = jpaService.execute(coordActionGetCmd);
assertEquals(job.getStatus(), CoordinatorJob.Status.SUCCEEDED);
assertEquals(action.getStatus(), CoordinatorAction.Status.SUCCEEDED);
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method checkCoordActionsTimeout.
private void checkCoordActionsTimeout(String actionId, int expected) {
try {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
assertEquals(action.getTimeOut(), expected);
} catch (JPAExecutorException se) {
se.printStackTrace();
fail("Action ID " + actionId + " was not stored properly in db");
}
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method checkCoordAction.
private CoordinatorActionBean checkCoordAction(String actionId) throws JPAExecutorException {
long[] lastSeqId = new long[1];
JPAService jpaService = Services.get().get(JPAService.class);
List<SLAEventBean> slaEventList = jpaService.execute(new SLAEventsGetForSeqIdJPAExecutor(-1, 10, lastSeqId));
if (slaEventList.size() == 0) {
fail("Unable to GET any record of sequence id greater than 0");
}
CoordinatorActionBean actionBean;
actionBean = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
return actionBean;
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class TestCoordPushDependencyCheckXCommand method checkDependencies.
private CoordinatorActionBean checkDependencies(String actionId, String expDeps, String expPushDeps) throws Exception {
try {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
assertEquals(expDeps, action.getMissingDependencies());
assertEquals(expPushDeps, action.getPushMissingDependencies());
return action;
} catch (JPAExecutorException se) {
throw new Exception("Action ID " + actionId + " was not stored properly in db");
}
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class TestCoordPushDependencyCheckXCommand method checkCoordAction.
private CoordinatorActionBean checkCoordAction(String actionId, String expDeps, CoordinatorAction.Status stat) throws Exception {
try {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
String missDeps = action.getPushMissingDependencies();
assertEquals(expDeps, missDeps);
assertEquals(stat, action.getStatus());
return action;
} catch (JPAExecutorException se) {
throw new Exception("Action ID " + actionId + " was not stored properly in db");
}
}
Aggregations