@VisibleForTesting void importSingleCalendar(UUID jobId, TokensAndUrlAuthData authData, CalendarModel calendarModel) throws IOException { com.google.api.services.calendar.model.Calendar toInsert = convertToGoogleCalendar( calendarModel); com.google.api.services.calendar.model.Calendar calendarResult = getOrCreateCalendarInterface(authData).calendars().insert(toInsert).execute(); TempCalendarData calendarMappings = jobStore.findData(jobId, createCacheKey(), TempCalendarData.class); if (calendarMappings == null) { calendarMappings = new TempCalendarData(jobId); jobStore.create(jobId, createCacheKey(), calendarMappings); } calendarMappings.addIdMapping(calendarModel.getId(), calendarResult.getId()); jobStore.update(jobId, createCacheKey(), calendarMappings); }
@Before public void setUp() { try { CalendarList calendarListModel = new com.google.api.services.calendar.model.CalendarList(); when(client.calendars()).thenReturn(calendars); when(calendars.insert(anyObject())).thenReturn(calendarsInsert); when(calendarsInsert.execute()).thenReturn(new com.google.api.services.calendar.model.Calendar()); when(client.calendarList()).thenReturn(calendarsList); when(calendarsList.list()).thenReturn(calendarsListList); when(calendarsListList.execute()).thenReturn(calendarListModel); when(auth.getAuthorizedCalendar(anyString(), anyString())).thenReturn(client); when(client.events()).thenReturn(clientEvents); when(clientEvents.insert(anyString(), anyObject())).thenReturn(calendarEventsInsert); when(calendarEventsInsert.execute()).thenReturn(new com.google.api.services.calendar.model.Event()); when(clientEvents.list(anyString())).thenReturn(calendarEventsList); when(calendarEventsList.execute()).thenReturn(new com.google.api.services.calendar.model.Events()); } catch (Exception e) { fail(e.getMessage()); } }
com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings()); Calendar confirmed = service.calendars().insert(calendar).execute(); AclRule rule = new AclRule(); AclRule.Scope scope = new AclRule.Scope();
com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings()); Calendar confirmed = service.calendars().insert(calendar).execute(); AclRule rule = new AclRule(); AclRule.Scope scope = new AclRule.Scope();
com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings()); Calendar confirmed = service.calendars().insert(calendar).execute(); AclRule rule = new AclRule(); AclRule.Scope scope = new AclRule.Scope();
private static Calendar addCalendar() throws IOException { View.header("Add Calendar"); Calendar entry = new Calendar(); entry.setSummary("Calendar for Testing 3"); Calendar result = client.calendars().insert(entry).execute(); View.display(result); return result; }