aldettinger commented on code in PR #3747:
URL: https://github.com/apache/camel-quarkus/pull/3747#discussion_r857850055
##########
integration-tests/infinispan/src/main/java/org/apache/camel/quarkus/component/infinispan/InfinispanResources.java:
##########
@@ -198,16 +232,24 @@ public void putAllAsync(@QueryParam("component") String
component)
}
@Path("/putIdempotent")
- @POST
- @Consumes(MediaType.TEXT_PLAIN)
- public void putIdempotent(
- @QueryParam("component") String component,
- @QueryParam("messageId") String messageId,
- String content) {
+ @GET
+ public void putIdempotent(@QueryParam("component") String component)
throws InterruptedException {
+ MockEndpoint mockEndpoint =
camelContext.getEndpoint("mock:resultIdempotent", MockEndpoint.class);
+ mockEndpoint.expectedMessageCount(1);
+
+ String messageId = UUID.randomUUID().toString();
String uri = component.equals("infinispan") ? "direct:camelIdempotent"
: "direct:quarkusIdempotent";
- Map<String, Object> headers = getCommonHeaders(component);
- headers.put("MessageId", messageId);
- template.sendBodyAndHeaders(uri, content, headers);
+ try {
+ IntStream.of(1, 10).forEach(value -> {
+ Map<String, Object> headers = getCommonHeaders(component);
+ headers.put("MessageId", messageId);
+ template.sendBodyAndHeaders(uri, "Message " + value, headers);
+ });
+
+ mockEndpoint.assertIsSatisfied(5000);
+ } finally {
+ mockEndpoint.reset();
Review Comment:
Manually calling `reset()` on MockEndpoint generated a race condition in
another test. Due to
[this](https://github.com/apache/camel/blob/main/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockEndpoint.java#L319).
I don't think it applies to the case at hand. I'm just wondering whether it
would generally be better practice to have single usage mock endpoint where
possible. In this PR, maybe we could have single use endpoint by integrating
component name in the mock uri ?
It's not a blocker. Just an idea to share.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]