Skip to content

Commit 0cb6c0a

Browse files
author
Hendrik Muhs
committed
use Stream.of
1 parent a039c1b commit 0cb6c0a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ protected IterationResult<Integer> doProcess(SearchResponse searchResponse) {
192192

193193
++processOps;
194194
if (processOps == 5) {
195-
return new IterationResult<>(Collections.singletonList(new IndexRequest()).stream(), processOps, true);
195+
return new IterationResult<>(Stream.of(new IndexRequest()), processOps, true);
196196
}
197197
else if (processOps % 2 == 0) {
198198
return new IterationResult<>(Stream.empty(), processOps, false);
199199
}
200200

201-
return new IterationResult<>(Collections.singletonList(new IndexRequest()).stream(), processOps, false);
201+
return new IterationResult<>(Stream.of(new IndexRequest()), processOps, false);
202202
}
203203

204204
@Override

x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerStateTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import java.util.concurrent.TimeUnit;
6464
import java.util.concurrent.atomic.AtomicReference;
6565
import java.util.function.Consumer;
66+
import java.util.stream.Stream;
6667

6768
import static org.elasticsearch.xpack.core.transform.transforms.DestConfigTests.randomDestConfig;
6869
import static org.elasticsearch.xpack.core.transform.transforms.SourceConfigTests.randomSourceConfig;
@@ -233,7 +234,7 @@ protected IterationResult<TransformIndexerPosition> doProcess(SearchResponse sea
233234
// pretend that we processed 10k documents for each call
234235
getStats().incrementNumDocuments(10_000);
235236
return new IterationResult<>(
236-
Collections.singletonList(new IndexRequest()).stream(),
237+
Stream.of(new IndexRequest()),
237238
new TransformIndexerPosition(null, null),
238239
false
239240
);

x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import java.util.concurrent.atomic.AtomicBoolean;
6161
import java.util.concurrent.atomic.AtomicReference;
6262
import java.util.function.Consumer;
63+
import java.util.stream.Stream;
6364

6465
import static org.elasticsearch.xpack.core.transform.transforms.DestConfigTests.randomDestConfig;
6566
import static org.elasticsearch.xpack.core.transform.transforms.SourceConfigTests.randomSourceConfig;
@@ -247,7 +248,7 @@ protected IterationResult<TransformIndexerPosition> doProcess(SearchResponse sea
247248
// pretend that we processed 10k documents for each call
248249
getStats().incrementNumDocuments(10_000);
249250
return new IterationResult<>(
250-
Collections.singletonList(new IndexRequest()).stream(),
251+
Stream.of(new IndexRequest()),
251252
new TransformIndexerPosition(null, null),
252253
numberOfLoops == 0
253254
);

0 commit comments

Comments
 (0)