use of org.apache.oozie.executor.jpa.CoordJobGetActionsSubsetJPAExecutor in project oozie by apache.
the class CoordJobXCommand method execute.
/* (non-Javadoc)
* @see org.apache.oozie.command.XCommand#execute()
*/
@Override
protected CoordinatorJobBean execute() throws CommandException {
try {
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorJobBean coordJob = null;
if (jpaService != null) {
coordJob = jpaService.execute(new CoordJobGetJPAExecutor(id));
if (getActionInfo) {
int numAction = jpaService.execute(new CoordActionsCountForJobIdJPAExecutor(id, filterMap));
List<CoordinatorActionBean> coordActions = null;
if (len == 0) {
coordActions = new ArrayList<CoordinatorActionBean>();
} else {
coordActions = jpaService.execute(new CoordJobGetActionsSubsetJPAExecutor(id, filterMap, offset, len, desc));
}
coordJob.setActions(coordActions);
coordJob.setNumActions(numAction);
}
} else {
LOG.error(ErrorCode.E0610);
}
return coordJob;
} catch (XException ex) {
throw new CommandException(ex);
}
}
use of org.apache.oozie.executor.jpa.CoordJobGetActionsSubsetJPAExecutor in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method checkCoordActionsNominalTime.
private void checkCoordActionsNominalTime(String jobId, int number, Date[] nominalTimes) {
try {
JPAService jpaService = Services.get().get(JPAService.class);
List<CoordinatorActionBean> actions = jpaService.execute(new CoordJobGetActionsSubsetJPAExecutor(jobId, null, 1, 1000, false));
if (actions.size() != number) {
fail("Should have " + number + " actions created for job " + jobId + ", but has " + actions.size() + " actions.");
}
for (int i = 0; i < nominalTimes.length; i++) {
assertEquals(nominalTimes[i], actions.get(i).getNominalTime());
}
} catch (JPAExecutorException se) {
se.printStackTrace();
fail("Job ID " + jobId + " was not stored properly in db");
}
}
use of org.apache.oozie.executor.jpa.CoordJobGetActionsSubsetJPAExecutor in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method checkCoordActionsStatus.
private void checkCoordActionsStatus(String jobId, CoordinatorActionBean.Status[] statuses) {
try {
JPAService jpaService = Services.get().get(JPAService.class);
List<CoordinatorActionBean> actions = jpaService.execute(new CoordJobGetActionsSubsetJPAExecutor(jobId, null, 1, 1000, false));
if (actions.size() != statuses.length) {
fail("Should have " + statuses.length + " actions created for job " + jobId + ", but has " + actions.size() + " actions.");
}
for (int i = 0; i < statuses.length; i++) {
assertEquals(statuses[i], actions.get(i).getStatus());
}
} catch (JPAExecutorException se) {
se.printStackTrace();
fail("Job ID " + jobId + " was not stored properly in db");
}
}
Aggregations