Package org.apache.oozie

Examples of org.apache.oozie.BundleJobBean


     * Test : Pause a RUNNING bundle
     *
     * @throws Exception
     */
    public void testBundlePauseUnpause2() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.RUNNING);

        new BundlePauseXCommand(job).call();

        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.PAUSED);
       
        new BundleUnpauseXCommand(job).call();
        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.RUNNING);
    }
View Full Code Here


     * Test : Pause a RUNNINGWITHERROR bundle
     *
     * @throws Exception
     */
    public void testBundlePauseUnpause3() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNINGWITHERROR, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.RUNNINGWITHERROR);

        new BundlePauseXCommand(job).call();

        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.PAUSEDWITHERROR);
       
        new BundleUnpauseXCommand(job).call();
        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.RUNNINGWITHERROR);
    }
View Full Code Here

     * Test : Negative case - pause a suspended bundle
     *
     * @throws Exception
     */
    public void testBundlePauseUnpauseNeg1() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUSPENDED, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(job.getStatus(), Job.Status.SUSPENDED);

        try {
            new BundlePauseXCommand(job).call();
            fail("should not reach here.");
        }
View Full Code Here

     * Test: submit bundle job, then check job info
     *
     * @throws Exception
     */
    public void testBundleJobInfo1() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        BundleJobGetJPAExecutor bundleJobGetjpa = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetjpa);
        assertEquals(job.getStatus(), Job.Status.PREP);

        BundleJobBean bundleJob = (new BundleJobXCommand(job.getId())).call();

        assertEquals(0, bundleJob.getCoordinators().size());
        assertEquals(bundleJob.getStatus(), Job.Status.PREP);
        assertEquals(bundleJob.getId(), job.getId());
    }
View Full Code Here

     * Test : Suspend bundle job
     *
     * @throws Exception
     */
    public void testBundleSuspend3() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);

        Configuration jobConf = null;
        try {
            jobConf = new XConfiguration(new StringReader(job.getConf()));
        }
        catch (IOException ioe) {
            log.warn("Configuration parse error. read from DB :" + job.getConf(), ioe);
            throw new CommandException(ErrorCode.E1005, ioe);
        }

        Path appPath = new Path(jobConf.get(OozieClient.BUNDLE_APP_PATH), "bundle.xml");
        jobConf.set(OozieClient.BUNDLE_APP_PATH, appPath.toString());

        BundleSubmitXCommand submitCmd = new BundleSubmitXCommand(jobConf, job.getAuthToken());
        submitCmd.call();

        BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(submitCmd.getJob().getId());
        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(Job.Status.PREP, job.getStatus());

        new BundleJobSuspendXCommand(job.getId()).call();

        job = jpaService.execute(bundleJobGetCmd);
        assertEquals(Job.Status.PREPSUSPENDED, job.getStatus());
    }
View Full Code Here

            // Job doesn't exist. Exception is expected.
        }
    }

    protected BundleJobBean addRecordToBundleJobTable(Job.Status jobStatus, Date lastModifiedTime) throws Exception {
        BundleJobBean bundle = createBundleJob(jobStatus, false);
        bundle.setLastModifiedTime(lastModifiedTime);
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
            jpaService.execute(bundleInsertjpa);
View Full Code Here

        services.destroy();
        super.tearDown();
    }

    public void testBundleActionsDeleteForPurgeJPAExecutor() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateUTC("2011-01-01T01:00Z"));
        this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.SUCCEEDED);
        this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.SUCCEEDED);
        _testBundleActionsDelete(job.getId());
    }
View Full Code Here

        ret = jpaService.execute(bundleActionsGetCmd);
        assertEquals(0, ret.size());
    }

    protected BundleJobBean addRecordToBundleJobTable(Job.Status jobStatus, Date lastModifiedTime) throws Exception {
        BundleJobBean bundle = createBundleJob(jobStatus, false);
        bundle.setLastModifiedTime(lastModifiedTime);
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
            jpaService.execute(bundleInsertjpa);
View Full Code Here

        services.destroy();
        super.tearDown();
    }

    public void testBundleJobDeleteJPAExecutor() throws Exception {
        BundleJobBean job1 = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateUTC("2011-01-01T01:00Z"));
        _testBundleJobDelete(job1.getId());
        BundleJobBean job2 = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateUTC("2011-01-02T01:00Z"));
        _testBundleJobDelete(job2.getId());
    }
View Full Code Here

        assertNotNull(jpaService);
        BundleJobDeleteJPAExecutor bundleDelCmd = new BundleJobDeleteJPAExecutor(jobId);
        jpaService.execute(bundleDelCmd);
        try {
            BundleJobGetJPAExecutor bundleGetCmd = new BundleJobGetJPAExecutor(jobId);
            BundleJobBean ret = jpaService.execute(bundleGetCmd);
            fail("Job should not be there");
        }
        catch (JPAExecutorException ex) {
        }
View Full Code Here

TOP

Related Classes of org.apache.oozie.BundleJobBean

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.