[AMQ-6518] - fix up aveMessageSize dest stat and test (cherry picked from commit cfdff4edc529984deea27067578810498541321c)
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/5b6ce12f Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/5b6ce12f Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/5b6ce12f Branch: refs/heads/activemq-5.14.x Commit: 5b6ce12fc473569e7de3c307330ff11e158e49ad Parents: 89209d3 Author: gtully <gary.tu...@gmail.com> Authored: Fri Nov 25 10:37:58 2016 +0000 Committer: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Committed: Mon Dec 5 08:45:56 2016 -0500 ---------------------------------------------------------------------- .../src/main/java/org/apache/activemq/plugin/StatisticsBroker.java | 2 +- .../org/apache/activemq/plugin/BrokerStatisticsPluginTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/5b6ce12f/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java ---------------------------------------------------------------------- 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 9e41138..7476c3e 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()); http://git-wip-us.apache.org/repos/asf/activemq/blob/5b6ce12f/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java ---------------------------------------------------------------------- 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 b2e4bdd..b003a16 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();