activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelpea...@apache.org
Subject [1/2] activemq-artemis git commit: NO-JIRA cli test fixes
Date Thu, 11 Oct 2018 07:22:18 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 25f3000e1 -> d4ac3c2f8


NO-JIRA cli test fixes

fix pom to not use hard coded version
further close cf's

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

Branch: refs/heads/master
Commit: 755f71e431fe4fd2801291a00c8185490ac5d45e
Parents: 25f3000
Author: Michael André Pearce <michael.andre.pearce@me.com>
Authored: Thu Oct 11 07:02:47 2018 +0100
Committer: Michael André Pearce <michael.andre.pearce@me.com>
Committed: Thu Oct 11 07:11:01 2018 +0100

----------------------------------------------------------------------
 artemis-cli/pom.xml                             |  2 +-
 .../cli/commands/messages/DestAbstract.java     | 45 +++++++++-----------
 .../cli/test/MessageSerializerTest.java         |  4 +-
 3 files changed, 24 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/755f71e4/artemis-cli/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-cli/pom.xml b/artemis-cli/pom.xml
index a8b7a92..d0007bc 100644
--- a/artemis-cli/pom.xml
+++ b/artemis-cli/pom.xml
@@ -149,7 +149,7 @@
       <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>artemis-junit</artifactId>
-         <version>2.7.0-SNAPSHOT</version>
+         <version>${project.version}</version>
          <scope>test</scope>
       </dependency>
    </dependencies>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/755f71e4/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java
index 64c6e66..ff6f71a 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java
@@ -97,20 +97,6 @@ public class DestAbstract extends ConnectionAbstract {
       return new XMLMessageSerializer();
    }
 
-   // FIXME We currently do not support producing to FQQN.  This is a work around.
-   private ClientSession getManagementSession() throws Exception {
-      ServerLocator serverLocator = ActiveMQClient.createServerLocator(brokerURL);
-      ClientSessionFactory sf = serverLocator.createSessionFactory();
-
-      ClientSession managementSession;
-      if (user != null || password != null) {
-         managementSession = sf.createSession(user, password, false, true, true, false, 0);
-      } else {
-         managementSession = sf.createSession(false, true, true);
-      }
-      return managementSession;
-   }
-
    public byte[] getQueueIdFromName(String queueName) throws Exception {
       try {
          ClientMessage message = getQueueAttribute(queueName, "ID");
@@ -124,17 +110,26 @@ public class DestAbstract extends ConnectionAbstract {
    }
 
    protected ClientMessage getQueueAttribute(String queueName, String attribute) throws Exception
{
-      ClientSession managementSession = getManagementSession();
-      managementSession.start();
-
-      try (ClientRequestor requestor = new ClientRequestor(managementSession, "activemq.management"))
{
-         ClientMessage managementMessage = managementSession.createMessage(false);
-         ManagementHelper.putAttribute(managementMessage, ResourceNames.QUEUE + queueName,
attribute);
-         managementSession.start();
-         ClientMessage reply = requestor.request(managementMessage);
-         return reply;
-      } finally {
-         managementSession.stop();
+      try (ServerLocator serverLocator = ActiveMQClient.createServerLocator(brokerURL)) {
+         try (ClientSessionFactory sf = serverLocator.createSessionFactory()) {
+            ClientSession managementSession;
+            if (user != null || password != null) {
+               managementSession = sf.createSession(user, password, false, true, true, false,
0);
+            } else {
+               managementSession = sf.createSession(false, true, true);
+            }
+            managementSession.start();
+
+            try (ClientRequestor requestor = new ClientRequestor(managementSession, "activemq.management"))
{
+               ClientMessage managementMessage = managementSession.createMessage(false);
+               ManagementHelper.putAttribute(managementMessage, ResourceNames.QUEUE + queueName,
attribute);
+               managementSession.start();
+               ClientMessage reply = requestor.request(managementMessage);
+               return reply;
+            } finally {
+               managementSession.stop();
+            }
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/755f71e4/artemis-cli/src/test/java/org/apache/activemq/cli/test/MessageSerializerTest.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/MessageSerializerTest.java
b/artemis-cli/src/test/java/org/apache/activemq/cli/test/MessageSerializerTest.java
index df79104..ba0f732 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/MessageSerializerTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/MessageSerializerTest.java
@@ -58,6 +58,7 @@ import static org.junit.Assert.assertTrue;
 public class MessageSerializerTest extends CliTestBase {
 
    private Connection connection;
+   private ActiveMQConnectionFactory cf;
 
    @Before
    @Override
@@ -65,7 +66,7 @@ public class MessageSerializerTest extends CliTestBase {
       setupAuth();
       super.setup();
       startServer();
-      ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
+      cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
       connection = cf.createConnection("admin", "admin");
    }
 
@@ -74,6 +75,7 @@ public class MessageSerializerTest extends CliTestBase {
    public void tearDown() throws Exception {
       try {
          connection.close();
+         cf.close();
       } finally {
          stopServer();
          super.tearDown();


Mime
View raw message