}
public void testOnSLADurationMissEvent() throws Exception {
JMSSLAEventListener slaListener = new JMSSLAEventListener();
slaListener.init(conf);
SLACalcStatus durationMiss = new SLACalcStatus(new SLARegistrationBean());
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("0000000-000000000000001-oozie-wrkf-C@1");
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);
MessageConsumer consumer = jmsContext.createConsumer(session, slaListener.getTopic(durationMiss));
slaListener.onDurationMiss(durationMiss);