assertFalse(IOUtils.toString((InputStream) entity, SyncopeConstants.DEFAULT_ENCODING).isEmpty());
}
@Test
public void executeAndExport() throws IOException {
ReportTO reportTO = reportService.read(1L);
reportTO.setId(0);
reportTO.setName("executeAndExport" + getUUIDString());
reportTO.getExecutions().clear();
reportTO = createReport(reportTO);
assertNotNull(reportTO);
ReportExecTO execution = reportService.execute(reportTO.getId());
assertNotNull(execution);
int i = 0;
int maxit = 50;
// wait for report execution completion (executions incremented)
do {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
reportTO = reportService.read(reportTO.getId());
assertNotNull(reportTO);
assertNotNull(reportTO.getExecutions());
i++;
} while (!ReportExecStatus.SUCCESS.name().equals(reportTO.getExecutions().get(0).getStatus()) && i < maxit);
assertEquals(ReportExecStatus.SUCCESS.name(), reportTO.getExecutions().get(0).getStatus());
long execId = reportTO.getExecutions().get(0).getId();
checkExport(execId, ReportExecExportFormat.XML);
checkExport(execId, ReportExecExportFormat.HTML);
checkExport(execId, ReportExecExportFormat.PDF);
checkExport(execId, ReportExecExportFormat.RTF);