use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToCoordJobTable.
/**
* Insert coord job for testing.
*
* @param status coord job status
* @param pending true if pending is true
* @param doneMatd true if doneMaterialization is true
* @return coord job bean
* @throws Exception
*/
protected CoordinatorJobBean addRecordToCoordJobTable(CoordinatorJob.Status status, boolean pending, boolean doneMatd) throws Exception {
CoordinatorJobBean coordJob = createCoordJob(status, pending, doneMatd);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
jpaService.execute(coordInsertCmd);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord job record to table");
throw je;
}
return coordJob;
}
use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToCoordJobTableWithBundle.
/**
* Add coordinator job bean with bundle id info.
*
* @param bundleId bundle id
* @param coordId coord id and coord name
* @param status job status
* @param start start time
* @param end end time
* @param pending true if pending is true
* @param doneMatd true if doneMaterialization is true
* @param lastActionNumber last action number
* @return coordinator job bean
* @throws Exception
*/
protected CoordinatorJobBean addRecordToCoordJobTableWithBundle(String bundleId, String coordId, CoordinatorJob.Status status, Date start, Date end, boolean pending, boolean doneMatd, int lastActionNumber) throws Exception {
CoordinatorJobBean coordJob = createCoordJob(status, start, end, pending, doneMatd, 0);
coordJob.setBundleId(bundleId);
// coord id and coord name are the same
coordJob.setId(coordId);
coordJob.setAppName(coordId);
coordJob.setLastActionNumber(lastActionNumber);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
jpaService.execute(coordInsertCmd);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord job record to table");
throw je;
}
return coordJob;
}
Aggregations