use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class XDataTestCase method createBundleJobNegative.
/**
* Create bundle job that contains bad coordinator jobs
*
* @param jobStatus
* @return bundle job bean
* @throws Exception
*/
protected BundleJobBean createBundleJobNegative(Job.Status jobStatus) throws Exception {
Path coordPath1 = new Path(getFsTestCaseDir(), "coord1");
Path coordPath2 = new Path(getFsTestCaseDir(), "coord2");
writeCoordXml(coordPath1, "coord-job-bundle-negative.xml");
writeCoordXml(coordPath2, "coord-job-bundle-negative.xml");
Path bundleAppPath = new Path(getFsTestCaseDir(), "bundle");
String bundleAppXml = getBundleXml("bundle-submit-job.xml");
bundleAppXml = bundleAppXml.replaceAll("#app_path1", new Path(coordPath1.toString(), "coordinator.xml").toString());
bundleAppXml = bundleAppXml.replaceAll("#app_path2", new Path(coordPath1.toString(), "coordinator.xml").toString());
writeToFile(bundleAppXml, bundleAppPath, "bundle.xml");
Configuration conf = new XConfiguration();
conf.set(OozieClient.BUNDLE_APP_PATH, bundleAppPath.toString());
conf.set(OozieClient.USER_NAME, getTestUser());
conf.set("jobTracker", getJobTrackerUri());
conf.set("nameNode", getNameNodeUri());
conf.set("coordName1", "coord1");
conf.set("coordName2", "coord2");
conf.set("coord1.starttime", "2009-02-01T00:00Z");
conf.set("isEnabled", "true");
BundleJobBean bundle = new BundleJobBean();
bundle.setId(Services.get().get(UUIDService.class).generateId(ApplicationType.BUNDLE));
bundle.setAppName("BUNDLE-TEST");
bundle.setAppPath(bundleAppPath.toString());
bundle.setConf(XmlUtils.prettyPrint(conf).toString());
bundle.setConsoleUrl("consoleUrl");
bundle.setCreatedTime(new Date());
bundle.setJobXml(bundleAppXml);
bundle.setLastModifiedTime(new Date());
bundle.setOrigJobXml(bundleAppXml);
bundle.resetPending();
bundle.setStatus(jobStatus);
bundle.setUser(conf.get(OozieClient.USER_NAME));
bundle.setGroup(conf.get(OozieClient.GROUP_NAME));
return bundle;
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBulkMonitorJPAExecutor method testMultipleBundleIdsForName.
public void testMultipleBundleIdsForName() throws Exception {
// Adding another bundle having same name
BundleJobBean bundle = new BundleJobBean();
bundle.setId("00002-12345-B");
bundle.setAppName(bundleName);
bundle.setStatus(BundleJob.Status.RUNNING);
bundle.setStartTime(new Date());
BundleJobInsertJPAExecutor bundleInsert = new BundleJobInsertJPAExecutor(bundle);
jpaService.execute(bundleInsert);
String request = "bundle=" + bundleName;
BulkJPAExecutor bulkjpa = new BulkJPAExecutor(BundleEngine.parseBulkFilter(request), 1, 10);
try {
jpaService.execute(bulkjpa);
} catch (JPAExecutorException jex) {
// should not throw exception as this case is now supported
fail();
}
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleActionQueryExecutor method testExecuteUpdate.
public void testExecuteUpdate() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
BundleActionBean bean = this.addRecordToBundleActionTable(job.getId(), "action1", 1, Job.Status.PREP);
bean.setStatus(Job.Status.RUNNING);
BundleActionQueryExecutor.getInstance().executeUpdate(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, bean);
BundleActionBean retBean = BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION, bean.getBundleActionId());
assertEquals(retBean.getStatus(), Job.Status.RUNNING);
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleActionQueryExecutor method testGetUpdateQuery.
public void testGetUpdateQuery() throws Exception {
EntityManager em = jpaService.getEntityManager();
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
BundleActionBean bundleAction = this.addRecordToBundleActionTable(job.getId(), "action1", 1, Job.Status.PREP);
// UPDATE_BUNDLE_ACTION_PENDING_MODTIME
Query query = BundleActionQueryExecutor.getInstance().getUpdateQuery(BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME, bundleAction, em);
assertEquals(query.getParameterValue("lastModifiedTime"), bundleAction.getLastModifiedTimestamp());
assertEquals(query.getParameterValue("pending"), bundleAction.getPending());
assertEquals(query.getParameterValue("bundleActionId"), bundleAction.getBundleActionId());
// UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME:
query = BundleActionQueryExecutor.getInstance().getUpdateQuery(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID, bundleAction, em);
assertEquals(query.getParameterValue("status"), bundleAction.getStatus().toString());
assertEquals(query.getParameterValue("lastModifiedTime"), bundleAction.getLastModifiedTimestamp());
assertEquals(query.getParameterValue("pending"), bundleAction.getPending());
assertEquals(query.getParameterValue("coordId"), bundleAction.getCoordId());
assertEquals(query.getParameterValue("bundleActionId"), bundleAction.getBundleActionId());
// UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID
query = BundleActionQueryExecutor.getInstance().getUpdateQuery(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID, bundleAction, em);
assertEquals(query.getParameterValue("status"), bundleAction.getStatus().toString());
assertEquals(query.getParameterValue("lastModifiedTime"), bundleAction.getLastModifiedTimestamp());
assertEquals(query.getParameterValue("pending"), bundleAction.isPending() ? 1 : 0);
assertEquals(query.getParameterValue("coordId"), bundleAction.getCoordId());
assertEquals(query.getParameterValue("bundleActionId"), bundleAction.getBundleActionId());
em.close();
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleActionQueryExecutor method testGet.
public void testGet() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
BundleActionBean bundleAction = this.addRecordToBundleActionTable(job.getId(), "action1", 1, Job.Status.PREP);
// GET_UNIGNORED_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE
BundleActionBean retBean = BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_UNIGNORED_ACTION_STATUS_PENDING_FOR_BUNDLE, bundleAction.getBundleId());
assertEquals(bundleAction.getCoordId(), retBean.getCoordId());
assertEquals(bundleAction.getStatusStr(), retBean.getStatusStr());
assertEquals(bundleAction.getPending(), retBean.getPending());
// GET_BUNDLE_ACTION
retBean = BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION, bundleAction.getBundleActionId());
assertEquals(bundleAction.getStatus(), retBean.getStatus());
}
Aggregations