You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zh...@apache.org on 2023/04/14 05:32:02 UTC
[camel-quarkus] 02/02: Fix #4781 Intermittent failure of MyBatisConsumerTest
This is an automated email from the ASF dual-hosted git repository.
zhfeng pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit bd987152594191c52e2f2e6300e8f3d70ea5c767
Author: Zheng Feng <zh...@gmail.com>
AuthorDate: Fri Apr 14 10:45:06 2023 +0800
Fix #4781 Intermittent failure of MyBatisConsumerTest
---
integration-tests/mybatis/pom.xml | 4 ++++
.../camel/quarkus/component/mybatis/it/MybatisResource.java | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/integration-tests/mybatis/pom.xml b/integration-tests/mybatis/pom.xml
index 9243f2d594..3be4067f9e 100644
--- a/integration-tests/mybatis/pom.xml
+++ b/integration-tests/mybatis/pom.xml
@@ -59,6 +59,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-h2</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ </dependency>
<!-- test dependencies -->
<dependency>
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 550b982144..b5e45e2ba8 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 @@ package org.apache.camel.quarkus.component.mybatis.it;
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.CamelContext;
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 class MybatisResource {
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;
}
}