Package org.apache.oozie.client

Examples of org.apache.oozie.client.CoordinatorJob


    private void _testStatus(final String jobId) throws Exception {
        waitFor(6000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
                CoordinatorJob job = ce.getCoordJob(jobId);
                return !job.getStatus().equals(CoordinatorJob.Status.PREP);
            }
        });

        CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
        CoordinatorJob job = ce.getCoordJob(jobId);
        assertFalse(job.getStatus().equals(CoordinatorJob.Status.PREP));
    }
View Full Code Here


    }

    private void _testSubsetActions(final String jobId) throws Exception {
        CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
        // Check for WAITING filter
        CoordinatorJob job = ce.getCoordJob(jobId, "status=WAITING", 1, 2, false);
        // As both actions are waiting, expected result size is 2
        assertEquals(job.getActions().size(), 2);

        job = ce.getCoordJob(jobId, "status=WAITING", 1, 0, false);
        // Since length is 0, number of actions returned should be 0.
        assertEquals(job.getActions().size(), 0);

        job = ce.getCoordJob(jobId, "status=RUNNING", 1, 2, false);
        assertEquals(job.getActions().size(), 0);

        //Check for actions WAITING OR RUNNING
        job = ce.getCoordJob(jobId, "status=RUNNING;status=WAITING", 1, 2, false);
        assertEquals(job.getActions().size(), 2);

        //Check without filters
        job = ce.getCoordJob(jobId, null, 1, 2, false);
        assertEquals(job.getActions().size(), 2);

        //Check for empty filter list
        job = ce.getCoordJob(jobId, "", 1, 2, false);
        assertEquals(job.getActions().size(), 2);

        //Check for negative filter
        job = ce.getCoordJob(jobId, "status!=RUNNING", 1, 2, false);
        assertEquals(job.getActions().size(), 2);

        //Check for multiple negative filter
        job = ce.getCoordJob(jobId, "status!=RUNNING;status!=WAITING", 1, 2, false);
        assertEquals(job.getActions().size(), 0);

        //Check for combination of positive and negative filter
        try {
            job = ce.getCoordJob(jobId, "status=WAITING;status!=WAITING", 1, 2, false);
        }
View Full Code Here

public class TestBundleEngineSimple extends TestCase {

    public void testGetCoordJob1() {
        BundleEngine be = new BundleEngine();
        try {
            CoordinatorJob cj = be.getCoordJob("foo");
            fail("Expected BundleEngineException was not thrown.");
        }
        catch (BundleEngineException bee) {
            assertEquals(ErrorCode.E0301, bee.getErrorCode());
        }
View Full Code Here

    }

    public void testGetCoordJob4() {
        BundleEngine be = new BundleEngine();
        try {
            CoordinatorJob cj = be.getCoordJob("foo", "filter", 0, 1, false);
            fail("Expected BundleEngineException was not thrown.");
        }
        catch (BundleEngineException bee) {
            assertEquals(ErrorCode.E0301, bee.getErrorCode());
        }
View Full Code Here

        String jobId = client.run(conf);
        client.suspend(jobId);
        client.resume(jobId);
        client.kill(jobId);

        CoordinatorJob job = client.getCoordJobInfo(jobId);
        String appName = job.getAppName();
        assertEquals("NAME", appName);

        List<CoordinatorJob> list = client.getCoordJobsInfo("", 1, 5);
        assertEquals(2, list.size());
    }
View Full Code Here

        actionBean = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
        return actionBean;
    }

    private CoordinatorJob.Status getStatus(String jobId){
        CoordinatorJob job = null;
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
        }
        catch (JPAExecutorException se) {
            se.printStackTrace();
        }
        return job.getStatus();
    }
View Full Code Here

            if (actionsSize != number) {
                fail("Should have " + number + " actions created for job " + jobId + ", but has " + actionsSize + " actions.");
            }

            if (status != null) {
                CoordinatorJob job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
                if (job.getStatus() != status) {
                    fail("Job status " + job.getStatus() + " should be " + status);
                }
            }
        }
        catch (JPAExecutorException se) {
            se.printStackTrace();
View Full Code Here

    private void _testTimeout(final String jobId) throws Exception {
        final CoordinatorEngine ce = new CoordinatorEngine(getTestUser());

        waitFor(6000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJob job = ce.getCoordJob(jobId);
                return !(job.getStatus().equals(CoordinatorJob.Status.PREP));
            }
        });

        CoordinatorJob job = ce.getCoordJob(jobId);
        assertTrue(!(job.getStatus().equals(CoordinatorJob.Status.PREP)));

        waitFor(6000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJob job = ce.getCoordJob(jobId);
                List<CoordinatorAction> actions = job.getActions();
                return actions.size() > 0;
            }
        });

        job = ce.getCoordJob(jobId);
        List<CoordinatorAction> actions = job.getActions();
        assertTrue(actions.size() > 0);

        for (CoordinatorAction action : actions) {
            CoordinatorActionBean json = (CoordinatorActionBean) action;
            assertEquals(10, json.getTimeOut());
View Full Code Here

     */
    public void testBundleRecoveryCoordExists() throws Exception {
        CoordinatorStore store = Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
        final BundleActionBean bundleAction;
        final BundleJobBean bundle;
        final CoordinatorJob coord;
        store.beginTrx();
        try {
            bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
            coord = addRecordToCoordJobTable(Job.Status.PREP, false, false);
            bundleAction = addRecordToBundleActionTable(bundle.getId(), coord.getId(), "coord1", 1, Job.Status.PREP);
            store.commitTrx();
        }
        finally {
            store.closeTrx();
        }
        final JPAService jpaService = Services.get().get(JPAService.class);

        sleep(3000);
        Runnable recoveryRunnable = new RecoveryRunnable(0, 1,1);
        recoveryRunnable.run();

        waitFor(3000, new Predicate() {
            public boolean evaluate() throws Exception {
                BundleActionBean mybundleAction =
                        jpaService.execute(new BundleActionGetJPAExecutor(bundle.getId(), "coord1"));
                return !mybundleAction.getCoordId().equals(coord.getId());
            }
        });

        BundleActionBean mybundleAction = jpaService.execute(new BundleActionGetJPAExecutor(bundle.getId(), "coord1"));
        assertEquals(coord.getId(), mybundleAction.getCoordId());
    }
View Full Code Here

            if (actionsSize != number) {
                fail("Should have " + number + " actions created for job " + jobId + ", but has " + actionsSize + " actions.");
            }

            if (status != null) {
                CoordinatorJob job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
                if (job.getStatus() != status) {
                    fail("Job status " + job.getStatus() + " should be " + status);
                }
            }
        }
        catch (JPAExecutorException se) {
            se.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.oozie.client.CoordinatorJob

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.