Examples of OrkutProvider


Examples of org.opensocial.providers.OrkutProvider

    final String url = "http://example.org/test";
    final Map<String, String> headers = new HashMap<String, String>();

    SecurityTokenScheme authScheme = new SecurityTokenScheme(TOKEN);

    HttpMessage message = authScheme.getHttpMessage(new OrkutProvider(), "GET",
        url, headers, null);
    assertEquals(url + "?st=" + TOKEN, message.url.toString());
  }
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    final String url = "http://example.org/test?arg=value";
    final Map<String, String> headers = new HashMap<String, String>();

    SecurityTokenScheme authScheme = new SecurityTokenScheme(TOKEN);

    HttpMessage message = authScheme.getHttpMessage(new OrkutProvider(), "GET",
        url, headers, null);
    assertEquals(url + "&st=" + TOKEN, message.url.toString());
  }
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    final Map<String, String> headers = new HashMap<String, String>();

    SecurityTokenScheme authScheme = new SecurityTokenScheme(TOKEN_NAME,
        TOKEN);

    HttpMessage message = authScheme.getHttpMessage(new OrkutProvider(), "GET",
        url, headers, null);
    assertEquals(url + "?" + TOKEN_NAME + "=" + TOKEN, message.url.toString());
  }
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

  private static final String CONSUMER_KEY = "orkut.com:623061448914";
  private static final String CONSUMER_SECRET = "uynAeXiWTisflWX99KU1D2q5";

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

    Map<String, Request> requests = new HashMap<String, Request>();
    client.send(requests);
  }
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    IMocksControl mockControl = EasyMock.createControl();

    HttpClient httpClient = mockControl.createMock(HttpClient.class);
    AuthScheme authScheme = mockControl.createMock(AuthScheme.class);

    OrkutProvider provider = new OrkutProvider();

    Client client = new Client(provider, authScheme, httpClient);

    Request request = new Request(null, "service.method", null);
    request.setContentType("test/content-type");

    String rpcEndPoint = provider.getRpcEndpoint();
    rpcEndPoint = rpcEndPoint.substring(0, rpcEndPoint.length() - 1);

    HttpResponseMessage httpResponseMessage = new HttpResponseMessage("GET",
        new URL(provider.getRpcEndpoint()), 200, stringToInputStream("[]"));

    EasyMock.expect(authScheme.getHttpMessage(eq(provider), eq("POST"),
        eq(rpcEndPoint), isA(Map.class), isA(byte[].class)))
        .andAnswer(new IAnswer<HttpMessage>() {
          public HttpMessage answer() throws Throwable {
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    IMocksControl mockControl = EasyMock.createControl();

    HttpClient httpClient = mockControl.createMock(HttpClient.class);
    AuthScheme authScheme = mockControl.createMock(AuthScheme.class);

    OrkutProvider provider = new OrkutProvider();

    Client client = new Client(provider, authScheme, httpClient);

    Request request = new Request(null, "service.method", null);
    byte[] payload = "testpayload".getBytes();
    request.setCustomPayload(payload);

    String rpcEndPoint = provider.getRpcEndpoint();
    rpcEndPoint = rpcEndPoint.substring(0, rpcEndPoint.length() - 1);

    HttpResponseMessage httpResponseMessage = new HttpResponseMessage("GET",
        new URL(provider.getRpcEndpoint()), 200, stringToInputStream("[]"));

    EasyMock.expect(authScheme.getHttpMessage(eq(provider), eq("POST"),
        eq(rpcEndPoint), isA(Map.class), eq(payload))).andReturn(null);

    EasyMock.expect(httpClient.execute((HttpMessage) eq(null))).andReturn(
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    IMocksControl mockControl = EasyMock.createControl();

    HttpClient httpClient = mockControl.createMock(HttpClient.class);
    AuthScheme authScheme = mockControl.createMock(AuthScheme.class);

    OrkutProvider provider = new OrkutProvider();

    Client client = new Client(provider, authScheme, httpClient);

    Request request = new Request(null, null, null);
    request.addRpcQueryStringParameter("key1", "value1");
    request.addRpcQueryStringParameter("key2", "value2");

    String rpcUrl = provider.getRpcEndpoint();
    rpcUrl = rpcUrl.substring(0, rpcUrl.length() - 1);
    String rpcUrl1 = rpcUrl + "?key1=value1&key2=value2";
    String rpcUrl2 = rpcUrl + "?key2=value2&key1=value1";

    EasyMock.expect(authScheme.getHttpMessage(eq(provider), eq("POST"),
        or(eq(rpcUrl1), eq(rpcUrl2)), isA(Map.class), isA(byte[].class)))
        .andReturn(null);

    HttpResponseMessage httpResponseMessage = new HttpResponseMessage("GET",
        new URL(provider.getRpcEndpoint()), 200, stringToInputStream("[]"));

    EasyMock.expect(httpClient.execute((HttpMessage) eq(null))).andReturn(
        httpResponseMessage);

    mockControl.replay();
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    retrieveSelfFromOrkut(true);
  }

  private void retrieveSelfFromOrkut(boolean useRest) {
    try {
      Client client = new Client(new OrkutProvider(useRest),
          new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
      Request request = PeopleService.getViewer();
      Response response = client.send(request);

      Person self = response.getEntry();
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

    retrieveFriendsFromOrkut(true);
  }

  private void retrieveFriendsFromOrkut(boolean useRest) {
    try {
      Client client = new Client(new OrkutProvider(useRest),
          new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
      Request request = PeopleService.getFriends();
      Response response = client.send(request);

      Person self = response.getEntry();
View Full Code Here

Examples of org.opensocial.providers.OrkutProvider

*
*/
public class BaseRequestTest extends AbstractRequestTest {
  @BeforeClass
  public static void init() {
    client = new Client(new OrkutProvider(false), new OAuth2LeggedScheme(
        "consumerKey", "consumerSecret"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.