use of io.druid.indexing.common.RetryPolicyConfig in project druid by druid-io.
the class RemoteTaskActionClientTest method testSubmitSimple.
@Test
public void testSubmitSimple() throws JsonProcessingException {
// return status code 200 and a list with size equals 1
Map<String, Object> responseBody = new HashMap<String, Object>();
responseBody.put("result", result);
String strResult = objectMapper.writeValueAsString(responseBody);
StatusResponseHolder responseHolder = new StatusResponseHolder(HttpResponseStatus.OK, new StringBuilder().append(strResult));
// set up mocks
expect(selector.pick()).andReturn(server);
replay(selector);
expect(httpClient.go(anyObject(Request.class), anyObject(StatusResponseHandler.class))).andReturn(Futures.immediateFuture(responseHolder));
replay(httpClient);
Task task = new NoopTask("id", 0, 0, null, null, null);
RemoteTaskActionClient client = new RemoteTaskActionClient(task, httpClient, selector, new RetryPolicyFactory(new RetryPolicyConfig()), objectMapper);
try {
result = client.submit(new LockListAction());
} catch (IOException e) {
Assert.fail("unexpected IOException");
}
Assert.assertEquals(1, result.size());
EasyMock.verify(selector, httpClient);
}
Aggregations