use of org.pentaho.platform.api.scheduler2.recur.ITimeRecurrence in project pentaho-platform by pentaho.
the class ComplexTriggerJAXBTest method assertRecurrencesCorrect.
private void assertRecurrencesCorrect(String dimension, int expectedCount, ITimeWrapper recurrences) {
int count = 0;
for (ITimeRecurrence rec : recurrences.getRecurrences()) {
if (rec instanceof IncrementalRecurrence) {
count++;
IncrementalRecurrence i = (IncrementalRecurrence) rec;
Assert.assertEquals("Wrong starting value for dimension " + dimension, inc.getStartingValue(), i.getStartingValue());
Assert.assertEquals("Wrong increment for dimension " + dimension, inc.getIncrement(), i.getIncrement());
}
if (rec instanceof SequentialRecurrence) {
count++;
SequentialRecurrence s = (SequentialRecurrence) rec;
Assert.assertEquals("Wrong first value for dimension " + dimension, seq.getFirstValue(), s.getFirstValue());
Assert.assertEquals("Wrong last value for dimension " + dimension, seq.getLastValue(), s.getLastValue());
}
if (rec instanceof RecurrenceList) {
count++;
RecurrenceList l = (RecurrenceList) rec;
Assert.assertEquals("Wrong first value for dimension " + dimension, list[0], l.getValues().get(0));
Assert.assertEquals("Wrong second value for dimension " + dimension, list[1], l.getValues().get(1));
}
if (rec instanceof QualifiedDayOfWeek) {
count++;
QualifiedDayOfWeek q = (QualifiedDayOfWeek) rec;
Assert.assertEquals("Wrong day of week for dimension " + dimension, qday.getDayOfWeek(), q.getDayOfWeek());
Assert.assertEquals("Wrong qualifier for dimension " + dimension, qday.getQualifier(), q.getQualifier());
}
}
Assert.assertEquals("A recurrence type was expected but not found", expectedCount, count);
}
Aggregations