Package org.apache.oozie

Examples of org.apache.oozie.CoordinatorJobBean


     */
    public void testActionMaterWithPauseTime3() throws Exception {
        Date startTime = DateUtils.parseDateUTC("2009-03-06T10:00Z");
        Date endTime = DateUtils.parseDateUTC("2009-03-06T10:14Z");
        Date pauseTime = DateUtils.parseDateUTC("2009-03-06T09:58Z");
        final CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, startTime, endTime, pauseTime);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        waitFor(1000*60, new Predicate() {
            public boolean evaluate() throws Exception {
                return (getStatus(job.getId()) == CoordinatorJob.Status.PAUSED?true:false);
            }
        });
        checkCoordActions(job.getId(), 0, CoordinatorJob.Status.PAUSED);
    }
View Full Code Here


    public void testTimeout() throws Exception {
        Date startTime = DateUtils.parseDateUTC("2009-03-06T10:00Z");
        Date endTime = DateUtils.parseDateUTC("2009-03-06T10:14Z");
        Date pauseTime = null;
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, startTime, endTime,
                pauseTime, 300);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        checkCoordActionsTimeout(job.getId() + "@1", 300);
    }
View Full Code Here

    }

    public void testMatLookupCommand1() throws Exception {
        Date startTime = DateUtils.parseDateUTC("2009-02-01T01:00Z");
        Date endTime = DateUtils.parseDateUTC("2009-02-03T23:59Z");
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, startTime, endTime, false, false, 0);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        checkCoordJobs(job.getId(), CoordinatorJob.Status.RUNNING);
    }
View Full Code Here

    }

    public void testMatThrottle() throws Exception {
        Date startTime = DateUtils.parseDateUTC("2009-02-01T01:00Z");
        Date endTime = DateUtils.parseDateUTC("2009-02-03T23:59Z");
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, startTime, endTime, false, false, 0);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        checkCoordWaiting(job.getId(), job.getMatThrottling());
    }
View Full Code Here

     * @throws Exception
     */
    public void testMatLookupCommand2() throws Exception {
        Date startTime = DateUtils.parseDateUTC("2099-02-01T01:00Z");
        Date endTime = DateUtils.parseDateUTC("2099-02-03T23:59Z");
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, startTime, endTime, false, false, 0);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        checkCoordJobs(job.getId(), CoordinatorJob.Status.PREP);
    }
View Full Code Here

     * @throws Exception
     */
    public void testMatLookupCommand3() throws Exception {
        Date startTime = DateUtils.toDate(new Timestamp(System.currentTimeMillis() + 180 * 1000));
        Date endTime = DateUtils.parseDateUTC("2099-02-03T23:59Z");
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, startTime, endTime, false, false, 0);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        checkCoordJobs(job.getId(), CoordinatorJob.Status.RUNNING);
    }
View Full Code Here

     * @throws Exception
     */
    public void testMatLookupCommand4() throws Exception {
        Date startTime = DateUtils.toDate(new Timestamp(System.currentTimeMillis() + 360 * 1000));
        Date endTime = DateUtils.parseDateUTC("2099-02-03T23:59Z");
        CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, startTime, endTime, false, false, 0);
        new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
        checkCoordJobs(job.getId(), CoordinatorJob.Status.PREP);
    }
View Full Code Here

        return addRecordToCoordJobTable(status, startTime, endTime, pauseTime, -1);
    }

    protected CoordinatorJobBean addRecordToCoordJobTable(CoordinatorJob.Status status, Date startTime, Date endTime,
            Date pauseTime, int timeout) throws Exception {
        CoordinatorJobBean coordJob = createCoordJob(status, startTime, endTime, false, false, 0);
        coordJob.setStartTime(startTime);
        coordJob.setEndTime(endTime);
        coordJob.setPauseTime(pauseTime);
        coordJob.setFrequency(5);
        coordJob.setTimeUnit(Timeunit.MINUTE);
        coordJob.setTimeout(timeout);
        coordJob.setConcurrency(3);
        coordJob.setMatThrottling(3);

        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
View Full Code Here

    }

    private void checkCoordJobs(String jobId, CoordinatorJob.Status expectedStatus) {
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            CoordinatorJobBean job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
            if (job.getStatus() != expectedStatus) {
                fail("CoordJobMatLookupCommand didn't work because the status for job id"
                        + jobId + " is : " + job.getStatusStr() + "; however expected status is : " + expectedStatus.toString());
            }
        }
        catch (JPAExecutorException se) {
            fail("Job ID " + jobId + " was not stored properly in db");
        }
View Full Code Here

            return idx;
        }
    }

    private static CoordinatorJob createDummyCoordinatorJob(int idx) {
        CoordinatorJobBean coordJob = new CoordinatorJobBean();
        coordJob.setId(JOB_ID + idx);
        coordJob.setAppName("testApp");
        coordJob.setAppPath("testAppPath");
        coordJob.setStatus(CoordinatorJob.Status.RUNNING);
        coordJob.setCreatedTime(new Date());
        coordJob.setLastModifiedTime(new Date());
        coordJob.setUser(USER);
        coordJob.setGroup(GROUP);
        coordJob.setAuthToken("notoken");
        coordJob.setConf(CONFIGURATION);
        coordJob.setLastActionNumber(0);
        coordJob.setFrequency(1);
        coordJob.setExecution(Execution.FIFO);
        coordJob.setConcurrency(1);
        try {
            coordJob.setEndTime(DateUtils.parseDateUTC("2009-02-03T23:59Z"));
            coordJob.setStartTime(DateUtils.parseDateUTC("2009-02-01T23:59Z"));
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        List<JsonCoordinatorAction> actions = new ArrayList<JsonCoordinatorAction>();
        for (int i = 0; i < idx; i++) {
            actions.add(createDummyAction(i, JOB_ID + idx));
        }

        coordJob.setActions(actions);
        return coordJob;
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.CoordinatorJobBean

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.