hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r396009 - in /jakarta/hivemind/trunk/jmx/src: java/org/apache/hivemind/management/impl/MBeanRegistryImpl.java test/org/apache/hivemind/management/TestMBeanRegistry.java test/org/apache/hivemind/management/testMBeanRegistry.xml
Date Fri, 21 Apr 2006 21:35:36 GMT
Author: ahuegen
Date: Fri Apr 21 14:35:34 2006
New Revision: 396009

URL: http://svn.apache.org/viewcvs?rev=396009&view=rev
Log:
Fix and test case for Hivemind-171: JMX Support does not work if you use the class directly
as the interface

Modified:
    jakarta/hivemind/trunk/jmx/src/java/org/apache/hivemind/management/impl/MBeanRegistryImpl.java
    jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java
    jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml

Modified: jakarta/hivemind/trunk/jmx/src/java/org/apache/hivemind/management/impl/MBeanRegistryImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/jmx/src/java/org/apache/hivemind/management/impl/MBeanRegistryImpl.java?rev=396009&r1=396008&r2=396009&view=diff
==============================================================================
--- jakarta/hivemind/trunk/jmx/src/java/org/apache/hivemind/management/impl/MBeanRegistryImpl.java
(original)
+++ jakarta/hivemind/trunk/jmx/src/java/org/apache/hivemind/management/impl/MBeanRegistryImpl.java
Fri Apr 21 14:35:34 2006
@@ -127,7 +127,7 @@
         Object mbean;
         try
         {
-            Class managementInterface = servicePoint.getServiceInterface();
+            Class managementInterface = servicePoint.getDeclaredInterface();
             // TODO: Check if ServiceModel is != pool and threaded
             mbean = servicePoint.getService(managementInterface);
             registerMBean(mbean, managementInterface, objectName);

Modified: jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java?rev=396009&r1=396008&r2=396009&view=diff
==============================================================================
--- jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java
(original)
+++ jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java
Fri Apr 21 14:35:34 2006
@@ -87,11 +87,19 @@
         server.registerMBean(mBean2, on2);
         serverControl.setReturnValue(new ObjectInstance(on2, mBean2.getClass().getName()));
 
+        // This is a special case. A class without interface
+        Object mBean3 = registry.getService("test.management.MBean3", MBeanNonInterfaceTestService.class);
+        ObjectName on3 = new ObjectName("hivemind:name=bean3");
+        server.registerMBean(mBean3, on3);
+        serverControl.setReturnValue(new ObjectInstance(on3, mBean3.getClass().getName()));
+        
         // Call from unregisterBean
         server.getObjectInstance(on1);
         serverControl.setReturnValue(oin1);
 
         server.unregisterMBean(on1);
+        // The automatically unregistered beans get unregistered in reverse order
+        server.unregisterMBean(on3);
         server.unregisterMBean(on2);
 
         replayControls();
@@ -158,6 +166,9 @@
         server.registerMBean(null, null);
         serverControl.setThrowable(new MBeanRegistrationException(new Exception(
                 "Registration failed")));
+        server.registerMBean(null, null);
+        serverControl.setThrowable(new MBeanRegistrationException(new Exception(
+        		"Registration failed")));
 
         replayControls();
 
@@ -169,7 +180,8 @@
     }
 
     /**
-     * Ensures that a bean with management interface is registered as StandardMBean
+     * Ensures that a bean that doesn't implement one of the standard JMX 
+     * interfaces (like DynamicMBean) is registered as StandardMBean.
      */
     public void testStandardMBean() throws Exception
     {

Modified: jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml?rev=396009&r1=396008&r2=396009&view=diff
==============================================================================
--- jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml
(original)
+++ jakarta/hivemind/trunk/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml
Fri Apr 21 14:35:34 2006
@@ -25,9 +25,14 @@
     <create-instance class="MBeanTestService" model="primitive" />
   </service-point>
 
+  <service-point id="MBean3" interface="MBeanNonInterfaceTestService">
+    <create-instance class="MBeanNonInterfaceTestService" model="primitive" />
+  </service-point>
+
   <contribution configuration-id="hivemind.management.MBeans">
 	<mbean service-id="MBean1" start-method="start" />
 	<mbean service-id="MBean2" object-name="hivemind:name=bean2" />
+	<mbean service-id="MBean3" object-name="hivemind:name=bean3" />
   </contribution>
  
 </module>



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org


Mime
View raw message