Skip to content

Commit 20ac10c

Browse files
committed
more
1 parent c6babd3 commit 20ac10c

File tree

1 file changed

+6
-22
lines changed
  • x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin

1 file changed

+6
-22
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/CanMatchIT.java

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@
1818
import org.elasticsearch.index.query.RangeQueryBuilder;
1919
import org.elasticsearch.index.shard.ShardId;
2020
import org.elasticsearch.plugins.Plugin;
21-
import org.elasticsearch.tasks.Task;
2221
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
2322
import org.elasticsearch.test.transport.MockTransportService;
24-
import org.elasticsearch.test.transport.StubbableTransport;
25-
import org.elasticsearch.transport.TransportChannel;
26-
import org.elasticsearch.transport.TransportRequest;
27-
import org.elasticsearch.transport.TransportRequestHandler;
2823
import org.elasticsearch.transport.TransportService;
2924
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
3025
import org.elasticsearch.xpack.esql.action.EsqlQueryResponse;
@@ -281,24 +276,13 @@ public void testSkipOnIndexName() {
281276
Set<String> queriedIndices = ConcurrentCollections.newConcurrentSet();
282277
for (TransportService ts : internalCluster().getInstances(TransportService.class)) {
283278
MockTransportService mockTransportService = as(ts, MockTransportService.class);
284-
mockTransportService.addRequestHandlingBehavior(
285-
ComputeService.DATA_ACTION_NAME,
286-
new StubbableTransport.RequestHandlingBehavior<TransportRequest>() {
287-
@Override
288-
public void messageReceived(
289-
TransportRequestHandler<TransportRequest> handler,
290-
TransportRequest request,
291-
TransportChannel channel,
292-
Task task
293-
) throws Exception {
294-
DataNodeRequest dataNodeRequest = (DataNodeRequest) request;
295-
for (ShardId shardId : dataNodeRequest.shardIds()) {
296-
queriedIndices.add(shardId.getIndexName());
297-
}
298-
handler.messageReceived(request, channel, task);
299-
}
279+
mockTransportService.addRequestHandlingBehavior(ComputeService.DATA_ACTION_NAME, (handler, request, channel, task) -> {
280+
DataNodeRequest dataNodeRequest = (DataNodeRequest) request;
281+
for (ShardId shardId : dataNodeRequest.shardIds()) {
282+
queriedIndices.add(shardId.getIndexName());
300283
}
301-
);
284+
handler.messageReceived(request, channel, task);
285+
});
302286
}
303287
try {
304288
for (int i = 0; i < numIndices; i++) {

0 commit comments

Comments
 (0)