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();
@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()); } }
private static void addCalendarsUsingBatch() throws IOException { View.header("Add Calendars using Batch"); BatchRequest batch = client.batch(); // Create the callback. JsonBatchCallback<Calendar> callback = new JsonBatchCallback<Calendar>() { @Override public void onSuccess(Calendar calendar, HttpHeaders responseHeaders) { View.display(calendar); addedCalendarsUsingBatch.add(calendar); } @Override public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) { System.out.println("Error Message: " + e.getMessage()); } }; // Create 2 Calendar Entries to insert. Calendar entry1 = new Calendar().setSummary("Calendar for Testing 1"); client.calendars().insert(entry1).queue(batch, callback); Calendar entry2 = new Calendar().setSummary("Calendar for Testing 2"); client.calendars().insert(entry2).queue(batch, callback); batch.execute(); }
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; }
@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); }