Examples of UserId


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

    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

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

  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

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

   */
  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

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

    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

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

  @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

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

  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

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

    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

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

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

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

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

    // update a field in user object
    person.setThumbnailUrl("http://newthumbnail.url");
View Full Code Here

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

    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();
View Full Code Here

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

    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));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.