Package com.restfb.types

Examples of com.restfb.types.Post$Action


  }

  public void testGetContentString() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/post";   
   
    Post expectedPost = loadObjectFromJSON("/examples/post.json",Post.class);
   
    //expected behavior 
    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class)).andReturn(expectedPost);
       
View Full Code Here


   *     the content url
   * @return a {#link=Content} object
   */
  public Content getContent(String contentURL) {
    String fbid = URLUtils.getFbId(contentURL);
    Post post = getFbClient().getFacebookObjectByID(fbid, Post.class);

    Content content = post2Content(post);
    content.setContentUrl(contentURL);

    return content;
View Full Code Here

  }
 
  public void testGetContentString() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/post";   
   
    Post expectedPost = loadObjectFromJSON("/examples/post.json",Post.class);
   
    //expected behavior 
    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class)).andReturn(expectedPost);
       
View Full Code Here

  public void testGetFacebookConnectionByID() {

    // declare behavior
    List<Post> posts = new ArrayList<Post>();
    posts.add(new Post());

    Connection<Post> mockDataList = EasyMock.createMock(Connection.class);
    expect(
        mockFb.fetchConnection("profileId/feeds", Post.class)).andReturn(mockDataList);
    expect(mockDataList.getData()).andReturn(posts);
View Full Code Here

  }

  public void testPublishObject() {

    // declare behavior
    Post post = new Post();
    Parameter[] params = new Parameter[0];
    expect(mockFb.publish("profileId/feed", Post.class)).andReturn(post);

    // register behavior
    replay(mockFb);

    // readFBClient.fetchObject(id, objectClass);
    Post actualPost = fbRestClient.publishObject("profileId/feed",
        Post.class, params);

    // verify behavior
    verify();
View Full Code Here

    expect(
        mockFbClient.publishObject(connection, FacebookType.class,
            arrayParams)).andReturn(mockFbType);
    expect(mockFbType.getId()).andReturn(POST_FBID);

    Post expectedPost = loadObjectFromJSON("/examples/post.json",
        Post.class);
    expect(mockFbClient.getFacebookObjectByID(POST_FBID, Post.class))
        .andReturn(expectedPost);
    // post comments
    expect(
View Full Code Here

  }

  public void testGetContent() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/post";

    Post expectedPost = loadObjectFromJSON("/examples/post.json",
        Post.class);

    // expected behavior
    // expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class))
View Full Code Here

        // Check if the post (to which the notification refers to) is
        // mine
        String[] linkPathSplitted = notif.getLink().split("/");
        String postId = notif.getTo().getId() + "_"
            + linkPathSplitted[linkPathSplitted.length - 1];
        Post p = facebookClient.fetchObject(postId, Post.class);
        if (p == null) {
          // If the post is not mine then 'p' is null and we jump to
          // the next notification
          continue;
        }
        // Get comment id
        String comment_id = getCommentId(p, notif);
        /*
         * We don't handle when comment_id is null, that would mean one
         * of two: a) the information of the notification is wrong. b)
         * we are retrieving wrongly the post id from the notification
         * information.
         */
        // Get replier's screen name
        String replierScreenName = facebookClient.fetchObject(
            notif.getFrom().getId(), User.class).getUsername();
        // Construct facebook post object and return
        FacebookMention fbp = new FacebookMention(comment_id.toString(),
            notif.getMessage(), replierScreenName, notif
                .getCreatedTime().getTime(), p.getId());
        postReplies.add(fbp);
        Boolean publishMessageResponse = facebookClient.publish(
            notif.getId(), Boolean.class,
            Parameter.with("unread", "0"));
        if (publishMessageResponse == false) {
View Full Code Here

  @Override
  public Long getTime(String mentionId) {
    LOG.info("Start getTime");
    Long time = null;
    if (mentionId != null) {
      Post p = facebookClient.fetchObject(mentionId, Post.class);
      if (p == null) {
        Comment c = facebookClient
            .fetchObject(mentionId, Comment.class);
        if (c == null) {
          LOG.info("Facebook object [" + mentionId
              + "] is not a valid post/comment");
        } else {
          LOG.info("Facebook object [" + mentionId + "] is comment");
          time = c.getCreatedTime() == null ? null : c
              .getCreatedTime().getTime() / 1000L;
        }
      } else {
        LOG.info("Facebook object [" + mentionId + "] is post");
        time = p.getCreatedTime() == null ? null : p.getCreatedTime()
            .getTime() / 1000L;
      }
    }
    LOG.info("End getTime");
    return time;
View Full Code Here

    protected Object handleGetEffect()
    {
        // Effect is mapped to action, not activity
        // We return the first action encountered in the activity
        Action effectAction = null;
        Activity effect = this.metaObject.getEffect();
        if (effect != null)
        {
            Collection nodes = effect.getNodes();
            for (Iterator nodesIt = nodes.iterator(); nodesIt.hasNext() && effectAction == null;)
View Full Code Here

TOP

Related Classes of com.restfb.types.Post$Action

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.