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

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


        assertThat(person.getDisplayName(), is(equalTo(DISPLAY_NAME)));
    }

    @Test(expected = ProtocolException.class)
    public void getPerson_nullValue() throws ExecutionException, InterruptedException {
        UserId id = new UserId(UserId.Type.userId, ID_2);

        expect(repository.get(Long.parseLong(ID_1))).andReturn(null);
        replay(repository);

        service.getPerson(id, null, token);
View Full Code Here


        return Lists.asList(getDbPerson(), new org.apache.rave.portal.model.Person[]{});
    }

    private Set<UserId> getUserIdSet() {
        Set<UserId> ids = new HashSet<UserId>();
        ids.add(new UserId(UserId.Type.userId, ID_2));
        ids.add(new UserId(UserId.Type.userId, ID_3));
        return ids;
    }
View Full Code Here

            case friends:
                return getUniqueListOfFriends(userIds, collectionOptions, token);
            case groupId:
                return getGroupMembersFromRepository(collectionOptions, groupId.getGroupId(), token.getAppId());
            case self:
                return Lists.newArrayList(getPersonForId(new UserId(UserId.Type.me, null), token));
            case deleted:
                throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Deleted Friends are not tracked by the container");
            default:
                throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Invalid group id specified by request");
        }
View Full Code Here

    bootstrap.tearDown();
  }

  @Test
  public void getJohnDoeActivityWithAppId1() throws Exception {
    Future<Activity> result = this.activityServiceDb.getActivity(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), null, ACTIVITY_ALL_FIELDS, "1", SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    Activity activity = result.get();
    SpiTestUtil.assertActivityEquals(activity, testActivity);
  }
View Full Code Here

  public void createNewActivityForJohnDoe() throws Exception {
    // Create new activity
    final String title = "hi mom!";
    final String body = "and dad.";
    Activity activity = SpiTestUtil.buildTestActivity("2", "john.doe", title, body);
    this.activityServiceDb.createActivity(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), "2", ACTIVITY_ALL_FIELDS, activity, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);

    // Check activity was created as expected
    Future<RestfulCollection<Activity>> result = this.activityServiceDb.getActivities(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), null, ACTIVITY_ALL_FIELDS, new CollectionOptions(), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    RestfulCollection<Activity> activityCollection = result.get();
    assertEquals(2, activityCollection.getTotalResults());
View Full Code Here

   */
  public static Set<UserId> buildUserIds(String... userIds) {
    // Set user id list
    Set<UserId> userIdSet = Sets.newHashSet();
    for (String userId: userIds) {
      userIdSet.add(new UserId(Type.userId, userId));
    }
    return userIdSet;
  }
View Full Code Here

    bootstrap.tearDown();
  }

  @Test
  public void getCanonicalPerson() throws Exception {
     Future<Person> person = this.personServiceDb.getPerson(new UserId(Type.userId, "canonical"), Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
     SpiTestUtil.assertPersonEquals(person.get(), canonical);
  }
View Full Code Here

  @Test
  public void testViewerCanUpdatePerson() throws Exception {
    Person p = SpiTestUtil.buildCanonicalPerson();
    p.setThumbnailUrl("http://newthumbnail.url");
    this.personServiceDb.updatePerson(new UserId(Type.userId, "canonical"),
        p, SpiTestUtil.CANONICAL_PERSON_SECURITY_TOKEN);

    Future<Person> person = this.personServiceDb.getPerson(new UserId(Type.userId, "canonical"), ImmutableSet.of("id","displayName","thumbnailUrl"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    assertEquals("http://newthumbnail.url", person.get().getThumbnailUrl());
  }
View Full Code Here

  public void testViewerNotAllowedUpdatePerson() throws Exception {
    Person p = SpiTestUtil.buildCanonicalPerson();
    p.setThumbnailUrl("http://newthumbnail.url");

    try {
      this.personServiceDb.updatePerson(new UserId(Type.userId, "canonical"),
          p, SpiTestUtil.JOHN_DOE_SECURITY_TOKEN);
      org.junit.Assert.fail();
    } catch (ProtocolException sse) {
      assertEquals(HttpServletResponse.SC_FORBIDDEN, sse.getCode());
    }
View Full Code Here

    people.put(people.length(),jsonPerson);

    SecurityToken updateToken = new FakeGadgetToken("appId", "appUrl", "domain", "updatePerson", "trustedJson", "updatePerson", "20");

    // Get user
    UserId userId = new UserId(UserId.Type.userId, "updatePerson");
    Person person = db
        .getPerson(userId, Person.Field.ALL_FIELDS, token).get();
    assertNotNull("User 'updatePerson' not found", person);

    // update a field in user object
View Full Code Here

TOP

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

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.