Examples of MockHttpTransport


Examples of com.google.api.client.testing.http.MockHttpTransport

      "{\"error\":{\"code\":401,\"errors\":[{\"domain\":\"global\","
      + "\"location\":\"Authorization\",\"locationType\":\"header\","
      + "\"message\":\"me\",\"reason\":\"authError\"}],\"message\":\"me\"}}";

  public void testExecuteUnparsed_error() 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.testing.http.MockHttpTransport

      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.testing.http.MockHttpTransport

    }
  }

  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.testing.http.MockHttpTransport

      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.testing.http.MockHttpTransport

      // 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.testing.http.MockHttpTransport

    }
  }

  public void testInitialize() throws Exception {
    CommonGoogleClientRequestInitializer key = new CommonGoogleClientRequestInitializer("foo");
    MockGoogleClient client = new MockGoogleClient.Builder(new MockHttpTransport(),
        HttpTesting.SIMPLE_URL, "test/", null, null).setApplicationName("Test Application").build();
    MyRequest request = new MyRequest(client, "GET", "", null, String.class);
    assertNull(request.key);
    key.initialize(request);
    assertEquals("foo", request.key);
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport

* @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.testing.http.MockHttpTransport

  public void testInitialize() throws Exception {
    CommonGoogleJsonClientRequestInitializer key =
        new CommonGoogleJsonClientRequestInitializer("foo");
    MockGoogleJsonClient client = new MockGoogleJsonClient.Builder(
        new MockHttpTransport(), new JacksonFactory(), HttpTesting.SIMPLE_URL, "test/", null,
        false).setApplicationName("Test Application").build();
    MyRequest request = new MyRequest(client, "GET", "", null, String.class);
    assertNull(request.key);
    key.initialize(request);
    assertEquals("foo", request.key);
View Full Code Here

Examples of com.google.api.client.testing.http.MockHttpTransport

  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.testing.http.MockHttpTransport

    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
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.