Search in sources :

Example 16 with CoordinatorJobInfo

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

Example 17 with CoordinatorJobInfo

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

Example 18 with CoordinatorJobInfo

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

Example 19 with CoordinatorJobInfo

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

Example 20 with CoordinatorJobInfo

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

Aggregations

CoordinatorJobInfo (org.apache.oozie.CoordinatorJobInfo)25 ArrayList (java.util.ArrayList)23 List (java.util.List)22 HashMap (java.util.HashMap)21 JPAService (org.apache.oozie.service.JPAService)16 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)6 Date (java.util.Date)2 CoordinatorEngine (org.apache.oozie.CoordinatorEngine)2 CoordinatorEngineException (org.apache.oozie.CoordinatorEngineException)2 XException (org.apache.oozie.XException)2 JSONObject (org.json.simple.JSONObject)2 Query (javax.persistence.Query)1 BundleEngine (org.apache.oozie.BundleEngine)1 BundleEngineException (org.apache.oozie.BundleEngineException)1 BundleJobInfo (org.apache.oozie.BundleJobInfo)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 CoordJobInfoGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobInfoGetJPAExecutor)1