use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleJobSuspendXCommand method testBundleSuspendWithError.
/**
* Test : Suspend bundle job in RUNNINGWITHERROR state
*
* @throws Exception
*/
public void testBundleSuspendWithError() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNINGWITHERROR, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.RUNNINGWITHERROR, job.getStatus());
new BundleJobSuspendXCommand(job.getId()).call();
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.SUSPENDEDWITHERROR, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleJobSuspendXCommand method testBundleSuspendWithError2.
/**
* Test : Suspend bundle job in PAUSEDWITHERROR state
*
* @throws Exception
*/
public void testBundleSuspendWithError2() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PAUSEDWITHERROR, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.PAUSEDWITHERROR, job.getStatus());
new BundleJobSuspendXCommand(job.getId()).call();
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.SUSPENDEDWITHERROR, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleKillXCommand method testBundleKill3.
/**
* Test : Kill bundle job
*
* @throws Exception
*/
public void testBundleKill3() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Configuration jobConf = null;
try {
jobConf = new XConfiguration(new StringReader(job.getConf()));
} catch (IOException ioe) {
log.warn("Configuration parse error. read from DB :" + job.getConf(), ioe);
throw new CommandException(ErrorCode.E1005, ioe);
}
Path appPath = new Path(jobConf.get(OozieClient.BUNDLE_APP_PATH), "bundle.xml");
jobConf.set(OozieClient.BUNDLE_APP_PATH, appPath.toString());
BundleSubmitXCommand submitCmd = new BundleSubmitXCommand(jobConf);
submitCmd.call();
BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(submitCmd.getJob().getId());
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.PREP, job.getStatus());
new BundleKillXCommand(job.getId()).call();
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.KILLED, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleKillXCommand method testBundleKill1.
/**
* Test : Kill bundle job
*
* @throws Exception
*/
public void testBundleKill1() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.PREP, job.getStatus());
new BundleKillXCommand(job.getId()).call();
job = jpaService.execute(bundleJobGetCmd);
assertEquals(Job.Status.KILLED, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundlePauseUnpauseXCommand method testBundlePauseUnpause3.
/**
* Test : Pause a RUNNINGWITHERROR bundle
*
* @throws Exception
*/
public void testBundlePauseUnpause3() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNINGWITHERROR, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetCmd);
assertEquals(job.getStatus(), Job.Status.RUNNINGWITHERROR);
new BundlePauseXCommand(job).call();
job = jpaService.execute(bundleJobGetCmd);
assertEquals(job.getStatus(), Job.Status.PAUSEDWITHERROR);
new BundleUnpauseXCommand(job).call();
job = jpaService.execute(bundleJobGetCmd);
assertEquals(job.getStatus(), Job.Status.RUNNINGWITHERROR);
}
Aggregations