diff --git a/integration-tests/mybatis/pom.xml b/integration-tests/mybatis/pom.xml index 9243f2d594fc..3be4067f9e01 100644 --- a/integration-tests/mybatis/pom.xml +++ b/integration-tests/mybatis/pom.xml @@ -59,6 +59,10 @@ io.quarkus quarkus-jdbc-h2 + + org.awaitility + awaitility + diff --git a/integration-tests/mybatis/src/main/java/org/apache/camel/quarkus/component/mybatis/it/MybatisResource.java b/integration-tests/mybatis/src/main/java/org/apache/camel/quarkus/component/mybatis/it/MybatisResource.java index 550b982144a3..b5e45e2ba865 100644 --- a/integration-tests/mybatis/src/main/java/org/apache/camel/quarkus/component/mybatis/it/MybatisResource.java +++ b/integration-tests/mybatis/src/main/java/org/apache/camel/quarkus/component/mybatis/it/MybatisResource.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @@ -37,6 +38,9 @@ import org.apache.camel.ProducerTemplate; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.quarkus.component.mybatis.it.entity.Account; +import org.hamcrest.Matchers; + +import static org.awaitility.Awaitility.await; @Path("/mybatis") @ApplicationScoped @@ -137,6 +141,11 @@ public List consumer() throws Exception { context.getRouteController().startRoute("mybatis-consumer"); MockEndpoint.assertIsSatisfied(context); - return template.requestBody("mybatis:selectProcessedAccounts?statementType=SelectList", null, List.class); + List body = await() + .atMost(1, TimeUnit.SECONDS) + .until(() -> template.requestBody("mybatis:selectProcessedAccounts?statementType=SelectList", null, List.class), + Matchers.notNullValue()); + + return body; } }