@Test public void testICalendarConverterYearlyWithoutBYMONTHGetTheStartDateOne() throws IOException, ParserException { ICalendar icalendar = icalendar("recur_event_freq-yearly_bymonth_unset.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); int julyMonthIndex = 7; MSMeetingRequestRecurrence recurrence = Iterables.getOnlyElement(msMeetingRequest.getRecurrences()); Assertions.assertThat(recurrence.getMonthOfYear()).isEqualTo(julyMonthIndex); }
@Test public void testICalendarConverterMonthlyEventWithByDayNumber() throws IOException, ParserException { ICalendar icalendar = icalendar("recur_event_freq-weekly_interval_byday-1.zimbra.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); Assertions.assertThat(msMeetingRequest) .isEqualTo( new MSMeetingRequest.MsMeetingRequestBuilder() .startTime(new DateTime("2012-07-10T07:00:00").toDate()) .dtStamp(new DateTime("2012-04-24T07:57:07Z").toDate()) .endTime(new DateTime("2012-07-10T07:15:00").toDate()) .organizer("*****@*****.**") .location("Lyon") .instanceType(MSMeetingRequestInstanceType.MASTER_RECURRING) .timeZone(TimeZone.getTimeZone("Europe/Brussels")) .msEventExtId(new MSEventExtId("f28d13af-a5b5-44cf-83c9-3e76aa743179")) .reponseRequested(true) .recurrenceId(new DateTime("2012-07-10T07:00:00").toDate()) .recurrences( Lists.newArrayList( MSMeetingRequestRecurrence.builder() .interval(1) .type(MSMeetingRequestRecurrenceType.MONTHLY_NTH_DAY) .dayOfMonth(2) .dayOfWeek( Lists.newArrayList(MSMeetingRequestRecurrenceDayOfWeek.TUESDAY)) .build())) .build()); }
@Test public void testICalendarConverterYearlyEventByMonthDayAndByMonth() throws IOException, ParserException { ICalendar icalendar = icalendar("recur_event_freq-yearly_interval_bymonthday_bymonth.zimbra.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); Assertions.assertThat(msMeetingRequest) .isEqualTo( new MSMeetingRequest.MsMeetingRequestBuilder() .startTime(new DateTime("2012-07-10T07:00:00").toDate()) .dtStamp(new DateTime("2012-04-24T08:08:09Z").toDate()) .endTime(new DateTime("2012-07-10T07:15:00").toDate()) .organizer("*****@*****.**") .location("Lyon") .instanceType(MSMeetingRequestInstanceType.MASTER_RECURRING) .timeZone(TimeZone.getTimeZone("Europe/Brussels")) .msEventExtId(new MSEventExtId("f28d13af-a5b5-44cf-83c9-3e76aa743179")) .reponseRequested(true) .recurrenceId(new DateTime("2012-07-10T07:00:00").toDate()) .recurrences( Lists.newArrayList( MSMeetingRequestRecurrence.builder() .interval(1) .type(MSMeetingRequestRecurrenceType.YEARLY) .dayOfMonth(10) .monthOfYear(7) .build())) .build()); }
@Test public void testICalendarConverterDailyEventWithIntervalAndWorkingDays() throws IOException, ParserException { ICalendar icalendar = icalendar("recur_event_freq-daily_interval_workingdays.zimbra.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); Assertions.assertThat(msMeetingRequest) .isEqualTo( new MSMeetingRequest.MsMeetingRequestBuilder() .startTime(new DateTime("2012-04-24T07:00:00").toDate()) .dtStamp(new DateTime("2012-04-23T15:04:23Z").toDate()) .endTime(new DateTime("2012-04-24T07:15:00").toDate()) .organizer("*****@*****.**") .location("Lyon") .instanceType(MSMeetingRequestInstanceType.MASTER_RECURRING) .timeZone(TimeZone.getTimeZone("Europe/Brussels")) .msEventExtId(new MSEventExtId("f28d13af-a5b5-44cf-83c9-3e76aa743179")) .reponseRequested(true) .recurrenceId(new DateTime("2012-04-24T07:00:00").toDate()) .recurrences( Lists.newArrayList( MSMeetingRequestRecurrence.builder() .interval(1) .type(MSMeetingRequestRecurrenceType.DAILY) .dayOfWeek( Lists.newArrayList( MSMeetingRequestRecurrenceDayOfWeek.MONDAY, MSMeetingRequestRecurrenceDayOfWeek.TUESDAY, MSMeetingRequestRecurrenceDayOfWeek.WEDNESDAY, MSMeetingRequestRecurrenceDayOfWeek.THURSDAY, MSMeetingRequestRecurrenceDayOfWeek.FRIDAY)) .build())) .build()); }