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/11/04 03:51:19 UTC

[3/5] activemq-artemis git commit: ARTEMIS-1416 Fixing qpid AMQP tests

ARTEMIS-1416 Fixing qpid AMQP tests

This will fix tests from https://git-wip-us.apache.org/repos/asf/qpid-interop-test.git

Notice that the previous 2 committs here are needed


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

Branch: refs/heads/master
Commit: 0e9b39c82522cb487b7e22d9e650ddb8d4091731
Parents: ec13ed6
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Nov 2 15:55:04 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Nov 3 18:27:24 2017 -0400

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        |  8 ++++----
 .../proton/ProtonServerReceiverContext.java     | 21 ++++++++++++--------
 2 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0e9b39c8/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
index 53b9b4f..667d57a 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
@@ -269,9 +269,11 @@ public class AMQPSessionCallback implements SessionCallback {
          queueQueryResult = serverSession.executeQueueQuery(SimpleString.toSimpleString(queueName));
       }
 
-      if (queueQueryResult.getRoutingType() != routingType) {
+      // if auto-create we will return whatever type was used before
+      if (!queueQueryResult.isAutoCreated() && queueQueryResult.getRoutingType() != routingType) {
          throw new IllegalStateException("Incorrect Routing Type for queue, expecting: " + routingType);
       }
+
       return queueQueryResult;
    }
 
@@ -407,9 +409,7 @@ public class AMQPSessionCallback implements SessionCallback {
       }
 
       //here check queue-autocreation
-      org.apache.qpid.proton.amqp.messaging.Target target = (org.apache.qpid.proton.amqp.messaging.Target) receiver.getRemoteTarget();
-
-      RoutingType routingType = context.getRoutingType(receiver);
+      RoutingType routingType = context.getRoutingType(receiver, RoutingType.ANYCAST);
       if (!bindingQuery(address, routingType)) {
          throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.addressDoesntExist();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0e9b39c8/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
index 014b9f9..15318d5 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
@@ -58,8 +58,6 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
 
    protected final AMQPSessionCallback sessionSPI;
 
-   private RoutingType defRoutingType;
-
    /*
     The maximum number of credits we will allocate to clients.
     This number is also used by the broker when refresh client credits.
@@ -98,6 +96,8 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
       // We don't currently support SECOND so enforce that the answer is anlways FIRST
       receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
 
+      RoutingType defRoutingType;
+
       if (target != null) {
          if (target.getDynamic()) {
             defRoutingType = getRoutingType(target.getCapabilities());
@@ -181,15 +181,16 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
       flow(amqpCredits, minCreditRefresh);
    }
 
-   public RoutingType getRoutingType(Receiver receiver) {
-      if (receiver == this.receiver) {
-         return defRoutingType;
-      }
+   public RoutingType getRoutingType(Receiver receiver, RoutingType defaultType) {
       org.apache.qpid.proton.amqp.messaging.Target target = (org.apache.qpid.proton.amqp.messaging.Target) receiver.getRemoteTarget();
-      return target != null ? getRoutingType(target.getCapabilities()) : getRoutingType((Symbol[])null);
+      return target != null ? getRoutingType(target.getCapabilities(), defaultType) : getRoutingType((Symbol[])null, defaultType);
    }
 
    private RoutingType getRoutingType(Symbol[] symbols) {
+      return getRoutingType(symbols, null);
+   }
+
+   private RoutingType getRoutingType(Symbol[] symbols, RoutingType defaultType) {
       if (symbols != null) {
          for (Symbol symbol : symbols) {
             if (AmqpSupport.TEMP_TOPIC_CAPABILITY.equals(symbol) || AmqpSupport.TOPIC_CAPABILITY.equals(symbol)) {
@@ -200,7 +201,11 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
          }
       }
 
-      return sessionSPI.getDefaultRoutingType(address);
+      if (defaultType != null) {
+         return defaultType;
+      } else {
+         return sessionSPI.getDefaultRoutingType(address);
+      }
    }
 
    /*