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/10/11 19:11:00 UTC
activemq-artemis git commit: NO-JIRA cli test fixes
Repository: activemq-artemis
Updated Branches:
refs/heads/2.6.x 4dbe0ecbb -> 475ff33b1
NO-JIRA cli test fixes
fix pom to not use hard coded version
further close cf's
(cherry picked from commit 755f71e431fe4fd2801291a00c8185490ac5d45e)
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/475ff33b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/475ff33b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/475ff33b
Branch: refs/heads/2.6.x
Commit: 475ff33b1ef5b92c345f73a92f224cb0cd3178bb
Parents: 4dbe0ec
Author: Michael André Pearce <mi...@me.com>
Authored: Thu Oct 11 07:02:47 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Oct 11 15:10:55 2018 -0400
----------------------------------------------------------------------
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/475ff33b/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/475ff33b/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/475ff33b/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();