Class MockAsyncHttpClient
java.lang.Object
software.amazon.awssdk.testutils.service.http.MockAsyncHttpClient
- All Implemented Interfaces:
AutoCloseable,SdkAsyncHttpClient,MockHttpClient,SdkAutoCloseable
Mock implementation of
SdkAsyncHttpClient.-
Nested Class Summary
Nested classes/interfaces inherited from interface software.amazon.awssdk.http.async.SdkAsyncHttpClient
SdkAsyncHttpClient.Builder<T extends SdkAsyncHttpClient.Builder<T>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()execute(AsyncExecuteRequest request) Execute the request.Get the last request called on the mock.Get all requests called on the mock.Optional<byte[]> Returns the streaming payload byte array, if the asyncRequestBodyLength was set correctly.voidreset()Resets this mock by clearing any captured requests and wiping any stubbed responses.voidsetAsyncRequestBodyLength(int asyncRequestBodyLength) Enable capturing the streaming payload by setting the length of the AsyncRequestBody.voidstubNextResponse(HttpExecuteResponse nextResponse) Sets up the next HTTP response that will be returned by the mock.voidstubNextResponse(HttpExecuteResponse nextResponse, Duration delay) Sets up the next HTTP response that will be returned by the mock with a delay.voidstubResponses(HttpExecuteResponse... responses) Sets the next set of HTTP responses that will be returned by the mock.voidstubResponses(Pair<HttpExecuteResponse, Duration>... responses) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.awssdk.testutils.service.http.MockHttpClient
stubNextResponse200Methods inherited from interface software.amazon.awssdk.http.async.SdkAsyncHttpClient
clientName
-
Constructor Details
-
MockAsyncHttpClient
public MockAsyncHttpClient()
-
-
Method Details
-
execute
Description copied from interface:SdkAsyncHttpClientExecute the request.- Specified by:
executein interfaceSdkAsyncHttpClient- Parameters:
request- The request object.- Returns:
- The future holding the result of the request execution. Upon success execution of the request, the future is
completed with
null, otherwise it is completed exceptionally.
-
close
public void close()Description copied from interface:SdkAutoCloseable- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
reset
public void reset()Description copied from interface:MockHttpClientResets this mock by clearing any captured requests and wiping any stubbed responses.- Specified by:
resetin interfaceMockHttpClient
-
getRequests
Description copied from interface:MockHttpClientGet all requests called on the mock.- Specified by:
getRequestsin interfaceMockHttpClient
-
getLastRequest
Description copied from interface:MockHttpClientGet the last request called on the mock.- Specified by:
getLastRequestin interfaceMockHttpClient
-
stubNextResponse
Description copied from interface:MockHttpClientSets up the next HTTP response that will be returned by the mock. Removes responses previously added to the mock.- Specified by:
stubNextResponsein interfaceMockHttpClient
-
stubNextResponse
Description copied from interface:MockHttpClientSets up the next HTTP response that will be returned by the mock with a delay. Removes responses previously added to the mock.- Specified by:
stubNextResponsein interfaceMockHttpClient
-
stubResponses
- Specified by:
stubResponsesin interfaceMockHttpClient
-
stubResponses
Description copied from interface:MockHttpClientSets the next set of HTTP responses that will be returned by the mock. Removes responses previously added to the mock.- Specified by:
stubResponsesin interfaceMockHttpClient
-
setAsyncRequestBodyLength
public void setAsyncRequestBodyLength(int asyncRequestBodyLength) Enable capturing the streaming payload by setting the length of the AsyncRequestBody. -
getStreamingPayload
Returns the streaming payload byte array, if the asyncRequestBodyLength was set correctly. Otherwise, returns empty Optional.
-