use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleJobInfoGetJPAExecutor method testBundleJobInfoGet.
public void testBundleJobInfoGet() throws Exception {
BundleJobBean bundleJob1 = addRecordToBundleJobTable(Job.Status.PREP, false);
addRecordToBundleJobTable(Job.Status.RUNNING, false);
_testGetJobInfoForStatus();
_testGetJobInfoForGroup();
addRecordToBundleJobTable(Job.Status.KILLED, false);
addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
_testGetJobInfoForAppName();
_testGetJobInfoForUser();
_testGetJobInfoForUserAndStatus();
_testGetJobInfoForId(bundleJob1.getId());
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleJobQueryExecutor method testGetUpdateQuery.
public void testGetUpdateQuery() throws Exception {
EntityManager em = jpaService.getEntityManager();
BundleJobBean bean = addRecordToBundleJobTable(Job.Status.PREP, false);
// UPDATE_BUNDLE_JOB
Query query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB, bean, em);
assertEquals(query.getParameterValue("appName"), bean.getAppName());
assertEquals(query.getParameterValue("appPath"), bean.getAppPath());
assertEquals(query.getParameterValue("conf"), bean.getConfBlob());
assertEquals(query.getParameterValue("timeOut"), bean.getTimeout());
assertEquals(query.getParameterValue("createdTime"), bean.getCreatedTimestamp());
assertEquals(query.getParameterValue("endTime"), bean.getEndTimestamp());
assertEquals(query.getParameterValue("jobXml"), bean.getJobXmlBlob());
assertEquals(query.getParameterValue("lastModifiedTime"), bean.getLastModifiedTimestamp());
assertEquals(query.getParameterValue("origJobXml"), bean.getOrigJobXmlBlob());
assertEquals(query.getParameterValue("startTime"), bean.getstartTimestamp());
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("timeUnit"), bean.getTimeUnitStr());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_BUNDLE_JOB_STATUS
query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS, bean, em);
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_BUNDLE_JOB_STATUS_PENDING
query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING, bean, em);
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME:
query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME, bean, em);
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("lastModifiedTime"), bean.getLastModifiedTimestamp());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("suspendedTime"), bean.getSuspendedTimestamp());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME:
query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME, bean, em);
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("lastModifiedTime"), bean.getLastModifiedTimestamp());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME:
query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME, bean, em);
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("pauseTime"), bean.getPauseTimestamp());
assertEquals(query.getParameterValue("endTime"), bean.getEndTimestamp());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_BUNDLE_JOB_PAUSE_KICKOFF:
query = BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_PAUSE_KICKOFF, bean, em);
assertEquals(query.getParameterValue("pauseTime"), bean.getPauseTimestamp());
assertEquals(query.getParameterValue("kickoffTime"), bean.getKickoffTimestamp());
assertEquals(query.getParameterValue("id"), bean.getId());
em.close();
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleJobQueryExecutor method testInsert.
public void testInsert() throws Exception {
BundleJobBean bean = new BundleJobBean();
bean.setId("test-oozie");
bean.setAppName("testApp");
bean.setUser("oozie");
BundleJobQueryExecutor.getInstance().insert(bean);
BundleJobBean retBean = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, "test-oozie");
assertEquals(retBean.getAppName(), "testApp");
assertEquals(retBean.getUser(), "oozie");
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestBundleJobQueryExecutor method testGet.
public void testGet() throws Exception {
BundleJobBean bean = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
// GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME
BundleJobBean retBean = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MOD_PAUSE_SUSPEND_TIME, bean.getId());
assertEquals(bean.getId(), retBean.getId());
assertEquals(bean.getStatusStr(), retBean.getStatusStr());
assertEquals(bean.getPending(), retBean.getPending());
assertEquals(bean.getLastModifiedTime().getTime(), retBean.getLastModifiedTime().getTime());
// GET_BUNDLE_JOB_ID_JOBXML_CONF
retBean = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_JOBXML_CONF, bean.getId());
assertEquals(bean.getId(), retBean.getId());
assertEquals(bean.getJobXml(), retBean.getJobXml());
assertEquals(bean.getConf(), retBean.getConf());
// GET_BUNDLE_JOB_STATUS
retBean = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS, bean.getId());
assertEquals(bean.getStatus(), retBean.getStatus());
assertEquals(bean.getId(), retBean.getId());
}
use of org.apache.oozie.BundleJobBean in project oozie by apache.
the class TestCoordJobsGetFromParentIdJPAExecutor method testGetBundleParent.
public void testGetBundleParent() throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobBean bundleJobA = addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
BundleJobBean bundleJobB = addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
CoordinatorJobBean coordJobA1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
CoordinatorJobBean coordJobA2 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
coordJobA2.setAppName("something_different");
CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJobA2);
CoordinatorJobBean coordJobB = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
CoordinatorActionBean coordActionA1 = addRecordToCoordActionTable(coordJobA1.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
CoordinatorActionBean coordActionA2 = addRecordToCoordActionTable(coordJobA2.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
CoordinatorActionBean coordActionB = addRecordToCoordActionTable(coordJobB.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
BundleActionBean bundleActionA1 = addRecordToBundleActionTable(bundleJobA.getId(), coordJobA1.getId(), coordJobA1.getAppName(), 0, Job.Status.SUCCEEDED);
BundleActionBean bundleActionA2 = addRecordToBundleActionTable(bundleJobA.getId(), coordJobA2.getId(), coordJobA2.getAppName(), 0, Job.Status.SUCCEEDED);
BundleActionBean bundleActionB = addRecordToBundleActionTable(bundleJobB.getId(), coordJobB.getId(), coordJobB.getAppName(), 0, Job.Status.SUCCEEDED);
List<String> children = new ArrayList<String>();
children.addAll(jpaService.execute(new CoordJobsGetFromParentIdJPAExecutor(bundleJobA.getId(), 10)));
checkChildren(children, coordJobA1.getId(), coordJobA2.getId());
children = new ArrayList<String>();
children.addAll(jpaService.execute(new CoordJobsGetFromParentIdJPAExecutor(bundleJobB.getId(), 10)));
checkChildren(children, coordJobB.getId());
}
Aggregations