Search in sources :

Example 1 with NullRrdStrategy

use of org.opennms.netmgt.rrd.NullRrdStrategy in project opennms by OpenNMS.

the class NodeSnmpResourceTypeTest method canGetChildByName.

@Test
public void canGetChildByName() throws IOException {
    final RrdStrategy<?, ?> rrdStrategy = new NullRrdStrategy();
    final FilesystemResourceStorageDao resourceStorageDao = new FilesystemResourceStorageDao();
    resourceStorageDao.setRrdDirectory(tempFolder.getRoot());
    resourceStorageDao.setRrdStrategy(rrdStrategy);
    File nodeSnmpFolder = tempFolder.newFolder("snmp", "1");
    File rrd = new File(nodeSnmpFolder, "ds" + rrdStrategy.getDefaultFileExtension());
    rrd.createNewFile();
    final NodeSnmpResourceType nodeSnmpResourceType = new NodeSnmpResourceType(resourceStorageDao);
    final OnmsResource parent = getNodeResource(1);
    final OnmsResource resource = nodeSnmpResourceType.getChildByName(parent, new String(""));
    assertEquals("node[1].nodeSnmp[]", resource.getId().toString());
    assertEquals(parent, resource.getParent());
}
Also used : OnmsResource(org.opennms.netmgt.model.OnmsResource) NullRrdStrategy(org.opennms.netmgt.rrd.NullRrdStrategy) File(java.io.File) Test(org.junit.Test)

Example 2 with NullRrdStrategy

use of org.opennms.netmgt.rrd.NullRrdStrategy in project opennms by OpenNMS.

the class GenericIndexResourceTypeTest method setUp.

@Before
public void setUp() throws IOException {
    m_fileAnticipator = new FileAnticipator();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    m_resourceStorageDao.setRrdDirectory(m_fileAnticipator.getTempDir());
    m_resourceStorageDao.setRrdStrategy(new NullRrdStrategy());
}
Also used : NullRrdStrategy(org.opennms.netmgt.rrd.NullRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator) Before(org.junit.Before)

Aggregations

NullRrdStrategy (org.opennms.netmgt.rrd.NullRrdStrategy)2 File (java.io.File)1 Before (org.junit.Before)1 Test (org.junit.Test)1 OnmsResource (org.opennms.netmgt.model.OnmsResource)1 FileAnticipator (org.opennms.test.FileAnticipator)1