From eecec9727454e684d7a9e224fb2e880ebb458d14 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 13 Apr 2016 17:18:31 -0400 Subject: [PATCH] Fix funny generics in request size limit test --- .../java/org/elasticsearch/http/netty/NettyHttpClient.java | 5 +++-- .../http/netty/NettyHttpRequestSizeLimitIT.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java index 4b04a6259c0..ce6ffc2b264 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java @@ -92,9 +92,10 @@ public class NettyHttpClient implements Closeable { return sendRequests(remoteAddress, requests); } - public Collection post(SocketAddress remoteAddress, Tuple... urisAndBodies) throws InterruptedException { + public Collection post(SocketAddress remoteAddress, Tuple... urisAndBodies) + throws InterruptedException { Collection requests = new ArrayList<>(urisAndBodies.length); - for (Tuple uriAndBody : urisAndBodies) { + for (Tuple uriAndBody : urisAndBodies) { ChannelBuffer content = ChannelBuffers.copiedBuffer(uriAndBody.v2(), StandardCharsets.UTF_8); HttpRequest request = new DefaultHttpRequest(HTTP_1_1, HttpMethod.POST, uriAndBody.v1()); request.headers().add(HOST, "localhost"); diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java index 7a72801c33a..1640e482a2c 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java @@ -67,7 +67,8 @@ public class NettyHttpRequestSizeLimitIT extends ESIntegTestCase { bulkRequest.append(System.lineSeparator()); } - Tuple[] requests = new Tuple[] { + @SuppressWarnings("unchecked") + Tuple[] requests = new Tuple[] { Tuple.tuple("/index/type/_bulk", bulkRequest), Tuple.tuple("/index/type/_bulk", bulkRequest), Tuple.tuple("/index/type/_bulk", bulkRequest), @@ -79,11 +80,11 @@ public class NettyHttpRequestSizeLimitIT extends ESIntegTestCase { ().boundAddresses()); try (NettyHttpClient nettyHttpClient = new NettyHttpClient()) { + @SuppressWarnings("unchecked") Collection singleResponse = nettyHttpClient.post(inetSocketTransportAddress.address(), requests[0]); assertThat(singleResponse, hasSize(1)); assertAtLeastOnceExpectedStatus(singleResponse, HttpResponseStatus.OK); - @SuppressWarnings("unchecked") Collection multipleResponses = nettyHttpClient.post(inetSocketTransportAddress.address(), requests); assertThat(multipleResponses, hasSize(requests.length)); assertAtLeastOnceExpectedStatus(multipleResponses, HttpResponseStatus.SERVICE_UNAVAILABLE);