Search in sources :

Example 16 with BundleJobInfo

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());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BundleJobInfo(org.apache.oozie.BundleJobInfo) ArrayList(java.util.ArrayList) List(java.util.List) JPAService(org.apache.oozie.service.JPAService)

Example 17 with BundleJobInfo

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());
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean) HashMap(java.util.HashMap) BundleJobInfo(org.apache.oozie.BundleJobInfo) ArrayList(java.util.ArrayList) List(java.util.List) JPAService(org.apache.oozie.service.JPAService) Date(java.util.Date)

Example 18 with BundleJobInfo

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());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BundleJobInfo(org.apache.oozie.BundleJobInfo) ArrayList(java.util.ArrayList) List(java.util.List) JPAService(org.apache.oozie.service.JPAService)

Example 19 with BundleJobInfo

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);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BundleJobInfo(org.apache.oozie.BundleJobInfo) ArrayList(java.util.ArrayList) List(java.util.List) JPAService(org.apache.oozie.service.JPAService)

Example 20 with BundleJobInfo

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());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BundleJobInfo(org.apache.oozie.BundleJobInfo) ArrayList(java.util.ArrayList) List(java.util.List) JPAService(org.apache.oozie.service.JPAService)

Aggregations

BundleJobInfo (org.apache.oozie.BundleJobInfo)20 ArrayList (java.util.ArrayList)18 List (java.util.List)17 HashMap (java.util.HashMap)16 JPAService (org.apache.oozie.service.JPAService)12 BundleJobBean (org.apache.oozie.BundleJobBean)6 Date (java.util.Date)2 BundleEngine (org.apache.oozie.BundleEngine)2 BundleEngineException (org.apache.oozie.BundleEngineException)2 XException (org.apache.oozie.XException)2 JSONObject (org.json.simple.JSONObject)2 Query (javax.persistence.Query)1 CoordinatorEngine (org.apache.oozie.CoordinatorEngine)1 CoordinatorEngineException (org.apache.oozie.CoordinatorEngineException)1 CoordinatorJobInfo (org.apache.oozie.CoordinatorJobInfo)1 DagEngine (org.apache.oozie.DagEngine)1 DagEngineException (org.apache.oozie.DagEngineException)1 WorkflowsInfo (org.apache.oozie.WorkflowsInfo)1 CommandException (org.apache.oozie.command.CommandException)1 BundleJobInfoGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobInfoGetJPAExecutor)1