Package org.apache.oozie

Examples of org.apache.oozie.CoordinatorActionBean


    }

    public void testCoordActionGet() throws Exception {
        int actionNum = 1;
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
        CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), actionNum, CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);

        _testGetActions(job.getId(), action.getId());
    }
View Full Code Here


     * Calls the purge service, and ensure the job does not exist in the system.
     */
    public void testPurgeServiceForCoordinator() throws Exception {
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
        final String jobId = job.getId();
        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);

        Runnable purgeRunnable = new PurgeRunnable(1, 1, 1, 100);
        purgeRunnable.run();

        final CoordinatorEngine engine = new CoordinatorEngine("u", "a");
View Full Code Here

    }

    public void testCoordActionUpdateStatus() throws Exception {
        int actionNum = 1;
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
        CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), actionNum,
                CoordinatorAction.Status.RUNNING, "coord-action-get.xml", 0);
        _testCoordActionUpdateStatus(action);
    }
View Full Code Here

        // Call the JPAUpdate executor to execute the Update command
        CoordActionUpdateForStartJPAExecutor coordUpdCmd = new CoordActionUpdateForStartJPAExecutor(action);
        jpaService.execute(coordUpdCmd);

        CoordActionGetJPAExecutor coordGetCmd = new CoordActionGetJPAExecutor(action.getId());
        CoordinatorActionBean newAction = jpaService.execute(coordGetCmd);

        assertNotNull(newAction);
        // Check for expected values
        assertEquals(CoordinatorAction.Status.SUCCEEDED, newAction.getStatus());
        assertEquals("dummyConf", newAction.getRunConf());
        assertEquals("dummyExternalId", newAction.getExternalId());
        assertEquals(1, newAction.getPending());
    }
View Full Code Here

    }

    public void testCoordActionGet() throws Exception {
        int actionNum = 1;
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
        CoordinatorActionBean action = createCoordAction(job.getId(), actionNum, CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);
        action.setSlaXml(XDataTestCase.slaXml);
     // Insert the action
        insertRecordCoordAction(action);
        _testGetActionByExternalId(action.getId(), job.getId(), CoordinatorAction.Status.WAITING, 0, action.getId() + "_E", XDataTestCase.slaXml);
    }
View Full Code Here

        int actionNum = 1;
        String errorCode = "000";
        String errorMessage = "Dummy";
        String resourceXmlName = "coord-action-get.xml";
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
        CoordinatorActionBean action = createCoordAction(job.getId(), actionNum, CoordinatorAction.Status.WAITING,
                resourceXmlName, 0);
        // Add extra attributes for action
        action.setSlaXml(XDataTestCase.slaXml);
        action.setErrorCode(errorCode);
        action.setErrorMessage(errorMessage);
        // Insert the action
        insertRecordCoordAction(action);

        Path appPath = new Path(getFsTestCaseDir(), "coord");
        String actionXml = getCoordActionXml(appPath, resourceXmlName);
        Configuration conf = getCoordConf(appPath);

        // Pass the expected values
        _testGetForStartX(action.getId(), job.getId(), CoordinatorAction.Status.WAITING, 0, action.getId() + "_E",
                XDataTestCase.slaXml, resourceXmlName, XmlUtils.prettyPrint(conf).toString(), actionXml,
                errorCode, errorMessage);
    }
View Full Code Here

            String errorCode, String errorMessage) throws Exception {
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            CoordActionGetForStartJPAExecutor actionGetCmd = new CoordActionGetForStartJPAExecutor(actionId);
            CoordinatorActionBean action = jpaService.execute(actionGetCmd);
            assertNotNull(action);
            // Check for expected values
            assertEquals(actionId, action.getId());
            assertEquals(jobId, action.getJobId());
            assertEquals(status, action.getStatus());
            assertEquals(pending, action.getPending());
            assertEquals(createdConf, action.getCreatedConf());
            assertEquals(slaXml, action.getSlaXml());
            assertEquals(actionXml, action.getActionXml());
            assertEquals(extId, action.getExternalId());
            assertEquals(errorMessage, action.getErrorMessage());
            assertEquals(errorCode, action.getErrorCode());
        }
        catch (Exception ex) {
            ex.printStackTrace();
            fail("Unable to GET a record for COORD Action By actionId =" + actionId);
}
View Full Code Here

    }

    public void testCoordActionRemove() throws Exception {
        int actionNum = 1;
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
        CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), actionNum,
                CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
        _testCoordActionRemove(job.getId(), action.getId());
    }
View Full Code Here

        CoordActionRemoveJPAExecutor coordRmvCmd = new CoordActionRemoveJPAExecutor(actionId);
        jpaService.execute(coordRmvCmd);

        try {
            CoordActionGetJPAExecutor coordGetCmd = new CoordActionGetJPAExecutor(actionId);
            CoordinatorActionBean newAction = jpaService.execute(coordGetCmd);
            fail("Action " + actionId + " Should be removed");
        }
        catch (JPAExecutorException je) {

        }
View Full Code Here

            }
            else {
                try {
                    // Get action for the nominal time
                    Date date = DateUtils.parseDateUTC(s.trim());
                    CoordinatorActionBean coordAction = jpaService
                            .execute(new CoordJobGetActionForNominalTimeJPAExecutor(jobId, date));

                    if (coordAction != null) {
                        actionSet.add(coordAction);
                    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.CoordinatorActionBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.