gnodet-bot commented on code in PR #27201:
URL: https://github.com/apache/camel/pull/27201#discussion_r4184256243


##########
components/camel-milo/src/test/java/org/apache/camel/component/milo/MonitorItemTest.java:
##########
@@ -113,12 +180,40 @@ public void testMonitorItem1() throws Exception {
         await().pollDelay(time, TimeUnit.MILLISECONDS).untilAsserted(() -> {
         });
 
+        // now wait for requestedPublishingInterval so we are sure the 3 
values are passed
+        await().pollDelay(10 * time, TimeUnit.MILLISECONDS).untilAsserted(() 
-> {
+        });
+        for (int i = 1; i <= 15; i++) {
+            this.producer1.sendBody("Message " + i);
+            await().pollDelay(time, TimeUnit.MILLISECONDS).untilAsserted(() -> 
{
+            });
+        }
+        this.producer1.sendBody("Done");
+
         // tests
         testBody(this.test1Endpoint.message(0), assertGoodValue("Foo"));
         testBody(this.test1Endpoint.message(1), assertGoodValue("Bar"));
         testBody(this.test1Endpoint.message(2), assertGoodValue("Baz"));
 
         // assert
         MockEndpoint.assertIsSatisfied(context, timeout, 
TimeUnit.MILLISECONDS);
+
+        // The number of messages must be less than the number sent, because 
from the 15 messages sent at last part,
+        // about 10 should be in one requestedPublishingInterval, everything 
over 4 should be dropped
+        int count1 = this.test1Endpoint.getReceivedCounter();
+        assertTrue(count1 < 18, "No messages have been dropped, but should 
because of queueSize");
+
+        // get the last exchange, this must be the last one, if messages are 
dropped it must be some it between
+        List<Exchange> receivedExchanges = 
this.test1Endpoint.getReceivedExchanges();
+        Exchange last = receivedExchanges.get(receivedExchanges.size() - 1);
+        assertGoodValue("Done").accept((DataValue) last.getIn().getBody());
+
+        // The second client should get no more than 6 messages
+        int count2 = this.test2Endpoint.getReceivedCounter();
+        assertTrue(count2 <= 6, "Not enough messages have been dropped, but 
should because of queueSize");

Review Comment:
   💡 Truncated comment — missing the rest of the sentence.
   
   ```suggestion
           // The third client has requestedPublishingInterval=1000, so with 
queueSize=3 some messages should be dropped
   ```



-- 
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]

Reply via email to