Future<RestfulCollection<Person>> people = personService.getPeople( userIds, groupId, options, fields, request.getToken()); return firstItem(people); return personService.getPeople(userIds, groupId, options, fields, request.getToken()); new UserId(UserId.Type.userId, optionalPersonId.iterator().next())); Future<RestfulCollection<Person>> people = personService.getPeople( optionalUserIds, new GroupId(GroupId.Type.self, null), options, fields, request.getToken()); return personService.getPeople(personIds.build(), new GroupId(GroupId.Type.self, null), options, fields, request.getToken()); return personService.getPeople(userIds, groupId, options, fields, request.getToken());
Future<RestfulCollection<Person>> people = personService.getPeople( userIds, groupId, options, fields, request.getToken()); return FutureUtil.getFirstFromCollection(people); return personService.getPeople(userIds, groupId, options, fields, request.getToken()); new UserId(UserId.Type.userId, optionalPersonId.iterator().next())); Future<RestfulCollection<Person>> people = personService.getPeople( optionalUserIds, new GroupId(GroupId.Type.self, null), options, fields, request.getToken()); return personService.getPeople(personIds.build(), new GroupId(GroupId.Type.self, null), options, fields, request.getToken()); return personService.getPeople(userIds, groupId, options, fields, request.getToken());
Future<RestfulCollection<Person>> people = personService.getPeople( userIds, groupId, options, fields, request.getToken()); return firstItem(people); return personService.getPeople(userIds, groupId, options, fields, request.getToken()); new UserId(UserId.Type.userId, optionalPersonId.iterator().next())); Future<RestfulCollection<Person>> people = personService.getPeople( optionalUserIds, new GroupId(GroupId.Type.self, null), options, fields, request.getToken()); return personService.getPeople(personIds.build(), new GroupId(GroupId.Type.self, null), options, fields, request.getToken()); return personService.getPeople(userIds, groupId, options, fields, request.getToken());
@Test public void testHandleGetPlural() throws Exception { String path = "/people/john.doe,jane.doe/@self"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> people = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(people); Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE); userIdSet.add(new UserId(UserId.Type.userId, "jane.doe")); expect(personService.getPeople(eq(userIdSet), eq(new GroupId(GroupId.Type.self, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))).andReturn(Futures.immediateFuture(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetPlural() throws Exception { String path = "/people/john.doe,jane.doe/@self"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> people = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(people); Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE); userIdSet.add(new UserId(UserId.Type.userId, "jane.doe")); expect(personService.getPeople(eq(userIdSet), eq(new GroupId(GroupId.Type.self, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))).andReturn(Futures.immediateFuture(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetAllNoParams() throws Exception { String path = "/people/john.doe/@all"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> personList = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(personList); expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.all, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(Futures.immediateFuture(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetFriendsNoParams() throws Exception { String path = "/people/john.doe/@friends"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> personList = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(personList); expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.friends, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(Futures.immediateFuture(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetAllNoParams() throws Exception { String path = "/people/john.doe/@all"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> personList = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(personList); expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.all, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(Futures.immediateFuture(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetFriendsNoParams() throws Exception { String path = "/people/john.doe/@friends"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> personList = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(personList); expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.friends, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(Futures.immediateFuture(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetFriendById() throws Exception { String path = "/people/john.doe/@friends/jane.doe"; RestHandler operation = registry.getRestHandler(path, "GET"); Person person = new PersonImpl(); List<Person> people = Lists.newArrayList(person); RestfulCollection<Person> data = new RestfulCollection<Person>(people); // TODO: We aren't passing john.doe to the service yet. expect(personService.getPeople( eq(ImmutableSet.of(new UserId(UserId.Type.userId, "jane.doe"))), eq(new GroupId(GroupId.Type.self, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(Futures.immediateFuture(data)); replay(); assertEquals(person, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetPlural() throws Exception { String path = "/people/john.doe,jane.doe/@self"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> people = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(people); Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE); userIdSet.add(new UserId(UserId.Type.userId, "jane.doe")); expect(personService.getPeople(eq(userIdSet), eq(new GroupId(GroupId.Type.self, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))).andReturn(ImmediateFuture.newInstance(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetFriendById() throws Exception { String path = "/people/john.doe/@friends/jane.doe"; RestHandler operation = registry.getRestHandler(path, "GET"); Person person = new PersonImpl(); List<Person> people = Lists.newArrayList(person); RestfulCollection<Person> data = new RestfulCollection<Person>(people); // TODO: We aren't passing john.doe to the service yet. expect(personService.getPeople( eq(ImmutableSet.of(new UserId(UserId.Type.userId, "jane.doe"))), eq(new GroupId(GroupId.Type.self, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(Futures.immediateFuture(data)); replay(); assertEquals(person, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetAllNoParams() throws Exception { String path = "/people/john.doe/@all"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> personList = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(personList); expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.all, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(ImmediateFuture.newInstance(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetFriendsNoParams() throws Exception { String path = "/people/john.doe/@friends"; RestHandler operation = registry.getRestHandler(path, "GET"); List<Person> personList = ImmutableList.of(); RestfulCollection<Person> data = new RestfulCollection<Person>(personList); expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.friends, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(ImmediateFuture.newInstance(data)); replay(); assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
@Test public void testHandleGetFriendById() throws Exception { String path = "/people/john.doe/@friends/jane.doe"; RestHandler operation = registry.getRestHandler(path, "GET"); Person person = new PersonImpl(); List<Person> people = Lists.newArrayList(person); RestfulCollection<Person> data = new RestfulCollection<Person>(people); // TODO: We aren't passing john.doe to the service yet. expect(personService.getPeople( eq(ImmutableSet.of(new UserId(UserId.Type.userId, "jane.doe"))), eq(new GroupId(GroupId.Type.self, null)), eq(DEFAULT_OPTIONS), eq(DEFAULT_FIELDS), eq(token))) .andReturn(ImmediateFuture.newInstance(data)); replay(); assertEquals(person, operation.execute(Maps.<String, String[]>newHashMap(), null, token, converter).get()); verify(); }
expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.friends, null)), eq(options),
expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.friends, null)), eq(options),
expect(personService.getPeople( eq(JOHN_DOE), eq(new GroupId(GroupId.Type.friends, null)), eq(options),