ConfigurationAdminMBeanHandler extends AbstractCompendiumHandler { @Override protected StandardMBean constructInjectMBean(Object targetService) { ConfigurationAdminMBean caMBean = new org.apache.aries.jmx.cm.ConfigurationAdmin( (org.osgi.service.cm.ConfigurationAdmin) targetService); StandardMBean mbean = null; try { mbean = new StandardMBean(caMBean, ConfigurationAdminMBean.class); } catch (NotCompliantMBeanException e) { Logger logger = agentContext.getLogger(); logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + ConfigurationAdminMBean.class.getName(), e); } return mbean; } ConfigurationAdminMBeanHandler(JMXAgentContext agentContext);   }
@Test public void testConstructInjectMBean() { BundleContext bundleContext = mock(BundleContext.class); Logger agentLogger = mock(Logger.class); JMXAgentContext agentContext = new JMXAgentContext(bundleContext, null, agentLogger); ConfigurationAdmin cAdmin = mock(ConfigurationAdmin.class); ConfigurationAdminMBeanHandler handler = new ConfigurationAdminMBeanHandler(agentContext); StandardMBean mbean = handler.constructInjectMBean(cAdmin); assertNotNull(mbean); }