1 15 package org.apache.hivemind.management; 16 17 import javax.management.MBeanServer ; 18 import javax.management.ObjectInstance ; 19 import javax.management.ObjectName ; 20 21 import org.apache.hivemind.Registry; 22 import org.apache.hivemind.xml.XmlTestCase; 23 24 30 public class TestPerformanceMonitorFactory extends XmlTestCase 31 { 32 35 public void testIntegration() throws Exception 36 { 37 Registry registry = buildFrameworkRegistry("testPerformanceMonitorFactory.xml"); 38 39 Calculator calculator = (Calculator) registry.getService(Calculator.class); 41 calculator.getSum(); 42 43 MBeanServer mbeanServer = (MBeanServer ) registry.getService(MBeanServer .class); 45 ObjectName objectName = new ObjectName ( 46 "hivemind:module=test.management,type=service,id=Calculator,decorator=PerformanceCollector"); 47 ObjectInstance instance = mbeanServer.getObjectInstance(objectName); 48 assertNotNull(instance); 49 50 calculator.add(123); 52 53 54 56 registry.shutdown(); 57 } 58 59 } | Popular Tags |