Search in sources :

Example 1 with JMXDataCollectionConfigDao

use of org.opennms.netmgt.config.JMXDataCollectionConfigDao in project opennms by OpenNMS.

the class JMXCollectorTest method setUp.

@Before
public void setUp() throws Exception {
    System.setProperty("opennms.home", new File("src/test/resources").getAbsolutePath());
    jmxDataCollectionConfigDao = new JMXDataCollectionConfigDao();
    jmxNodeInfo = new JMXNodeInfo(0);
    jmxCollector = new JMXCollectorImpl();
    jmxCollector.setJmxConfigDao(new JmxConfigDaoJaxb());
    jmxCollector.setJmxDataCollectionConfigDao(jmxDataCollectionConfigDao);
    platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
    ObjectName objectName = new ObjectName("org.opennms.netmgt.collectd.jmxhelper:type=JmxTest");
    JmxTestMBean testMBean = new JmxTest();
    platformMBeanServer.registerMBean(testMBean, objectName);
    collectionAgent = new MockCollectionAgent(1, "node", "fs", "fid", InetAddress.getLoopbackAddress());
}
Also used : JmxConfigDaoJaxb(org.opennms.netmgt.dao.jmx.JmxConfigDaoJaxb) JMXDataCollectionConfigDao(org.opennms.netmgt.config.JMXDataCollectionConfigDao) JmxTest(org.opennms.netmgt.collectd.jmxhelper.JmxTest) MockCollectionAgent(org.opennms.core.collection.test.MockCollectionAgent) JmxTestMBean(org.opennms.netmgt.collectd.jmxhelper.JmxTestMBean) File(java.io.File) ObjectName(javax.management.ObjectName) Before(org.junit.Before)

Example 2 with JMXDataCollectionConfigDao

use of org.opennms.netmgt.config.JMXDataCollectionConfigDao in project opennms by OpenNMS.

the class JMXCollectorComplianceTest method getRequiredBeans.

@Override
public Map<String, Object> getRequiredBeans() {
    MBeanServer mbeanServer = new MBeanServer();
    JmxConfigDao jmxConfigDao = mock(JmxConfigDao.class, RETURNS_DEEP_STUBS);
    final String host = InetAddrUtils.str(InetAddrUtils.getLocalHostAddress());
    when(jmxConfigDao.getConfig().lookupMBeanServer(host, JmxServerConnector.DEFAULT_OPENNMS_JMX_PORT)).thenReturn(mbeanServer);
    JmxCollection collection = new JmxCollection();
    JMXDataCollectionConfigDao jmxCollectionDao = mock(JMXDataCollectionConfigDao.class, RETURNS_DEEP_STUBS);
    when(jmxCollectionDao.getJmxCollection(COLLECTION)).thenReturn(collection);
    return new ImmutableMap.Builder<String, Object>().put("jmxConfigDao", jmxConfigDao).put("jmxDataCollectionConfigDao", jmxCollectionDao).build();
}
Also used : JMXDataCollectionConfigDao(org.opennms.netmgt.config.JMXDataCollectionConfigDao) JmxCollection(org.opennms.netmgt.config.collectd.jmx.JmxCollection) JmxConfigDao(org.opennms.netmgt.dao.jmx.JmxConfigDao) ImmutableMap(com.google.common.collect.ImmutableMap) MBeanServer(org.opennms.netmgt.config.jmx.MBeanServer)

Aggregations

JMXDataCollectionConfigDao (org.opennms.netmgt.config.JMXDataCollectionConfigDao)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 ObjectName (javax.management.ObjectName)1 Before (org.junit.Before)1 MockCollectionAgent (org.opennms.core.collection.test.MockCollectionAgent)1 JmxTest (org.opennms.netmgt.collectd.jmxhelper.JmxTest)1 JmxTestMBean (org.opennms.netmgt.collectd.jmxhelper.JmxTestMBean)1 JmxCollection (org.opennms.netmgt.config.collectd.jmx.JmxCollection)1 MBeanServer (org.opennms.netmgt.config.jmx.MBeanServer)1 JmxConfigDao (org.opennms.netmgt.dao.jmx.JmxConfigDao)1 JmxConfigDaoJaxb (org.opennms.netmgt.dao.jmx.JmxConfigDaoJaxb)1