Search in sources :

Example 1 with IdmRoleCatalogueDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto in project CzechIdMng by bcvsolutions.

the class RoleCatalogueSaveProcessor method process.

@Override
public EventResult<IdmRoleCatalogueDto> process(EntityEvent<IdmRoleCatalogueDto> event) {
    IdmRoleCatalogueDto dto = event.getContent();
    dto = service.saveInternal(dto);
    event.setContent(dto);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto)

Example 2 with IdmRoleCatalogueDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto in project CzechIdMng by bcvsolutions.

the class DefaultRoleCatalogueProvisioningTest method provisioningD_UpdateAccount.

@Test
public void provisioningD_UpdateAccount() {
    IdmRoleCatalogueFilter filter = new IdmRoleCatalogueFilter();
    filter.setName("P1");
    IdmRoleCatalogueDto nodeRoot = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeRoot);
    filter.setName("P12");
    IdmRoleCatalogueDto nodeOne = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeOne);
    // Check state before provisioning
    TestTreeResource one = entityManager.find(TestTreeResource.class, "P12");
    Assert.assertNotNull(one);
    Assert.assertEquals("P12", one.getCode());
    nodeOne.setCode(CHANGED);
    // Save IDM changed node (must invoke provisioning)
    treeNodeService.save(nodeOne);
    // Check state before provisioning
    one = entityManager.find(TestTreeResource.class, "P12");
    Assert.assertNotNull(one);
    Assert.assertEquals(CHANGED, one.getCode());
}
Also used : TestTreeResource(eu.bcvsolutions.idm.acc.entity.TestTreeResource) IdmRoleCatalogueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 3 with IdmRoleCatalogueDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto in project CzechIdMng by bcvsolutions.

the class DefaultRoleCatalogueProvisioningTest method provisioningF_DeleteAccount.

@Test
public void provisioningF_DeleteAccount() {
    IdmRoleCatalogueFilter filter = new IdmRoleCatalogueFilter();
    filter.setName("P12");
    IdmRoleCatalogueDto nodeOne = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeOne);
    // Delete IDM node (must invoke provisioning) .. We delete child
    treeNodeService.delete(nodeOne);
    Assert.assertTrue(treeNodeService.find(filter, null).getContent().isEmpty());
}
Also used : IdmRoleCatalogueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 4 with IdmRoleCatalogueDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto in project CzechIdMng by bcvsolutions.

the class DefaultRoleCatalogueProvisioningTest method provisioningA_CreateAccount_withOutMapping.

@Test
@Transactional
public void provisioningA_CreateAccount_withOutMapping() {
    // Delete all resource data
    this.deleteAllResourceData();
    // Create root node in IDM tree
    IdmRoleCatalogueDto nodeRoot = new IdmRoleCatalogueDto();
    nodeRoot.setCode("P1");
    nodeRoot.setName(nodeRoot.getCode());
    nodeRoot.setParent(null);
    nodeRoot = treeNodeService.save(nodeRoot);
    // Create node in IDM tree
    IdmRoleCatalogueDto nodeOne = new IdmRoleCatalogueDto();
    nodeOne.setCode("P12");
    nodeOne.setName(nodeOne.getCode());
    nodeOne.setParent(nodeRoot.getId());
    nodeOne = treeNodeService.save(nodeOne);
    // Check state before provisioning
    TestTreeResource one = entityManager.find(TestTreeResource.class, "P12");
    Assert.assertNull(one);
}
Also used : TestTreeResource(eu.bcvsolutions.idm.acc.entity.TestTreeResource) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with IdmRoleCatalogueDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto in project CzechIdMng by bcvsolutions.

the class DefaultRoleCatalogueProvisioningTest method provisioningB_CreateAccounts_withException.

// Provisioning tree in incorrect order
@Test(expected = ProvisioningException.class)
public void provisioningB_CreateAccounts_withException() {
    IdmRoleCatalogueFilter filter = new IdmRoleCatalogueFilter();
    filter.setName("P1");
    IdmRoleCatalogueDto nodeRoot = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeRoot);
    filter.setName("P12");
    IdmRoleCatalogueDto nodeOne = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeOne);
    // Check state before provisioning
    TestTreeResource one = entityManager.find(TestTreeResource.class, "P12");
    Assert.assertNull(one);
    // Create mapping for provisioning
    this.initData();
    // Save IDM node (must invoke provisioning)
    // We didn't provisioning for root first ... expect throw exception
    treeNodeService.save(nodeOne);
}
Also used : TestTreeResource(eu.bcvsolutions.idm.acc.entity.TestTreeResource) IdmRoleCatalogueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmRoleCatalogueDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto)19 Test (org.junit.Test)16 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)14 IdmRoleCatalogueFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter)9 TestTreeResource (eu.bcvsolutions.idm.acc.entity.TestTreeResource)4 IdmRoleCatalogueRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto)3 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)3 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)2 LinkedHashMap (java.util.LinkedHashMap)2 UUID (java.util.UUID)2 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)1 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)1 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)1 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)1 IdmRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter)1 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)1 Transactional (org.springframework.transaction.annotation.Transactional)1