Package org.apache.oozie

Examples of org.apache.oozie.CoordinatorActionBean


        try {
            int actionNum = 1;
            String slaXml = "slaXml";
            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);
            action.setSlaXml(slaXml);
            insertRecordCoordAction(action);
            _testGetForInfoAllActions(job.getId(), slaXml, 1, 1);
        }
        finally {
            Services.get().destroy();
View Full Code Here


        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordJobGetActionsSubsetJPAExecutor actionGetCmd = new CoordJobGetActionsSubsetJPAExecutor(jobId,
                Collections.<String> emptyList(), start, len);
        List<CoordinatorActionBean> actions = jpaService.execute(actionGetCmd);
        CoordinatorActionBean action = actions.get(0);

        assertEquals(CoordinatorAction.Status.WAITING, action.getStatus());
        assertEquals(slaXml, action.getSlaXml());
        assertEquals(0, action.getPending());
    }
View Full Code Here

        final int actionNum = 1;
        final CoordinatorEngine ce = new CoordinatorEngine(getTestUser(), "UNIT_TESTING");
        final CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
        final WorkflowJobBean wfJob = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED,
                WorkflowInstance.Status.SUCCEEDED);
        final CoordinatorActionBean action = addRecordToCoordActionTable(job.getId(), actionNum,
                CoordinatorAction.Status.RUNNING, "coord-action-get.xml", wfJob.getId(), "RUNNING", 0);

        Thread.sleep(3000);
        Runnable actionCheckRunnable = new ActionCheckRunnable(1);
        actionCheckRunnable.run();
        Thread.sleep(3000);

        waitFor(200000, new Predicate() {
            public boolean evaluate() throws Exception {
                return (ce.getCoordAction(action.getId()).getStatus() == CoordinatorAction.Status.SUCCEEDED);
            }
        });

        JPAService jpaService = Services.get().get(JPAService.class);
        CoordinatorActionBean recoveredAction = jpaService.execute(new CoordActionGetJPAExecutor(action.getId()));
        assertEquals(CoordinatorAction.Status.SUCCEEDED, recoveredAction.getStatus());
    }
View Full Code Here

        Date createdTime = new Date();
        Date lastModifiedTime = new Date();

        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.setErrorCode(errorCode);
        action.setErrorMessage(errorMessage);
        action.setConsoleUrl(consoleUrl);
        action.setExternalStatus(externalStatus);
        action.setTrackerUri(trackerUri);
        action.setCreatedTime(createdTime);
        action.setMissingDependencies(missingDeps);
        action.setLastModifiedTime(lastModifiedTime);
        action.setSlaXml(slaXml);
        // Insert the action
        insertRecordCoordAction(action);

        Path appPath = new Path(getFsTestCaseDir(), "coord");
        String actionXml = getCoordActionXml(appPath, resourceXmlName);
        String actionNominalTime = getActionNominalTime(actionXml);

        // Pass the expected values
        _testGetForInfo(action.getId(), job.getId(), CoordinatorAction.Status.WAITING, action.getId() + "_E",
                errorCode, errorMessage, consoleUrl, externalStatus, trackerUri, createdTime, missingDeps,
                DateUtils.parseDateUTC(actionNominalTime), actionNum, lastModifiedTime);

       //services.destroy();
    }
View Full Code Here

            throws Exception {
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            CoordActionGetForInfoJPAExecutor actionGetCmd = new CoordActionGetForInfoJPAExecutor(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(extId, action.getExternalId());
            assertEquals(errorMessage, action.getErrorMessage());
            assertEquals(errorCode, action.getErrorCode());
            assertEquals(consoleUrl, action.getConsoleUrl());
            assertEquals(externalStatus, action.getExternalStatus());
            assertEquals(trackerUri, action.getTrackerUri());
            assertEquals(createdTime, action.getCreatedTime());
            assertEquals(missingDeps, action.getMissingDependencies());
            assertEquals(nominalTime, action.getNominalTime());
            assertEquals(actionNumber, action.getActionNumber());
            assertEquals(lastModifiedTime, action.getLastModifiedTime());

        }
        catch (Exception ex) {
            ex.printStackTrace();
            fail("Unable to GET a record for COORD Action By actionId =" + actionId);
View Full Code Here

        setSystemProperty(CoordActionGetForInfoJPAExecutor.COORD_GET_ALL_COLS_FOR_ACTION, "true");
        new Services().init();
        try {
            String resourceXmlName = "coord-action-get.xml";
            CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
            CoordinatorActionBean action = createCoordAction(job.getId(), 1, CoordinatorAction.Status.WAITING,
                    resourceXmlName, 0);
            String slaXml = "slaXml";
            action.setSlaXml(slaXml);
            // Insert the action
            insertRecordCoordAction(action);
            _testGetForInfoAllActions(action.getId(), slaXml);
        }
        finally {
            Services.get().destroy();
        }
    }
View Full Code Here

    private void _testGetForInfoAllActions(String actionId, String slaXml) throws Exception{
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            CoordActionGetForInfoJPAExecutor actionGetCmd = new CoordActionGetForInfoJPAExecutor(actionId);
            CoordinatorActionBean action = jpaService.execute(actionGetCmd);
            assertEquals(CoordinatorAction.Status.WAITING, action.getStatus());
            assertEquals(slaXml, action.getSlaXml());
            assertEquals(0, action.getPending());

    }
View Full Code Here

    }

    public void testCoordActionUpdate() 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);
        _testCoordActionUpdate(action);
    }
View Full Code Here

        action.setStatus(CoordinatorAction.Status.SUCCEEDED);
        CoordActionUpdateJPAExecutor coordUpdCmd = new CoordActionUpdateJPAExecutor(action);
        jpaService.execute(coordUpdCmd);

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

        assertNotNull(newAction);
        assertEquals(newAction.getStatus(), CoordinatorAction.Status.SUCCEEDED);
    }
View Full Code Here

    }

    public void testCoordActionsGetByActionNumber() 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);
        _testCoordActionsGetByActionNumber(job, action);
    }
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.