use of org.apache.oozie.CoordinatorJobInfo in project oozie by apache.
the class TestCoordJobsXCommand method _testGetJobsForUserAndStatus.
private void _testGetJobsForUserAndStatus() throws Exception {
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);
CoordJobsXCommand coordsGetCmd = new CoordJobsXCommand(filter, 1, 20);
CoordinatorJobInfo ret = coordsGetCmd.call();
assertNotNull(ret);
assertEquals(ret.getCoordJobs().size(), 2);
}
use of org.apache.oozie.CoordinatorJobInfo in project oozie by apache.
the class TestCoordJobsXCommand method _testGetJobsForAppName.
private void _testGetJobsForAppName() throws Exception {
Map<String, List<String>> filter = new HashMap<String, List<String>>();
List<String> list = new ArrayList<String>();
list.add("COORD-TEST");
filter.put(OozieClient.FILTER_NAME, list);
CoordJobsXCommand coordsGetCmd = new CoordJobsXCommand(filter, 1, 20);
CoordinatorJobInfo ret = coordsGetCmd.call();
assertNotNull(ret);
assertEquals(ret.getCoordJobs().size(), 3);
}
use of org.apache.oozie.CoordinatorJobInfo in project oozie by apache.
the class TestCoordJobInfoGetJPAExecutor method testGetJobInfoForWrongTimeFormat.
public void testGetJobInfoForWrongTimeFormat() throws Exception {
addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Map<String, List<String>> filter = new HashMap<String, List<String>>();
CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
assertNotNull(ret);
assertEquals(2, ret.getCoordJobs().size());
filter.clear();
filter.put(OozieClient.FILTER_CREATED_TIME_START, Arrays.asList("2012-01-02T10:00"));
coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
try {
jpaService.execute(coordInfoGetCmd);
fail("This should not happen. Check the createdTime passed.");
} catch (JPAExecutorException e) {
assertEquals(e.getErrorCode(), ErrorCode.E0302);
assertTrue(e.getMessage().contains(StoreStatusFilter.TIME_FORMAT));
}
}
use of org.apache.oozie.CoordinatorJobInfo in project oozie by apache.
the class TestCoordJobInfoGetJPAExecutor 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);
CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
assertNotNull(ret);
assertEquals(ret.getCoordJobs().size(), 1);
}
use of org.apache.oozie.CoordinatorJobInfo in project oozie by apache.
the class TestCoordJobInfoGetJPAExecutor method testGetJobInfoForBundleId.
public void testGetJobInfoForBundleId() throws Exception {
String bundleId = "0000000-171003192756908-oozie-test-B";
String coordId = "0000000-171003192756999-oozie-test-C";
addRecordToCoordJobTableWithBundle(bundleId, coordId, CoordinatorJob.Status.SUCCEEDED, true, true, 1);
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(coordId);
filter.put(OozieClient.FILTER_ID, jobIdList);
CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
assertNotNull("CoordinatorJobInfo should not be null", ret);
assertEquals("The number of coord jobs should be 1", 1, ret.getCoordJobs().size());
assertEquals("Failed to verify bundle id of coord job", bundleId, ret.getCoordJobs().get(0).getBundleId());
}
Aggregations