[hornetq-commits] JBoss hornetq SVN: r9343 - in trunk: tests/src/org/hornetq/tests/integration/management and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jun 17 04:14:15 EDT 2010


Author: jmesnil
Date: 2010-06-17 04:14:13 -0400 (Thu, 17 Jun 2010)
New Revision: 9343

Modified:
   trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
   trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java
Log:
https://jira.jboss.org/browse/HORNETQ-420: HDR_OPERATION_SUCCEEDED not set to true when retrieving an attribute value

* set the header on the reply message after successfully retrieving the attribute value

Modified: trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java	2010-06-16 14:03:30 UTC (rev 9342)
+++ trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java	2010-06-17 08:14:13 UTC (rev 9343)
@@ -462,6 +462,8 @@
                Object result = getAttribute(resourceName, attribute);
 
                ManagementHelper.storeResult(reply, result);
+               
+               reply.putBooleanProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED, true);
             }
             catch (Exception e)
             {

Modified: trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java	2010-06-16 14:03:30 UTC (rev 9342)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java	2010-06-17 08:14:13 UTC (rev 9343)
@@ -114,7 +114,7 @@
       server.stop();
    }
 
-   public void testHandleManagementMessageWithUnknowAttribute() throws Exception
+   public void testHandleManagementMessageWithUnknownAttribute() throws Exception
    {
       Configuration conf = new ConfigurationImpl();
       conf.setJMXManagementEnabled(false);
@@ -125,6 +125,26 @@
       // invoke attribute and operation on the server
       ServerMessage message = new ServerMessageImpl(1, 100);
 
+      ManagementHelper.putAttribute(message, ResourceNames.CORE_SERVER, "started");
+
+      ServerMessage reply = server.getManagementService().handleMessage(message);
+
+      Assert.assertTrue(ManagementHelper.hasOperationSucceeded(reply));
+      Assert.assertTrue((Boolean)ManagementHelper.getResult(reply));
+      server.stop();
+   }
+   
+   public void testHandleManagementMessageWithKnownAttribute() throws Exception
+   {
+      Configuration conf = new ConfigurationImpl();
+      conf.setJMXManagementEnabled(false);
+
+      HornetQServer server = HornetQServers.newHornetQServer(conf, false);
+      server.start();
+
+      // invoke attribute and operation on the server
+      ServerMessage message = new ServerMessageImpl(1, 100);
+
       ManagementHelper.putAttribute(message, ResourceNames.CORE_SERVER, "attribute.Does.Not.Exist");
 
       ServerMessage reply = server.getManagementService().handleMessage(message);



More information about the hornetq-commits mailing list