Search in sources :

Example 1 with RrdDefinition

use of org.opennms.netmgt.rrd.tcp.TcpRrdStrategy.RrdDefinition in project opennms by OpenNMS.

the class TcpRrdStrategyTest method createRrdFile.

public File createRrdFile() throws Exception {
    String rrdFileBase = "foo";
    m_fileAnticipator.initialize();
    // This is so the RrdUtils.getExtension() call in the strategy works
    // Properties properties = new Properties();
    // properties.setProperty("org.opennms.rrd.fileExtension", rrdExtension);
    // RrdConfig.getInstance().setProperties(properties);
    List<RrdDataSource> dataSources = new ArrayList<RrdDataSource>();
    dataSources.add(new RrdDataSource("bar", RrdAttributeType.GAUGE, 3000, "U", "U"));
    List<String> rraList = new ArrayList<String>();
    rraList.add("RRA:AVERAGE:0.5:1:2016");
    File tempDir = m_fileAnticipator.getTempDir();
    // Create an '/rrd/snmp/1' directory in the temp directory so that the
    // RRDs created by the test will have a realistic path
    File rrdDir = m_fileAnticipator.tempDir(m_fileAnticipator.tempDir(m_fileAnticipator.tempDir(tempDir, "rrd"), "snmp"), "1");
    RrdDefinition def = m_strategy.createDefinition("hello!", rrdDir.getAbsolutePath(), rrdFileBase, 300, dataSources, rraList);
    m_strategy.createFile(def);
    return m_fileAnticipator.expecting(rrdDir, rrdFileBase + RRD_EXTENSION);
}
Also used : RrdDefinition(org.opennms.netmgt.rrd.tcp.TcpRrdStrategy.RrdDefinition) ArrayList(java.util.ArrayList) RrdDataSource(org.opennms.netmgt.rrd.RrdDataSource) File(java.io.File)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 RrdDataSource (org.opennms.netmgt.rrd.RrdDataSource)1 RrdDefinition (org.opennms.netmgt.rrd.tcp.TcpRrdStrategy.RrdDefinition)1