/** * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2} * * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app * * The post data should be a regular json object. All of the fields vars will be pulled from the * values and set on the person object. If there are no fields vars then all of the data will be * overridden. */ @Operation(httpMethods = "DELETE") public Future<?> delete(SocialRequestItem request) throws ProtocolException { Set<UserId> userIds = request.getUsers(); HandlerPreconditions.requireNotEmpty(userIds, "No userId specified"); HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported"); return service.deletePersonData(userIds.iterator().next(), request.getGroup(), request.getAppId(), request.getFields(), request.getToken()); }
/** * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2} * * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app * * The post data should be a regular json object. All of the fields vars will be pulled from the * values and set on the person object. If there are no fields vars then all of the data will be * overridden. */ @Operation(httpMethods = "DELETE") public Future<?> delete(SocialRequestItem request) throws ProtocolException { Set<UserId> userIds = request.getUsers(); HandlerPreconditions.requireNotEmpty(userIds, "No userId specified"); HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported"); return service.deletePersonData(userIds.iterator().next(), request.getGroup(), request.getAppId(), request.getFields(), request.getToken()); }
/** * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2} * * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app * * The post data should be a regular json object. All of the fields vars will be pulled from the * values and set on the person object. If there are no fields vars then all of the data will be * overridden. */ @Operation(httpMethods = "DELETE") public Future<?> delete(SocialRequestItem request) throws ProtocolException { Set<UserId> userIds = request.getUsers(); HandlerPreconditions.requireNotEmpty(userIds, "No userId specified"); HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported"); return service.deletePersonData(userIds.iterator().next(), request.getGroup(), request.getAppId(), request.getFields(), request.getToken()); }
@Test public void testHandleDelete() throws Exception { Map<String, String[]> params = Maps.newHashMap(); params.put("fields", new String[]{"pandas"}); String path = "/appdata/john.doe/@self/appId"; RestHandler operation = registry.getRestHandler(path, "DELETE"); EasyMock.expect(appDataService.deletePersonData(eq(JOHN_DOE.iterator().next()), eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.of("pandas")), eq(token))) .andReturn(Futures.immediateFuture((Void) null)); replay(); assertNull(operation.execute(params, null, token, converter).get()); verify(); } }
@Test public void testHandleDelete() throws Exception { Map<String, String[]> params = Maps.newHashMap(); params.put("fields", new String[]{"pandas"}); String path = "/appdata/john.doe/@self/appId"; RestHandler operation = registry.getRestHandler(path, "DELETE"); EasyMock.expect(appDataService.deletePersonData(eq(JOHN_DOE.iterator().next()), eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.of("pandas")), eq(token))) .andReturn(Futures.immediateFuture((Void) null)); replay(); assertNull(operation.execute(params, null, token, converter).get()); verify(); } }
@Test public void testHandleDelete() throws Exception { Map<String, String[]> params = Maps.newHashMap(); params.put("fields", new String[]{"pandas"}); String path = "/appdata/john.doe/@self/appId"; RestHandler operation = registry.getRestHandler(path, "DELETE"); EasyMock.expect(appDataService.deletePersonData(eq(JOHN_DOE.iterator().next()), eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.of("pandas")), eq(token))) .andReturn(ImmediateFuture.newInstance((Void) null)); replay(); assertNull(operation.execute(params, null, token, converter).get()); verify(); } }