Skip to content

Commit 95281f5

Browse files
Remove redundant parallel invocations of JsonbBuilder in JpaTestBase
Fixes #7895
1 parent 97176ad commit 95281f5

File tree

1 file changed

+11
-8
lines changed
  • integration-tests/jpa/src/test/java/org/apache/camel/quarkus/component/jpa/it

1 file changed

+11
-8
lines changed

integration-tests/jpa/src/test/java/org/apache/camel/quarkus/component/jpa/it/JpaTestBase.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import io.restassured.RestAssured;
2323
import io.restassured.http.ContentType;
24+
import jakarta.json.bind.Jsonb;
2425
import jakarta.json.bind.JsonbBuilder;
2526
import org.apache.camel.quarkus.component.jpa.it.model.Fruit;
2627
import org.eclipse.microprofile.config.Config;
@@ -81,7 +82,7 @@ public void testProducerNativeQuery() {
8182

8283
@Test
8384
public void testConsumer() {
84-
IntStream.range(1, 3).parallel().forEach((id) -> {
85+
IntStream.range(1, 3).forEach((id) -> {
8586
await().atMost(10L, TimeUnit.SECONDS).until(() -> findFruit(id).getProcessed());
8687
});
8788

@@ -157,12 +158,14 @@ public void testJpaMessageIdRepository() {
157158
.body("size()", is(3));
158159
}
159160

160-
public Fruit findFruit(int id) {
161-
return JsonbBuilder.create().fromJson(
162-
RestAssured.get("/jpa/fruit/" + id)
163-
.then()
164-
.statusCode(200)
165-
.extract().body().asString(),
166-
Fruit.class);
161+
public Fruit findFruit(int id) throws Exception {
162+
try (Jsonb jsonb = JsonbBuilder.create()) {
163+
return jsonb.fromJson(
164+
RestAssured.get("/jpa/fruit/" + id)
165+
.then()
166+
.statusCode(200)
167+
.extract().body().asString(),
168+
Fruit.class);
169+
}
167170
}
168171
}

0 commit comments

Comments
 (0)