You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/28 08:28:46 UTC

[GitHub] [camel-quarkus] essobedo commented on a diff in pull request #3747: Fix MockEndpoint usage in Infinispan tests

essobedo commented on code in PR #3747:
URL: https://github.com/apache/camel-quarkus/pull/3747#discussion_r860622997


##########
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:
   Hi, if [CAMEL-17948](https://issues.apache.org/jira/browse/CAMEL-17948) is not clear enough for you, let me know, I will try to clarify it a little bit more



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org