use of org.apache.oozie.BundleJobInfo in project oozie by apache.
the class TestBundleJobInfoGetJPAExecutor method _testGetJobInfoForUserAndStatus.
private void _testGetJobInfoForUserAndStatus() throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Map<String, List<String>> filter = new HashMap<String, List<String>>();
List<String> list1 = new ArrayList<String>();
list1.add(getTestUser());
filter.put(OozieClient.FILTER_USER, list1);
List<String> list2 = new ArrayList<String>();
list2.add("KILLED");
filter.put(OozieClient.FILTER_STATUS, list2);
BundleJobInfoGetJPAExecutor bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
BundleJobInfo ret = jpaService.execute(bundleInfoGetCmd);
assertNotNull(ret);
assertEquals(1, ret.getBundleJobs().size());
}
use of org.apache.oozie.BundleJobInfo in project oozie by apache.
the class TestBundleJobInfoGetJPAExecutor method testGetJobInfoForStartCreatedTime.
public void testGetJobInfoForStartCreatedTime() throws Exception {
BundleJobBean bundleJob1 = addRecordToBundleJobTable(BundleJob.Status.PREP, false);
BundleJobBean bundleJob2 = addRecordToBundleJobTable(BundleJob.Status.KILLED, false);
Date createTime1 = DateUtils.parseDateUTC("2012-01-01T10:00Z");
Date createTime2 = DateUtils.parseDateUTC("2012-01-05T10:00Z");
bundleJob1.setCreatedTime(createTime1);
bundleJob2.setCreatedTime(createTime2);
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQueryExecutor.BundleJobQuery.UPDATE_BUNDLE_JOB, bundleJob1);
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQueryExecutor.BundleJobQuery.UPDATE_BUNDLE_JOB, bundleJob2);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Map<String, List<String>> filter = new HashMap<String, List<String>>();
BundleJobInfoGetJPAExecutor BundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
BundleJobInfo ret = jpaService.execute(BundleInfoGetCmd);
assertNotNull(ret);
assertEquals(2, ret.getBundleJobs().size());
filter.clear();
filter.put(OozieClient.FILTER_CREATED_TIME_START, Arrays.asList("2012-01-02T10:00Z"));
BundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
ret = jpaService.execute(BundleInfoGetCmd);
assertNotNull(ret);
assertEquals(1, ret.getBundleJobs().size());
BundleJobBean jobBean = ret.getBundleJobs().get(0);
assertEquals(bundleJob2.getStatus(), jobBean.getStatus());
assertEquals(bundleJob2.getCreatedTime(), jobBean.getCreatedTime());
}
use of org.apache.oozie.BundleJobInfo in project oozie by apache.
the class TestBundleJobInfoGetJPAExecutor method _testGetJobInfoForUser.
private void _testGetJobInfoForUser() throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Map<String, List<String>> filter = new HashMap<String, List<String>>();
List<String> list = new ArrayList<String>();
list.add(getTestUser());
filter.put(OozieClient.FILTER_USER, list);
BundleJobInfoGetJPAExecutor bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
BundleJobInfo ret = jpaService.execute(bundleInfoGetCmd);
assertNotNull(ret);
assertEquals(4, ret.getBundleJobs().size());
}
use of org.apache.oozie.BundleJobInfo in project oozie by apache.
the class TestBundleJobInfoGetJPAExecutor method _testGetJobInfoForId.
private void _testGetJobInfoForId(String jobId) throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Map<String, List<String>> filter = new HashMap<String, List<String>>();
List<String> jobIdList = new ArrayList<String>();
jobIdList.add(jobId);
filter.put(OozieClient.FILTER_ID, jobIdList);
BundleJobInfoGetJPAExecutor bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
BundleJobInfo ret = jpaService.execute(bundleInfoGetCmd);
assertNotNull(ret);
assertEquals(ret.getBundleJobs().size(), 1);
}
use of org.apache.oozie.BundleJobInfo in project oozie by apache.
the class TestBundleJobInfoGetJPAExecutor method _testGetJobInfoForGroup.
private void _testGetJobInfoForGroup() throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Map<String, List<String>> filter = new HashMap<String, List<String>>();
List<String> list = new ArrayList<String>();
list.add(getTestGroup());
filter.put(OozieClient.FILTER_GROUP, list);
BundleJobInfoGetJPAExecutor bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
BundleJobInfo ret = jpaService.execute(bundleInfoGetCmd);
assertNotNull(ret);
assertEquals(2, ret.getBundleJobs().size());
}
Aggregations