You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2016/04/14 00:54:12 UTC

activemq git commit: https://issues.apache.org/jira/browse/AMQ-6246

Repository: activemq
Updated Branches:
  refs/heads/master aaecdff8b -> 15dc6cc76


https://issues.apache.org/jira/browse/AMQ-6246

Fix loop to not skip the composite split code.

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

Branch: refs/heads/master
Commit: 15dc6cc7659bfacf3ca10c490466a2cf2d3c54de
Parents: aaecdff
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Apr 13 18:53:28 2016 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Apr 13 18:53:28 2016 -0400

----------------------------------------------------------------------
 .../transport/stomp/LegacyFrameTranslator.java  |  7 ++-
 .../stomp/StompCompositeDestinationTest.java    | 46 ++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/15dc6cc7/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
----------------------------------------------------------------------
diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
index 013c1ec..2029f84 100644
--- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
+++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
@@ -214,16 +214,15 @@ public class LegacyFrameTranslator implements FrameTranslator {
                         ActiveMQDestination fallback = ActiveMQDestination.getUnresolvableDestinationTransformer().transform(fallbackName);
                         if (fallback != null) {
                             destinationBuilder.append(fallback.getQualifiedName());
-                            continue;
                         }
                     } catch (JMSException e) {
                         throw new ProtocolException("Illegal destination name: [" + fallbackName + "] -- ActiveMQ STOMP destinations "
                                 + "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/", false, e);
                     }
+                } else {
+                    throw new ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP destinations "
+                                                + "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
                 }
-
-                throw new ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP destinations "
-                                            + "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
             }
 
             if (i < destinations.length - 1) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/15dc6cc7/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java
----------------------------------------------------------------------
diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java
index 223a84a..bc84b56 100644
--- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java
+++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java
@@ -28,6 +28,7 @@ import javax.jms.JMSException;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+import javax.management.ObjectName;
 
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.broker.jmx.BrokerViewMBean;
@@ -234,6 +235,51 @@ public class StompCompositeDestinationTest extends StompTestSupport {
     }
 
     @Test(timeout = 60000)
+    public void testSendMessageToCompositeQueueNoPrefixes() throws Exception {
+        stompConnect();
+
+        String destinationA = "StompA.Queue";
+        String destinationB = "StompB.Queue";
+
+        String frame = "CONNECT\n" +
+                       "login:system\n" +
+                       "passcode:manager\n\n" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
+
+        frame = stompConnection.receiveFrame();
+        assertTrue(frame.startsWith("CONNECTED"));
+
+        frame = "SEND\n" +
+                "destination:" + destinationA + "," + destinationB +
+                "\n\n" + "Hello World" + Stomp.NULL;
+
+        stompConnection.sendFrame(frame);
+
+        final BrokerViewMBean brokerView = getProxyToBroker();
+        assertTrue("Should be two destinations for the dispatch", Wait.waitFor(new Wait.Condition() {
+
+            @Override
+            public boolean isSatisified() throws Exception {
+                for(ObjectName queueName : brokerView.getQueues()) {
+                    LOG.info("Broker Has Queue: {}", queueName);
+                }
+                return brokerView.getQueues().length == 2;
+            }
+        }, TimeUnit.SECONDS.toMillis(30), TimeUnit.MILLISECONDS.toMillis(150)));
+
+        QueueViewMBean viewOfA = getProxyToQueue(destinationA);
+        QueueViewMBean viewOfB = getProxyToQueue(destinationB);
+
+        assertNotNull(viewOfA);
+        assertNotNull(viewOfB);
+
+        assertEquals(1, viewOfA.getQueueSize());
+        assertEquals(1, viewOfB.getQueueSize());
+
+        stompConnection.disconnect();
+    }
+
+    @Test(timeout = 60000)
     public void testSendMessageToCompositeTopic() throws Exception {
         stompConnect();