use of org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method addRecordToBundleJobTableWithPausedTime.
protected BundleJobBean addRecordToBundleJobTableWithPausedTime(Job.Status jobStatus, boolean pending, Date pausedTime) throws Exception {
BundleJobBean bundle = createBundleJob(jobStatus, pending);
bundle.setPauseTime(pausedTime);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
jpaService.execute(bundleInsertjpa);
} catch (JPAExecutorException ce) {
ce.printStackTrace();
fail("Unable to insert the test bundle job record to table");
throw ce;
}
return bundle;
}
use of org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor in project oozie by apache.
the class TestStatusTransitService method testBundleStatusTransitServicePausedWithError.
/**
* Test : Check the transition of a PAUSED bundle job to PAUSEDWITHERROR
* @throws Exception
*/
public void testBundleStatusTransitServicePausedWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
BundleJobBean bundleJob = createBundleJob(Job.Status.PAUSED, true);
bundleJob.setPauseTime(DateUtils.parseDateOozieTZ("2009-02-01T01:00Z"));
final JPAService jpaService = Services.get().get(JPAService.class);
BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundleJob);
jpaService.execute(bundleInsertjpa);
final String bundleId = bundleJob.getId();
addRecordToBundleActionTable(bundleId, "action1", 1, Job.Status.PAUSED);
addRecordToBundleActionTable(bundleId, "action2", 1, Job.Status.PAUSED);
BundleActionBean bundleAction = addRecordToBundleActionTable(bundleId, "action3", 0, Job.Status.FAILED);
bundleAction.setCoordId("test");
BundleActionQueryExecutor.getInstance().executeUpdate(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID, bundleAction);
Runnable runnable = new StatusTransitRunnable();
runnable.run();
waitFor(5 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
BundleJobBean bundle = jpaService.execute(new BundleJobGetJPAExecutor(bundleId));
return bundle.getStatus() == Job.Status.PAUSEDWITHERROR;
}
});
bundleJob = jpaService.execute(new BundleJobGetJPAExecutor(bundleId));
assertEquals(Job.Status.PAUSEDWITHERROR, bundleJob.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToBundleJobTable.
/**
* Insert bundle job for testing.
*
* @param jobStatus job status
* @param pending true if pending
* @return bundle job bean
* @throws Exception
*/
public BundleJobBean addRecordToBundleJobTable(Job.Status jobStatus, boolean pending) throws Exception {
BundleJobBean bundle = createBundleJob(jobStatus, pending);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
jpaService.execute(bundleInsertjpa);
} catch (JPAExecutorException ce) {
ce.printStackTrace();
fail("Unable to insert the test bundle job record to table");
throw ce;
}
return bundle;
}
use of org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToBundleJobTableNegative.
/**
* Insert a bad bundle job for testing negative cases.
*
* @param jobStatus job status
* @return bundle job bean
* @throws Exception
*/
protected BundleJobBean addRecordToBundleJobTableNegative(Job.Status jobStatus) throws Exception {
BundleJobBean bundle = createBundleJobNegative(jobStatus);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
jpaService.execute(bundleInsertjpa);
} catch (JPAExecutorException ce) {
ce.printStackTrace();
fail("Unable to insert the test bundle job record to table");
throw ce;
}
return bundle;
}
use of org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToBundleJobTableDisabledCoord.
/**
* Insert bundle job for testing.
*
* @param jobStatus job status
* @param pending true if pending
* @return bundle job bean
* @throws Exception
*/
protected BundleJobBean addRecordToBundleJobTableDisabledCoord(Job.Status jobStatus) throws Exception {
BundleJobBean bundle = createBundleJobCoordDisabled(jobStatus);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
jpaService.execute(bundleInsertjpa);
} catch (JPAExecutorException ce) {
ce.printStackTrace();
fail("Unable to insert the test bundle job record to table");
throw ce;
}
return bundle;
}
Aggregations