Fix funny generics in request size limit test
This commit is contained in:
parent
eb71918878
commit
eecec97274
|
@ -92,9 +92,10 @@ public class NettyHttpClient implements Closeable {
|
||||||
return sendRequests(remoteAddress, requests);
|
return sendRequests(remoteAddress, requests);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<HttpResponse> post(SocketAddress remoteAddress, Tuple<String, String>... urisAndBodies) throws InterruptedException {
|
public Collection<HttpResponse> post(SocketAddress remoteAddress, Tuple<String, CharSequence>... urisAndBodies)
|
||||||
|
throws InterruptedException {
|
||||||
Collection<HttpRequest> requests = new ArrayList<>(urisAndBodies.length);
|
Collection<HttpRequest> requests = new ArrayList<>(urisAndBodies.length);
|
||||||
for (Tuple<String, String> uriAndBody : urisAndBodies) {
|
for (Tuple<String, CharSequence> uriAndBody : urisAndBodies) {
|
||||||
ChannelBuffer content = ChannelBuffers.copiedBuffer(uriAndBody.v2(), StandardCharsets.UTF_8);
|
ChannelBuffer content = ChannelBuffers.copiedBuffer(uriAndBody.v2(), StandardCharsets.UTF_8);
|
||||||
HttpRequest request = new DefaultHttpRequest(HTTP_1_1, HttpMethod.POST, uriAndBody.v1());
|
HttpRequest request = new DefaultHttpRequest(HTTP_1_1, HttpMethod.POST, uriAndBody.v1());
|
||||||
request.headers().add(HOST, "localhost");
|
request.headers().add(HOST, "localhost");
|
||||||
|
|
|
@ -67,7 +67,8 @@ public class NettyHttpRequestSizeLimitIT extends ESIntegTestCase {
|
||||||
bulkRequest.append(System.lineSeparator());
|
bulkRequest.append(System.lineSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
Tuple[] requests = new Tuple[] {
|
@SuppressWarnings("unchecked")
|
||||||
|
Tuple<String, CharSequence>[] requests = new Tuple[] {
|
||||||
Tuple.tuple("/index/type/_bulk", bulkRequest),
|
Tuple.tuple("/index/type/_bulk", bulkRequest),
|
||||||
Tuple.tuple("/index/type/_bulk", bulkRequest),
|
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());
|
().boundAddresses());
|
||||||
|
|
||||||
try (NettyHttpClient nettyHttpClient = new NettyHttpClient()) {
|
try (NettyHttpClient nettyHttpClient = new NettyHttpClient()) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Collection<HttpResponse> singleResponse = nettyHttpClient.post(inetSocketTransportAddress.address(), requests[0]);
|
Collection<HttpResponse> singleResponse = nettyHttpClient.post(inetSocketTransportAddress.address(), requests[0]);
|
||||||
assertThat(singleResponse, hasSize(1));
|
assertThat(singleResponse, hasSize(1));
|
||||||
assertAtLeastOnceExpectedStatus(singleResponse, HttpResponseStatus.OK);
|
assertAtLeastOnceExpectedStatus(singleResponse, HttpResponseStatus.OK);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Collection<HttpResponse> multipleResponses = nettyHttpClient.post(inetSocketTransportAddress.address(), requests);
|
Collection<HttpResponse> multipleResponses = nettyHttpClient.post(inetSocketTransportAddress.address(), requests);
|
||||||
assertThat(multipleResponses, hasSize(requests.length));
|
assertThat(multipleResponses, hasSize(requests.length));
|
||||||
assertAtLeastOnceExpectedStatus(multipleResponses, HttpResponseStatus.SERVICE_UNAVAILABLE);
|
assertAtLeastOnceExpectedStatus(multipleResponses, HttpResponseStatus.SERVICE_UNAVAILABLE);
|
||||||
|
|
Loading…
Reference in New Issue