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:18 UTC
[2/5] activemq-artemis git commit: ARTEMIS-1416 Fix regressions in
Joram tests
ARTEMIS-1416 Fix regressions in Joram tests
This closes #1621
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ec13ed6d
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ec13ed6d
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ec13ed6d
Branch: refs/heads/master
Commit: ec13ed6df0fb2c92ab9a9c9e6af9259a07be0fdb
Parents: f3ace6a
Author: Howard Gao <ho...@gmail.com>
Authored: Wed Nov 1 23:34:05 2017 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Nov 3 18:26:03 2017 -0400
----------------------------------------------------------------------
.../protocol/amqp/broker/AMQPSessionCallback.java | 9 +++++++--
.../amqp/proton/ProtonServerReceiverContext.java | 18 +++++++++++++++---
.../jtests/jms/framework/PubSubTestCase.java | 3 +--
3 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec13ed6d/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 7a7a41e..53b9b4f 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
@@ -48,6 +48,7 @@ import org.apache.activemq.artemis.protocol.amqp.logger.ActiveMQAMQPProtocolMess
import org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext;
import org.apache.activemq.artemis.protocol.amqp.proton.AMQPSessionContext;
import org.apache.activemq.artemis.protocol.amqp.proton.AmqpSupport;
+import org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerReceiverContext;
import org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerSenderContext;
import org.apache.activemq.artemis.protocol.amqp.sasl.PlainSASLResult;
import org.apache.activemq.artemis.protocol.amqp.sasl.SASLResult;
@@ -386,7 +387,8 @@ public class AMQPSessionCallback implements SessionCallback {
((ServerConsumer) consumer).receiveCredits(-1);
}
- public void serverSend(final Transaction transaction,
+ public void serverSend(final ProtonServerReceiverContext context,
+ final Transaction transaction,
final Receiver receiver,
final Delivery delivery,
String address,
@@ -405,7 +407,10 @@ public class AMQPSessionCallback implements SessionCallback {
}
//here check queue-autocreation
- if (!bindingQuery(address, RoutingType.ANYCAST)) {
+ org.apache.qpid.proton.amqp.messaging.Target target = (org.apache.qpid.proton.amqp.messaging.Target) receiver.getRemoteTarget();
+
+ RoutingType routingType = context.getRoutingType(receiver);
+ if (!bindingQuery(address, routingType)) {
throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.addressDoesntExist();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec13ed6d/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 bcab2ea..014b9f9 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,6 +58,8 @@ 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,12 +100,13 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
if (target != null) {
if (target.getDynamic()) {
+ defRoutingType = getRoutingType(target.getCapabilities());
// if dynamic we have to create the node (queue) and set the address on the target, the node is temporary and
// will be deleted on closing of the session
address = sessionSPI.tempQueueName();
try {
- sessionSPI.createTemporaryQueue(address, getRoutingType(target.getCapabilities()));
+ sessionSPI.createTemporaryQueue(address, defRoutingType);
} catch (ActiveMQSecurityException e) {
throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingTempDestination(e.getMessage());
} catch (Exception e) {
@@ -118,8 +121,9 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
address = target.getAddress();
if (address != null && !address.isEmpty()) {
+ defRoutingType = getRoutingType(target.getCapabilities());
try {
- if (!sessionSPI.bindingQuery(address, getRoutingType(target.getCapabilities()))) {
+ if (!sessionSPI.bindingQuery(address, defRoutingType)) {
throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.addressDoesntExist();
}
} catch (ActiveMQAMQPNotFoundException e) {
@@ -177,6 +181,14 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
flow(amqpCredits, minCreditRefresh);
}
+ public RoutingType getRoutingType(Receiver receiver) {
+ if (receiver == this.receiver) {
+ return defRoutingType;
+ }
+ 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);
+ }
+
private RoutingType getRoutingType(Symbol[] symbols) {
if (symbols != null) {
for (Symbol symbol : symbols) {
@@ -223,7 +235,7 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
tx = this.sessionSPI.getTransaction(txState.getTxnId(), false);
}
- sessionSPI.serverSend(tx, receiver, delivery, address, delivery.getMessageFormat(), data);
+ sessionSPI.serverSend(this, tx, receiver, delivery, address, delivery.getMessageFormat(), data);
flow(amqpCredits, minCreditRefresh);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec13ed6d/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
index d5792c0..d340024 100644
--- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
+++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
@@ -161,8 +161,7 @@ public abstract class PubSubTestCase extends JMSTestCase {
subscriberTCF = null;
subscriberSession = null;
subscriberConnection = null;
+ super.tearDown();
}
-
- super.tearDown();
}
}