Search in sources :

Example 11 with CoordActionGetJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.

the class TestPurgeXCommand method testFailCoordPurgeXCommand.

/**
 * Test : purge failed coord job and action successfully
 *
 * @throws Exception
 */
public void testFailCoordPurgeXCommand() throws Exception {
    CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.FAILED, false, false);
    CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), 1, CoordinatorAction.Status.FAILED, "coord-action-get.xml", 0);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    CoordJobGetJPAExecutor coordJobGetExecutor = new CoordJobGetJPAExecutor(job.getId());
    CoordActionGetJPAExecutor coordActionGetExecutor = new CoordActionGetJPAExecutor(action.getId());
    job = jpaService.execute(coordJobGetExecutor);
    action = jpaService.execute(coordActionGetExecutor);
    assertEquals(job.getStatus(), CoordinatorJob.Status.FAILED);
    assertEquals(action.getStatus(), CoordinatorAction.Status.FAILED);
    new PurgeXCommand(1, 7, 1, 10).call();
    try {
        jpaService.execute(coordJobGetExecutor);
        fail("Coordinator Job should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordActionGetExecutor);
        fail("Coordinator Action should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) CoordActionGetJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Example 12 with CoordActionGetJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.

the class TestPurgeXCommand method testPurgeBundleWithCoordChildWithWFChild3MoreThanLimit.

/**
 * Test : The workflow and coordinator should get purged, and the bundle parent should get purged --> all will get purged
 * There are more coordinator children than the limit
 *
 * @throws Exception
 */
public void testPurgeBundleWithCoordChildWithWFChild3MoreThanLimit() throws Exception {
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    BundleJobBean bundleJob = addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateOozieTZ("2011-01-01T01:00Z"));
    CoordinatorJobBean coordJob1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    CoordinatorJobBean coordJob2 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    coordJob2.setAppName("coord2");
    CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob2);
    CoordinatorJobBean coordJob3 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    coordJob3.setAppName("coord3");
    CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob3);
    CoordinatorJobBean coordJob4 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    coordJob4.setAppName("coord4");
    CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob4);
    CoordinatorJobBean coordJob5 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    coordJob5.setAppName("coord5");
    CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob5);
    WorkflowJobBean wfJob1 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    WorkflowJobBean wfJob2 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    WorkflowJobBean wfJob3 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    WorkflowJobBean wfJob4 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    WorkflowJobBean wfJob5 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    WorkflowActionBean wfAction1 = addRecordToWfActionTable(wfJob1.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfAction2 = addRecordToWfActionTable(wfJob2.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfAction3 = addRecordToWfActionTable(wfJob3.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfAction4 = addRecordToWfActionTable(wfJob4.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfAction5 = addRecordToWfActionTable(wfJob5.getId(), "1", WorkflowAction.Status.OK);
    CoordinatorActionBean coordAction1 = addRecordToCoordActionTable(coordJob1.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJob1.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordAction2 = addRecordToCoordActionTable(coordJob2.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJob2.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordAction3 = addRecordToCoordActionTable(coordJob3.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJob3.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordAction4 = addRecordToCoordActionTable(coordJob4.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJob4.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordAction5 = addRecordToCoordActionTable(coordJob5.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJob5.getId(), "SUCCEEDED", 0);
    BundleActionBean bundleAction1 = addRecordToBundleActionTable(bundleJob.getId(), coordJob1.getId(), coordJob1.getAppName(), 0, Job.Status.SUCCEEDED);
    BundleActionBean bundleAction2 = addRecordToBundleActionTable(bundleJob.getId(), coordJob2.getId(), coordJob2.getAppName(), 0, Job.Status.SUCCEEDED);
    BundleActionBean bundleAction3 = addRecordToBundleActionTable(bundleJob.getId(), coordJob3.getId(), coordJob3.getAppName(), 0, Job.Status.SUCCEEDED);
    BundleActionBean bundleAction4 = addRecordToBundleActionTable(bundleJob.getId(), coordJob4.getId(), coordJob4.getAppName(), 0, Job.Status.SUCCEEDED);
    BundleActionBean bundleAction5 = addRecordToBundleActionTable(bundleJob.getId(), coordJob5.getId(), coordJob5.getAppName(), 0, Job.Status.SUCCEEDED);
    WorkflowJobGetJPAExecutor wfJob1GetCmd = new WorkflowJobGetJPAExecutor(wfJob1.getId());
    WorkflowJobGetJPAExecutor wfJob2GetCmd = new WorkflowJobGetJPAExecutor(wfJob2.getId());
    WorkflowJobGetJPAExecutor wfJob3GetCmd = new WorkflowJobGetJPAExecutor(wfJob3.getId());
    WorkflowJobGetJPAExecutor wfJob4GetCmd = new WorkflowJobGetJPAExecutor(wfJob4.getId());
    WorkflowJobGetJPAExecutor wfJob5GetCmd = new WorkflowJobGetJPAExecutor(wfJob5.getId());
    WorkflowActionGetJPAExecutor wfAction1GetCmd = new WorkflowActionGetJPAExecutor(wfAction1.getId());
    WorkflowActionGetJPAExecutor wfAction2GetCmd = new WorkflowActionGetJPAExecutor(wfAction2.getId());
    WorkflowActionGetJPAExecutor wfAction3GetCmd = new WorkflowActionGetJPAExecutor(wfAction3.getId());
    WorkflowActionGetJPAExecutor wfAction4GetCmd = new WorkflowActionGetJPAExecutor(wfAction4.getId());
    WorkflowActionGetJPAExecutor wfAction5GetCmd = new WorkflowActionGetJPAExecutor(wfAction5.getId());
    CoordJobGetJPAExecutor coordJob1GetCmd = new CoordJobGetJPAExecutor(coordJob1.getId());
    CoordJobGetJPAExecutor coordJob2GetCmd = new CoordJobGetJPAExecutor(coordJob2.getId());
    CoordJobGetJPAExecutor coordJob3GetCmd = new CoordJobGetJPAExecutor(coordJob3.getId());
    CoordJobGetJPAExecutor coordJob4GetCmd = new CoordJobGetJPAExecutor(coordJob4.getId());
    CoordJobGetJPAExecutor coordJob5GetCmd = new CoordJobGetJPAExecutor(coordJob5.getId());
    CoordActionGetJPAExecutor coordAction1GetCmd = new CoordActionGetJPAExecutor(coordAction1.getId());
    CoordActionGetJPAExecutor coordAction2GetCmd = new CoordActionGetJPAExecutor(coordAction2.getId());
    CoordActionGetJPAExecutor coordAction3GetCmd = new CoordActionGetJPAExecutor(coordAction3.getId());
    CoordActionGetJPAExecutor coordAction4GetCmd = new CoordActionGetJPAExecutor(coordAction4.getId());
    CoordActionGetJPAExecutor coordAction5GetCmd = new CoordActionGetJPAExecutor(coordAction5.getId());
    BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(bundleJob.getId());
    BundleActionGetJPAExecutor bundleAction1GetCmd = new BundleActionGetJPAExecutor(bundleJob.getId(), coordJob1.getAppName());
    BundleActionGetJPAExecutor bundleAction2GetCmd = new BundleActionGetJPAExecutor(bundleJob.getId(), coordJob2.getAppName());
    BundleActionGetJPAExecutor bundleAction3GetCmd = new BundleActionGetJPAExecutor(bundleJob.getId(), coordJob3.getAppName());
    BundleActionGetJPAExecutor bundleAction4GetCmd = new BundleActionGetJPAExecutor(bundleJob.getId(), coordJob4.getAppName());
    BundleActionGetJPAExecutor bundleAction5GetCmd = new BundleActionGetJPAExecutor(bundleJob.getId(), coordJob5.getAppName());
    wfJob1 = jpaService.execute(wfJob1GetCmd);
    wfJob2 = jpaService.execute(wfJob2GetCmd);
    wfJob3 = jpaService.execute(wfJob3GetCmd);
    wfJob4 = jpaService.execute(wfJob4GetCmd);
    wfJob5 = jpaService.execute(wfJob5GetCmd);
    wfAction1 = jpaService.execute(wfAction1GetCmd);
    wfAction2 = jpaService.execute(wfAction2GetCmd);
    wfAction3 = jpaService.execute(wfAction3GetCmd);
    wfAction4 = jpaService.execute(wfAction4GetCmd);
    wfAction5 = jpaService.execute(wfAction5GetCmd);
    coordJob1 = jpaService.execute(coordJob1GetCmd);
    coordJob2 = jpaService.execute(coordJob2GetCmd);
    coordJob3 = jpaService.execute(coordJob3GetCmd);
    coordJob4 = jpaService.execute(coordJob4GetCmd);
    coordJob5 = jpaService.execute(coordJob5GetCmd);
    coordAction1 = jpaService.execute(coordAction1GetCmd);
    coordAction2 = jpaService.execute(coordAction2GetCmd);
    coordAction3 = jpaService.execute(coordAction3GetCmd);
    coordAction4 = jpaService.execute(coordAction4GetCmd);
    coordAction5 = jpaService.execute(coordAction5GetCmd);
    bundleJob = jpaService.execute(bundleJobGetCmd);
    bundleAction1 = jpaService.execute(bundleAction1GetCmd);
    bundleAction2 = jpaService.execute(bundleAction2GetCmd);
    bundleAction3 = jpaService.execute(bundleAction3GetCmd);
    bundleAction4 = jpaService.execute(bundleAction4GetCmd);
    bundleAction5 = jpaService.execute(bundleAction5GetCmd);
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJob1.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJob2.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJob3.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJob4.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJob5.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfAction1.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfAction2.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfAction3.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfAction4.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfAction5.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob1.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob2.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob3.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob4.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob5.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordAction1.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordAction2.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordAction3.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordAction4.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordAction5.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleJob.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleAction1.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleAction2.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleAction3.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleAction4.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleAction5.getStatus());
    new PurgeXCommand(7, 7, 7, 10).call();
    try {
        jpaService.execute(bundleJobGetCmd);
        fail("Bundle Job should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleAction1GetCmd);
        fail("Bundle Action 1 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleAction2GetCmd);
        fail("Bundle Action 2 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleAction3GetCmd);
        fail("Bundle Action 3 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleAction4GetCmd);
        fail("Bundle Action 4 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleAction5GetCmd);
        fail("Bundle Action 5 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(coordJob1GetCmd);
        fail("Coordinator Job 1 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordJob2GetCmd);
        fail("Coordinator Job 2 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordJob3GetCmd);
        fail("Coordinator Job 3 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordJob4GetCmd);
        fail("Coordinator Job 4 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordJob5GetCmd);
        fail("Coordinator Job 5 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordAction1GetCmd);
        fail("Coordinator Action 1 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(coordAction2GetCmd);
        fail("Coordinator Action 2 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(coordAction3GetCmd);
        fail("Coordinator Action 3 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(coordAction4GetCmd);
        fail("Coordinator Action 4 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(coordAction5GetCmd);
        fail("Coordinator Action 5 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJob1GetCmd);
        fail("Workflow Job 1 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJob2GetCmd);
        fail("Workflow Job 2 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJob3GetCmd);
        fail("Workflow Job 3 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJob4GetCmd);
        fail("Workflow Job 4 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJob5GetCmd);
        fail("Workflow Job 5 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfAction1GetCmd);
        fail("Workflow Action 1 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfAction2GetCmd);
        fail("Workflow Action 2 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfAction3GetCmd);
        fail("Workflow Action 3 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfAction4GetCmd);
        fail("Workflow Action 4 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfAction5GetCmd);
        fail("Workflow Action 5 should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
}
Also used : WorkflowJobGetJPAExecutor(org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor) CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) BundleActionGetJPAExecutor(org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor) CoordActionGetJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor) WorkflowJobBean(org.apache.oozie.WorkflowJobBean) WorkflowActionBean(org.apache.oozie.WorkflowActionBean) BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) BundleJobBean(org.apache.oozie.BundleJobBean) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) WorkflowActionGetJPAExecutor(org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor) JPAService(org.apache.oozie.service.JPAService) BundleActionBean(org.apache.oozie.BundleActionBean)

Example 13 with CoordActionGetJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.

the class TestPurgeXCommand method testPurgeLotsOfJobs.

/**
 * Test : Test purging a lot of jobs (with different parent-child relationships and purge-eligibility) in one go
 *
 * @throws Exception
 */
public void testPurgeLotsOfJobs() throws Exception {
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    /* Job relationships:
        bundleJobA              yes     yes
            coordJobA           yes     ^
                wfJobA          yes     ^
                    subwfJobA   yes     ^
        bundleJobB              no      no
            coordJobB           yes     ^
                wfJobB          no      ^
        coordJobC               no      no
            wfJobC              no      ^
                subwfJobC       yes     ^
        coordJobD               yes     no
            wfJobD              no      ^
        wfJobE                  yes     yes
        wfJobF                  yes     no
            subwfJobF           no      ^
        */
    BundleJobBean bundleJobA = addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateOozieTZ("2011-05-01T01:00Z"));
    BundleJobBean bundleJobB = addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateOozieTZ("2011-06-01T01:00Z"));
    CoordinatorJobBean coordJobA = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    setLastModifiedTime(coordJobA, "2011-03-01T01:00Z");
    CoordinatorJobBean coordJobB = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    setLastModifiedTime(coordJobB, "2011-03-01T01:00Z");
    CoordinatorJobBean coordJobC = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    setLastModifiedTime(coordJobC, "2011-07-01T01:00Z");
    CoordinatorJobBean coordJobD = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    setLastModifiedTime(coordJobD, "2011-06-01T01:00Z");
    WorkflowJobBean wfJobA = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    setEndTime(wfJobA, "2011-02-01T01:00Z");
    WorkflowJobBean wfJobB = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    setEndTime(wfJobB, "2011-03-01T01:00Z");
    WorkflowJobBean wfJobC = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    setEndTime(wfJobC, "2011-06-01T01:00Z");
    WorkflowJobBean wfJobD = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    setEndTime(wfJobD, "2011-06-01T01:00Z");
    WorkflowJobBean wfJobE = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    setEndTime(wfJobE, "2011-01-01T01:00Z");
    WorkflowJobBean wfJobF = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
    setEndTime(wfJobF, "2011-01-01T01:00Z");
    WorkflowActionBean wfActionA = addRecordToWfActionTable(wfJobA.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfActionB = addRecordToWfActionTable(wfJobB.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfActionC = addRecordToWfActionTable(wfJobC.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfActionD = addRecordToWfActionTable(wfJobD.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfActionE = addRecordToWfActionTable(wfJobE.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean wfActionF = addRecordToWfActionTable(wfJobF.getId(), "1", WorkflowAction.Status.OK);
    WorkflowJobBean subwfJobA = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED, wfJobA.getId());
    setEndTime(subwfJobA, "2011-01-01T01:00Z");
    WorkflowJobBean subwfJobC = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED, wfJobC.getId());
    setEndTime(subwfJobC, "2011-01-01T01:00Z");
    WorkflowJobBean subwfJobF = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED, wfJobF.getId());
    setEndTime(subwfJobF, "2011-04-01T01:00Z");
    WorkflowActionBean subwfActionA = addRecordToWfActionTable(subwfJobA.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean subwfActionC = addRecordToWfActionTable(subwfJobC.getId(), "1", WorkflowAction.Status.OK);
    WorkflowActionBean subwfActionF = addRecordToWfActionTable(subwfJobF.getId(), "1", WorkflowAction.Status.OK);
    CoordinatorActionBean coordActionA = addRecordToCoordActionTable(coordJobA.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJobA.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordActionB = addRecordToCoordActionTable(coordJobB.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJobB.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordActionC = addRecordToCoordActionTable(coordJobC.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJobC.getId(), "SUCCEEDED", 0);
    CoordinatorActionBean coordActionD = addRecordToCoordActionTable(coordJobD.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJobD.getId(), "SUCCEEDED", 0);
    BundleActionBean bundleActionA = addRecordToBundleActionTable(bundleJobA.getId(), coordJobA.getId(), coordJobA.getAppName(), 0, Job.Status.SUCCEEDED);
    BundleActionBean bundleActionB = addRecordToBundleActionTable(bundleJobB.getId(), coordJobB.getId(), coordJobB.getAppName(), 0, Job.Status.SUCCEEDED);
    WorkflowJobGetJPAExecutor wfJobAGetCmd = new WorkflowJobGetJPAExecutor(wfJobA.getId());
    WorkflowJobGetJPAExecutor wfJobBGetCmd = new WorkflowJobGetJPAExecutor(wfJobB.getId());
    WorkflowJobGetJPAExecutor wfJobCGetCmd = new WorkflowJobGetJPAExecutor(wfJobC.getId());
    WorkflowJobGetJPAExecutor wfJobDGetCmd = new WorkflowJobGetJPAExecutor(wfJobD.getId());
    WorkflowJobGetJPAExecutor wfJobEGetCmd = new WorkflowJobGetJPAExecutor(wfJobE.getId());
    WorkflowJobGetJPAExecutor wfJobFGetCmd = new WorkflowJobGetJPAExecutor(wfJobF.getId());
    WorkflowActionGetJPAExecutor wfActionAGetCmd = new WorkflowActionGetJPAExecutor(wfActionA.getId());
    WorkflowActionGetJPAExecutor wfActionBGetCmd = new WorkflowActionGetJPAExecutor(wfActionB.getId());
    WorkflowActionGetJPAExecutor wfActionCGetCmd = new WorkflowActionGetJPAExecutor(wfActionC.getId());
    WorkflowActionGetJPAExecutor wfActionDGetCmd = new WorkflowActionGetJPAExecutor(wfActionD.getId());
    WorkflowActionGetJPAExecutor wfActionEGetCmd = new WorkflowActionGetJPAExecutor(wfActionE.getId());
    WorkflowActionGetJPAExecutor wfActionFGetCmd = new WorkflowActionGetJPAExecutor(wfActionF.getId());
    WorkflowJobGetJPAExecutor subwfJobAGetCmd = new WorkflowJobGetJPAExecutor(subwfJobA.getId());
    WorkflowJobGetJPAExecutor subwfJobCGetCmd = new WorkflowJobGetJPAExecutor(subwfJobC.getId());
    WorkflowJobGetJPAExecutor subwfJobFGetCmd = new WorkflowJobGetJPAExecutor(subwfJobF.getId());
    WorkflowActionGetJPAExecutor subwfActionAGetCmd = new WorkflowActionGetJPAExecutor(subwfActionA.getId());
    WorkflowActionGetJPAExecutor subwfActionCGetCmd = new WorkflowActionGetJPAExecutor(subwfActionC.getId());
    WorkflowActionGetJPAExecutor subwfActionFGetCmd = new WorkflowActionGetJPAExecutor(subwfActionF.getId());
    CoordJobGetJPAExecutor coordJobAGetCmd = new CoordJobGetJPAExecutor(coordJobA.getId());
    CoordJobGetJPAExecutor coordJobBGetCmd = new CoordJobGetJPAExecutor(coordJobB.getId());
    CoordJobGetJPAExecutor coordJobCGetCmd = new CoordJobGetJPAExecutor(coordJobC.getId());
    CoordJobGetJPAExecutor coordJobDGetCmd = new CoordJobGetJPAExecutor(coordJobD.getId());
    CoordActionGetJPAExecutor coordActionAGetCmd = new CoordActionGetJPAExecutor(coordActionA.getId());
    CoordActionGetJPAExecutor coordActionBGetCmd = new CoordActionGetJPAExecutor(coordActionB.getId());
    CoordActionGetJPAExecutor coordActionCGetCmd = new CoordActionGetJPAExecutor(coordActionC.getId());
    CoordActionGetJPAExecutor coordActionDGetCmd = new CoordActionGetJPAExecutor(coordActionD.getId());
    BundleJobGetJPAExecutor bundleJobAGetCmd = new BundleJobGetJPAExecutor(bundleJobA.getId());
    BundleJobGetJPAExecutor bundleJobBGetCmd = new BundleJobGetJPAExecutor(bundleJobB.getId());
    BundleActionGetJPAExecutor bundleActionAGetCmd = new BundleActionGetJPAExecutor(bundleJobA.getId(), coordJobA.getAppName());
    BundleActionGetJPAExecutor bundleActionBGetCmd = new BundleActionGetJPAExecutor(bundleJobB.getId(), coordJobB.getAppName());
    wfJobA = jpaService.execute(wfJobAGetCmd);
    wfJobB = jpaService.execute(wfJobBGetCmd);
    wfJobC = jpaService.execute(wfJobCGetCmd);
    wfJobD = jpaService.execute(wfJobDGetCmd);
    wfJobE = jpaService.execute(wfJobEGetCmd);
    wfJobF = jpaService.execute(wfJobFGetCmd);
    wfActionA = jpaService.execute(wfActionAGetCmd);
    wfActionB = jpaService.execute(wfActionBGetCmd);
    wfActionC = jpaService.execute(wfActionCGetCmd);
    wfActionD = jpaService.execute(wfActionDGetCmd);
    wfActionE = jpaService.execute(wfActionEGetCmd);
    wfActionF = jpaService.execute(wfActionFGetCmd);
    subwfJobA = jpaService.execute(subwfJobAGetCmd);
    subwfJobC = jpaService.execute(subwfJobCGetCmd);
    subwfJobF = jpaService.execute(subwfJobFGetCmd);
    subwfActionA = jpaService.execute(subwfActionAGetCmd);
    subwfActionC = jpaService.execute(subwfActionCGetCmd);
    subwfActionF = jpaService.execute(subwfActionFGetCmd);
    coordJobA = jpaService.execute(coordJobAGetCmd);
    coordJobB = jpaService.execute(coordJobBGetCmd);
    coordJobC = jpaService.execute(coordJobCGetCmd);
    coordJobD = jpaService.execute(coordJobDGetCmd);
    coordActionA = jpaService.execute(coordActionAGetCmd);
    coordActionB = jpaService.execute(coordActionBGetCmd);
    coordActionC = jpaService.execute(coordActionCGetCmd);
    coordActionD = jpaService.execute(coordActionDGetCmd);
    bundleJobA = jpaService.execute(bundleJobAGetCmd);
    bundleJobB = jpaService.execute(bundleJobBGetCmd);
    bundleActionA = jpaService.execute(bundleActionAGetCmd);
    bundleActionB = jpaService.execute(bundleActionBGetCmd);
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJobA.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJobB.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJobC.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJobD.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJobE.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, wfJobF.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfActionA.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfActionB.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfActionC.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfActionD.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfActionE.getStatus());
    assertEquals(WorkflowAction.Status.OK, wfActionF.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, subwfJobA.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, subwfJobC.getStatus());
    assertEquals(WorkflowJob.Status.SUCCEEDED, subwfJobF.getStatus());
    assertEquals(WorkflowAction.Status.OK, subwfActionA.getStatus());
    assertEquals(WorkflowAction.Status.OK, subwfActionC.getStatus());
    assertEquals(WorkflowAction.Status.OK, subwfActionF.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJobA.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJobB.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJobC.getStatus());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJobD.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordActionA.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordActionB.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordActionC.getStatus());
    assertEquals(CoordinatorAction.Status.SUCCEEDED, coordActionD.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleJobA.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleJobB.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleActionA.getStatus());
    assertEquals(BundleJobBean.Status.SUCCEEDED, bundleActionB.getStatus());
    new PurgeXCommand(getNumDaysToNotBePurged(wfJobB.getEndTime()), getNumDaysToNotBePurged(coordJobC.getLastModifiedTime()), getNumDaysToNotBePurged(bundleJobB.getLastModifiedTime()), 10).call();
    try {
        jpaService.execute(bundleJobAGetCmd);
        fail("Bundle Job A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleActionAGetCmd);
        fail("Bundle Action A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(bundleJobBGetCmd);
    } catch (JPAExecutorException je) {
        fail("Bundle Job B should not have been purged");
    }
    try {
        jpaService.execute(bundleActionBGetCmd);
    } catch (JPAExecutorException je) {
        fail("Bundle Action B should not have been purged");
    }
    try {
        jpaService.execute(coordJobAGetCmd);
        fail("Coordinator Job A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordActionAGetCmd);
        fail("Coordinator Action A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(coordJobBGetCmd);
    } catch (JPAExecutorException je) {
        fail("Coordinator Job B should not have been purged");
    }
    try {
        jpaService.execute(coordActionBGetCmd);
    } catch (JPAExecutorException je) {
        fail("Coordinator Action B should not have been purged");
    }
    try {
        jpaService.execute(coordJobCGetCmd);
    } catch (JPAExecutorException je) {
        fail("Coordinator Job C should not have been purged");
    }
    try {
        jpaService.execute(coordActionCGetCmd);
    } catch (JPAExecutorException je) {
        fail("Coordinator Action C should not have been purged");
    }
    try {
        jpaService.execute(coordJobDGetCmd);
    } catch (JPAExecutorException je) {
        fail("Coordinator Job D should not have been purged");
    }
    try {
        jpaService.execute(coordActionDGetCmd);
    } catch (JPAExecutorException je) {
        fail("Coordinator Action D should not have been purged");
    }
    try {
        jpaService.execute(wfJobAGetCmd);
        fail("Workflow Job A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfActionAGetCmd);
        fail("Workflow Action A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJobBGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Job B should not have been purged");
    }
    try {
        jpaService.execute(wfActionBGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Action B should not have been purged");
    }
    try {
        jpaService.execute(wfJobCGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Job C should not have been purged");
    }
    try {
        jpaService.execute(wfActionCGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Action C should not have been purged");
    }
    try {
        jpaService.execute(wfJobDGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Job D should not have been purged");
    }
    try {
        jpaService.execute(wfActionDGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Action D should not have been purged");
    }
    try {
        jpaService.execute(wfJobEGetCmd);
        fail("Workflow Job E should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(wfActionEGetCmd);
        fail("Workflow Action E should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(wfJobFGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Job F should not have been purged");
    }
    try {
        jpaService.execute(wfActionFGetCmd);
    } catch (JPAExecutorException je) {
        fail("Workflow Action F should not have been purged");
    }
    try {
        jpaService.execute(subwfJobAGetCmd);
        fail("SubWorkflow Job A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(subwfActionAGetCmd);
        fail("SubWorkflow Action A should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
    try {
        jpaService.execute(subwfJobCGetCmd);
    } catch (JPAExecutorException je) {
        fail("SubWorkflow Job C should not have been purged");
    }
    try {
        jpaService.execute(subwfActionCGetCmd);
    } catch (JPAExecutorException je) {
        fail("SubWorkflow Action C should not have been purged");
    }
    try {
        jpaService.execute(subwfJobFGetCmd);
    } catch (JPAExecutorException je) {
        fail("SubWorkflow Job F should not have been purged");
    }
    try {
        jpaService.execute(subwfActionFGetCmd);
    } catch (JPAExecutorException je) {
        fail("SubWorkflow Action F should not have been purged");
    }
}
Also used : WorkflowJobGetJPAExecutor(org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor) CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) BundleActionGetJPAExecutor(org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor) CoordActionGetJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor) WorkflowJobBean(org.apache.oozie.WorkflowJobBean) WorkflowActionBean(org.apache.oozie.WorkflowActionBean) BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) BundleJobBean(org.apache.oozie.BundleJobBean) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) WorkflowActionGetJPAExecutor(org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor) JPAService(org.apache.oozie.service.JPAService) BundleActionBean(org.apache.oozie.BundleActionBean)

Example 14 with CoordActionGetJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.

the class TestPurgeXCommand method testKillCoordPurgeXCommand.

/**
 * Test : purge killed coord job and action successfully
 *
 * @throws Exception
 */
public void testKillCoordPurgeXCommand() throws Exception {
    CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.KILLED, false, false);
    CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), 1, CoordinatorAction.Status.KILLED, "coord-action-get.xml", 0);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    CoordJobGetJPAExecutor coordJobGetExecutor = new CoordJobGetJPAExecutor(job.getId());
    CoordActionGetJPAExecutor coordActionGetExecutor = new CoordActionGetJPAExecutor(action.getId());
    job = jpaService.execute(coordJobGetExecutor);
    action = jpaService.execute(coordActionGetExecutor);
    assertEquals(job.getStatus(), CoordinatorJob.Status.KILLED);
    assertEquals(action.getStatus(), CoordinatorAction.Status.KILLED);
    new PurgeXCommand(1, 7, 1, 10).call();
    try {
        jpaService.execute(coordJobGetExecutor);
        fail("Coordinator Job should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordActionGetExecutor);
        fail("Coordinator Action should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) CoordActionGetJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Example 15 with CoordActionGetJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor in project oozie by apache.

the class TestPurgeXCommand method testSucCoordPurgeXCommand.

/**
 * Test : purge succeeded coord job and action successfully
 *
 * @throws Exception
 */
public void testSucCoordPurgeXCommand() throws Exception {
    CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
    CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    CoordJobGetJPAExecutor coordJobGetExecutor = new CoordJobGetJPAExecutor(job.getId());
    CoordActionGetJPAExecutor coordActionGetExecutor = new CoordActionGetJPAExecutor(action.getId());
    job = jpaService.execute(coordJobGetExecutor);
    action = jpaService.execute(coordActionGetExecutor);
    assertEquals(job.getStatus(), CoordinatorJob.Status.SUCCEEDED);
    assertEquals(action.getStatus(), CoordinatorAction.Status.SUCCEEDED);
    new PurgeXCommand(1, 7, 1, 10).call();
    try {
        jpaService.execute(coordJobGetExecutor);
        fail("Coordinator Job should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0604, je.getErrorCode());
    }
    try {
        jpaService.execute(coordActionGetExecutor);
        fail("Coordinator Action should have been purged");
    } catch (JPAExecutorException je) {
        assertEquals(ErrorCode.E0605, je.getErrorCode());
    }
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) CoordActionGetJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Aggregations

CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)60 CoordActionGetJPAExecutor (org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor)60 JPAService (org.apache.oozie.service.JPAService)54 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)43 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)41 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)32 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)25 WorkflowJobGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor)23 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)21 WorkflowActionGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor)21 Date (java.util.Date)19 BundleActionBean (org.apache.oozie.BundleActionBean)9 BundleJobBean (org.apache.oozie.BundleJobBean)9 BundleActionGetJPAExecutor (org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor)9 BundleJobGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor)9 IOException (java.io.IOException)8 CommandException (org.apache.oozie.command.CommandException)7 CoordActionStartXCommand (org.apache.oozie.command.coord.CoordActionStartXCommand)3 Properties (java.util.Properties)2 CoordinatorEngine (org.apache.oozie.CoordinatorEngine)2