Examples of createRequestFactory()


Examples of com.google.api.client.http.javanet.NetHttpTransport.createRequestFactory()

      // make the request
      HttpTransport transport = new NetHttpTransport();
      HttpRequestFactory f = null;
      if (useOAuth) {
        f = transport.createRequestFactory(params);
      } else {
        f = transport.createRequestFactory();
      }
      HttpRequest request = null;
      if ("POST".equals(requestMethod))
View Full Code Here

Examples of com.google.api.client.http.javanet.NetHttpTransport.createRequestFactory()

      HttpTransport transport = new NetHttpTransport();
      HttpRequestFactory f = null;
      if (useOAuth) {
        f = transport.createRequestFactory(params);
      } else {
        f = transport.createRequestFactory();
      }
      HttpRequest request = null;
      if ("POST".equals(requestMethod))
        if (postData == null)
          request = f.buildPostRequest(url, null);
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

        ((Map<?, ?>) ((UrlEncodedContent) request.getContent()).getData()).get("access_token"));
  }

  private HttpRequest subtestConstructor(Credential credential) throws Exception {
    MockHttpTransport transport = new MockHttpTransport();
    HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
    HttpRequest request = requestFactory.buildDeleteRequest(HttpTesting.SIMPLE_GENERIC_URL);
    request.execute();
    return request;
  }
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

  public void testInterceptMaxLength() throws IOException {
    HttpTransport transport = new MockHttpTransport();
    GenericUrl url = new GenericUrl(HttpTesting.SIMPLE_URL);
    url.set("a", "foo");
    HttpRequest request =
        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
    new MethodOverride().intercept(request);
    assertEquals(HttpMethods.GET, request.getRequestMethod());
    assertNull(request.getHeaders().get(MethodOverride.HEADER));
    assertNull(request.getContent());
    char[] arr = new char[MethodOverride.MAX_URL_LENGTH];
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

    expectedOutput.append("\r\n");
    expectedOutput.append("GET http://test/dummy/url2\r\n");
    expectedOutput.append("\r\n");
    expectedOutput.append("--__END_OF_PART__--\r\n");
    MockHttpTransport transport = new MockHttpTransport();
    HttpRequest request1 = transport.createRequestFactory().buildRequest(
        request1Method, new GenericUrl(request1Url),
        new ByteArrayContent(request1ContentType, request1Content.getBytes()));
    HttpRequest request2 = transport.createRequestFactory()
        .buildRequest(request2Method, new GenericUrl(request2Url), null);
    subtestExecute_checkWriteTo(expectedOutput.toString(), request1, request2);
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

    expectedOutput.append("--__END_OF_PART__--\r\n");
    MockHttpTransport transport = new MockHttpTransport();
    HttpRequest request1 = transport.createRequestFactory().buildRequest(
        request1Method, new GenericUrl(request1Url),
        new ByteArrayContent(request1ContentType, request1Content.getBytes()));
    HttpRequest request2 = transport.createRequestFactory()
        .buildRequest(request2Method, new GenericUrl(request2Url), null);
    subtestExecute_checkWriteTo(expectedOutput.toString(), request1, request2);
  }

  private void subtestExecute_checkWriteTo(final String expectedOutput, HttpRequest... requests)
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

    batchRequest.execute();
  }

  public void testExecute_checkWriteToNoHeaders() throws Exception {
    MockHttpTransport transport = new MockHttpTransport();
    HttpRequest request1 = transport.createRequestFactory()
        .buildPostRequest(HttpTesting.SIMPLE_GENERIC_URL, new HttpContent() {

          @Override
          public long getLength() {
            return -1;
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

public class GoogleJsonResponseExceptionTest extends TestCase {

  public void testFrom_noDetails() throws Exception {
    HttpTransport transport = new MockHttpTransport();
    HttpRequest request =
        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
    request.setThrowExceptionOnExecuteError(false);
    HttpResponse response = request.execute();
    GoogleJsonResponseException ge =
        GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
    assertNull(ge.getDetails());
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

    appIdentity.setAccessTokenText(expectedAccessToken);
    AppIdentityCredential.Builder builder = new AppIdentityCredential.Builder(SCOPES);
    builder.setAppIdentityService(appIdentity);
    AppIdentityCredential appCredential = builder.build();
    HttpTransport transport = new MockHttpTransport();
    HttpRequest request = transport.createRequestFactory().buildRequest(
        "get", null, null);

    appCredential.intercept(request);

    assertEquals(appIdentity.getGetAccessTokenCallCount(), 1);
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport.createRequestFactory()

    AppIdentityCredential appCredential = builder.build();

    GoogleCredential wrapper = new
        AppIdentityCredential.AppEngineCredentialWrapper(appCredential, transport, jsonFactory);

    HttpRequest request = transport.createRequestFactory().buildRequest("get", null, null);

    assertTrue(wrapper.createScopedRequired());
    try {
      wrapper.intercept(request);
      fail("Should not be able to use credential without scopes.");
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.