jbonofre commented on code in PR #1668:
URL: https://github.com/apache/activemq/pull/1668#discussion_r2800114960


##########
activemq-unit-tests/src/test/java/org/apache/activemq/usecases/AdvisoryViaNetworkTest.java:
##########
@@ -270,18 +272,27 @@ public void testPrefetchSizePercent() throws Exception {
             createConsumer("A", new ActiveMQTopic("A.FOO"));
         }
 
-        assertDeqInflight(7, 3);
+        assertDeqInflight(7, 3, new ActiveMQTopic("A.FOO"));
     }
 
-    private void assertDeqInflight(final int dequeue, final int inflight) 
throws Exception {
+    private void assertDeqInflight(final int dequeue, final int inflight,
+                                   final ActiveMQTopic... topics) throws 
Exception {
         assertTrue("deq and inflight as expected", Wait.waitFor(new 
Wait.Condition() {
             @Override
             public boolean isSatisified() throws Exception {
-                RegionBroker regionBroker = (RegionBroker) 
brokers.get("A").broker.getRegionBroker();
-                LOG.info("A Deq:" + 
regionBroker.getDestinationStatistics().getDequeues().getCount());
-                LOG.info("A Inflight:" + 
regionBroker.getDestinationStatistics().getInflight().getCount());
-                return 
regionBroker.getDestinationStatistics().getDequeues().getCount() == dequeue
-                        && 
regionBroker.getDestinationStatistics().getInflight().getCount() == inflight;
+                long actualDeq = 0;
+                long actualInflight = 0;
+                for (ActiveMQTopic topic : topics) {
+                    ActiveMQTopic advisory = 
AdvisorySupport.getConsumerAdvisoryTopic(topic);

Review Comment:
   Just for context: what we are testing here is not the global 
`DestinationStatistics`.
   We want to test that the consuming actually increase the `dequeue` (after 
consuming completed) and the `inflight` (when consuming is in progress).
   
   So, it's fine to use that for a specific destination (instead of global).
   
   However, maybe it makes sense to try to keep also the test with global but 
"isolated" to avoid side effect. Just my $0.01.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to