Search in sources :

Example 11 with RptReportDto

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));
}
Also used : RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with RptReportDto

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));
}
Also used : RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with RptReportDto

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()));
}
Also used : RptRenderedReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptRenderedReportDto) RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 14 with RptReportDto

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);
}
Also used : RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto) UUID(java.util.UUID) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 15 with RptReportDto

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());
}
Also used : IdmFormDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto) UUID(java.util.UUID) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

RptReportDto (eu.bcvsolutions.idm.rpt.api.dto.RptReportDto)15 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)9 Test (org.junit.Test)9 UUID (java.util.UUID)5 Transactional (org.springframework.transaction.annotation.Transactional)5 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)4 IdmFormDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDto)4 IdmFormValueDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto)4 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)3 List (java.util.List)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 InitTestData (eu.bcvsolutions.idm.InitTestData)2 IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)2 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)2 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)2 AttachmentManager (eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager)2 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)2 LoginDto (eu.bcvsolutions.idm.core.security.api.dto.LoginDto)2