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", "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, null);

    return m_fileAnticipator.expecting(rrdDir, rrdFileBase + RRD_EXTENSION);
  }
  @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());
  }
 private File touch(String first, String... more) {
   Path parent = m_fileAnticipator.getTempDir().toPath();
   Path path = parent.resolve(Paths.get(first, more));
   File file = path.toFile();
   file.getParentFile().mkdirs();
   try {
     file.createNewFile();
   } catch (IOException e) {
     throw Throwables.propagate(e);
   }
   assertTrue(file.canRead());
   return file;
 }