// get a Calendar by uid, then by summary, then by recurrence-id @Test public void queryCalendar() throws CalDAV4JException { Calendar calendar = null; GenerateQuery gq = new GenerateQuery(); // query by uid calendar = collection.queryCalendar( fixture.getHttpClient(), Component.VEVENT, ICS_GOOGLE_DAILY_NY_5PM_UID, null); assertNotNull(calendar); // check if is cache assertNotNull(collection.getCache().getHrefForEventUID(ICS_GOOGLE_DAILY_NY_5PM_UID)); // query by SUMMARY calendar = null; gq.setFilter("VEVENT : SUMMARY==" + ICS_GOOGLE_NORMAL_PACIFIC_1PM_SUMMARY); List<Calendar> calendars = collection.queryCalendars(fixture.getHttpClient(), gq.generate()); assertNotNull(calendars); assertEquals("non unique result", calendars.size(), 1); calendar = calendars.get(0); assertEquals(ICalendarUtils.getUIDValue(calendar), ICS_GOOGLE_NORMAL_PACIFIC_1PM_UID); // check if is in cache }
// TODO: this is work in progress; see issue 48 @Ignore @Test public void queryPartialCalendar() throws CalDAV4JException { Calendar calendar = null; GenerateQuery gq = new GenerateQuery(); // query by UID in a given timerange calendar = null; gq.setFilter("VEVENT : UID==" + ICS_GOOGLE_DAILY_NY_5PM_UID); gq.setRecurrenceSet("20060101T170000Z", "20060103T230000Z", CalendarData.EXPAND); List<Calendar> calendars = collection.queryCalendars(fixture.getHttpClient(), gq.generate()); assertNotNull(calendars); assertEquals("bad number of responses: ", 3, calendars.size()); for (Calendar c : calendars) { assertEquals(ICalendarUtils.getUIDValue(calendar), ICS_GOOGLE_DAILY_NY_5PM_UID); assertNotNull( ICalendarUtils.getPropertyValue( c.getComponent(Component.VEVENT), Property.RECURRENCE_ID)); } // check if is in cache }