Package org.apache.shindig.social.opensocial.model

Examples of org.apache.shindig.social.opensocial.model.Activity


  @Test
  public void testHandleGetActivityById() throws Exception {
    String path = "/activities/john.doe/@friends/@app/1";
    RestHandler operation = registry.getRestHandler(path, "GET");

    Activity activity = new ActivityImpl();
    org.easymock.EasyMock.expect(activityService.getActivity(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.friends, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq("1"), eq(token))).andReturn(
        Futures.immediateFuture(activity));
View Full Code Here


    String jsonActivity = "{title: hi mom!, etc etc}";

    String path = "/activities/john.doe/@self/@app";
    RestHandler operation = registry.getRestHandler(path, method);

    Activity activity = new ActivityImpl();
    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivity), eq(Activity.class)))
        .andReturn(activity);

    org.easymock.EasyMock.expect(activityService.createActivity(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
View Full Code Here

    assertSame(3, responseItem.getTotalResults());
  }

  @Test
  public void testGetExpectedActivity() throws Exception {
    Activity activity = db.getActivity(
        CANON_USER, SELF_GROUP, APP_ID,
        ImmutableSet.of("appId", "body", "mediaItems"), APP_ID, new FakeGadgetToken()).get();
    assertNotNull(activity);
    // Check that some fields are fetched and others are not
    assertNotNull(activity.getBody());
    assertNull(activity.getBodyId());
  }
View Full Code Here

  @Test
  public void testHandleGetActivityById() throws Exception {
    String path = "/activities/john.doe/@friends/@app/1";
    RestHandler operation = registry.getRestHandler(path, "GET");

    Activity activity = new ActivityImpl();
    org.easymock.EasyMock.expect(activityService.getActivity(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.friends, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq("1"), eq(token))).andReturn(
        ImmediateFuture.newInstance(activity));
View Full Code Here

    String jsonActivity = "{title: hi mom!, etc etc}";

    String path = "/activities/john.doe/@self/@app";
    RestHandler operation = registry.getRestHandler(path, method);

    Activity activity = new ActivityImpl();
    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivity), eq(Activity.class)))
        .andReturn(activity);

    org.easymock.EasyMock.expect(activityService.createActivity(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
View Full Code Here

        new FakeGadgetToken()).get();
    assertTrue(responseItem.getTotalResults() == 3);
  }

  public void testGetExpectedActivity() throws Exception {
    Activity activity = db.getActivity(
        CANON_USER, SELF_GROUP, APP_ID,
        Sets.newHashSet("appId", "body", "mediaItems"), APP_ID, new FakeGadgetToken()).get();
    assertNotNull(activity);
    // Check that some fields are fetched and others are not
    assertNotNull(activity.getBody());
    assertNull(activity.getBodyId());
  }
View Full Code Here

  }

  public void testHandleGetActivityById() throws Exception {
    setPath("/people/john.doe/@friends/@app/1");

    Activity activity = new ActivityImpl();
    EasyMock.expect(activityService.getActivity(JOHN_DOE.iterator().next(),
        new GroupId(GroupId.Type.friends, null),
        "appId", Sets.<String>newHashSet(), "1", token)).andReturn(
        ImmediateFuture.newInstance(activity));
View Full Code Here

  private void setupPostData() throws SocialSpiException {
    String jsonActivity = "{title: hi mom!, etc etc}";

    setPathAndPostData("/people/john.doe/@self/@app", jsonActivity);

    Activity activity = new ActivityImpl();
    EasyMock.expect(converter.convertToObject(jsonActivity, Activity.class)).andReturn(activity);

    EasyMock.expect(activityService.createActivity(JOHN_DOE.iterator().next(),
        new GroupId(GroupId.Type.self, null), "appId", Sets.<String>newHashSet(),
        activity, token)).andReturn(ImmediateFuture.newInstance((Void) null));
View Full Code Here

  public void testJsonToActivity() throws Exception {
    String jsonActivity = "{userId : 5, id : 6, mediaItems : ["
      + "{url : 'hello', mimeType : 'mimey', type : 'video'}"
      + "]}";
    // TODO: rename the enums to be lowercase
    Activity result = beanJsonConverter.convertToObject(jsonActivity,
        Activity.class);

    assertEquals("5", result.getUserId());
    assertEquals("6", result.getId());

    assertEquals(1, result.getMediaItems().size());

    MediaItem actualItem = result.getMediaItems().get(0);

    assertEquals("hello", actualItem.getUrl());
    assertEquals("mimey", actualItem.getMimeType());
    assertEquals("video", actualItem.getType().toString());
  }
View Full Code Here

    String result = beanJsonConverter.convertToString(activity);
    if (outputInfo) {
      log.info("JSON (" + result + ")");
    }
    Activity parsedActivity = beanJsonConverter.convertToObject(result, Activity.class);
    assertEquals(activity.getUserId(), parsedActivity.getUserId());
    assertEquals(activity.getId(), parsedActivity.getId());

    assertEquals(1, parsedActivity.getMediaItems().size());

    MediaItem expectedItem = activity.getMediaItems().get(0);
    MediaItem actualItem = parsedActivity.getMediaItems().get(0);

    assertEquals(expectedItem.getUrl(), actualItem.getUrl());
    assertEquals(expectedItem.getMimeType(), actualItem.getMimeType());
    assertEquals(expectedItem.getType().toString(), actualItem.getType().toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.model.Activity

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.