Package org.apache.oozie.sla

Examples of org.apache.oozie.sla.SLARegistrationBean


        assertEquals(query.getParameterValue("id"), bean.getId());
    }

    public void testGet() throws Exception {

        SLARegistrationBean bean = addRecordToSLARegistrationTable("test-application", SLAStatus.MET);
        //GET_SLA_REG_ON_RESTART
        SLARegistrationBean retBean = SLARegistrationQueryExecutor.getInstance().get(
                SLARegQuery.GET_SLA_REG_ON_RESTART, bean.getId());
        assertEquals(bean.getJobData(), retBean.getJobData());
        assertEquals(bean.getSlaConfig(), retBean.getSlaConfig());
        assertEquals(bean.getUpstreamApps(), retBean.getUpstreamApps());
        assertEquals(bean.getNotificationMsg(), retBean.getNotificationMsg());
        assertNull(retBean.getAppName());
        assertNull(retBean.getExpectedEnd());
        assertNull(retBean.getExpectedStart());
        assertNull(retBean.getCreatedTime());
        assertNull(retBean.getNominalTime());
        assertNull(retBean.getUser());
        assertNull(retBean.getParentId());
        //GET_SLA_REG_ALL
        retBean = SLARegistrationQueryExecutor.getInstance().get(SLARegQuery.GET_SLA_REG_ALL, bean.getId());
        assertEquals(bean.getId(), retBean.getId());
        assertEquals(bean.getAppName(), retBean.getAppName());
        assertEquals(bean.getAppType(), retBean.getAppType());
        assertEquals(bean.getExpectedDuration(), retBean.getExpectedDuration());
        assertEquals(bean.getExpectedStart().getTime(), retBean.getExpectedStart().getTime());
        assertEquals(bean.getExpectedEnd().getTime(), retBean.getExpectedEnd().getTime());
        assertEquals(bean.getCreatedTime().getTime(), retBean.getCreatedTime().getTime());
        assertEquals(bean.getNominalTime().getTime(), retBean.getNominalTime().getTime());
        assertEquals(bean.getNotificationMsg(), retBean.getNotificationMsg());
        assertEquals(bean.getJobData(), retBean.getJobData());
        assertEquals(bean.getParentId(), retBean.getParentId());
        assertEquals(bean.getSlaConfig(), retBean.getSlaConfig());
        assertEquals(bean.getUpstreamApps(), retBean.getUpstreamApps());
        assertEquals(bean.getUser(), retBean.getUser());
}
View Full Code Here


    public void testOnSLAStartMissEvent() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus startMiss = _createSLACalcStatus(id);
        SLARegistrationBean startMissBean = startMiss.getSLARegistrationBean();
        Date startDate = DateUtils.parseDateUTC("2013-01-01T00:00Z");
        startMiss.setId(id);
        startMissBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
        startMissBean.setAppName("Test-SLA-Start-Miss");
        startMissBean.setUser("dummyuser");
        startMissBean.setExpectedStart(startDate);
        startMissBean.setNotificationMsg("notification of start miss");
        startMissBean.setJobData("random job data");
        startMiss.setEventStatus(EventStatus.START_MISS);
        startMiss.setSLAStatus(SLAStatus.NOT_STARTED);
        startMissBean.setAppType(AppType.COORDINATOR_ACTION);
        startMiss.setActualStart(DateUtils.parseDateUTC("2013-01-01T01:00Z"));

        ConnectionContext jmsContext = getConnectionContext();

        Session session = jmsContext.createSession(Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    public void testOnSLAEndMissEvent() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus endMiss = _createSLACalcStatus(id);
        SLARegistrationBean endMissBean = endMiss.getSLARegistrationBean();
        Date expectedEndDate = DateUtils.parseDateUTC("2013-01-01T00:00Z");
        Date actualEndDate = DateUtils.parseDateUTC("2013-01-01T01:00Z");
        endMiss.setId(id);
        endMissBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
        endMissBean.setAppName("Test-SLA-End-Miss");
        endMiss.setEventStatus(EventStatus.END_MISS);
        endMiss.setSLAStatus(SLAStatus.IN_PROCESS);
        endMissBean.setAppType(AppType.COORDINATOR_ACTION);
        endMissBean.setUser("dummyuser");
        endMissBean.setNotificationMsg("notification of end miss");
        endMissBean.setExpectedEnd(expectedEndDate);
        endMiss.setActualEnd(actualEndDate);

        ConnectionContext jmsContext = getConnectionContext();

        Session session = jmsContext.createSession(Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    public void testOnSLADurationMissEvent() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus durationMiss = _createSLACalcStatus(id);
        SLARegistrationBean durationMissBean = durationMiss.getSLARegistrationBean();
        Date expectedStartDate = DateUtils.parseDateUTC("2013-01-01T00:00Z");
        Date actualStartDate = DateUtils.parseDateUTC("2013-01-01T01:00Z");
        Date expectedEndDate = DateUtils.parseDateUTC("2013-01-01T12:00Z");
        Date actualEndDate = DateUtils.parseDateUTC("2013-01-01T14:00Z");
        long expectedDuration = ( expectedEndDate.getTime() - actualStartDate.getTime() ) / (1000 * 60);
        durationMiss.setId(id);
        durationMissBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
        durationMissBean.setAppName("Test-SLA-Duration-Miss");
        durationMiss.setEventStatus(EventStatus.DURATION_MISS);
        durationMiss.setSLAStatus(SLAStatus.IN_PROCESS);
        durationMissBean.setAppType(AppType.COORDINATOR_ACTION);
        durationMissBean.setUser("dummyuser");
        durationMissBean.setNotificationMsg("notification of duration miss");
        durationMissBean.setExpectedStart(expectedStartDate);
        durationMiss.setActualStart(actualStartDate);
        durationMissBean.setExpectedEnd(expectedEndDate);
        durationMiss.setActualEnd(actualEndDate);
        durationMissBean.setExpectedDuration(expectedDuration);
        long actualDuration = actualEndDate.getTime() - actualStartDate.getTime();
        durationMiss.setActualDuration(actualDuration);

        ConnectionContext jmsContext = getConnectionContext();
        Session session = jmsContext.createSession(Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    public void testSLAJobSelectors() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus startMiss = _createSLACalcStatus(id);
        SLARegistrationBean startMissBean = startMiss.getSLARegistrationBean();
        startMiss.setId(id);
        startMissBean.setAppName("Test-SLA-Start-Miss");
        startMissBean.setAppType(AppType.COORDINATOR_ACTION);
        startMissBean.setUser("dummyuser");
        startMiss.setEventStatus(EventStatus.START_MISS);
        startMiss.setSLAStatus(SLAStatus.NOT_STARTED);
        startMiss.setMsgType(MessageType.SLA);

        ConnectionContext jmsContext = getConnectionContext();
View Full Code Here

    public void testSLAJobSelectorsNegative() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus startMiss = _createSLACalcStatus(id);
        SLARegistrationBean startMissBean = startMiss.getSLARegistrationBean();

        startMiss.setId(id);
        startMissBean.setAppName("Test-SLA-Start-Miss");
        startMissBean.setAppType(AppType.COORDINATOR_ACTION);
        startMissBean.setUser("dummyuser");
        startMiss.setEventStatus(EventStatus.START_MISS);
        startMiss.setSLAStatus(SLAStatus.NOT_STARTED);
        startMiss.setMsgType(MessageType.SLA);

        ConnectionContext jmsContext = getConnectionContext();
View Full Code Here

    public void testOnSLAStartMetEvent() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus startMet = _createSLACalcStatus(id);
        SLARegistrationBean startMetBean = startMet.getSLARegistrationBean();
        Date expectedStartDate = DateUtils.parseDateUTC("2013-01-01T10:00Z");
        Date actualStartDate = DateUtils.parseDateUTC("2013-01-01T09:55Z");
        startMetBean.setAppName("Test-SLA-Start-Met");
        startMet.setEventStatus(EventStatus.START_MET);
        startMet.setSLAStatus(SLAStatus.IN_PROCESS);
        startMetBean.setAppType(AppType.COORDINATOR_ACTION);
        startMet.setId(id);
        startMetBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
        startMetBean.setUser("dummyuser");
        startMetBean.setNotificationMsg("notification of start miss");
        startMetBean.setJobData("random job data");
        startMetBean.setExpectedStart(expectedStartDate);
        startMet.setActualStart(actualStartDate);

        ConnectionContext jmsContext = getConnectionContext();
        Session session = jmsContext.createSession(Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = jmsContext.createConsumer(session, slaListener.getTopic(startMet));
View Full Code Here

    public void testOnSLAEndMetEvent() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus endMet = _createSLACalcStatus(id);
        SLARegistrationBean endMetBean = endMet.getSLARegistrationBean();
        Date expectedEndDate = DateUtils.parseDateUTC("2013-01-01T12:00Z");
        Date actualEndDate = DateUtils.parseDateUTC("2013-01-01T11:00Z");
        endMet.setId(id);
        endMetBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
        endMetBean.setAppName("Test-SLA-End-Met");
        endMet.setEventStatus(EventStatus.END_MET);
        endMet.setSLAStatus(SLAStatus.MET);
        endMetBean.setAppType(AppType.COORDINATOR_ACTION);
        endMetBean.setUser("dummyuser");
        endMetBean.setNotificationMsg("notification of end met");
        endMetBean.setExpectedEnd(expectedEndDate);
        endMet.setActualEnd(actualEndDate);

        ConnectionContext jmsContext = getConnectionContext();

        Session session = jmsContext.createSession(Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    public void testOnSLADurationMetEvent() throws Exception {
        JMSSLAEventListener slaListener = new JMSSLAEventListener();
        slaListener.init(conf);
        String id = "0000000-000000000000001-oozie-wrkf-C@1";
        SLACalcStatus durationMet = _createSLACalcStatus(id);
        SLARegistrationBean durationMetBean = durationMet.getSLARegistrationBean();

        Date expectedStartDate = DateUtils.parseDateUTC("2013-01-01T00:00Z");
        Date actualStartDate = DateUtils.parseDateUTC("2013-01-01T01:00Z");
        Date expectedEndDate = DateUtils.parseDateUTC("2013-01-01T12:00Z");
        Date actualEndDate = DateUtils.parseDateUTC("2013-01-01T14:00Z");
        long expectedDuration = ( expectedEndDate.getTime() - actualStartDate.getTime() ) / (1000 * 60);
        durationMet.setId(id);
        durationMetBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
        durationMetBean.setAppName("Test-SLA-Duration-Met");
        durationMet.setEventStatus(EventStatus.DURATION_MET);
        durationMet.setSLAStatus(SLAStatus.MET);
        durationMetBean.setAppType(AppType.COORDINATOR_ACTION);
        durationMetBean.setUser("dummyuser");
        durationMetBean.setNotificationMsg("notification of duration met");
        durationMetBean.setExpectedStart(expectedStartDate);
        durationMet.setActualStart(actualStartDate);
        durationMetBean.setExpectedEnd(expectedEndDate);
        durationMet.setActualEnd(actualEndDate);
        durationMetBean.setExpectedDuration(expectedDuration);
        long actualDuration = actualEndDate.getTime() - actualStartDate.getTime();
        durationMet.setActualDuration(actualDuration);

        ConnectionContext jmsContext = getConnectionContext();

View Full Code Here

        assertEquals(actualDuration, durationMissMsg.getActualDuration());
        assertEquals("notification of duration met", durationMissMsg.getNotificationMessage());
    }
   
    private SLACalcStatus _createSLACalcStatus(String actionId) {
        SLARegistrationBean reg = new SLARegistrationBean();
        reg.setId(actionId);
        reg.setAppType(AppType.COORDINATOR_ACTION);
        return new SLACalcStatus(reg);
    }
View Full Code Here

TOP

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

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.