Package com.restfb.types

Examples of com.restfb.types.FacebookType


    String connection = "me/notes";
    Parameter[] arrayParams = new Parameter[2];
    arrayParams[0] = Parameter.with("subject", subject);
    arrayParams[1] = Parameter.with("message", message);
    FacebookType mockFbType = EasyMock.createMock(FacebookType.class);
    expect(
        mockFbClient.publishObject(connection, FacebookType.class,
            arrayParams)).andReturn(mockFbType);
    expect(mockFbType.getId()).andReturn(fbid);

    Note expectedNote = loadObjectFromJSON("/examples/note.json",
        Note.class);
    expect(mockFbClient.getFacebookObjectByID(fbid, Note.class)).andReturn(
        expectedNote);
View Full Code Here


    assertTrue(repo.getContentByProvider(providerID, true).size() == 0);

    String connection = "me/feed";
    Parameter[] arrayParams = new Parameter[1];
    arrayParams[0] = Parameter.with("message", "test status message");
    FacebookType mockFbType = EasyMock.createMock(FacebookType.class);
    expect(
        mockFbClient.publishObject(connection, FacebookType.class,
            arrayParams)).andReturn(mockFbType);
    expect(mockFbType.getId()).andReturn(STATUS_FBID);

    List<StatusMessage> statuses = loadListFromJSON(
        "/examples/exampleStatus.json", StatusMessage.class);

    StatusMessage expectedStatus = statuses.get(2);
View Full Code Here

    String connection = "me/events";
    Parameter[] arrayParams = new Parameter[3];
    arrayParams[0] = Parameter.with("name", "TestEvent");
    arrayParams[1] = Parameter.with("start_time", tomorrow);
    arrayParams[2] = Parameter.with("end_time", tomorrowX2);
    FacebookType mockFbType = EasyMock.createMock(FacebookType.class);

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

    List<Event> events = loadListFromJSON("/examples/events.json",
        Event.class);

    List<FacebookType> eventUsers = loadListFromJSON(
View Full Code Here

    String connection = "friendId/feed";
    Parameter[] arrayParams = new Parameter[2];
    arrayParams[0] = Parameter.with("name", "post name");
    arrayParams[1] = Parameter.with("message", "post message");
    FacebookType mockFbType = EasyMock.createMock(FacebookType.class);
    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);
View Full Code Here

  }

  @Override
  public String publish(String to, String message) {
    LOG.info("Start publish");
    FacebookType publishMessageResponse = null;
//    try {
    if (to != null) {
      User user = facebookClient.fetchObject(to, User.class);
      publishMessageResponse = facebookClient.publish(user.getId()
          + "/feed", FacebookType.class,
          Parameter.with("message", message));
    } else {
      publishMessageResponse = facebookClient.publish("me/feed",
          FacebookType.class, Parameter.with("message", message));
    }
    LOG.error("Published post [" + publishMessageResponse.getId() + "]");
//    } catch (FacebookException e) {
//      LOG.error("An error occurred while publishing", e);
//    }
    LOG.info("End publish");
    return publishMessageResponse.getId();
  }
View Full Code Here

TOP

Related Classes of com.restfb.types.FacebookType

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.