Search in sources :

Example 11 with BundleJobInfo

use of org.apache.oozie.BundleJobInfo in project oozie by apache.

the class TestBundleJobsXCommand method _testGetJobsForGroup.

private void _testGetJobsForGroup() throws Exception {
    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);
    BundleJobsXCommand bundlesGetCmd = new BundleJobsXCommand(filter, 1, 20);
    BundleJobInfo ret = bundlesGetCmd.call();
    assertNotNull(ret);
    assertEquals(4, ret.getBundleJobs().size());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BundleJobInfo(org.apache.oozie.BundleJobInfo) List(java.util.List) ArrayList(java.util.ArrayList)

Example 12 with BundleJobInfo

use of org.apache.oozie.BundleJobInfo in project oozie by apache.

the class TestBundleJobsXCommand 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("BUNDLE-TEST");
    filter.put(OozieClient.FILTER_NAME, list);
    BundleJobsXCommand bundlesGetCmd = new BundleJobsXCommand(filter, 1, 20);
    BundleJobInfo ret = bundlesGetCmd.call();
    assertNotNull(ret);
    assertEquals(6, ret.getBundleJobs().size());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BundleJobInfo(org.apache.oozie.BundleJobInfo) List(java.util.List) ArrayList(java.util.ArrayList)

Example 13 with BundleJobInfo

use of org.apache.oozie.BundleJobInfo in project oozie by apache.

the class TestBundleJobInfoGetJPAExecutor method _testGetJobInfoForStatus.

private void _testGetJobInfoForStatus() 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("RUNNING");
    list.add("PREP");
    filter.put(OozieClient.FILTER_STATUS, 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)

Example 14 with BundleJobInfo

use of org.apache.oozie.BundleJobInfo in project oozie by apache.

the class TestBundleJobInfoGetJPAExecutor method testBundleJobsSortBy.

public void testBundleJobsSortBy() throws Exception {
    BundleJobBean bundleJob1 = addRecordToBundleJobTable(Job.Status.PREP, false);
    BundleJobBean bundleJob2 = addRecordToBundleJobTable(Job.Status.RUNNING, false);
    bundleJob1.setLastModifiedTime(DateUtils.parseDateUTC("2012-01-04T10:00Z"));
    bundleJob1.setCreatedTime(DateUtils.parseDateUTC("2012-01-03T10:00Z"));
    BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQueryExecutor.BundleJobQuery.UPDATE_BUNDLE_JOB, bundleJob1);
    bundleJob2.setLastModifiedTime(DateUtils.parseDateUTC("2012-01-05T10:00Z"));
    bundleJob2.setCreatedTime(DateUtils.parseDateUTC("2012-01-02T10:00Z"));
    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>>();
    List<String> list = new ArrayList<String>();
    list.add("lastmodifiedTime");
    filter.put(OozieClient.FILTER_SORT_BY, list);
    BundleJobInfoGetJPAExecutor bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
    BundleJobInfo ret = jpaService.execute(bundleInfoGetCmd);
    assertNotNull(ret);
    assertEquals(2, ret.getBundleJobs().size());
    compareBundleJobs(bundleJob2, ret.getBundleJobs().get(0));
    // test the default behavior
    filter.clear();
    list.clear();
    bundleInfoGetCmd = new BundleJobInfoGetJPAExecutor(filter, 1, 20);
    ret = jpaService.execute(bundleInfoGetCmd);
    assertNotNull(ret);
    assertEquals(2, ret.getBundleJobs().size());
    compareBundleJobs(bundleJob1, ret.getBundleJobs().get(0));
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean) 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 15 with BundleJobInfo

use of org.apache.oozie.BundleJobInfo in project oozie by apache.

the class TestBundleJobInfoGetJPAExecutor method _testGetJobInfoForAppName.

private void _testGetJobInfoForAppName() 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("BUNDLE-TEST");
    filter.put(OozieClient.FILTER_NAME, 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)

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