Class MockHttpTransportHelper
java.lang.Object
com.google.cloud.hadoop.util.testing.MockHttpTransportHelper
Utility methods for testing with
MockHttpTransport-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHTTP JSON API error responses -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.api.client.testing.http.MockLowLevelHttpResponsearbitraryInputStreamSupplier(Supplier<InputStream> supplier) Return an arbitrary InputStream supplier.static com.google.api.client.testing.http.MockLowLevelHttpResponsedataRangeResponse(byte[] content, long rangeStart, long totalSize) static com.google.api.client.testing.http.MockLowLevelHttpResponsedataResponse(byte[] content) static com.google.api.client.testing.http.MockLowLevelHttpResponsedataResponse(Map<String, Object> headers, byte[] content) static com.google.api.client.testing.http.MockLowLevelHttpResponseemptyResponse(int statusCode) static com.google.api.client.testing.http.MockLowLevelHttpResponseinputStreamResponse(InputStream content) static com.google.api.client.testing.http.MockLowLevelHttpResponseinputStreamResponse(String header, Object headerValue, InputStream content) static com.google.api.client.testing.http.MockLowLevelHttpResponseinputStreamResponse(Map<String, Object> headers, InputStream content) static com.google.api.client.testing.http.MockLowLevelHttpResponsejsonDataResponse(Object object) static com.google.api.client.testing.http.MockLowLevelHttpResponsejsonErrorResponse(MockHttpTransportHelper.ErrorResponses errorResponse) static com.google.api.client.testing.http.MockHttpTransportmockBatchTransport(int requestsPerBatch, com.google.api.client.http.LowLevelHttpResponse... responses) static com.google.api.client.testing.http.MockHttpTransportmockTransport(Object... responsesIn)
-
Method Details
-
mockTransport
public static com.google.api.client.testing.http.MockHttpTransport mockTransport(Object... responsesIn) -
mockBatchTransport
public static com.google.api.client.testing.http.MockHttpTransport mockBatchTransport(int requestsPerBatch, com.google.api.client.http.LowLevelHttpResponse... responses) -
emptyResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse emptyResponse(int statusCode) -
dataRangeResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse dataRangeResponse(byte[] content, long rangeStart, long totalSize) -
jsonDataResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse jsonDataResponse(Object object) throws IOException - Throws:
IOException
-
dataResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse dataResponse(byte[] content) -
dataResponse
-
jsonErrorResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse jsonErrorResponse(MockHttpTransportHelper.ErrorResponses errorResponse) throws IOException - Throws:
IOException
-
inputStreamResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse inputStreamResponse(String header, Object headerValue, InputStream content) -
inputStreamResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse inputStreamResponse(InputStream content) -
inputStreamResponse
public static com.google.api.client.testing.http.MockLowLevelHttpResponse inputStreamResponse(Map<String, Object> headers, InputStream content) -
arbitraryInputStreamSupplier
public static com.google.api.client.testing.http.MockLowLevelHttpResponse arbitraryInputStreamSupplier(Supplier<InputStream> supplier) Return an arbitrary InputStream supplier. This function should only be used to simulate arbitrary runtime behavior when callingexecuteandexecuteMedia.
-