1 23 24 29 package com.sun.enterprise.management.monitor; 30 31 import java.io.IOException ; 32 33 import javax.management.ObjectName ; 34 35 import com.sun.appserv.management.base.Util; 36 import com.sun.appserv.management.monitor.JMXMonitorMgr; 37 import com.sun.appserv.management.monitor.AMXStringMonitor; 38 39 40 import com.sun.enterprise.management.AMXTestBase; 41 import com.sun.enterprise.management.Capabilities; 42 43 45 public final class JMXMonitorMgrTest extends AMXTestBase 46 { 47 public 48 JMXMonitorMgrTest( ) 49 { 50 } 51 52 public JMXMonitorMgr 53 getMgr() 54 { 55 return( getDomainRoot().getJMXMonitorMgr() ); 56 } 57 58 public void 59 testGetMgr() 60 { 61 final JMXMonitorMgr mgr = getMgr(); 62 assert( mgr != null ); 63 } 64 65 public void 66 testCreateRemoveStringMonitor() 67 throws IOException 68 { 69 final JMXMonitorMgr mgr = getMgr(); 70 71 final AMXStringMonitor mon = mgr.createStringMonitor( getClass().getName() + "Test" ); 72 final ObjectName objectName = Util.getObjectName( mon ); 73 74 mon.setObservedAttribute( "Group" ); 75 final ObjectName observee = Util.getObjectName( mgr ); 76 assert( observee != null ); 77 mon.addObservedObject( observee ); 78 assert mon.containsObservedObject( observee ); 79 mon.removeObservedObject( observee ); 80 81 assert( getConnection().isRegistered( objectName ) ); 82 mgr.remove( mon.getName() ); 83 assert( ! getConnection().isRegistered( objectName ) ); 84 } 85 } 86 87 88 | Popular Tags |