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 2020/10/30 02:10:01 UTC

[activemq-artemis] 01/02: ARTEMIS-2967 Adding testSimpleConnect back and fixing a possible NPE

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 480197975b34d0048b273624915bc4fbfb2f2933
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu Oct 29 22:01:01 2020 -0400

    ARTEMIS-2967 Adding testSimpleConnect back and fixing a possible NPE
---
 .../artemis/protocol/amqp/connect/AMQPBrokerConnection.java   |  8 +++++---
 .../tests/integration/amqp/connect/AMQPBridgeTest.java        | 11 +++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java
index 39fa196..fadf64f 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java
@@ -154,9 +154,11 @@ public class AMQPBrokerConnection implements ClientConnectionLifeCycleListener,
       server.getConfiguration().registerBrokerPlugin(this);
       try {
 
-         for (AMQPBrokerConnectionElement connectionElement : brokerConnectConfiguration.getConnectionElements()) {
-            if (connectionElement.getType() == AMQPBrokerConnectionAddressType.MIRROR) {
-               installMirrorController((AMQPMirrorBrokerConnectionElement)connectionElement, server);
+         if (brokerConnectConfiguration != null && brokerConnectConfiguration.getConnectionElements() != null) {
+            for (AMQPBrokerConnectionElement connectionElement : brokerConnectConfiguration.getConnectionElements()) {
+               if (connectionElement.getType() == AMQPBrokerConnectionAddressType.MIRROR) {
+                  installMirrorController((AMQPMirrorBrokerConnectionElement) connectionElement, server);
+               }
             }
          }
       } catch (Throwable e) {
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java
index e4b7fbe..085c570 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java
@@ -55,6 +55,17 @@ public class AMQPBridgeTest extends AmqpClientTestSupport {
    }
 
    @Test
+   public void testsSimpleConnect() throws Exception {
+      server.start();
+      server_2 = createServer(AMQP_PORT_2, false);
+
+      AMQPBrokerConnectConfiguration amqpConnection = new AMQPBrokerConnectConfiguration("test", "tcp://localhost:" + AMQP_PORT);
+      server_2.getConfiguration().addAMQPConnection(amqpConnection);
+
+      server_2.start();
+   }
+
+   @Test
    public void testSimpleTransferPush() throws Exception {
       internalTransferPush("TEST", false);
    }