activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-565 more JSON fixes
Date Wed, 27 Jul 2016 16:57:30 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 1ecc46b12 -> 53c56efca


ARTEMIS-565 more JSON fixes


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

Branch: refs/heads/master
Commit: a80c2bb442434faff9b26b22538a3b78180729ce
Parents: 1ecc46b
Author: jbertram <jbertram@apache.org>
Authored: Wed Jul 27 08:52:20 2016 -0500
Committer: jbertram <jbertram@apache.org>
Committed: Wed Jul 27 11:53:21 2016 -0500

----------------------------------------------------------------------
 .../management/impl/AddressControlImpl.java     |  2 +-
 .../management/AddressControlUsingCoreTest.java |  2 +-
 .../management/CoreMessagingProxy.java          |  6 +++-
 .../management/QueueControlUsingCoreTest.java   | 32 ++++++++------------
 4 files changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a80c2bb4/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
index 9ea4081..739f4d1 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
@@ -146,7 +146,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
          for (Role role : roles) {
             json.add(role.toJson());
          }
-         return json.toString();
+         return json.build().toString();
       }
       finally {
          blockOnIO();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a80c2bb4/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java
index 83aeb1c..9ccb832 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java
@@ -136,7 +136,7 @@ public class AddressControlUsingCoreTest extends ManagementTestBase {
       newRoles.add(role);
       server.getSecurityRepository().addMatch(address.toString(), newRoles);
 
-      roles = (Object[]) proxy.retrieveAttributeValue("roles");
+      roles = (Object[]) proxy.retrieveAttributeValue("roles", String.class);
       Assert.assertEquals(1, roles.length);
       Object[] r = (Object[]) roles[0];
       Assert.assertEquals(role.getName(), r[0]);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a80c2bb4/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/CoreMessagingProxy.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/CoreMessagingProxy.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/CoreMessagingProxy.java
index e9168a2..c519b7f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/CoreMessagingProxy.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/CoreMessagingProxy.java
@@ -73,12 +73,16 @@ public class CoreMessagingProxy {
    }
 
    public Object invokeOperation(final String operationName, final Object... args) throws
Exception {
+      return invokeOperation(null, operationName, args);
+   }
+
+   public Object invokeOperation(final Class desiredType, final String operationName, final
Object... args) throws Exception {
       ClientMessage m = session.createMessage(false);
       ManagementHelper.putOperationInvocation(m, resourceName, operationName, args);
       ClientMessage reply = requestor.request(m);
       if (reply != null) {
          if (ManagementHelper.hasOperationSucceeded(reply)) {
-            return ManagementHelper.getResult(reply);
+            return ManagementHelper.getResult(reply, desiredType);
          }
          else {
             throw new Exception((String) ManagementHelper.getResult(reply));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a80c2bb4/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
index f27eaf1..230941f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
@@ -62,7 +62,7 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public long countMessages(final String filter) throws Exception {
-            return ((Number) proxy.invokeOperation("countMessages", filter)).longValue();
+            return (Long) proxy.invokeOperation(Long.class, "countMessages", filter);
          }
 
          @Override
@@ -72,7 +72,7 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public int expireMessages(final String filter) throws Exception {
-            return (Integer) proxy.invokeOperation("expireMessages", filter);
+            return (Integer) proxy.invokeOperation(Integer.class, "expireMessages", filter);
          }
 
          @Override
@@ -82,7 +82,7 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public int getConsumerCount() {
-            return (Integer) proxy.retrieveAttributeValue("consumerCount");
+            return (Integer) proxy.retrieveAttributeValue("consumerCount", Integer.class);
          }
 
          @Override
@@ -92,7 +92,7 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public int getDeliveringCount() {
-            return (Integer) proxy.retrieveAttributeValue("deliveringCount");
+            return (Integer) proxy.retrieveAttributeValue("deliveringCount", Integer.class);
          }
 
          @Override
@@ -107,22 +107,22 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public long getMessageCount() {
-            return ((Number) proxy.retrieveAttributeValue("messageCount")).longValue();
+            return (Long) proxy.retrieveAttributeValue("messageCount", Long.class);
          }
 
          @Override
          public long getMessagesAdded() {
-            return (Integer) proxy.retrieveAttributeValue("messagesAdded");
+            return (Integer) proxy.retrieveAttributeValue("messagesAdded", Integer.class);
          }
 
          @Override
          public long getMessagesAcknowledged() {
-            return (Integer) proxy.retrieveAttributeValue("messagesAcknowledged");
+            return (Integer) proxy.retrieveAttributeValue("messagesAcknowledged", Integer.class);
          }
 
          @Override
          public long getMessagesExpired() {
-            return ((Number) proxy.retrieveAttributeValue("messagesExpired")).longValue();
+            return (Long) proxy.retrieveAttributeValue("messagesExpired", Long.class);
          }
 
          @Override
@@ -201,13 +201,7 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
           */
          @Override
          public Long getFirstMessageAge() throws Exception {
-            Object value = proxy.invokeOperation("getFirstMessageAge");
-
-            if (value instanceof Integer) {
-               return ((Integer) value).longValue();
-            }
-
-            return (Long) value;
+            return (Long) proxy.invokeOperation(Long.class, "getFirstMessageAge");
          }
 
          @Override
@@ -247,7 +241,7 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public int moveMessages(final String filter, final String otherQueueName) throws
Exception {
-            return (Integer) proxy.invokeOperation("moveMessages", filter, otherQueueName);
+            return (Integer) proxy.invokeOperation(Integer.class, "moveMessages", filter,
otherQueueName);
          }
 
          @Override
@@ -284,17 +278,17 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
 
          @Override
          public int retryMessages() throws Exception {
-            return (Integer) proxy.invokeOperation("retryMessages");
+            return (Integer) proxy.invokeOperation(Integer.class, "retryMessages");
          }
 
          @Override
          public int removeMessages(final String filter) throws Exception {
-            return (Integer) proxy.invokeOperation("removeMessages", filter);
+            return (Integer) proxy.invokeOperation(Integer.class, "removeMessages", filter);
          }
 
          @Override
          public int removeMessages(final int limit, final String filter) throws Exception
{
-            return (Integer) proxy.invokeOperation("removeMessages", limit, filter);
+            return (Integer) proxy.invokeOperation(Integer.class, "removeMessages", limit,
filter);
          }
 
          @Override


Mime
View raw message