Example usage for javax.management.openmbean TabularDataSupport values

List of usage examples for javax.management.openmbean TabularDataSupport values

Introduction

In this page you can find the example usage for javax.management.openmbean TabularDataSupport values.

Prototype

@SuppressWarnings("unchecked") 
public Collection<Object> values() 

Source Link

Document

Returns a collection view of the rows contained in this TabularDataSupport instance.

Usage

From source file:com.dsf.dbxtract.cdc.AppJournalWindowTest.java

@Test(dependsOnMethods = { "testAppWithJournalWindow" })
public void testInfoStatistics() throws Exception {

    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:5000/jmxrmi");
    JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
    MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

    ObjectName mbeanName = new ObjectName("com.dsf.dbxtract:type=InfoMBean");

    TabularDataSupport info = (TabularDataSupport) mbsc.getAttribute(mbeanName, InfoMBean.ATTR_INFO);
    Collection<?> list = info.values();
    boolean hasHandlerEntry = false;
    for (Iterator<?> it = list.iterator(); it.hasNext();) {
        CompositeDataSupport entry = (CompositeDataSupport) it.next();

        if (entry.get("handler").equals(TestWindowHandler.class.getName())) {
            assert (((Long) entry.get("readCount")).longValue() == TEST_SIZE);
            hasHandlerEntry = true;//from w  w w.  j  a  v  a  2  s  .  c  o  m
        }
    }
    assert (hasHandlerEntry);
    jmxc.close();
}