assertTrue(msgBody.indexOf(indent + EmailField.ACTUAL_END_TIME.toString() + sep + actualEndDate) > -1);
}
public void testOnDurationMiss() throws Exception {
SLACalcStatus event = new SLACalcStatus(new SLARegistrationBean());
SLARegistrationBean eventBean = event.getSLARegistrationBean();
Date expectedStartDate = DateUtils.parseDateUTC("2013-01-01T00:00Z");
Date actualStartDate = DateUtils.parseDateUTC("2013-01-01T00:10Z");
Date expectedEndDate = DateUtils.parseDateUTC("2013-01-01T00:20Z");
Date actualEndDate = DateUtils.parseDateUTC("2013-01-01T00:40Z");
long expectedDuration = expectedEndDate.getTime() - expectedStartDate.getTime();
long actualDuration = actualEndDate.getTime() - actualStartDate.getTime();
long expectedDurationInMins = expectedDuration / 60000;
long actualDurationInMins = actualDuration / 60000;
event.setId("0000000-000000000000001-oozie-wrkf-C@1");
eventBean.setParentId("0000000-000000000000001-oozie-wrkf-C");
event.setEventStatus(EventStatus.DURATION_MISS);
event.setJobStatus(JobEvent.EventStatus.SUCCESS.toString());
eventBean.setAppName("Test-SLA-Duration-Miss");
eventBean.setUser("dummyuser");
eventBean.setNominalTime(expectedStartDate);
eventBean.setExpectedStart(expectedStartDate);
eventBean.setExpectedEnd(expectedEndDate);
eventBean.setNotificationMsg("notification of duration miss");
eventBean.setAlertContact("alert-receiver-durationmiss@oozie.com");
eventBean.setAppType(AppType.COORDINATOR_ACTION);
eventBean.setExpectedStart(expectedStartDate);
eventBean.setExpectedEnd(expectedEndDate);
event.setActualStart(actualStartDate);
event.setActualEnd(actualEndDate);
eventBean.setExpectedDuration(expectedDuration);
event.setActualDuration(actualDuration);
slaEmailListener.onEndMiss(event);
MimeMessage[] msgs = greenMail.getReceivedMessages();
MimeMessage msg = msgs[0];