Skip to content

Commit e7075ac

Browse files
committed
Update reindex tests with new parameter for mocked method
1 parent 02e96ff commit e7075ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/reindex/src/test/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSourceTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.http.HttpResponse;
2727
import org.apache.http.ProtocolVersion;
2828
import org.apache.http.StatusLine;
29+
import org.apache.http.client.protocol.HttpClientContext;
2930
import org.apache.http.concurrent.FutureCallback;
3031
import org.apache.http.entity.ContentType;
3132
import org.apache.http.entity.InputStreamEntity;
@@ -430,11 +431,11 @@ public void testTooLargeResponse() throws Exception {
430431
ContentTooLongException tooLong = new ContentTooLongException("too long!");
431432
CloseableHttpAsyncClient httpClient = mock(CloseableHttpAsyncClient.class);
432433
when(httpClient.<HttpResponse>execute(any(HttpAsyncRequestProducer.class), any(HttpAsyncResponseConsumer.class),
433-
any(FutureCallback.class))).then(new Answer<Future<HttpResponse>>() {
434+
any(HttpClientContext.class), any(FutureCallback.class))).then(new Answer<Future<HttpResponse>>() {
434435
@Override
435436
public Future<HttpResponse> answer(InvocationOnMock invocationOnMock) throws Throwable {
436437
HeapBufferedAsyncResponseConsumer consumer = (HeapBufferedAsyncResponseConsumer) invocationOnMock.getArguments()[1];
437-
FutureCallback callback = (FutureCallback) invocationOnMock.getArguments()[2];
438+
FutureCallback callback = (FutureCallback) invocationOnMock.getArguments()[3];
438439
assertEquals(new ByteSizeValue(100, ByteSizeUnit.MB).bytesAsInt(), consumer.getBufferLimit());
439440
callback.failed(tooLong);
440441
return null;
@@ -495,7 +496,7 @@ private RemoteScrollableHitSource sourceWithMockedRemoteCall(boolean mockRemoteV
495496

496497
CloseableHttpAsyncClient httpClient = mock(CloseableHttpAsyncClient.class);
497498
when(httpClient.<HttpResponse>execute(any(HttpAsyncRequestProducer.class), any(HttpAsyncResponseConsumer.class),
498-
any(FutureCallback.class))).thenAnswer(new Answer<Future<HttpResponse>>() {
499+
any(HttpClientContext.class), any(FutureCallback.class))).thenAnswer(new Answer<Future<HttpResponse>>() {
499500

500501
int responseCount = 0;
501502

@@ -504,7 +505,7 @@ public Future<HttpResponse> answer(InvocationOnMock invocationOnMock) throws Thr
504505
// Throw away the current thread context to simulate running async httpclient's thread pool
505506
threadPool.getThreadContext().stashContext();
506507
HttpAsyncRequestProducer requestProducer = (HttpAsyncRequestProducer) invocationOnMock.getArguments()[0];
507-
FutureCallback<HttpResponse> futureCallback = (FutureCallback<HttpResponse>) invocationOnMock.getArguments()[2];
508+
FutureCallback<HttpResponse> futureCallback = (FutureCallback<HttpResponse>) invocationOnMock.getArguments()[3];
508509
HttpEntityEnclosingRequest request = (HttpEntityEnclosingRequest)requestProducer.generateRequest();
509510
URL resource = resources[responseCount];
510511
String path = paths[responseCount++];

0 commit comments

Comments
 (0)