test getAttribute
This commit is contained in:
parent
9756e558fc
commit
8240ca58d4
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue