public final void testGetConsumedTime2() throws Exception { String resource = "/samples/valid/derryn.ics"; net.fortuna.ical4j.model.Calendar calendar = loadCalendar(resource); Date start = new Date(); Calendar endCal = getCalendarInstance(); endCal.setTime(start); endCal.add(Calendar.WEEK_OF_YEAR, 4); // Date end = new Date(start.getTime() + (1000 * 60 * 60 * 24 * 7 * 4)); calendar.getComponents().forEach(calendarComponent -> { if (calendarComponent instanceof VEvent) { PeriodList consumed = ((VEvent) calendarComponent).getConsumedTime(start, new Date(endCal.getTime().getTime())); log.debug("Event [" + calendarComponent + "]"); log.debug("Consumed time [" + consumed + "]"); } }); }
/** * @throws IOException * @throws ParserException */ public void testTzIdCompatibility() throws IOException, ParserException { CalendarBuilder builder = new CalendarBuilder(); Calendar calendar = builder.build(getClass().getResourceAsStream("/samples/valid/tmeher.ics")); // ensure the calendar is loaded properly.. assertNotNull(calendar); TimeZoneRegistry registry = builder.getRegistry(); calendar.getComponents().forEach(calendarComponent -> { calendarComponent.getProperties().forEach(property -> { TzId tzId = property.getParameter(Parameter.TZID); if (tzId != null) { assertNotNull(registry.getTimeZone(tzId.getValue())); } }); }); } }
net.fortuna.ical4j.model.Calendar calendar = Calendars.load(testFiles[i]); if (Method.PUBLISH.equals(calendar.getProperty(Property.METHOD))) { calendar.getComponents(Component.VEVENT).forEach(calendarComponent -> { suite.addTest(new VEventTest("testPublishValidation", (VEvent) calendarComponent)); }); } else if (Method.REQUEST.equals(calendar.getProperty(Property.METHOD))) { calendar.getComponents(Component.VEVENT).forEach(calendarComponent -> { suite.addTest(new VEventTest("testRequestValidation", (VEvent) calendarComponent)); });