Search in sources :

Example 1 with JRobinRrdStrategy

use of org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy in project opennms by OpenNMS.

the class DefaultRrdDaoIntegrationTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    m_rrdStrategy = new JRobinRrdStrategy();
    m_fileAnticipator = new FileAnticipator();
    m_dao = new DefaultRrdDao();
    m_dao.setRrdStrategy(m_rrdStrategy);
    m_dao.setRrdBaseDirectory(m_fileAnticipator.getTempDir());
    m_dao.setRrdBinaryPath("/bin/true");
    m_dao.afterPropertiesSet();
}
Also used : JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator)

Example 2 with JRobinRrdStrategy

use of org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy in project opennms by OpenNMS.

the class BasePersisterTest method setUp.

@Before
public void setUp() throws Exception {
    MockUtil.println("------------ Begin Test " + m_testName.getMethodName() + " --------------------------");
    MockLogAppender.setupLogging();
    m_fileAnticipator = new FileAnticipator();
    m_rrdStrategy = new JRobinRrdStrategy();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    m_resourceStorageDao.setRrdDirectory(m_fileAnticipator.getTempDir());
    m_intf = new OnmsIpInterface();
    m_node = new OnmsNode();
    m_node.setId(1);
    m_intf.setId(25);
    m_intf.setNode(m_node);
    m_intf.setIpAddress(InetAddressUtils.addr("1.1.1.1"));
    m_ifDao = m_easyMockUtils.createMock(IpInterfaceDao.class);
    m_serviceParams = new ServiceParameters(new HashMap<String, Object>());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) HashMap(java.util.HashMap) FilesystemResourceStorageDao(org.opennms.netmgt.dao.support.FilesystemResourceStorageDao) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator) IpInterfaceDao(org.opennms.netmgt.dao.api.IpInterfaceDao) Before(org.junit.Before)

Example 3 with JRobinRrdStrategy

use of org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy in project opennms by OpenNMS.

the class RrdPersistOperationBuilderTest method setUp.

@Before
public void setUp() throws Exception {
    MockLogAppender.setupLogging();
    m_rrdStrategy = new JRobinRrdStrategy();
    m_fileAnticipator = new FileAnticipator();
    m_intf = new OnmsIpInterface();
    m_node = new OnmsNode();
    m_node.setId(1);
    m_intf.setNode(m_node);
    m_intf.setIpAddress(InetAddressUtils.addr("1.1.1.1"));
    m_intf.setId(27);
    m_ifDao = EasyMock.createMock(IpInterfaceDao.class);
    EasyMock.expect(m_ifDao.load(m_intf.getId())).andReturn(m_intf).anyTimes();
    EasyMock.replay(m_ifDao);
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator) IpInterfaceDao(org.opennms.netmgt.dao.api.IpInterfaceDao) Before(org.junit.Before)

Example 4 with JRobinRrdStrategy

use of org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy in project opennms by OpenNMS.

the class SnmpCollectorIT method setUp.

@Before
public void setUp() throws Exception {
    MockServiceCollector.setDelegate(null);
    MockLogAppender.setupLogging();
    m_rrdStrategy = new JRobinRrdStrategy();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    File snmpRrdDirectory = (File) m_context.getAttribute("rrdDirectory");
    m_resourceStorageDao.setRrdDirectory(snmpRrdDirectory.getParentFile());
    m_testHostName = InetAddressUtils.str(InetAddress.getLocalHost());
    OnmsIpInterface iface = null;
    OnmsNode testNode = null;
    Collection<OnmsNode> testNodes = m_nodeDao.findByLabel(TEST_NODE_LABEL);
    if (testNodes == null || testNodes.size() < 1) {
        NetworkBuilder builder = new NetworkBuilder();
        builder.addNode(TEST_NODE_LABEL).setId(1).setSysObjectId(".1.3.6.1.4.1.1588.2.1.1.1");
        builder.addSnmpInterface(1).setIfName("lo0").setPhysAddr("00:11:22:33:44");
        builder.addSnmpInterface(2).setIfName("gif0").setPhysAddr("00:11:22:33:45").setIfType(55);
        builder.addSnmpInterface(3).setIfName("stf0").setPhysAddr("00:11:22:33:46").setIfType(57);
        builder.addSnmpInterface(6).setIfName("fw0").setPhysAddr("44:33:22:11:00").setIfType(144).setCollectionEnabled(true).addIpInterface(m_testHostName).setIsSnmpPrimary("P");
        testNode = builder.getCurrentNode();
        assertNotNull(testNode);
        m_nodeDao.save(testNode);
        m_nodeDao.flush();
    } else {
        testNode = testNodes.iterator().next();
    }
    Set<OnmsIpInterface> ifaces = testNode.getIpInterfaces();
    assertEquals(1, ifaces.size());
    iface = ifaces.iterator().next();
    SnmpPeerFactory.setInstance(m_snmpPeerFactory);
    SnmpCollector collector = new SnmpCollector();
    collector.initialize();
    m_collectionSpecification = CollectorTestUtils.createCollectionSpec("SNMP", collector, "default");
    m_collectionAgent = DefaultSnmpCollectionAgent.create(iface.getId(), m_ipInterfaceDao, m_transactionManager);
    m_agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.getLocalHostAddress());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) NetworkBuilder(org.opennms.netmgt.model.NetworkBuilder) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) FilesystemResourceStorageDao(org.opennms.netmgt.dao.support.FilesystemResourceStorageDao) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) File(java.io.File) Before(org.junit.Before)

Example 5 with JRobinRrdStrategy

use of org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy in project opennms by OpenNMS.

the class NMS7963IT 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);
}
Also used : NodeDao(org.opennms.netmgt.dao.api.NodeDao) OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsAssetRecord(org.opennms.netmgt.model.OnmsAssetRecord) FilesystemResourceStorageDao(org.opennms.netmgt.dao.support.FilesystemResourceStorageDao) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) MockCollectionAgent(org.opennms.core.collection.test.MockCollectionAgent) FileSystemResource(org.springframework.core.io.FileSystemResource) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) DefaultDataCollectionConfigDao(org.opennms.netmgt.config.DefaultDataCollectionConfigDao) Before(org.junit.Before)

Aggregations

JRobinRrdStrategy (org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy)14 Before (org.junit.Before)11 FilesystemResourceStorageDao (org.opennms.netmgt.dao.support.FilesystemResourceStorageDao)8 OnmsNode (org.opennms.netmgt.model.OnmsNode)7 FileAnticipator (org.opennms.test.FileAnticipator)6 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)5 File (java.io.File)4 RrdPersisterFactory (org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory)4 NodeDao (org.opennms.netmgt.dao.api.NodeDao)4 MockCollectionAgent (org.opennms.core.collection.test.MockCollectionAgent)3 IpInterfaceDao (org.opennms.netmgt.dao.api.IpInterfaceDao)3 NetworkBuilder (org.opennms.netmgt.model.NetworkBuilder)3 FileSystemResource (org.springframework.core.io.FileSystemResource)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DefaultDataCollectionConfigDao (org.opennms.netmgt.config.DefaultDataCollectionConfigDao)2 ResourceTypesDao (org.opennms.netmgt.config.api.ResourceTypesDao)2 LocationMonitorDao (org.opennms.netmgt.dao.api.LocationMonitorDao)2 FilterDao (org.opennms.netmgt.filter.api.FilterDao)2 OnmsAssetRecord (org.opennms.netmgt.model.OnmsAssetRecord)2