You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2025/11/03 10:43:39 UTC
(camel-quarkus) 10/11: Remove redundant parallel invocations of JsonbBuilder in JpaTestBase
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch 3.27.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit d2646ae80507fe8ebb741bd1aeec938592f4da88
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Oct 31 10:57:12 2025 +0000
Remove redundant parallel invocations of JsonbBuilder in JpaTestBase
Fixes #7895
---
.../camel/quarkus/component/jpa/it/JpaTestBase.java | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/integration-tests/jpa/src/test/java/org/apache/camel/quarkus/component/jpa/it/JpaTestBase.java b/integration-tests/jpa/src/test/java/org/apache/camel/quarkus/component/jpa/it/JpaTestBase.java
index 873ce244ff..461b47e697 100644
--- a/integration-tests/jpa/src/test/java/org/apache/camel/quarkus/component/jpa/it/JpaTestBase.java
+++ b/integration-tests/jpa/src/test/java/org/apache/camel/quarkus/component/jpa/it/JpaTestBase.java
@@ -21,6 +21,7 @@ import java.util.stream.IntStream;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
+import jakarta.json.bind.Jsonb;
import jakarta.json.bind.JsonbBuilder;
import org.apache.camel.quarkus.component.jpa.it.model.Fruit;
import org.eclipse.microprofile.config.Config;
@@ -81,7 +82,7 @@ public class JpaTestBase {
@Test
public void testConsumer() {
- IntStream.range(1, 3).parallel().forEach((id) -> {
+ IntStream.range(1, 3).forEach((id) -> {
await().atMost(10L, TimeUnit.SECONDS).until(() -> findFruit(id).getProcessed());
});
@@ -157,12 +158,14 @@ public class JpaTestBase {
.body("size()", is(3));
}
- public Fruit findFruit(int id) {
- return JsonbBuilder.create().fromJson(
- RestAssured.get("/jpa/fruit/" + id)
- .then()
- .statusCode(200)
- .extract().body().asString(),
- Fruit.class);
+ public Fruit findFruit(int id) throws Exception {
+ try (Jsonb jsonb = JsonbBuilder.create()) {
+ return jsonb.fromJson(
+ RestAssured.get("/jpa/fruit/" + id)
+ .then()
+ .statusCode(200)
+ .extract().body().asString(),
+ Fruit.class);
+ }
}
}