public class ClientExecutionAndRequestTimerTestUtils extends Object
Constructor and Description |
---|
ClientExecutionAndRequestTimerTestUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
assertCanceledTasksRemoved(ScheduledThreadPoolExecutor timerExecutor)
If the request completes successfully then the timer task should be canceled and should be
removed from the thread pool to prevent build up of canceled tasks
|
static void |
assertClientExecutionTimerExecutorNotCreated(ClientExecutionTimer clientExecutionTimer)
Assert that the executor backing
ClientExecutionTimer was never created or used |
static void |
assertCoreThreadsShutDownAfterBeingIdle(ScheduledThreadPoolExecutor timerExecutor)
Waits until a little after the thread pools keep alive time and then asserts that all thre
|
static void |
assertNumberOfRetries(org.apache.http.client.HttpClient spyClient,
int expectedNumberOfRequests) |
static void |
assertNumberOfTasksTriggered(ClientExecutionTimer clientExecutionTimer,
int expectedNumberOfTasks) |
static void |
assertNumberOfTasksTriggered(HttpRequestTimer requestTimer,
int expectedNumberOfTasks) |
static void |
assertRequestTimerExecutorNotCreated(HttpRequestTimer requestTimer)
Assert that the executor backing
ClientExecutionTimer was never created or used |
static void |
assertResponseIsBuffered(HttpResponseProxy responseProxy)
Assert response was buffered into memory to enforce the timeout on both connection
established and reading of content
|
static void |
assertResponseWasNotBuffered(HttpResponseProxy responseProxy)
Assert response was NOT buffered into memory as should be the case when client execution and
request timeouts are disabled or an operation is streaming and it's content must be left open
|
static void |
assertTimerNeverTriggered(ScheduledThreadPoolExecutor timerExecutor)
Asserts the timer never went off (I.E.
|
static HttpResponseProxy |
createHttpHeadResponseProxy()
Creates Apache
HttpResponseProxy with a null entity |
static HttpResponseProxy |
createHttpResponseProxySpy()
Creates Apache
HttpResponseProxy spy |
static Request<?> |
createMockGetRequest() |
static Request<?> |
createMockHeadRequest() |
static ConnectionManagerAwareHttpClient |
createRawHttpClientSpy(ClientConfiguration config)
Creates Apache
HttpClient spy |
static void |
execute(AmazonHttpClient httpClient,
Request<?> request)
Execute the request with a dummy response handler and error response handler
|
static void |
interruptCurrentThreadAfterDelay(long delay) |
public ClientExecutionAndRequestTimerTestUtils()
public static void assertRequestTimerExecutorNotCreated(HttpRequestTimer requestTimer)
ClientExecutionTimer
was never created or usedrequestTimer
- public static void assertClientExecutionTimerExecutorNotCreated(ClientExecutionTimer clientExecutionTimer)
ClientExecutionTimer
was never created or usedclientExecutionTimer
- public static void assertResponseIsBuffered(HttpResponseProxy responseProxy)
responseProxy
- Must by a spied HttpResponseProxy
public static void assertResponseWasNotBuffered(HttpResponseProxy responseProxy)
responseProxy
- Must by a spied HttpResponseProxy
public static void assertCoreThreadsShutDownAfterBeingIdle(ScheduledThreadPoolExecutor timerExecutor)
timerExecutor
- Executor used by timer implementationInterruptedException
public static void assertCanceledTasksRemoved(ScheduledThreadPoolExecutor timerExecutor)
timerExecutor
- Executor used by timer implementationpublic static void assertTimerNeverTriggered(ScheduledThreadPoolExecutor timerExecutor)
timerExecutor
- Executor used by timer implementationpublic static void assertNumberOfTasksTriggered(ClientExecutionTimer clientExecutionTimer, int expectedNumberOfTasks)
public static void assertNumberOfTasksTriggered(HttpRequestTimer requestTimer, int expectedNumberOfTasks)
public static ConnectionManagerAwareHttpClient createRawHttpClientSpy(ClientConfiguration config)
HttpClient
spyconfig
- ClientConfiguration
for HttpClientFactory
HttpClient
with ability to verify method calls or
partially mockpublic static HttpResponseProxy createHttpResponseProxySpy() throws IOException
HttpResponseProxy
spyHttpResponseProxy
with ability to verify method calls
or partially mockIOException
public static HttpResponseProxy createHttpHeadResponseProxy() throws IOException
HttpResponseProxy
with a null entityIOException
public static Request<?> createMockGetRequest()
public static Request<?> createMockHeadRequest()
public static void execute(AmazonHttpClient httpClient, Request<?> request)
public static void assertNumberOfRetries(org.apache.http.client.HttpClient spyClient, int expectedNumberOfRequests)
public static void interruptCurrentThreadAfterDelay(long delay)
Copyright © 2020. All rights reserved.