use of net.fortuna.ical4j.data.CalendarBuilder in project traccar by tananaev.
the class Calendar method setData.
public void setData(byte[] data) throws IOException, ParserException {
CalendarBuilder builder = new CalendarBuilder();
calendar = builder.build(new ByteArrayInputStream(data));
this.data = data.clone();
}
use of net.fortuna.ical4j.data.CalendarBuilder in project openolat by klemens.
the class CalendarImportTest method testImportFromFGiCal.
/*
* Why is this test not reliable???
@Test(expected = ParserException.class)
public void testImportRefresh() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("Refresh.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
*/
@Test
@Ignore
public void testImportFromFGiCal() throws IOException, ParserException {
// default settings in olat
System.setProperty(CompatibilityHints.KEY_RELAXED_UNFOLDING, "true");
System.setProperty(CompatibilityHints.KEY_RELAXED_PARSING, "true");
InputStream in = CalendarImportTest.class.getResourceAsStream("EMAIL.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
use of net.fortuna.ical4j.data.CalendarBuilder in project openolat by klemens.
the class CalendarImportTest method testImportOktoberFromOutlook.
@Test
public void testImportOktoberFromOutlook() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("BB_Okt.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
use of net.fortuna.ical4j.data.CalendarBuilder in project openolat by klemens.
the class CalendarImportTest method testImportFromOutlook.
@Test
public void testImportFromOutlook() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("Hoffstedde.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
use of net.fortuna.ical4j.data.CalendarBuilder in project openolat by klemens.
the class CalendarImportTest method testImportRecurringCal.
@Test
public void testImportRecurringCal() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("RecurringEvent.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
VEvent rootEvent = null;
VEvent exceptionEvent = null;
for (Iterator<?> iter = calendar.getComponents().iterator(); iter.hasNext(); ) {
Object comp = iter.next();
if (comp instanceof VEvent) {
VEvent vevent = (VEvent) comp;
if (vevent.getRecurrenceId() == null) {
rootEvent = vevent;
} else {
exceptionEvent = vevent;
}
}
}
assertNotNull(rootEvent);
assertNotNull(exceptionEvent);
java.util.Date startDate = CalendarUtils.getDate(2016, java.util.Calendar.OCTOBER, 10);
DateTime start = new DateTime(startDate);
java.util.Date endDate = CalendarUtils.getDate(2016, java.util.Calendar.NOVEMBER, 10);
DateTime end = new DateTime(endDate);
Period period = new Period(start, end);
PeriodList pList = rootEvent.calculateRecurrenceSet(period);
for (Object obj : pList) {
Period p = (Period) obj;
System.out.println("Period: " + p.getStart());
}
RecurrenceId recurrenceId = exceptionEvent.getRecurrenceId();
Date recurrenceDate = recurrenceId.getDate();
System.out.println("Recurrence: " + recurrenceDate);
exceptionEvent.getSequence();
}
Aggregations