This is an automated email from the ASF dual-hosted git repository.
apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new a1cba94efa Optimize OpensearchResource with stream-based count and
remove unrelated files
a1cba94efa is described below
commit a1cba94efad90a9ed8036d2e126153983d393599
Author: Sanjana <[email protected]>
AuthorDate: Wed Feb 11 00:01:01 2026 +0530
Optimize OpensearchResource with stream-based count and remove unrelated
files
---
.../component/opensearch/it/OpensearchResource.java | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git
a/integration-tests-jvm/opensearch/src/main/java/org/apache/camel/quarkus/component/opensearch/it/OpensearchResource.java
b/integration-tests-jvm/opensearch/src/main/java/org/apache/camel/quarkus/component/opensearch/it/OpensearchResource.java
index f8726e4235..068fc23e0e 100644
---
a/integration-tests-jvm/opensearch/src/main/java/org/apache/camel/quarkus/component/opensearch/it/OpensearchResource.java
+++
b/integration-tests-jvm/opensearch/src/main/java/org/apache/camel/quarkus/component/opensearch/it/OpensearchResource.java
@@ -134,8 +134,8 @@ public class OpensearchResource {
.withHeader(OpensearchConstants.PARAM_INDEX_NAME, index)
.request(MultiGetResponseItem[].class);
- int totalFound = Arrays.asList(responseItem).stream().map(s ->
s.result().found())
- .collect(Collectors.toList()).size();
+ long totalFound = Arrays.stream(responseItem).map(s ->
s.result().found())
+ .count();
return Response.ok(totalFound).build();
}
@@ -170,17 +170,10 @@ public class OpensearchResource {
.withBody(builder)
.request(MultiSearchResponseItem[].class);
- if (response.length > 0) {
- int totalFound = 0;
- for (MultiSearchResponseItem<?> item : response) {
- if (!item.isFailure() && item.isResult() && item.result() !=
null) {
- totalFound++;
- }
- }
- return Response.ok(totalFound).build();
- }
- return Response.ok().build();
-
+ long totalFound = Arrays.stream(response)
+ .filter(item -> !item.isFailure() && item.isResult() &&
item.result() != null)
+ .count();
+ return Response.ok(totalFound).build();
}
@DELETE