Skip to content

Commit

Permalink
Fix #4781 Intermittent failure of MyBatisConsumerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfeng committed Apr 14, 2023
1 parent 8c368fa commit bd98715
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions integration-tests/mybatis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}

0 comments on commit bd98715

Please sign in to comment.