Package org.opensocial.providers

Examples of org.opensocial.providers.Provider


    assertHasSecurityToken();
  }

  // TODO: call corresponding functions in Client class directly.
  protected void toHttpMessage() throws RequestException, IOException {
    Provider provider = client.getProvider();
    if (provider.getRpcEndpoint() != null) {
      isRpc = true;

      Map<String, String> headers = new HashMap<String, String>();
      headers.put(HttpMessage.CONTENT_TYPE, provider.getContentType());

      final String KEY = "key";
      Map<String, Request> requests = new HashMap<String, Request>();
      requests.put(KEY, request);

      byte[] body = client.buildRpcPayload(requests);

      String method = "POST";
      String url = client.buildRpcUrl(requests);

      message = client.getAuthScheme().getHttpMessage(provider, method, url,
          headers, body);
    } else if (provider.getRestEndpoint() != null) {
      isRpc = false;

      Map<String, String> headers = new HashMap<String, String>();
      if (request.getContentType() != null) {
        headers.put(HttpMessage.CONTENT_TYPE, request.getContentType());
      } else {
        headers.put(HttpMessage.CONTENT_TYPE, provider.getContentType());
      }

      String method = request.getRestMethod();

      String url = client.buildRestUrl(request);
View Full Code Here


  }

  public static class Orkut3LeggedRpcTest extends BaseRequestTest {
    @BeforeClass
    public static void init() {
      Provider p = new OrkutProvider(false);
      client = new Client(p, new OAuth3LeggedScheme(p, "consumerKey",
          "consumerSecret"));
    }
View Full Code Here

  }

  public static class Orkut3LeggedRestTest extends BaseRequestTest {
    @BeforeClass
    public static void init() {
      Provider p = new OrkutProvider(true);
      client = new Client(p, new OAuth3LeggedScheme(p, "consumerKey",
          "consumerSecret"));
    }
View Full Code Here

    headers.put("Content-Type", "application/json");
  }

  @Test
  public void testSetFieldsParameterRpc() throws RequestException, IOException {
    Provider provider = new ShindigProvider();
    Client client = new Client(provider, authScheme, httpClient);
    Request request = new Request("/service/", "service.test", "GET");

    String fieldsString = "\"fields\":[\"field1\",\"field2\"]";
    String url = removeTrailingSlash(provider.getRpcEndpoint());

    expect(authScheme.getHttpMessage(
        eq(provider), eq("POST"), eq(url), eq(headers),
        EasyMock.cmp(fieldsString.getBytes(),
            new BodyContainsComparator(), LogicalOperator.EQUAL))).andReturn(
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.