Package org.apache.shindig.social.opensocial.spi

Examples of org.apache.shindig.social.opensocial.spi.CollectionOptions


        ImmutableMap.of("count", "2", "size", "100"), person.getAppData());
  }

  @Test
  public void testGetExpectedFriends() throws Exception {
    CollectionOptions options = new CollectionOptions();
    options.setSortBy(PersonService.TOP_FRIENDS_SORT);
    options.setSortOrder(SortOrder.ascending);
    options.setFilter(null);
    options.setFilterOperation(FilterOperation.contains);
    options.setFilterValue("");
    options.setFirst(0);
    options.setMax(20);

    RestfulCollection<Person> responseItem = db.getPeople(
        ImmutableSet.of(CANON_USER), new GroupId(GroupId.Type.friends, null),
        options, Collections.<String>emptySet(), token).get();
    assertNotNull(responseItem);
View Full Code Here


    assertEquals("jane.doe", responseItem.getList().get(1).getId());
  }

  @Test
  public void testGetExpectedUsersForPlural() throws Exception {
    CollectionOptions options = new CollectionOptions();
    options.setSortBy(PersonService.TOP_FRIENDS_SORT);
    options.setSortOrder(SortOrder.ascending);
    options.setFilter(null);
    options.setFilterOperation(FilterOperation.contains);
    options.setFilterValue("");
    options.setFirst(0);
    options.setMax(20);

    RestfulCollection<Person> responseItem = db.getPeople(
        ImmutableSet.of(JOHN_DOE, JANE_DOE), new GroupId(GroupId.Type.friends, null),
       options, Collections.<String>emptySet(), token).get();
    assertNotNull(responseItem);
View Full Code Here

    public void getPeople_GroupFilterField() throws ExecutionException, InterruptedException {
        Set<UserId> ids = getUserIdSet();
        GroupId groupId = new GroupId(GroupId.Type.objectId, GROUP_ID);
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = Person.Field.ABOUT_ME.toString();
        String value = "AAA";
        options.setFilter(field);
        options.setFilterOperation(FilterOperation.contains);
        options.setFilterValue(value);

        expect(repository.findByGroup(GROUP_ID, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
        replay(repository);

        Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
View Full Code Here

    public void getPeople_AllFilterField() throws ExecutionException, InterruptedException {
        Set<UserId> ids = getUserIdSet();
        GroupId groupId = new GroupId(GroupId.Type.all, GROUP_ID);
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = Person.Field.ABOUT_ME.toString();
        String value = "AAA";
        options.setFilter(field);
        options.setFilterOperation(FilterOperation.contains);
        options.setFilterValue(value);

        expect(repository.findByUsername(ID_2)).andReturn(getDbPerson(ID_2));
        expect(repository.findByUsername(ID_3)).andReturn(getDbPerson(ID_3));

        expect(repository.findAllConnectedPeople(ID_2, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
View Full Code Here

    public void getPeople_FriendsFilterField() throws ExecutionException, InterruptedException {
        Set<UserId> ids = getUserIdSet();
        GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = Person.Field.ABOUT_ME.toString();
        String value = "AAA";
        options.setFilter(field);
        options.setFilterOperation(FilterOperation.contains);
        options.setFilterValue(value);
        expect(repository.findByUsername(ID_2)).andReturn(getDbPerson(ID_2));
        expect(repository.findByUsername(ID_3)).andReturn(getDbPerson(ID_3));

        expect(repository.findFriends(ID_2, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
        expect(repository.findFriends(ID_3, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
View Full Code Here

    public void getPeople_FriendsAllFilterField() throws ExecutionException, InterruptedException {
        Set<UserId> ids = getUserIdSet();
        GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = PersonService.ALL_FILTER;
        String value = "AAA";
        options.setFilter(field);
        options.setFilterOperation(FilterOperation.contains);
        options.setFilterValue(value);
        expect(repository.findByUsername(ID_2)).andReturn(getDbPerson(ID_2));
        expect(repository.findByUsername(ID_3)).andReturn(getDbPerson(ID_3));

        expect(repository.findFriends(ID_2)).andReturn(getDbPersonList());
        expect(repository.findFriends(ID_3)).andReturn(getDbPersonList());
View Full Code Here

        GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
        String appId = "5";
        expect(token.getAppId()).andReturn(appId).anyTimes();
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = PersonService.HAS_APP_FILTER;
        options.setFilter(field);

        expect(repository.findByUsername(ID_2)).andReturn(getDbPerson(ID_2));
        expect(repository.findByUsername(ID_3)).andReturn(getDbPerson(ID_3));

        expect(repository.findFriends(ID_2, appId)).andReturn(getDbPersonList());
View Full Code Here

        GroupId groupId = new GroupId(GroupId.Type.all, GROUP_ID);
        String appId = "5";
        expect(token.getAppId()).andReturn(appId).anyTimes();
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = PersonService.HAS_APP_FILTER;
        options.setFilter(field);

        expect(repository.findByUsername(ID_2)).andReturn(getDbPerson(ID_2));
        expect(repository.findByUsername(ID_3)).andReturn(getDbPerson(ID_3));

        expect(repository.findAllConnectedPeople(ID_2, appId)).andReturn(getDbPersonList());
View Full Code Here

        GroupId groupId = new GroupId(GroupId.Type.objectId, GROUP_ID);
        String appId = "5";
        expect(token.getAppId()).andReturn(appId).anyTimes();
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = PersonService.HAS_APP_FILTER;
        options.setFilter(field);

        expect(repository.findByGroup(GROUP_ID, appId)).andReturn(getDbPersonList());
        replay(repository);

        Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
View Full Code Here

        GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
        String appId = "5";
        expect(token.getAppId()).andReturn(appId);
        replay(token);

        CollectionOptions options = new CollectionOptions();
        String field = PersonService.IS_WITH_FRIENDS_FILTER;
        options.setFilter(field);
        options.setFilterValue(ID_1);

        expect(repository.findByUsername(ID_2)).andReturn(getDbPerson(ID_2));
        expect(repository.findByUsername(ID_3)).andReturn(getDbPerson(ID_3));

        expect(repository.findFriendsWithFriend(ID_2, ID_1)).andReturn(getDbPersonList());
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.spi.CollectionOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.