cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1298601 - in /cxf/trunk/rt/management/src: main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java test/java/org/apache/cxf/management/InstrumentationManagerTest.java test/resources/managed-spring3.xml
Date Thu, 08 Mar 2012 21:46:33 GMT
Author: ay
Date: Thu Mar  8 21:46:32 2012
New Revision: 1298601

URL: http://svn.apache.org/viewvc?rev=1298601&view=rev
Log:
[CXF-4170] JMX InstrumentationManagerImpl's properties may not be read correctly in standalone
mode after 2.5.2

Added:
    cxf/trunk/rt/management/src/test/resources/managed-spring3.xml   (with props)
Modified:
    cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
    cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/InstrumentationManagerTest.java

Modified: cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java?rev=1298601&r1=1298600&r2=1298601&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
(original)
+++ cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Thu Mar  8 21:46:32 2012
@@ -389,17 +389,17 @@ public class InstrumentationManagerImpl 
     
     private void readJMXProperties(Bus b) {
         if (b != null) {
-            persistentBusId = getBusProperty(b, "bus.jmx.persistentBusId", null);
+            persistentBusId = getBusProperty(b, "bus.jmx.persistentBusId", persistentBusId);
             mbeanServerName = 
-                getBusProperty(b, "bus.jmx.serverName", ManagementConstants.DEFAULT_DOMAIN_NAME);
+                getBusProperty(b, "bus.jmx.serverName", mbeanServerName);
             usePlatformMBeanServer = 
-                Boolean.valueOf(getBusProperty(b, "bus.jmx.usePlatformMBeanServer", null));
+                getBusProperty(b, "bus.jmx.usePlatformMBeanServer", usePlatformMBeanServer);
             createMBServerConnectorFactory = 
-                Boolean.valueOf(getBusProperty(b, "bus.jmx.createMBServerConnectorFactory",
null));
-            daemon = Boolean.valueOf(getBusProperty(b, "bus.jmx.daemon", null));
-            threaded = Boolean.valueOf(getBusProperty(b, "bus.jmx.threaded", null));
-            enabled = Boolean.valueOf(getBusProperty(b, "bus.jmx.enabled", null));
-            jmxServiceURL = getBusProperty(b, "bus.jmx.JMXServiceURL", null);
+                getBusProperty(b, "bus.jmx.createMBServerConnectorFactory", createMBServerConnectorFactory);
+            daemon = getBusProperty(b, "bus.jmx.daemon", daemon);
+            threaded = getBusProperty(b, "bus.jmx.threaded", threaded);
+            enabled = getBusProperty(b, "bus.jmx.enabled", enabled);
+            jmxServiceURL = getBusProperty(b, "bus.jmx.JMXServiceURL", jmxServiceURL);
         }
     }
 
@@ -407,5 +407,10 @@ public class InstrumentationManagerImpl 
         String v = (String)b.getProperty(key);
         return v != null ? v : dflt;
     }
+
+    private static boolean getBusProperty(Bus b, String key, boolean dflt) {
+        String v = (String)b.getProperty(key);
+        return v != null ? Boolean.valueOf(v) : dflt;
+    }
 }
 

Modified: cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/InstrumentationManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/InstrumentationManagerTest.java?rev=1298601&r1=1298600&r2=1298601&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/InstrumentationManagerTest.java
(original)
+++ cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/InstrumentationManagerTest.java
Thu Mar  8 21:46:32 2012
@@ -65,6 +65,16 @@ public class InstrumentationManagerTest 
     }
     
     @Test
+    public void testInstrumentationEnabledSetBeforeBusSet() {
+        SpringBusFactory factory = new SpringBusFactory();
+        bus =  factory.createBus("managed-spring3.xml", true);
+        im = bus.getExtension(InstrumentationManager.class);
+        assertTrue("Instrumentation Manager should not be null", im != null);
+        MBeanServer mbs = im.getMBeanServer();
+        assertNotNull("MBeanServer should be available.", mbs);
+    }
+    
+    @Test
     // try to get WorkQueue information
     public void testWorkQueueInstrumentation() throws Exception {
         SpringBusFactory factory = new SpringBusFactory();

Added: cxf/trunk/rt/management/src/test/resources/managed-spring3.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/test/resources/managed-spring3.xml?rev=1298601&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/trunk/rt/management/src/test/resources/managed-spring3.xml
------------------------------------------------------------------------------
    svn:mime-type = application/xml



Mime
View raw message