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 2018/09/04 16:55:16 UTC
activemq-artemis git commit: ARTEMIS-2073 - make sure connection gets
set for interceptors
Repository: activemq-artemis
Updated Branches:
refs/heads/2.6.x 1b9062b5b -> 170fa4c76
ARTEMIS-2073 - make sure connection gets set for interceptors
https://issues.apache.org/jira/browse/ARTEMIS-2073
(cherry picked from commit f4b77a2cb4a23241d8d0285a882cdc3cfb55601e)
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/170fa4c7
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/170fa4c7
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/170fa4c7
Branch: refs/heads/2.6.x
Commit: 170fa4c76f41b0d2651e767ca23f065a100d1a49
Parents: 1b9062b
Author: andytaylor <an...@gmail.com>
Authored: Tue Sep 4 11:16:35 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Sep 4 12:55:09 2018 -0400
----------------------------------------------------------------------
.../ActiveMQProtonRemotingConnection.java | 1 +
.../amqp/AmqpSendReceiveInterceptorTest.java | 46 ++++++++++++++++++++
2 files changed, 47 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/170fa4c7/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ActiveMQProtonRemotingConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ActiveMQProtonRemotingConnection.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ActiveMQProtonRemotingConnection.java
index a37b7b7..41f6e78 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ActiveMQProtonRemotingConnection.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ActiveMQProtonRemotingConnection.java
@@ -50,6 +50,7 @@ public class ActiveMQProtonRemotingConnection extends AbstractRemotingConnection
super(transportConnection, executor);
this.manager = manager;
this.amqpConnection = amqpConnection;
+ transportConnection.setProtocolConnection(this);
}
public Executor getExecutor() {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/170fa4c7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveInterceptorTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveInterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveInterceptorTest.java
index 20be85d..8dcb2bf 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveInterceptorTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveInterceptorTest.java
@@ -176,4 +176,50 @@ public class AmqpSendReceiveInterceptorTest extends AmqpClientTestSupport {
receiver.close();
connection.close();
}
+
+ @Test(timeout = 60000)
+ public void testCheckRemotingConnection() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ final boolean[] passed = {false};
+ server.getRemotingService().addIncomingInterceptor(new AmqpInterceptor() {
+ @Override
+ public boolean intercept(AMQPMessage message, RemotingConnection connection) throws ActiveMQException {
+ passed[0] = connection != null;
+ latch.countDown();
+ return true;
+ }
+ });
+
+ AmqpClient client = createAmqpClient();
+ AmqpConnection connection = addConnection(client.connect());
+ AmqpSession session = connection.createSession();
+
+ AmqpSender sender = session.createSender(getTestName());
+ AmqpMessage message = new AmqpMessage();
+ message.setMessageId("msg" + 1);
+ message.setText("Test-Message");
+ sender.send(message);
+
+ assertTrue(latch.await(2, TimeUnit.SECONDS));
+ assertTrue("connection not set", passed[0]);
+
+ final CountDownLatch latch2 = new CountDownLatch(1);
+ server.getRemotingService().addOutgoingInterceptor(new AmqpInterceptor() {
+ @Override
+ public boolean intercept(AMQPMessage packet, RemotingConnection connection) throws ActiveMQException {
+ passed[0] = connection != null;
+ latch2.countDown();
+ return true;
+ }
+ });
+ AmqpReceiver receiver = session.createReceiver(getTestName());
+ receiver.flow(2);
+ AmqpMessage amqpMessage = receiver.receive(5, TimeUnit.SECONDS);
+ assertNotNull(amqpMessage);
+ assertEquals(latch2.getCount(), 0);
+ assertTrue("connection not set", passed[0]);
+ sender.close();
+ receiver.close();
+ connection.close();
+ }
}