use of com.facebook.airlift.http.client.StringResponseHandler.StringResponse in project presto by prestodb.
the class TestGenerateTokenFilter method testTraceToken.
@Test
public void testTraceToken() {
Request request = prepareGet().setUri(server.getBaseUrl().resolve("/testing/echo_token")).build();
StringResponse response = httpClient.execute(request, createStringResponseHandler());
assertEquals(response.getStatusCode(), SC_OK);
assertEquals(response.getBody(), filter.getLastToken());
}
use of com.facebook.airlift.http.client.StringResponseHandler.StringResponse in project presto by prestodb.
the class ClusterSizeFetcher method fetchClusterSize.
private int fetchClusterSize() {
Request request = prepareGet().setUri(nodeResourceUri).setHeader(CONTENT_TYPE, APPLICATION_JSON).build();
StringResponse response = httpClient.execute(request, createStringResponseHandler());
checkState(response.getStatusCode() == OK.getStatusCode(), "Invalid response: %s %s", response.getStatusCode(), response.getStatusMessage());
List<Map<String, Object>> values;
try {
values = new JsonObjectMapperProvider().get().readValue(response.getBody(), new TypeReference<List<Map<String, Object>>>() {
});
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return values.size();
}
Aggregations