Package org.apache.shindig.social.core.model

Examples of org.apache.shindig.social.core.model.ActivityImpl


    assertEquals(actual.getTitle(), expected.getTitle());
    assertEquals(actual.getBody(), expected.getBody());
  }

  public static Activity buildTestActivity(String id, String userId, String title, String body) {
    Activity activity = new ActivityImpl(id, userId);
    activity.setTitle(title);
    activity.setBody(body);
    return activity;
  }
View Full Code Here


public class RestfulXmlActivityTest extends AbstractLargeRestfulTests {
  private Activity johnsActivity;

  @Before
  public void restfulXmlActivityTestBefore() throws Exception {
    johnsActivity = new ActivityImpl("1", "john.doe");
    johnsActivity.setTitle("yellow");
    johnsActivity.setBody("what a color!");
  }
View Full Code Here

public class RestfulJsonActivityTest extends AbstractLargeRestfulTests {
  Activity johnsActivity;

  @Before
  public void restfulJsonActivityTestBefore() throws Exception {
    johnsActivity = new ActivityImpl("1", "john.doe");
    johnsActivity.setTitle("yellow");
    johnsActivity.setBody("what a color!");
  }
View Full Code Here

     * @param activityObj org.wso2.carbon.social.activity.Activity object
     * @return org.apache.shindig.social.opensocial.model.Activity object
     */

    private Activity convertToShindigActivity(org.wso2.carbon.registry.social.api.activity.Activity activityObj) {
        Activity resultObj = new ActivityImpl();
        if (activityObj.getAppId() != null) {
            resultObj.setAppId(activityObj.getAppId());
        }
        if (activityObj.getBody() != null) {
            resultObj.setBody(activityObj.getBody());
        }
        if (activityObj.getBodyId() != null) {
            resultObj.setBodyId(activityObj.getBodyId());
        }
        if (activityObj.getExternalId() != null) {
            resultObj.setExternalId(activityObj.getExternalId());
        }
        if (activityObj.getId() != null) {
            resultObj.setId(activityObj.getId());
        }
        if (activityObj.getPostedTime() != null) {
            resultObj.setPostedTime(activityObj.getPostedTime());
        }
        if (activityObj.getPriority() != null) {
            resultObj.setPriority(activityObj.getPriority());
        }
        if (activityObj.getStreamFaviconUrl() != null) {
            resultObj.setStreamFaviconUrl(activityObj.getStreamFaviconUrl());
        }
        if (activityObj.getStreamSourceUrl() != null) {
            resultObj.setStreamSourceUrl(activityObj.getStreamSourceUrl());
        }
        if (activityObj.getStreamTitle() != null) {
            resultObj.setStreamTitle(activityObj.getStreamTitle());
        }
        if (activityObj.getStreamUrl() != null) {
            resultObj.setStreamUrl(activityObj.getStreamUrl());
        }
        if (activityObj.getTemplateParams() != null) {
            resultObj.setTemplateParams(activityObj.getTemplateParams());
        }
        if (activityObj.getTitle() != null) {
            resultObj.setTitle(activityObj.getTitle());
        }
        if (activityObj.getTitleId() != null) {
            resultObj.setTitleId(activityObj.getTitleId());
        }
        if (activityObj.getUpdated() != null) {
            resultObj.setUpdated(activityObj.getUpdated());
        }
        if (activityObj.getUrl() != null) {
            resultObj.setUrl(activityObj.getUrl());
        }
        if (activityObj.getUserId() != null) {
            resultObj.setUserId(activityObj.getUserId());
        }
        List<MediaItem> mediaItemList = new ArrayList<MediaItem>();

        if (activityObj.getMediaItems() != null) {
            for (org.wso2.carbon.registry.social.api.activity.MediaItem item : activityObj.getMediaItems()) {
                MediaItem itemObj = new MediaItemImpl();
                if (item != null) {
                    if (item.getMimeType() != null) {
                        itemObj.setMimeType(item.getMimeType());
                    }
                    if (item.getThumbnailUrl() != null) {
                        itemObj.setThumbnailUrl(item.getThumbnailUrl());
                    }
                    if (item.getType() != null) {
                        org.wso2.carbon.registry.social.api.activity.MediaItem.Type itemType = item.getType();
                        if (itemType.name().equals(MEDIA_ITEM_TYPE_AUDIO)) {
                            itemObj.setType(MediaItem.Type.AUDIO);
                        }
                        if (itemType.name().equals(MEDIA_ITEM_TYPE_IMAGE)) {
                            itemObj.setType(MediaItem.Type.IMAGE);
                        }
                        if (itemType.name().equals(MEDIA_ITEM_TYPE_VIDEO)) {
                            itemObj.setType(MediaItem.Type.VIDEO);
                        }

                    }
                    if (item.getUrl() != null) {
                        itemObj.setUrl(item.getUrl());
                    }
                    mediaItemList.add(itemObj);
                }

            }
            resultObj.setMediaItems(mediaItemList);

        }

        return resultObj;
    }
View Full Code Here

    assertEquals(actual.getTitle(), expected.getTitle());
    assertEquals(actual.getBody(), expected.getBody());
  }
 
  public static Activity buildTestActivity(String id, String userId, String title, String body) {
    Activity activity = new ActivityImpl(id, userId);
    activity.setTitle(title);
    activity.setBody(body);
    return activity;
  }
View Full Code Here

        "My home address")));

    johnDoe.setEmails(Lists.<ListField> newArrayList(new ListFieldImpl("work",
        "john.doe@work.bar"), new ListFieldImpl("home", "john.doe@home.bar")));

    activity = new ActivityImpl("activityId", johnDoe.getId());
    activity.setUrl("http://foo.com/");

    activity.setMediaItems(Lists.<MediaItem> newArrayList(new MediaItemImpl(
        "image/jpg", MediaItem.Type.IMAGE, "http://foo.bar")));
View Full Code Here

        "My home address")));

    johnDoe.setEmails(Lists.<ListField> newArrayList(new ListFieldImpl("work",
        "john.doe@work.bar"), new ListFieldImpl("home", "john.doe@home.bar")));

    activity = new ActivityImpl("activityId", johnDoe.getId());

    activity.setMediaItems(Lists.<MediaItem> newArrayList(new MediaItemImpl(
        "image/jpg", MediaItem.Type.IMAGE, "http://foo.bar")));
    activity.setUrl("http://foo.com");
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

    assertEquals(actual.getTitle(), expected.getTitle());
    assertEquals(actual.getBody(), expected.getBody());
  }

  public static Activity buildTestActivity(String id, String userId, String title, String body) {
    Activity activity = new ActivityImpl(id, userId);
    activity.setTitle(title);
    activity.setBody(body);
    return activity;
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.core.model.ActivityImpl

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.