use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class MetricsEndpointTest method testGetMetricsDataAsPpt.
@Test
public void testGetMetricsDataAsPpt() throws Exception {
// Create RRD file that Metrics Endpoint will detect
// 15 minutes in seconds
int dateOffset = 900;
createRrdFile(dateOffset);
UriInfo uriInfo = createUriInfo();
// Get the metrics data from the endpoint
MetricsEndpoint endpoint = getEndpoint();
endpoint.setMetricsDir(TEST_DIR);
Response response = endpoint.getMetricsData("uptime", "ppt", null, null, Integer.toString(dateOffset), "my label", "my title", uriInfo);
cleanupRrd();
InputStream is = (InputStream) response.getEntity();
assertThat(is, not(nullValue()));
SlideShow ppt = new SlideShow(is);
Slide[] slides = ppt.getSlides();
assertThat(slides.length, equalTo(1));
}
use of org.apache.poi.hslf.usermodel.SlideShow in project ddf by codice.
the class MetricsEndpointTest method testGetMetricsReportAsPpt.
@Test
public void testGetMetricsReportAsPpt() throws Exception {
// Create RRD file that Metrics Endpoint will detect
// 15 minutes in seconds
int dateOffset = 900;
createRrdFile(dateOffset, "uptime");
UriInfo uriInfo = createUriInfo();
// Get the metrics data from the endpoint
MetricsEndpoint endpoint = getEndpoint();
endpoint.setMetricsDir(TEST_DIR);
Response response = endpoint.getMetricsReport("ppt", null, null, Integer.toString(dateOffset), null, uriInfo);
cleanupRrd();
MultivaluedMap<String, Object> headers = response.getHeaders();
assertTrue(headers.getFirst("Content-Disposition").toString().contains("attachment; filename="));
InputStream is = (InputStream) response.getEntity();
assertThat(is, not(nullValue()));
SlideShow ppt = new SlideShow(is);
Slide[] slides = ppt.getSlides();
assertThat(slides.length, equalTo(1));
}
Aggregations