@Test public void testReportCalendarWithTimezone() throws Exception { GenerateQuery gq = new GenerateQuery(); gq.setComponent("VEVENT :"); CalendarQuery query = gq.generate(); Calendar calendar = null; try { calendar = collection.getCalendarForEventUID(fixture.getHttpClient(), ICS_DAILY_NY_5PM_UID); } catch (CalDAV4JException ce) { assertNull(ce); } assertNotNull(calendar); VEvent vevent = ICalendarUtils.getFirstEvent(calendar); assertNotNull(vevent); String summary = ICalendarUtils.getSummaryValue(vevent); assertEquals(ICS_DAILY_NY_5PM_SUMMARY, summary); CalDAV4JException calDAV4JException = null; try { calendar = collection.getCalendarForEventUID(fixture.getHttpClient(), "NON_EXISTENT_RESOURCE"); } catch (CalDAV4JException ce) { calDAV4JException = ce; } assertNotNull(calDAV4JException); }
@Test public void testGetCalendarByPath() throws Exception { Calendar calendar = null; try { calendar = uncachedCollection.getCalendar( fixture.getHttpClient(), ICS_GOOGLE_DAILY_NY_5PM_UID + ".ics"); } catch (CalDAV4JException ce) { assertNull(ce); } assertNotNull(calendar); VEvent vevent = ICalendarUtils.getFirstEvent(calendar); assertNotNull(vevent); String summary = ICalendarUtils.getSummaryValue(vevent); assertEquals(ICS_DAILY_NY_5PM_SUMMARY, summary); CalDAV4JException calDAV4JException = null; try { calendar = uncachedCollection.getCalendar(fixture.getHttpClient(), "NON_EXISTENT_RESOURCE"); } catch (CalDAV4JException ce) { calDAV4JException = ce; } assertNotNull(calDAV4JException); }
/** @throws Exception */ @Test public void testUpdateEvent() throws Exception { Calendar calendar = collection.getCalendarForEventUID(fixture.getHttpClient(), ICS_NORMAL_PACIFIC_1PM_UID); VEvent ve = ICalendarUtils.getFirstEvent(calendar); // sanity! assertNotNull(calendar); assertEquals(ICS_NORMAL_PACIFIC_1PM_SUMMARY, ICalendarUtils.getSummaryValue(ve)); ICalendarUtils.addOrReplaceProperty(ve, new Summary("NEW")); collection.updateMasterEvent(fixture.getHttpClient(), ve, null); calendar = collection.getCalendarForEventUID(fixture.getHttpClient(), ICS_NORMAL_PACIFIC_1PM_UID); ve = ICalendarUtils.getFirstEvent(calendar); assertEquals("NEW", ICalendarUtils.getSummaryValue(ve)); }