test getAttribute

This commit is contained in:
Doug MacEachern 2008-10-09 05:53:13 +00:00
parent 9756e558fc
commit 8240ca58d4
1 changed files with 14 additions and 0 deletions

View File

@ -18,8 +18,11 @@
package org.hyperic.sigar.test; package org.hyperic.sigar.test;
import java.util.Iterator;
import java.util.Set; import java.util.Set;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanInfo;
import javax.management.MBeanServer; import javax.management.MBeanServer;
import javax.management.ObjectName; import javax.management.ObjectName;
@ -56,5 +59,16 @@ public class TestMx extends SigarTestCase {
server.queryNames(new ObjectName("sigar:*"), null); server.queryNames(new ObjectName("sigar:*"), null);
assertGtZeroTrace("beans.size", beans.size()); assertGtZeroTrace("beans.size", beans.size());
for (Iterator it=beans.iterator(); it.hasNext();) {
ObjectName name = (ObjectName)it.next();
MBeanInfo info = server.getMBeanInfo(name);
MBeanAttributeInfo[] attrs = info.getAttributes();
for (int k = 0; k < attrs.length; k++) {
String attr = attrs[k].getName();
Object o = server.getAttribute(name, attr);
traceln(name + ":" + attr + "=" + o);
}
}
} }
} }