Package org.apache.oozie.sla

Examples of org.apache.oozie.sla.SLASummaryBean


        Query query = getSelectQuery(namedQuery, em, parameters);
        Object ret = jpaService.executeGet(namedQuery.name(), query, em);
        if (ret == null && !namedQuery.equals(SLASummaryQuery.GET_SLA_SUMMARY)) {
            throw new JPAExecutorException(ErrorCode.E0604, query.toString());
        }
        SLASummaryBean bean = constructBean(namedQuery, ret, parameters);
        return bean;
    }
View Full Code Here


        return ret;
    }

    private SLASummaryBean constructBean(SLASummaryQuery namedQuery, Object ret, Object... parameters)
            throws JPAExecutorException {
        SLASummaryBean bean;
        switch (namedQuery) {
            case GET_SLA_SUMMARY:
                bean = (SLASummaryBean) ret;
                break;
            case GET_SLA_SUMMARY_EVENTPROCESSED:
                bean = new SLASummaryBean();
                bean.setEventProcessed(((Byte)ret).intValue());
                break;
            default:
                throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor cannot construct job bean for "
                        + namedQuery.name());
        }
View Full Code Here

        slaRegBean2.setId(ca2.getId());
        SLARegistrationBean slaRegBean3 = new SLARegistrationBean();
        slaRegBean3.setId(ca3.getId());
        SLARegistrationBean slaRegBean4 = new SLARegistrationBean();
        slaRegBean4.setId(ca4.getId());
        SLASummaryBean slaSummaryBean1 = new SLASummaryBean();
        slaSummaryBean1.setId(ca1.getId());
        SLASummaryBean slaSummaryBean3 = new SLASummaryBean();
        slaSummaryBean3.setId(ca3.getId());
        List<JsonBean> insertList = new ArrayList<JsonBean>();
        insertList.add(slaRegBean1);
        insertList.add(slaRegBean2);
        insertList.add(slaRegBean3);
        insertList.add(slaRegBean4);
        insertList.add(slaSummaryBean1);
        insertList.add(slaSummaryBean3);

        JPAService jpaService = Services.get().get(JPAService.class);
        BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);

        new CoordChangeXCommand(job.getId(), pauseTimeChangeStr).call();

        CoordJobGetJPAExecutor coordGetCmd = new CoordJobGetJPAExecutor(job.getId());
        CoordinatorJobBean coordJob = jpaService.execute(coordGetCmd);
        assertEquals(DateUtils.formatDateOozieTZ(coordJob.getPauseTime()), DateUtils.formatDateOozieTZ(pauseTime));
        assertEquals(Job.Status.RUNNING, coordJob.getStatus());
        assertEquals(2, coordJob.getLastActionNumber());
        try {
            jpaService.execute(new CoordJobGetActionByActionNumberJPAExecutor(job.getId(), 3));
            fail("Expected to fail as action 3 should have been deleted");
        }
        catch (JPAExecutorException jpae) {
            assertEquals(ErrorCode.E0603, jpae.getErrorCode());
        }

        try {
            jpaService.execute(new CoordJobGetActionByActionNumberJPAExecutor(job.getId(), 4));
            fail("Expected to fail as action 4 should have been deleted");
        }
        catch (JPAExecutorException jpae) {
            assertEquals(ErrorCode.E0603, jpae.getErrorCode());
        }

        slaRegBean1 = SLARegistrationQueryExecutor.getInstance().get(SLARegQuery.GET_SLA_REG_ALL, slaRegBean1.getId());
        assertNotNull(slaRegBean1);
        slaRegBean2 = SLARegistrationQueryExecutor.getInstance().get(SLARegQuery.GET_SLA_REG_ALL, slaRegBean2.getId());
        assertNotNull(slaRegBean2);
        slaRegBean3 = SLARegistrationQueryExecutor.getInstance().get(SLARegQuery.GET_SLA_REG_ALL, slaRegBean3.getId());
        assertNull(slaRegBean3);
        slaRegBean4 = SLARegistrationQueryExecutor.getInstance().get(SLARegQuery.GET_SLA_REG_ALL, slaRegBean4.getId());
        assertNull(slaRegBean4);
        slaSummaryBean3 = SLASummaryQueryExecutor.getInstance().get(SLASummaryQuery.GET_SLA_SUMMARY, slaSummaryBean3.getId());
        assertNull(slaSummaryBean3);
        slaSummaryBean1 = SLASummaryQueryExecutor.getInstance().get(SLASummaryQuery.GET_SLA_SUMMARY, slaSummaryBean1.getId());
        assertNotNull(slaSummaryBean1);
    }
View Full Code Here

            actualStart.add(Calendar.MINUTE, i);
            Calendar expectedEnd = (Calendar) nominalTime.clone();
            expectedEnd.add(Calendar.MINUTE, 60);
            Calendar actualEnd = (Calendar) expectedEnd.clone();
            actualEnd.add(Calendar.MINUTE, i);
            SLASummaryBean bean = new SLASummaryBean();
            bean.setId(jobIDPrefix + i + jobIDSuffix);
            bean.setParentId(parentId);
            bean.setAppName(appName);
            bean.setAppType(appType);
            bean.setJobStatus("RUNNING");
            bean.setEventStatus(EventStatus.END_MISS);
            bean.setSLAStatus(SLAStatus.IN_PROCESS);
            bean.setNominalTime(nominalTime.getTime());
            bean.setExpectedStart(nominalTime.getTime());
            bean.setActualStart(actualStart.getTime());
            bean.setExpectedEnd(expectedEnd.getTime());
            bean.setActualEnd(actualEnd.getTime());
            bean.setExpectedDuration(10);
            bean.setActualDuration(15);
            bean.setUser("testuser");
            bean.setLastModifiedTime(currentTime);
            list.add(bean);
            nominalTime.add(Calendar.HOUR, 1);
        }

        SLACalculationInsertUpdateJPAExecutor writeCmd = new SLACalculationInsertUpdateJPAExecutor(list, null);
View Full Code Here

            ssBeans = q.getResultList();
        }
        catch (Exception e) {
            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
        }
        SLASummaryBean slaSummaryBean = null;
        if (ssBeans != null && ssBeans.size() > 0) {
            slaSummaryBean = ssBeans.get(0);
        }
        return slaSummaryBean;
    }
View Full Code Here

            SLARegistrationBean slaReg = jpaService.execute(new SLARegistrationGetJPAExecutor(actionId));
            if (slaReg != null) {
                LOG.debug("Deleting registration bean corresponding to action " + slaReg.getId());
                deleteList.add(slaReg);
            }
            SLASummaryBean slaSummaryBean = jpaService.execute(new SLASummaryGetJPAExecutor(actionId));
            if (slaSummaryBean != null) {
                LOG.debug("Deleting summary bean corresponding to action " + slaSummaryBean.getId());
                deleteList.add(slaSummaryBean);
            }
            deleteList.add(bean);
        }
        catch (JPAExecutorException e) {
View Full Code Here

        slaRegBean2.setId(ca2.getId());
        SLARegistrationBean slaRegBean3 = new SLARegistrationBean();
        slaRegBean3.setId(ca3.getId());
        SLARegistrationBean slaRegBean4 = new SLARegistrationBean();
        slaRegBean4.setId(ca4.getId());
        SLASummaryBean slaSummaryBean1 = new SLASummaryBean();
        slaSummaryBean1.setId(ca1.getId());
        SLASummaryBean slaSummaryBean3 = new SLASummaryBean();
        slaSummaryBean3.setId(ca3.getId());
        List<JsonBean> insertList = new ArrayList<JsonBean>();
        insertList.add(slaRegBean1);
        insertList.add(slaRegBean2);
        insertList.add(slaRegBean3);
        insertList.add(slaRegBean4);
        insertList.add(slaSummaryBean1);
        insertList.add(slaSummaryBean3);

        JPAService jpaService = Services.get().get(JPAService.class);
        jpaService.execute(new SLACalculationInsertUpdateJPAExecutor(insertList, null));

        new CoordChangeXCommand(job.getId(), pauseTimeChangeStr).call();

        CoordJobGetJPAExecutor coordGetCmd = new CoordJobGetJPAExecutor(job.getId());
        CoordinatorJobBean coordJob = jpaService.execute(coordGetCmd);
        assertEquals(DateUtils.formatDateOozieTZ(coordJob.getPauseTime()), DateUtils.formatDateOozieTZ(pauseTime));
        assertEquals(Job.Status.RUNNING, coordJob.getStatus());
        assertEquals(2, coordJob.getLastActionNumber());
        try {
            jpaService.execute(new CoordJobGetActionByActionNumberJPAExecutor(job.getId(), 3));
            fail("Expected to fail as action 3 should have been deleted");
        }
        catch (JPAExecutorException jpae) {
            assertEquals(ErrorCode.E0603, jpae.getErrorCode());
            jpae.printStackTrace();
        }

        try {
            jpaService.execute(new CoordJobGetActionByActionNumberJPAExecutor(job.getId(), 4));
            fail("Expected to fail as action 4 should have been deleted");
        }
        catch (JPAExecutorException jpae) {
            assertEquals(ErrorCode.E0603, jpae.getErrorCode());
            jpae.printStackTrace();
        }

        slaRegBean1 = jpaService.execute(new SLARegistrationGetJPAExecutor(slaRegBean1.getId()));
        assertNotNull(slaRegBean1);
        slaRegBean2 = jpaService.execute(new SLARegistrationGetJPAExecutor(slaRegBean2.getId()));
        assertNotNull(slaRegBean2);
        slaRegBean3 = jpaService.execute(new SLARegistrationGetJPAExecutor(slaRegBean3.getId()));
        assertNull(slaRegBean3);
        slaRegBean4 = jpaService.execute(new SLARegistrationGetJPAExecutor(slaRegBean4.getId()));
        assertNull(slaRegBean4);
        slaSummaryBean3 = jpaService.execute(new SLASummaryGetJPAExecutor(slaSummaryBean3.getId()));
        assertNull(slaSummaryBean3);
        slaSummaryBean1 = jpaService.execute(new SLASummaryGetJPAExecutor(slaSummaryBean1.getId()));
        assertNotNull(slaSummaryBean1);
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.sla.SLASummaryBean

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.