Package twitter4j.auth

Examples of twitter4j.auth.Authorization


     *
     * @throws TwitterException When Twitter service or network is unavailable, when the user has not authorized, or when the client application is not permitted to use xAuth
     * @see <a href="https://dev.twitter.com/docs/oauth/xauth">xAuth | Twitter Developers</a>
     */
    public synchronized AccessToken getOAuthAccessToken() throws TwitterException {
        Authorization auth = getAuthorization();
        AccessToken oauthAccessToken;
        if (auth instanceof BasicAuthorization) {
            BasicAuthorization basicAuth = (BasicAuthorization) auth;
            auth = AuthorizationFactory.getInstance(conf);
            if (auth instanceof OAuthAuthorization) {
View Full Code Here


public class JavaTwitterStreamSuite extends LocalJavaStreamingContext {
  @Test
  public void testTwitterStream() {
    String[] filters = (String[])Arrays.<String>asList("filter1", "filter2").toArray();
    Authorization auth = NullAuthorization.getInstance();

    // tests the API, does not actually test data receiving
    JavaDStream<Status> test1 = TwitterUtils.createStream(ssc);
    JavaDStream<Status> test2 = TwitterUtils.createStream(ssc, filters);
    JavaDStream<Status> test3 = TwitterUtils.createStream(
View Full Code Here

        builder.setOAuthConsumerSecret(oAuthConsumerSecret);
        builder.setOAuthAccessToken(token.getKey());
        builder.setOAuthAccessTokenSecret(token.getSecret());
        Configuration conf = builder.build();

        Authorization authorization = AuthorizationFactory
            .getInstance(conf);
        Twitter twitter = new TwitterFactory()
            .getInstance(authorization);
        keyTwitters.add(twitter);
      }
View Full Code Here

     *
     * @param mediaProvider media provider
     * @return ImageUploader
     */
    public ImageUpload getInstance(MediaProvider mediaProvider) {
        Authorization authorization = AuthorizationFactory.getInstance(conf);
        return getInstance(mediaProvider, authorization);
    }
View Full Code Here

        super.tearDown();
    }

    public void testAnonymousInstance() throws Exception {
        Twitter twitter = new TwitterFactory().getInstance();
        Authorization auth = twitter.getAuthorization();
        assertTrue(auth instanceof NullAuthorization);
    }
View Full Code Here

            fail("should throw IllegalStateException");
        } catch (IllegalStateException ignore) {

        }

        Authorization auth = twitter.getAuthorization();
        assertTrue(auth instanceof OAuthAuthorization);
    }
View Full Code Here

            twitter.setOAuthConsumer(consumerSecret, consumerKey);
            fail("should throw IllegalStateException");
        } catch (IllegalStateException ignore) {
        }

        Authorization auth = twitter.getAuthorization();
        assertTrue(auth instanceof OAuth2Authorization);
    }
View Full Code Here

TOP

Related Classes of twitter4j.auth.Authorization

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.