use of org.kie.kogito.jobs.ExpirationTime in project kogito-runtimes by kiegroup.
the class DeadlineHelperTest method testRepetitionWithEndDateAndLimit.
@Test
public void testRepetitionWithEndDateAndLimit() {
Collection<DeadlineInfo<Map<String, Object>>> deadlines = DeadlineHelper.parseDeadlines("[subject:5secs]@[R2/PT5S/2021-03-18T18:55:01+01:00]");
assertEquals(1, deadlines.size());
DeadlineInfo<Map<String, Object>> deadlineInfo = deadlines.iterator().next();
assertEquals("5secs", deadlineInfo.getNotification().get("subject"));
Collection<ScheduleInfo> scheduling = deadlineInfo.getScheduleInfo();
assertEquals(1, scheduling.size());
ScheduleInfo scheduleInfo = scheduling.iterator().next();
assertEquals(Duration.ofSeconds(5), scheduleInfo.getDuration());
assertEquals(2, scheduleInfo.getNumRepetitions());
assertEquals(ZonedDateTime.parse("2021-03-18T18:55:01+01:00"), scheduleInfo.getEndDate());
assertNull(scheduleInfo.getStartDate());
ExpirationTime time = DeadlineHelper.getExpirationTime(scheduleInfo);
assertEquals(5000L, time.repeatInterval());
assertEquals(2, time.repeatLimit());
assertEqualsDate(ZonedDateTime.parse("2021-03-18T18:54:51+01:00"), time.get());
}
Aggregations