use of eu.bcvsolutions.idm.rpt.api.dto.RptReportDto in project CzechIdMng by bcvsolutions.
the class IdentityReportExecutorIntegrationTest method testRenderers.
@Test
@Transactional
public void testRenderers() {
helper.createIdentity();
//
// prepare report filter
RptReportDto report = new RptReportDto(UUID.randomUUID());
report.setExecutorName(reportExecutor.getName());
//
// generate report
report = reportExecutor.generate(report);
//
Assert.assertNotNull(xlsxRenderer.render(report));
}
use of eu.bcvsolutions.idm.rpt.api.dto.RptReportDto in project CzechIdMng by bcvsolutions.
the class IdentityReportExecutorIntegrationTest method testRenderers.
@Test
@Transactional
public void testRenderers() {
helper.createIdentity();
//
// prepare report filter
RptReportDto report = new RptReportDto(UUID.randomUUID());
report.setExecutorName(reportExecutor.getName());
//
// generate report
report = reportExecutor.generate(report);
//
Assert.assertNotNull(xlsxRenderer.render(report));
}
use of eu.bcvsolutions.idm.rpt.api.dto.RptReportDto in project CzechIdMng by bcvsolutions.
the class DefaultRptReportManagerIntegrationTest method testRenderReportAsJson.
@Test
public void testRenderReportAsJson() throws IOException {
TestReportExecutor testReportExecutor = context.getAutowireCapableBeanFactory().createBean(TestReportExecutor.class);
RptReportDto report = testReportExecutor.generate(new RptReportDto(UUID.randomUUID()));
RptRenderedReportDto renderedData = manager.render(report, TestReportRenderer.RENDERER_NAME);
//
Assert.assertEquals(mapper.writeValueAsString(TestReportExecutor.identities), IOUtils.toString(renderedData.getRenderedReport()));
}
use of eu.bcvsolutions.idm.rpt.api.dto.RptReportDto in project CzechIdMng by bcvsolutions.
the class DefaultRptReportManagerIntegrationTest method testGenerateReportByManager.
@Test
public void testGenerateReportByManager() throws IOException {
RptReportDto report = new RptReportDto();
report.setExecutorName(TestReportExecutor.REPORT_NAME);
report = manager.generate(report);
final UUID reportId = report.getId();
Assert.assertNotNull(reportId);
helper.waitForResult(res -> {
return OperationState.isRunnable(reportService.get(reportId).getResult().getState());
});
Assert.assertNotNull(report.getData());
Assert.assertEquals(mapper.writeValueAsString(TestReportExecutor.identities), IOUtils.toString(attachmentManager.getAttachmentData(report.getData())));
attachmentManager.deleteAttachments(report);
}
use of eu.bcvsolutions.idm.rpt.api.dto.RptReportDto in project CzechIdMng by bcvsolutions.
the class DefaultRptReportServiceIntegrationTest method testReportReferentialIntegrity.
@Test
public void testReportReferentialIntegrity() throws IOException {
RptReportDto report = new RptReportDto();
report.setExecutorName(TestFilterReportExecutor.REPORT_NAME);
IdmFormDto filter = new IdmFormDto();
TestFilterReportExecutor testReportExecutor = context.getAutowireCapableBeanFactory().createBean(TestFilterReportExecutor.class);
IdmFormDefinitionDto definition = testReportExecutor.getFormDefinition();
IdmFormValueDto username = new IdmFormValueDto(definition.getMappedAttributeByCode(IdmIdentity_.username.getName()));
username.setValue(TestReportExecutor.identities.get(0).getUsername());
filter.getValues().add(username);
filter.setFormDefinition(definition.getId());
report.setFilter(filter);
//
report = reportManager.generate(report);
final UUID reportId = report.getId();
Assert.assertNotNull(reportId);
helper.waitForResult(res -> {
return OperationState.isRunnable(reportService.get(reportId).getResult().getState());
});
Assert.assertNotNull(report.getData());
Assert.assertNotNull(report.getFilter());
Assert.assertFalse(commonFormService.getForms(report).isEmpty());
Assert.assertFalse(attachmentManager.getAttachments(report, null).getTotalElements() == 0);
//
// delete report
reportService.delete(report);
// check report is deleted
Assert.assertNull(reportService.get(report.getId()));
// check attachment was deleted
Assert.assertTrue(attachmentManager.getAttachments(report, null).getTotalElements() == 0);
// check filter is deleted
Assert.assertTrue(commonFormService.getForms(report).isEmpty());
}
Aggregations