@Test public void testRrdArchiveOne() throws Exception { createMockVariationRrds(null); RrdDb rrd = new RrdDb(m_variation); TimeSeriesDataSource archive = new RrdArchive(rrd.getArchive(1), Arrays.asList(rrd.getDsNames())); final int expectedArchiveSize = 1488; final int expectedArchiveStep = 3600; final long end = getMidnightInSeconds(m_baseTime); final long start = (end - ((expectedArchiveSize - 1) * expectedArchiveStep)); assertEquals(end, archive.getEndTime()); assertEquals(start, archive.getStartTime()); assertEquals(expectedArchiveStep, archive.getNativeStep()); List<RrdEntry> entries = archive.getData(expectedArchiveStep); assertEquals(expectedArchiveSize, entries.size()); assertEquals(start, entries.get(0).getTimestamp()); assertEquals(end, entries.get(expectedArchiveSize - 1).getTimestamp()); assertEquals(0.601111111111111D, entries.get(0).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(0.634444444444445D, entries.get(1).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(1.334444444444445D, entries.get(expectedArchiveSize - 2).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(1.301111111111111D, entries.get(expectedArchiveSize - 1).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertTrue(Double.isNaN(entries.get(0).getValue("b"))); List<RrdEntry> halfEntries = archive.getData(expectedArchiveStep / 2); assertEquals(expectedArchiveSize * 2, halfEntries.size()); assertEquals(start, halfEntries.get(0).getTimestamp()); assertEquals(end + (expectedArchiveStep / 2), halfEntries.get((expectedArchiveSize * 2) - 1).getTimestamp()); assertEquals(0.601111111111111D, halfEntries.get(0).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(0.601111111111111D, halfEntries.get(1).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(1.301111111111111D, halfEntries.get((expectedArchiveSize * 2) - 2).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(1.301111111111111D, halfEntries.get((expectedArchiveSize * 2) - 1).getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertTrue(Double.isNaN(halfEntries.get(0).getValue("b"))); for (int i = 0; i < halfEntries.size(); i++) { final RrdEntry halfEntry = halfEntries.get(i); final RrdEntry entry = entries.get(i/2); assertEquals(halfEntry.getTimestamp(), entry.getTimestamp() + ((i % 2) * (expectedArchiveStep / 2))); assertEquals(halfEntry.getValue("a"), entry.getValue("a"), ACCEPTABLE_DOUBLE_DELTA); assertEquals(halfEntry.getValue("b"), entry.getValue("b"), ACCEPTABLE_DOUBLE_DELTA); } }
public List<String> getDsNames(final File rrdFile) throws ConverterException { try { final RrdDb db = new RrdDb(rrdFile.getAbsolutePath(), true); return Arrays.asList(db.getDsNames()); } catch (final Exception e) { LogUtils.debugf(JRobinConverter.class, e, "error reading file %s", rrdFile); throw new ConverterException(e); } }
JRobinConverter { public List<String> getDsNames(final File rrdFile) throws ConverterException { try { final RrdDb db = new RrdDb(rrdFile.getAbsolutePath(), true); return Arrays.asList(db.getDsNames()); } catch (final Exception e) { LogUtils.debugf(JRobinConverter.class, e, "error reading file %s", rrdFile); throw new ConverterException(e); } } }
JRobinConverter { public List<String> getDsNames(final File rrdFile) throws ConverterException { try { final RrdDb db = new RrdDb(rrdFile.getAbsolutePath(), true); return Arrays.asList(db.getDsNames()); } catch (final Exception e) { LogUtils.debugf(JRobinConverter.class, e, "error reading file %s", rrdFile); throw new ConverterException(e); } }  }
JRobinConverter { public List<String> getDsNames(final File rrdFile) throws ConverterException { try { final RrdDb db = new RrdDb(rrdFile.getAbsolutePath(), true); return Arrays.asList(db.getDsNames()); } catch (final Exception e) { LogUtils.debugf(JRobinConverter.class, e, "error reading file %s", rrdFile); throw new ConverterException(e); } }  static void main(final String[] args); void execute(final String[] args); List<File> getMatchingGroupRrds(final File rrdGroupFile); List<String> getDsNames(final File rrdFile); List<String> getRras(final File rrdFile); Map<String, Integer> getDsIndexes(final RrdDb rrd); void consolidateRrdFile(final File groupFile, final File outputFile); List<File> findRrds(final File topDirectory); List<File> findGroupRrds(final File topDirectory); void findRrds(final File directory, final List<File> files); File createTempRrd(final File rrdFile); boolean moveFileSafely(final File in, final File out); }
JRobinConverter { public List<String> getDsNames(final File rrdFile) throws ConverterException { try { final RrdDb db = new RrdDb(rrdFile.getAbsolutePath(), true); return Arrays.asList(db.getDsNames()); } catch (final Exception e) { LogUtils.debugf(JRobinConverter.class, e, "error reading file %s", rrdFile); throw new ConverterException(e); } }  static void main(final String[] args); void execute(final String[] args); List<File> getMatchingGroupRrds(final File rrdGroupFile); List<String> getDsNames(final File rrdFile); List<String> getRras(final File rrdFile); Map<String, Integer> getDsIndexes(final RrdDb rrd); void consolidateRrdFile(final File groupFile, final File outputFile); List<File> findRrds(final File topDirectory); List<File> findGroupRrds(final File topDirectory); void findRrds(final File directory, final List<File> files); File createTempRrd(final File rrdFile); boolean moveFileSafely(final File in, final File out);  }