activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: add test case for https://issues.apache.org/jira/browse/AMQ-5752 - fix needs some thought
Date Thu, 30 Apr 2015 15:20:16 GMT
Repository: activemq
Updated Branches:
  refs/heads/master f2c3ebfa0 -> 82200b6e7


add test case for https://issues.apache.org/jira/browse/AMQ-5752 - fix needs some thought


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/82200b6e
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/82200b6e
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/82200b6e

Branch: refs/heads/master
Commit: 82200b6e70e1a93adf023a040eb1737a02c2fd37
Parents: f2c3ebf
Author: gtully <gary.tully@gmail.com>
Authored: Thu Apr 30 16:19:51 2015 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Thu Apr 30 16:19:57 2015 +0100

----------------------------------------------------------------------
 .../apache/activemq/broker/jmx/MBeanTest.java   | 46 ++++++++++++++++++++
 1 file changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/82200b6e/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
index 1a363cc..acf706d 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
@@ -62,6 +62,7 @@ import org.apache.activemq.command.ActiveMQTempQueue;
 import org.apache.activemq.util.JMXSupport;
 import org.apache.activemq.util.URISupport;
 import org.apache.activemq.util.Wait;
+import org.junit.Ignore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -176,6 +177,51 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
         assertEquals("no forwards", 0, queueNew.getForwardCount());
     }
 
+    //Show broken behaviour https://issues.apache.org/jira/browse/AMQ-5752"
+    // points to the need to except on a duplicate or have store.addMessage return bool
+    // need some thought on how best to resolve this
+    public void Broken_testMoveDuplicateDoesNotDelete() throws Exception {
+        connection = connectionFactory.createConnection();
+        useConnection(connection);
+
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName="
+ getDestinationString());
+
+        QueueViewMBean queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
queueViewMBeanName, QueueViewMBean.class, true);
+
+        CompositeData[] compdatalist = queue.browse();
+        int initialQueueSize = compdatalist.length;
+        CompositeData cdata = compdatalist[0];
+        String messageID = (String) cdata.get("JMSMessageID");
+
+        String newDestination = getSecondDestinationString();
+        queue.copyMessageTo(messageID, newDestination);
+
+        compdatalist = queue.browse();
+        int actualCount = compdatalist.length;
+        echo("Current queue size: " + actualCount);
+        assertEquals("no change", initialQueueSize, actualCount);
+
+        echo("Now browsing the second queue");
+
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName="
+ newDestination );
+        QueueViewMBean queueNew = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
queueViewMBeanName, QueueViewMBean.class, true);
+
+        long newQueuesize = queueNew.getQueueSize();
+        assertEquals("Expect one", 1, newQueuesize);
+
+        // try move of same message - should fail on duplicate send
+        boolean moveResult = queue.moveMessageTo(messageID, newDestination);
+        assertFalse("move of duplicate should fail", moveResult);
+
+        newQueuesize = queueNew.getQueueSize();
+        assertEquals("Expect one", 1, newQueuesize);
+
+        compdatalist = queue.browse();
+        actualCount = compdatalist.length;
+        echo("Current queue size: " + actualCount);
+        assertEquals("no change", initialQueueSize, actualCount);
+    }
+
     public void testRemoveMessages() throws Exception {
         ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
brokerName, BrokerViewMBean.class, true);


Mime
View raw message