Search in sources :

Example 1 with EventAttendee

use of com.google.api.services.calendar.model.EventAttendee in project camel by apache.

the class CalendarEventsIntegrationTest method testInsert.

@Test
public void testInsert() throws Exception {
    Event event = new Event();
    event.setSummary("Feed the Camel");
    event.setLocation("Somewhere");
    ArrayList<EventAttendee> attendees = new ArrayList<EventAttendee>();
    attendees.add(new EventAttendee().setEmail("camel-google-calendar.janstey@gmail.com"));
    event.setAttendees(attendees);
    Date startDate = new Date();
    Date endDate = new Date(startDate.getTime() + 3600000);
    DateTime start = new DateTime(startDate, TimeZone.getTimeZone("UTC"));
    event.setStart(new EventDateTime().setDateTime(start));
    DateTime end = new DateTime(endDate, TimeZone.getTimeZone("UTC"));
    event.setEnd(new EventDateTime().setDateTime(end));
    final Map<String, Object> headers = new HashMap<String, Object>();
    // parameter type is String
    headers.put("CamelGoogleCalendar.calendarId", getCalendar().getId());
    // parameter type is com.google.api.services.calendar.model.Event
    headers.put("CamelGoogleCalendar.content", event);
    final com.google.api.services.calendar.model.Event result = requestBodyAndHeaders("direct://INSERT", null, headers);
    assertEquals("Feed the Camel", result.getSummary());
    LOG.debug("insert: " + result);
}
Also used : Event(com.google.api.services.calendar.model.Event) HashMap(java.util.HashMap) EventAttendee(com.google.api.services.calendar.model.EventAttendee) EventDateTime(com.google.api.services.calendar.model.EventDateTime) ArrayList(java.util.ArrayList) Date(java.util.Date) EventDateTime(com.google.api.services.calendar.model.EventDateTime) DateTime(com.google.api.client.util.DateTime) Event(com.google.api.services.calendar.model.Event) Test(org.junit.Test)

Aggregations

DateTime (com.google.api.client.util.DateTime)1 Event (com.google.api.services.calendar.model.Event)1 EventAttendee (com.google.api.services.calendar.model.EventAttendee)1 EventDateTime (com.google.api.services.calendar.model.EventDateTime)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1