Package org.opensocial.providers

Examples of org.opensocial.providers.Provider


    client.send(requests);
  }

  @Test(expected = RequestException.class)
  public void testNoEndpointsSet() throws RequestException, IOException {
    Client client = new Client(new Provider(), new OAuth2LeggedScheme(
        CONSUMER_KEY, CONSUMER_SECRET, VIEWER_ID));

    Request request = PeopleService.getViewer();
    client.send(request);
  }
View Full Code Here


  @Test
  public void testGetAuthorizationUrl() throws OAuthException,
      URISyntaxException, IOException {
    HttpClientStub httpClient = new HttpClientStub();
    Provider provider = new MySpaceProvider();

    OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
        consumerKey, consumerSecret, httpClient);

    httpClient.addResponse(200, OAuth.OAUTH_TOKEN + "=OAUTH_TOKEN&" +
View Full Code Here

  @Test
  public void testGetAuthorizationUrlUnregistered() throws OAuthException,
      URISyntaxException, IOException {
    HttpClientStub httpClient = new HttpClientStub();
    Provider provider = new MySpaceProvider() {
      @Override
      public String getRequestTokenUrl() {
        return null;
      }
    };
View Full Code Here

  @Test
  public void testGetAuthorizationUrlRequestTokenParams() throws
      OAuthException, URISyntaxException, IOException {
    HttpClientStub httpClient = new HttpClientStub();
    Provider provider = new MySpaceProvider();

    provider.addRequestTokenParameter("testKey", "testValue");

    OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
        consumerKey, consumerSecret, httpClient);

    httpClient.addResponse(200, OAuth.OAUTH_TOKEN + "=OAUTH_TOKEN&" +
View Full Code Here

  @Test
  public void testRequestAccessToken() throws OAuthException,
      URISyntaxException, IOException {
    HttpClientStub httpClient = new HttpClientStub();
    Provider provider = new MySpaceProvider();

    OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
        consumerKey, consumerSecret, httpClient);

    httpClient.addResponse(200, OAuth.OAUTH_TOKEN + "=OAUTH_TOKEN&" +
View Full Code Here

    assertEquals("ACCESS_TOKEN", token.token);
  }

  @Test
  public void testGetHttpMessage() throws RequestException, IOException {
    Provider provider = new MySpaceProvider();
    OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
        consumerKey, consumerSecret);
    authScheme.setAccessToken(new OAuth3LeggedScheme.Token("ACCESS_TOKEN",
        "ACCESS_TOKEN_SECRET"));
View Full Code Here

  }

  @Test
  public void testGetHttpMessageSignBodyHash() throws RequestException,
      IOException {
    Provider provider = new MySpaceProvider() {
      @Override
      public boolean getSignBodyHash() {
        return true;
      }
    };
View Full Code Here

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getIntent().getData() != null) {
      Provider provider = loadSelectedProvider();
      OAuth3LeggedScheme.Token requestToken = loadRequestToken();

      if (provider != null && requestToken != null) {
        try {
          String[] credentials = providerCredentials.get(provider.getName());
          OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
              credentials[0], credentials[1]);
          authScheme.setRequestToken(requestToken);
          authScheme.requestAccessToken(requestToken.token);
          persistAccessToken(authScheme.getAccessToken());
View Full Code Here

  }

  protected Client getClient() {
    OAuth3LeggedScheme.Token requestToken = loadRequestToken();
    OAuth3LeggedScheme.Token accessToken = loadAccessToken();
    Provider provider = loadSelectedProvider();

    if (requestToken != null && accessToken != null && provider != null) {
      String[] credentials = providerCredentials.get(provider.getName());
      OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
          credentials[0], credentials[1]);
      authScheme.setRequestToken(requestToken);
      authScheme.setAccessToken(accessToken);
View Full Code Here

        credentials.length < 2) {
      return null;
    }

    try {
      Provider provider = providerClass.newInstance();

      return new OAuth3LeggedScheme(provider, credentials[0], credentials[1]);
    } catch (InstantiationException e) {
      return null;
    } catch (IllegalAccessException e) {
View Full Code Here

TOP

Related Classes of org.opensocial.providers.Provider

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.