Package com.restfb

Examples of com.restfb.DefaultFacebookClient


  public static void main(String[] args) {
    new GraphReaderExample("AAAB87uvHcIQBAEIjZCJeZAvZBa2NQZAIweHuFy1ONhZBcwguVKbDV7G4HKRZBCMVrFiaPeOGOtxQ2avBQkgWv6ZASv7I3pnGJ6JcGwXCi5VkQZDZD").runEverything();
  }

  public GraphReaderExample(String accessToken) {
    facebookClient = new DefaultFacebookClient(accessToken);
  }
View Full Code Here


                                            String[] temp1 = string.split("&");
                                            String[] temp2 = temp1[0].split("=");
                                            System.out.println("access tocken=" + temp2);
                                            access_token = temp2[1];
                                            new GraphReaderExample(access_token).runEverything();
                                            facebookClient = new DefaultFacebookClient(access_token);
                                            User user = facebookClient.fetchObject("me", User.class);
                                            Page page = facebookClient.fetchObject("cocacola", Page.class);
                                            // userName = user.getName();
                                           //  userMail = user.getEmail();
                                           
View Full Code Here

public class EndpointBuilderTest {
   
    @Test
    public void version1Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_1_0);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v1.0/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void version2Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_2_0);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v2.0/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void version21Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_2_1);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v2.1/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void unversionedTest() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.UNVERSIONED);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void unversionedNoVersionTest() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper());
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    d20101205_0000pst = sdfPST.parse("20101205_0000");
  }

  @Before
  public void before() {
    defaultNoAccessTokenClient = new DefaultFacebookClient();
  }
View Full Code Here

  private static FacebookClient createFixedResponseFacebookClient(String pathToJson) throws IOException {
    WebRequestor wr = new ClasspathWebRequestor(JSON_RESOURCES_PREFIX + pathToJson);
    String jsonBody = wr.executeGet(null).getBody();
    Assert.assertTrue("path to json not found:" + JSON_RESOURCES_PREFIX + pathToJson,
      (jsonBody != null) && (jsonBody.length() > 0));
    return new DefaultFacebookClient(null, wr, new DefaultJsonMapper());
  }
View Full Code Here

public class FetchConnectionPageITCase extends RestFbIntegrationTestBase {

  @Test
  public void checkConnectionPage() {
    DefaultFacebookClient client = new DefaultFacebookClient(getAccessToken(), Version.VERSION_2_1);
    Connection<Post> connection = client.fetchConnection("/cocacola/feed", Post.class);
    assertTrue(connection.getData().size() > 0);
    if (connection.hasNext()) {
      Connection<Post> connection2 = client.fetchConnectionPage(connection.getNextPageUrl(), Post.class);
      assertTrue(connection2.getData().size() > 0);
    } else {
      fail("Page has no second connection");
    }
  }
View Full Code Here

TOP

Related Classes of com.restfb.DefaultFacebookClient

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.