use of org.opennms.core.collection.test.MockCollectionAgent in project opennms by OpenNMS.
the class HttpDataCollectionIT method setUp.
/**
* Sets the up.
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
DefaultDataCollectionConfigDao dao = new DefaultDataCollectionConfigDao();
dao.setConfigDirectory("src/test/resources/etc/datacollection");
dao.setConfigResource(new FileSystemResource("src/test/resources/etc/datacollection-config.xml"));
dao.afterPropertiesSet();
DataCollectionConfigFactory.setInstance(dao);
m_rrdStrategy = new JRobinRrdStrategy();
m_resourceStorageDao = new FilesystemResourceStorageDao();
m_resourceStorageDao.setRrdDirectory(m_temporaryFolder.getRoot());
m_temporaryFolder.newFolder("snmp");
m_persisterFactory = new RrdPersisterFactory();
m_persisterFactory.setResourceStorageDao(m_resourceStorageDao);
m_persisterFactory.setRrdStrategy(m_rrdStrategy);
m_collectionAgent = new MockCollectionAgent(1, "mynode.local", InetAddrUtils.addr("127.0.0.1"));
m_nodeDao = EasyMock.createMock(NodeDao.class);
OnmsNode node = new OnmsNode();
node.setId(1);
node.setLabel("mynode.local");
node.setAssetRecord(new OnmsAssetRecord());
EasyMock.expect(m_nodeDao.get(1)).andReturn(node).anyTimes();
EasyMock.replay(m_nodeDao);
}
use of org.opennms.core.collection.test.MockCollectionAgent in project opennms by OpenNMS.
the class XmlCollectorITCase method setUp.
/**
* Sets the up.
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
initializeRrdStrategy();
initializeDocumentBuilder();
m_collectionAgent = new MockCollectionAgent(1, "mynode.local", InetAddrUtils.addr("127.0.0.1"));
m_eventProxy = EasyMock.createMock(EventProxy.class);
m_xmlCollectionDao = new XmlDataCollectionConfigDaoJaxb();
Resource resource = new FileSystemResource(getConfigFileName());
m_xmlCollectionDao.setConfigResource(resource);
m_xmlCollectionDao.afterPropertiesSet();
EasyMock.replay(m_eventProxy);
}
use of org.opennms.core.collection.test.MockCollectionAgent 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());
}
Aggregations