You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2014/04/30 10:44:54 UTC
git commit: https://issues.apache.org/jira/browse/AMQ-5165 - fix for
destination stats name
Repository: activemq
Updated Branches:
refs/heads/trunk 0b7d9420c -> 4eb5097f2
https://issues.apache.org/jira/browse/AMQ-5165 - fix for destination stats name
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/4eb5097f
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/4eb5097f
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/4eb5097f
Branch: refs/heads/trunk
Commit: 4eb5097f22a1ca2a3901a343f4dbb1e4b5a45b4a
Parents: 0b7d942
Author: Dejan Bosanac <de...@nighttale.net>
Authored: Wed Apr 30 10:44:28 2014 +0200
Committer: Dejan Bosanac <de...@nighttale.net>
Committed: Wed Apr 30 10:44:47 2014 +0200
----------------------------------------------------------------------
.../activemq/plugin/StatisticsBroker.java | 3 ++
.../plugin/BrokerStatisticsPluginTest.java | 30 ++++++++++++++++++--
2 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/4eb5097f/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 9eabd4f..fdffa02 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
@@ -97,6 +97,9 @@ public class StatisticsBroker extends BrokerFilter {
RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
if (destStats) {
String destinationName = physicalName.substring(STATS_DESTINATION_PREFIX.length(), physicalName.length());
+ if (destinationName.startsWith(".")) {
+ destinationName = destinationName.substring(1);
+ }
String destinationQuery = destinationName.replace(STATS_DENOTE_END_LIST,"");
boolean endListMessage = !destinationName.equals(destinationQuery);
ActiveMQDestination queryDestination = ActiveMQDestination.createDestination(destinationQuery,msgDest.getDestinationType());
http://git-wip-us.apache.org/repos/asf/activemq/blob/4eb5097f/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 f99953a..b2e4bdd 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
@@ -112,7 +112,33 @@ public class BrokerStatisticsPluginTest extends TestCase{
msg.setJMSReplyTo(replyTo);
producer.send(query,msg);
- MapMessage reply = (MapMessage) consumer.receive();
+ MapMessage reply = (MapMessage) consumer.receive(10 * 1000);
+ assertNotNull(reply);
+ assertTrue(reply.getMapNames().hasMoreElements());
+ assertTrue(reply.getJMSTimestamp() > 0);
+ assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority());
+ /*
+ for (Enumeration e = reply.getMapNames();e.hasMoreElements();) {
+ String name = e.nextElement().toString();
+ System.err.println(name+"="+reply.getObject(name));
+ }
+ */
+ }
+
+ public void testDestinationStatsWithDot() throws Exception{
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Queue replyTo = session.createTemporaryQueue();
+ MessageConsumer consumer = session.createConsumer(replyTo);
+ Queue testQueue = session.createQueue("Test.Queue");
+ MessageProducer producer = session.createProducer(null);
+ Queue query = session.createQueue(StatisticsBroker.STATS_DESTINATION_PREFIX + "." + testQueue.getQueueName());
+ Message msg = session.createMessage();
+
+ producer.send(testQueue,msg);
+
+ msg.setJMSReplyTo(replyTo);
+ producer.send(query,msg);
+ MapMessage reply = (MapMessage) consumer.receive(10 * 1000);
assertNotNull(reply);
assertTrue(reply.getMapNames().hasMoreElements());
assertTrue(reply.getJMSTimestamp() > 0);
@@ -140,7 +166,7 @@ public class BrokerStatisticsPluginTest extends TestCase{
msg.setJMSReplyTo(replyTo);
producer.send(query,msg);
- MapMessage reply = (MapMessage) consumer.receive();
+ MapMessage reply = (MapMessage) consumer.receive(10 * 1000);
assertNotNull(reply);
assertTrue(reply.getMapNames().hasMoreElements());
assertTrue(reply.getJMSTimestamp() > 0);