use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class RrdMetricsRetrieverTest method testMetricsPptReport.
@Test
public void testMetricsPptReport() throws Exception {
String rrdFilename = TEST_DIR + "queryCount_Counter" + RRD_FILE_EXTENSION;
new RrdFileBuilder().rrdFileName(rrdFilename).build();
rrdFilename = TEST_DIR + "queryCount_Gauge" + RRD_FILE_EXTENSION;
long endTime = new RrdFileBuilder().rrdFileName(rrdFilename).dsType(DsType.GAUGE).build();
List<String> metricNames = new ArrayList<String>();
metricNames.add("queryCount_Counter");
metricNames.add("queryCount_Gauge");
MetricsRetriever metricsRetriever = new RrdMetricsRetriever();
OutputStream os = metricsRetriever.createPptReport(metricNames, TEST_DIR, START_TIME, endTime);
InputStream is = new ByteArrayInputStream(((ByteArrayOutputStream) os).toByteArray());
assertThat(is, not(nullValue()));
SlideShow ppt = new SlideShow(is);
Slide[] slides = ppt.getSlides();
assertThat(slides.length, equalTo(2));
verifySlide(slides[0], "queryCount_Counter", true);
verifySlide(slides[1], "queryCount_Gauge", false);
}
use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class RrdMetricsRetrieverTest method testMetricsPptDataWithGauge.
@Test
public void testMetricsPptDataWithGauge() throws Exception {
String rrdFilename = TEST_DIR + "queryCount_Gauge" + RRD_FILE_EXTENSION;
long endTime = new RrdFileBuilder().rrdFileName(rrdFilename).dsType(DsType.GAUGE).build();
MetricsRetriever metricsRetriever = new RrdMetricsRetriever();
OutputStream os = metricsRetriever.createPptData("queryCount", rrdFilename, START_TIME, endTime);
InputStream is = new ByteArrayInputStream(((ByteArrayOutputStream) os).toByteArray());
assertThat(is, not(nullValue()));
SlideShow ppt = new SlideShow(is);
Slide[] slides = ppt.getSlides();
assertThat(slides.length, equalTo(1));
verifySlide(slides[0], "queryCount", false);
}
use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class RrdMetricsRetriever method createPptData.
@Override
public OutputStream createPptData(String metricName, String rrdFilename, long startTime, long endTime) throws IOException, MetricsGraphException {
LOGGER.trace("ENTERING: createPptData");
SlideShow ppt = new SlideShow();
byte[] graph = createGraph(metricName, rrdFilename, startTime, endTime);
MetricData metricData = getMetricData(rrdFilename, startTime, endTime);
createSlide(ppt, metricName, graph, metricData);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ppt.write(bos);
bos.close();
LOGGER.trace("EXITING: createPptData");
return bos;
}
use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class RrdMetricsRetriever method createPptReport.
@Override
public OutputStream createPptReport(List<String> metricNames, String metricsDir, long startTime, long endTime) throws IOException, MetricsGraphException {
LOGGER.trace("ENTERING: createPptReport");
SlideShow ppt = new SlideShow();
Collections.sort(metricNames);
for (String metricName : metricNames) {
String rrdFilename = getRrdFilename(metricsDir, metricName);
byte[] graph = createGraph(metricName, rrdFilename, startTime, endTime);
MetricData metricData = getMetricData(rrdFilename, startTime, endTime);
createSlide(ppt, metricName, graph, metricData);
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ppt.write(bos);
bos.close();
LOGGER.trace("EXITING: createPptReport");
return bos;
}
use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class RrdMetricsRetrieverTest method testMetricsPptDataWithCounter.
@Test
public void testMetricsPptDataWithCounter() throws Exception {
String rrdFilename = TEST_DIR + "queryCount_Counter" + RRD_FILE_EXTENSION;
long endTime = new RrdFileBuilder().rrdFileName(rrdFilename).build();
MetricsRetriever metricsRetriever = new RrdMetricsRetriever();
OutputStream os = metricsRetriever.createPptData("queryCount", rrdFilename, START_TIME, endTime);
InputStream is = new ByteArrayInputStream(((ByteArrayOutputStream) os).toByteArray());
assertThat(is, not(nullValue()));
SlideShow ppt = new SlideShow(is);
Slide[] slides = ppt.getSlides();
assertThat(slides.length, equalTo(1));
verifySlide(slides[0], "queryCount", true);
}
Aggregations