qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1771487 - in /qpid/java/trunk: broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java systests/src/test/java/org/apache/qpid/systest/management/amqp/AmqpManagementTest.java
Date Sat, 26 Nov 2016 13:58:34 GMT
Author: kwall
Date: Sat Nov 26 13:58:34 2016
New Revision: 1771487

URL: http://svn.apache.org/viewvc?rev=1771487&view=rev
Log:
QPID-7533: [Java Broker] Add AMQP management READ operation to return an object's effective
values

Modified:
    qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
    qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/management/amqp/AmqpManagementTest.java

Modified: qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java?rev=1771487&r1=1771486&r2=1771487&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
(original)
+++ qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
Sat Nov 26 13:58:34 2016
@@ -91,6 +91,7 @@ class ManagementNode implements MessageS
     public static final String IDENTITY_ATTRIBUTE = "identity";
     public static final String INDEX_ATTRIBUTE = "index";
     public static final String KEY_ATTRIBUTE = "key";
+    public static final String ACTUALS_ATTRIBUTE = "actuals";
 
     public static final String TYPE_ATTRIBUTE = "type";
     public static final String OPERATION_HEADER = "operation";
@@ -614,8 +615,20 @@ class ManagementNode implements MessageS
         InternalMessageHeader requestHeader = message.getMessageHeader();
 
         final Map<String, Object> headers = requestHeader.getHeaderMap();
-
         ConfiguredObject<?> object = findObject(clazz, headers);
+
+        boolean actuals = true;
+        if(message.getMessageBody() instanceof Map)
+        {
+            @SuppressWarnings("unchecked")
+            Map<String, Object> attributes = (Map<String, Object>) message.getMessageBody();
+            if (attributes.containsKey(ACTUALS_ATTRIBUTE))
+            {
+                Object actualsObject = attributes.get(ACTUALS_ATTRIBUTE);
+                actuals = actualsObject instanceof Boolean ? ((Boolean)actualsObject) : Boolean.parseBoolean(String.valueOf(actualsObject));
+            }
+        }
+
         if(object != null)
         {
             final MutableMessageHeader responseHeader = new MutableMessageHeader();
@@ -625,10 +638,10 @@ class ManagementNode implements MessageS
             responseHeader.setMessageId(UUID.randomUUID().toString());
             responseHeader.setHeader(STATUS_CODE_HEADER, STATUS_CODE_OK);
 
-            // TODO - remove insecure on insecure channel, provide mechanism for requesting
effective rather than actual
+            // TODO - remove insecure on insecure channel
 
             return InternalMessage.createMapMessage(_addressSpace.getMessageStore(), responseHeader,
-                                                    _managementOutputConverter.convertToOutput(object,
true));
+                                                    _managementOutputConverter.convertToOutput(object,
actuals));
         }
         else
         {

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/management/amqp/AmqpManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/management/amqp/AmqpManagementTest.java?rev=1771487&r1=1771486&r2=1771487&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/management/amqp/AmqpManagementTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/management/amqp/AmqpManagementTest.java
Sat Nov 26 13:58:34 2016
@@ -482,6 +482,15 @@ public class AmqpManagementTest extends
         assertEquals("Incorrect response code", 200, responseMessage.getIntProperty("statusCode"));
         checkResponseIsMapType(responseMessage);
         assertEquals("The name of the virtual host is not as expected", "test", getValueFromMapResponse(responseMessage,
"name"));
+
+        message.setBoolean("actuals", false);
+        _producer.send(message);
+        responseMessage = _consumer.receive(getReceiveTimeout());
+        assertNotNull("A response message was not sent", responseMessage);
+        assertTrue("The response message does not have a status code",
+                   Collections.list(responseMessage.getPropertyNames()).contains("statusCode"));
+        checkResponseIsMapType(responseMessage);
+        assertNotNull("Derived attribute (productVersion) should be available", getValueFromMapResponse(responseMessage,
"productVersion"));
     }
 
     // create a virtual host from $management



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message