From cfdff4edc529984deea27067578810498541321c Mon Sep 17 00:00:00 2001 From: gtully Date: Fri, 25 Nov 2016 10:37:58 +0000 Subject: [PATCH] [AMQ-6518] - fix up aveMessageSize dest stat and test --- .../main/java/org/apache/activemq/plugin/StatisticsBroker.java | 2 +- .../org/apache/activemq/plugin/BrokerStatisticsPluginTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java index 9e41138ce1..7476c3ec9e 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java @@ -120,7 +120,7 @@ public class StatisticsBroker extends BrokerFilter { statsMessage.setLong("inflightCount", stats.getInflight().getCount()); statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount()); // we are okay with the size without decimals so cast to long - statsMessage.setLong("averageMessageSize", (long) stats.getMessageSize().getAveragePerSecond()); + statsMessage.setLong("averageMessageSize", (long) stats.getMessageSize().getAverageSize()); statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage()); statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage()); statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit()); diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java index b2e4bddfe5..b003a161e7 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java @@ -117,6 +117,8 @@ public class BrokerStatisticsPluginTest extends TestCase{ assertTrue(reply.getMapNames().hasMoreElements()); assertTrue(reply.getJMSTimestamp() > 0); assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority()); + assertTrue(reply.getLong("averageMessageSize") > 0); + /* for (Enumeration e = reply.getMapNames();e.hasMoreElements();) { String name = e.nextElement().toString();