Пример #1
0
  @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);
  }
Пример #2
0
  // 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

  }
Пример #3
0
  // 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

  }