Package facebook4j

Examples of facebook4j.Facebook


    @Test
    public void deterministic() throws Exception {
        ArrayList list1 = new ArrayList();
        ArrayList list2 = new ArrayList();
        assertThat(list1, is(list2));
        Facebook Facebook1 = new FacebookFactory().getInstance();
        Facebook1.setOAuthAppId("appId", "appSecret");
        Facebook Facebook2 = new FacebookFactory().getInstance();
        Facebook2.setOAuthAppId("appId", "appSecret");
        assertThat(Facebook1, is(Facebook2));
    }
View Full Code Here


        String oAuthAppSecret = p.getProperty("oauth.appSecret");
        build.setOAuthAccessToken(oAuthAccessToken);
        build.setOAuthAppId(oAuthAppId);
        build.setOAuthAppSecret(oAuthAppSecret);
        OAuthAuthorization auth = new OAuthAuthorization(build.build());
        Facebook fb = new FacebookFactory().getInstance(auth);
        fb.getId();
    }
View Full Code Here

    @Category(RealAPITests.class)
    @Test
    public void signinWithFacebook() throws Exception {
        CookieHandler.setDefault(new ListCookieHandler());

        Facebook facebook = new FacebookFactory().getInstance();
        HttpClientImpl http = new HttpClientImpl();
        HttpResponse response;
       
        String oAuthAppId = p.getProperty("oauth.appId");
        String oAuthAppSecret = p.getProperty("oauth.appSecret");
        facebook.setOAuthAppId(oAuthAppId, oAuthAppSecret);
        facebook.setOAuthPermissions("email");

        // auth
        String callbackURL = p.getProperty("login.callbackURL");
        String authorizationURL = facebook.getOAuthAuthorizationURL(callbackURL);
        response = http.get(authorizationURL);

        // login
        String loginURL = response.getResponseHeader("Location");
        response = http.get(loginURL);
View Full Code Here

public class AuthorizationTest extends FacebookTestBase {

    @Test
    public void anonymousInstance() throws Exception {
        Facebook facebook = new FacebookFactory().getInstance();
        Authorization auth = facebook.getAuthorization();
        assertThat(auth, instanceOf(NullAuthorization.class));
    }
View Full Code Here

        String appSecret;
        String appId;
        appSecret = p.getProperty("oauth.appSecret");
        appId = p.getProperty("oauth.appSecret");

        Facebook facebook = new FacebookFactory().getInstance();
        facebook.setOAuthAppId(appId, appSecret);
        try {
            facebook.setOAuthAppId(appSecret, appId);
            fail("should throw IllegalStateException");
        } catch (IllegalStateException ignore) {}

        Authorization auth = facebook.getAuthorization();
        assertThat(auth, instanceOf(OAuthAuthorization.class));
    }
View Full Code Here

TOP

Related Classes of facebook4j.Facebook

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.