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

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


  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());
    assertEquals(0, activityCollection.getStartIndex());
    activity = activityCollection.getEntry().get(1);
    assertEquals(activity.getTitle(), title);
View Full Code Here


    collectionOptions.setSortBy("name");
    collectionOptions.setSortOrder(SortOrder.ascending);
    collectionOptions.setMax(20);

    // Get all friends of john.doe
    Future<RestfulCollection<Person>> result = this.personServiceDb.getPeople(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), collectionOptions, Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);

    RestfulCollection<Person> peopleCollection = result.get();
    assertEquals(3, peopleCollection.getTotalResults());
    assertEquals(0, peopleCollection.getStartIndex());
    List<Person> people = peopleCollection.getEntry();
View Full Code Here

    collectionOptions.setSortOrder(SortOrder.ascending);
    collectionOptions.setFirst(0);
    collectionOptions.setMax(1);

    // Get first friend of john.doe
    Future<RestfulCollection<Person>> result = this.personServiceDb.getPeople(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), collectionOptions, Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    RestfulCollection<Person> peopleCollection = result.get();
    assertEquals(3, peopleCollection.getTotalResults());
    assertEquals(0, peopleCollection.getStartIndex());
    List<Person> people = peopleCollection.getEntry();
    SpiTestUtil.assertPersonEquals(people.get(0), "george.doe", "George Doe");

    // Get second friend of john.doe
    collectionOptions.setFirst(1);
    result = this.personServiceDb.getPeople(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), collectionOptions, Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    peopleCollection = result.get();
    assertEquals(3, peopleCollection.getTotalResults());
    assertEquals(1, peopleCollection.getStartIndex());
    people = peopleCollection.getEntry();
    SpiTestUtil.assertPersonEquals(people.get(0), "jane.doe", "Jane Doe");
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 class GroupIdTest extends Assert {

  @Test
  public void testFromJson() throws Exception {
    GroupId all = GroupId.fromJson("@all");
    assertEquals(GroupId.Type.all, all.getType());

    GroupId friends = GroupId.fromJson("@friends");
    assertEquals(GroupId.Type.friends, friends.getType());

    GroupId self = GroupId.fromJson("@self");
    assertEquals(GroupId.Type.self, self.getType());

    GroupId group = GroupId.fromJson("superbia");
    assertEquals(GroupId.Type.groupId, group.getType());
    assertEquals("superbia", group.getGroupId());
  }
View Full Code Here

    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);
    assertEquals(4, responseItem.getTotalResults());
    // Test a couple of users
    assertEquals("john.doe", responseItem.getEntry().get(0).getId());
View Full Code Here

    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);
    assertEquals(4, responseItem.getTotalResults());
    // Test a couple of users
    assertEquals("john.doe", responseItem.getEntry().get(0).getId());
View Full Code Here

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

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

    List<Person> people = ImmutableList.of();
    RestfulCollection<Person> data = new RestfulCollection<Person>(people);
    expect(personService.getPeople(
        eq(JOHN_DOE),
        eq(new GroupId(GroupId.Type.friends, null)), eq(options),
        eq(ImmutableSortedSet.of("money", "fame", "fortune")), eq(token)))
        .andReturn(ImmediateFuture.newInstance(data));

    replay();
    assertEquals(data, operation.execute(params, null, token, converter).get());
View Full Code Here

TOP

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

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.