Package com.restfb.json

Examples of com.restfb.json.JsonObject


    String jsonString = "{\"data\":\"value\"}";       
    byte[] expectedData = jsonString.getBytes();
   

    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);   
    expect(mockFbClient.getObjectByID("fbid")).andReturn(new JsonObject(jsonString));
   
    replay(mockFactory, mockFbClient);   

    byte[] actualData = fbcp.getBinaryData(content);
   
View Full Code Here


  public boolean canRead(String user, String password, Content content)
      throws IQserSecurityException {
    IFacebookRESTClient fbClient = openFbConnection(user, password);
   
    String fbId = URLUtils.getFbId(content.getContentUrl());
    JsonObject fbObject = fbClient.getObjectByID(fbId);
   
    return ! fbObject.isNull("id");
  }
View Full Code Here

   * @return a byte[] array representing the raw data of the content.
   */
  public byte[] getBinaryData(Content content){
    String fbid = URLUtils.getFbId(content.getContentUrl());
   
    JsonObject jsonData = fbClient.getObjectByID(fbid);
   
    return jsonData.toString().getBytes();
  }
View Full Code Here

   * @param fbid
   *            Facebook id
   * @return a JsonObject
   */
  public JsonObject getObjectByID(String fbid) {
    JsonObject jsonObject = readFBClient
        .fetchObject(fbid, JsonObject.class);
    return jsonObject;
  }
View Full Code Here

  protected void tearDown() throws Exception {
  }

  public void testGetObjectByID() {
    // declare behavior
    JsonObject obj = new JsonObject();
    expect(mockFb.fetchObject("fbid", JsonObject.class)).andReturn(obj);

    // register behavior
    replay(mockFb);

    // call test method
    JsonObject actualObj = fbRestClient.getObjectByID("fbid");

    // verify behavior
    verify();

    // assert postconditions
View Full Code Here

    // declare behavior
    expect(
        mockFb.fetchObject("fbid", JsonObject.class,
            Parameter.with("field", "id"))).andReturn(
        new JsonObject());

    // register behavior
    replay(mockFb);

    boolean exists = fbRestClient.getObjectExistsOnFacebook("fbid");
View Full Code Here

    setPrivateField(securityFilter, "factory", mockFactory);
    IFacebookRESTClient mockClient = EasyMock.createMock(IFacebookRESTClient.class);
                   
    String accessToken = securityFilter.getUserAccessToken().get(user);       
    EasyMock.expect(mockFactory.createFacebookAPIClient(accessToken)).andReturn(mockClient);
    JsonObject jsonObject = new JsonObject();
    jsonObject.put("id", fbItemId);
    EasyMock.expect(mockClient.getObjectByID(fbItemId)).andReturn(jsonObject);
   
    EasyMock.replay(mockFactory, mockClient);
   
    boolean isAllowed = securityFilter.canRead(user, password, content);
View Full Code Here

TOP

Related Classes of com.restfb.json.JsonObject

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.