Search in sources :

Example 6 with IdmFormDto

use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDto 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

IdmFormDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDto)6 IdmFormValueDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto)5 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)5 Test (org.junit.Test)5 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)4 RptReportDto (eu.bcvsolutions.idm.rpt.api.dto.RptReportDto)4 UUID (java.util.UUID)4 Transactional (org.springframework.transaction.annotation.Transactional)4 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 InitTestData (eu.bcvsolutions.idm.InitTestData)2 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)2 IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)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 LoginService (eu.bcvsolutions.idm.core.security.api.service.LoginService)2 TestHelper (eu.bcvsolutions.idm.test.api.TestHelper)2 IOException (java.io.IOException)2