use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class TestActionCheckerService method testActionCheckerServiceCoord.
/**
* Tests functionality of the Action Checker Service Runnable for
* coordinator actions. </p> Inserts Coord Job, Coord Action, and Workflow
* Job, and verifies the action status updated to SUCCEEDED. </p> Runs the
* ActionCheck runnable, and checks for the action job.
*
* @throws Exception
*/
public void testActionCheckerServiceCoord() throws Exception {
final int actionNum = 1;
final CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
Date start = DateUtils.parseDateOozieTZ(currentDatePlusMonth);
Date end = DateUtils.parseDateOozieTZ(currentDatePlusMonth);
final CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, start, end, false, false, 0);
final WorkflowJobBean wfJob = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
final CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), actionNum, CoordinatorAction.Status.RUNNING, "coord-action-get.xml", wfJob.getId(), "RUNNING", 0);
sleep(3000);
Runnable actionCheckRunnable = new ActionCheckRunnable(1);
actionCheckRunnable.run();
sleep(3000);
waitFor(200000, new Predicate() {
public boolean evaluate() throws Exception {
return (ce.getCoordAction(action.getId()).getStatus() == CoordinatorAction.Status.SUCCEEDED);
}
});
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean recoveredAction = jpaService.execute(new CoordActionGetJPAExecutor(action.getId()));
assertEquals(CoordinatorAction.Status.SUCCEEDED, recoveredAction.getStatus());
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class XDataTestCase method setMissingDependencies.
protected void setMissingDependencies(String actionId, String missingDependencies) throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
action.setMissingDependencies(missingDependencies);
CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION, action);
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class XDataTestCase method checkCoordActionStatus.
protected CoordinatorActionBean checkCoordActionStatus(final String actionId, final CoordinatorAction.Status stat) throws Exception {
final JPAService jpaService = Services.get().get(JPAService.class);
waitFor(5 * 1000, new Predicate() {
@Override
public boolean evaluate() throws Exception {
try {
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
return stat.equals(action.getStatus());
} catch (JPAExecutorException se) {
throw new Exception("Action ID " + actionId + " was not stored properly in db");
}
}
});
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
assertEquals(stat, action.getStatus());
return action;
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class XDataTestCase method setCoordActionCreationTime.
protected void setCoordActionCreationTime(String actionId, long actionCreationTime) throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
action.setCreatedTime(new Date(actionCreationTime));
CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION, action);
}
use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.
the class XDataTestCase method setCoordActionNominalTime.
protected void setCoordActionNominalTime(String actionId, long actionNominalTime) throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
action.setNominalTime(new Date(actionNominalTime));
CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION, action);
}
Aggregations