You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/05/18 13:31:17 UTC

[2/2] activemq-artemis git commit: ARTEMIS-1173: Don't set routing type if null

ARTEMIS-1173: Don't set routing type if null


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

Branch: refs/heads/master
Commit: 4f1308d2f0e54ab1f4187c9493263f887c624363
Parents: cc81cdf
Author: Ulf Lilleengen <lu...@redhat.com>
Authored: Thu May 18 12:38:33 2017 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 18 09:31:07 2017 -0400

----------------------------------------------------------------------
 .../artemis/protocol/amqp/broker/AMQPMessage.java       |  3 ++-
 .../tests/integration/amqp/AmqpMessageDivertsTest.java  | 12 +++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4f1308d2/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
index d447ecd..db39c06 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
@@ -279,8 +279,9 @@ public class AMQPMessage extends RefCountMessage {
       parseHeaders();
       if (routingType == null) {
          removeSymbol(AMQPMessageSupport.ROUTING_TYPE);
+      } else {
+         setSymbol(AMQPMessageSupport.ROUTING_TYPE, routingType.getType());
       }
-      setSymbol(AMQPMessageSupport.ROUTING_TYPE, routingType.getType());
       return this;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4f1308d2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java
index f895c86..ed7b110 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.amqp;
 
 import java.util.concurrent.TimeUnit;
 
+import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
@@ -32,10 +33,19 @@ public class AmqpMessageDivertsTest extends AmqpClientTestSupport {
 
    @Test(timeout = 60000)
    public void testQueueReceiverReadMessageWithDivert() throws Exception {
+      runQueueReceiverReadMessageWithDivert(DivertConfigurationRoutingType.ANYCAST.toString());
+   }
+
+   @Test(timeout = 60000)
+   public void testQueueReceiverReadMessageWithDivertDefaultRouting() throws Exception {
+      runQueueReceiverReadMessageWithDivert(ActiveMQDefaultConfiguration.getDefaultDivertRoutingType());
+   }
+
+   public void runQueueReceiverReadMessageWithDivert(String routingType) throws Exception {
       final String forwardingAddress = getQueueName() + "Divert";
       final SimpleString simpleForwardingAddress = SimpleString.toSimpleString(forwardingAddress);
       server.createQueue(simpleForwardingAddress, RoutingType.ANYCAST, simpleForwardingAddress, null, true, false);
-      server.getActiveMQServerControl().createDivert("name", "routingName", getQueueName(), forwardingAddress, true, null, null, DivertConfigurationRoutingType.ANYCAST.toString());
+      server.getActiveMQServerControl().createDivert("name", "routingName", getQueueName(), forwardingAddress, true, null, null, routingType);
 
       sendMessages(getQueueName(), 1);