Examples of HTTPTransport


Examples of com.google.api.client.http.HttpTransport

      assertEquals("401" + StringUtils.LINE_SEPARATOR + ERROR_CONTENT, e.getMessage());
    }
  }

  public void testExecuteUsingHead() throws Exception {
    HttpTransport transport = new MockHttpTransport() {
      @Override
      public LowLevelHttpRequest buildRequest(final String method, final String url) {
        return new MockLowLevelHttpRequest() {
          @Override
          public LowLevelHttpResponse execute() {
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

    }
  }

  private void subtestBuildHttpRequest_emptyContent(String method, boolean expectEmptyContent)
      throws Exception {
    HttpTransport transport = new MockHttpTransport();
    MockGoogleClient client = new MockGoogleClient.Builder(
        transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName(
        "Test Application").build();
    MockGoogleClientRequest<String> request =
        new MockGoogleClientRequest<String>(client, method, URI_TEMPLATE, null, String.class);
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

      assertNull(httpRequest.getContent());
    }
  }

  public void testCheckRequiredParameter() throws Exception {
    HttpTransport transport = new MockHttpTransport();
    MockGoogleClient client = new MockGoogleClient.Builder(
        transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName(
        "Test Application").build();
    MockGoogleClientRequest<String> request = new MockGoogleClientRequest<String>(
        client, HttpMethods.GET, URI_TEMPLATE, null, String.class);
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

      // Expected.
    }
  }

  public void testExecute_void() throws Exception {
    HttpTransport transport = new MockHttpTransport() {
      @Override
      public LowLevelHttpRequest buildRequest(final String method, final String url) {
        return new MockLowLevelHttpRequest() {
          @Override
          public LowLevelHttpResponse execute() {
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

* @author Yaniv Inbar
*/
public class AbstractGoogleJsonClientTest extends TestCase {

  public void testExecuteUnparsed_error() throws Exception {
    HttpTransport transport = new MockHttpTransport() {
        @Override
      public LowLevelHttpRequest buildRequest(String name, String url) {
        return new MockLowLevelHttpRequest() {
            @Override
          public LowLevelHttpResponse execute() {
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

  private static final Lock lock = new ReentrantLock();

  private static File tempDirectory = null;

  public void testDefaultCredentialAppEngineDeployed() throws IOException  {
    HttpTransport transport = new MockHttpTransport();
    TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider();
    testProvider.addType(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS,
        MockAppEngineCredential.class);
    testProvider.addType(GAE_SIGNAL_CLASS, MockAppEngineSystemProperty.class);
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

    assertSame(transport, defaultCredential.getTransport());
    assertSame(JSON_FACTORY, defaultCredential.getJsonFactory());
  }

  public void testDefaultCredentialAppEngineComponentOffAppEngineGivesNotFoundError() {
    HttpTransport transport = new MockHttpTransport();
    TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider();
    testProvider.addType(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS,
        MockAppEngineCredential.class);
    testProvider.addType(GAE_SIGNAL_CLASS, MockOffAppEngineSystemProperty.class);
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

      return new MockLowLevelHttpRequest(url).setResponse(response);
    }
  }

  public void testParse() throws Exception {
    HttpTransport transport = new ErrorTransport();
    HttpRequest request =
        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
    request.setThrowExceptionOnExecuteError(false);
    HttpResponse response = request.execute();
    GoogleJsonError errorResponse = GoogleJsonError.parse(FACTORY, response);
    assertEquals(ERROR, FACTORY.toString(errorResponse));
  }
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

      assertTrue(message.contains(DefaultCredentialProvider.HELP_PERMALINK));
    }
  }

  public void testDefaultCredentialAppEngineWithoutDependencyThrowsHelpfulLoadError() {
    HttpTransport transport = new MockHttpTransport();
    TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider();
    testProvider.addType(GAE_SIGNAL_CLASS, MockAppEngineSystemProperty.class);

    try {
      testProvider.getDefaultCredential(transport, JSON_FACTORY);
View Full Code Here

Examples of com.google.api.client.http.HttpTransport

      assertTrue(message.contains(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS));
    }
  }

  public void testDefaultCredentialAppEngineSingleClassLoadAttempt() {
    HttpTransport transport = new MockHttpTransport();
    TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider();
    try {
      testProvider.getDefaultCredential(transport, JSON_FACTORY);
      fail("No credential expected for default test provider.");
    } catch (IOException expected) {
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.