Skip to content

Commit bd98715

Browse files
committed
Fix #4781 Intermittent failure of MyBatisConsumerTest
1 parent 8c368fa commit bd98715

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

integration-tests/mybatis/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
<groupId>io.quarkus</groupId>
6060
<artifactId>quarkus-jdbc-h2</artifactId>
6161
</dependency>
62+
<dependency>
63+
<groupId>org.awaitility</groupId>
64+
<artifactId>awaitility</artifactId>
65+
</dependency>
6266

6367
<!-- test dependencies -->
6468
<dependency>

integration-tests/mybatis/src/main/java/org/apache/camel/quarkus/component/mybatis/it/MybatisResource.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.List;
2020
import java.util.Map;
21+
import java.util.concurrent.TimeUnit;
2122

2223
import javax.enterprise.context.ApplicationScoped;
2324
import javax.inject.Inject;
@@ -37,6 +38,9 @@
3738
import org.apache.camel.ProducerTemplate;
3839
import org.apache.camel.component.mock.MockEndpoint;
3940
import org.apache.camel.quarkus.component.mybatis.it.entity.Account;
41+
import org.hamcrest.Matchers;
42+
43+
import static org.awaitility.Awaitility.await;
4044

4145
@Path("/mybatis")
4246
@ApplicationScoped
@@ -137,6 +141,11 @@ public List consumer() throws Exception {
137141
context.getRouteController().startRoute("mybatis-consumer");
138142
MockEndpoint.assertIsSatisfied(context);
139143

140-
return template.requestBody("mybatis:selectProcessedAccounts?statementType=SelectList", null, List.class);
144+
List<?> body = await()
145+
.atMost(1, TimeUnit.SECONDS)
146+
.until(() -> template.requestBody("mybatis:selectProcessedAccounts?statementType=SelectList", null, List.class),
147+
Matchers.notNullValue());
148+
149+
return body;
141150
}
142151
}

0 commit comments

Comments
 (0)