Search in sources :

Example 11 with TestTreeResource

use of eu.bcvsolutions.idm.acc.entity.TestTreeResource in project CzechIdMng by bcvsolutions.

the class DefaultTreeSynchronizationServiceTest method removeOne.

@Transactional
public void removeOne() {
    TestTreeResource one = entityManager.find(TestTreeResource.class, "111");
    entityManager.remove(one);
}
Also used : TestTreeResource(eu.bcvsolutions.idm.acc.entity.TestTreeResource) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with TestTreeResource

use of eu.bcvsolutions.idm.acc.entity.TestTreeResource in project CzechIdMng by bcvsolutions.

the class DefaultTreeSynchronizationServiceTest method provisioningA_CreateAccount_withOutMapping.

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

Example 13 with TestTreeResource

use of eu.bcvsolutions.idm.acc.entity.TestTreeResource in project CzechIdMng by bcvsolutions.

the class DefaultRoleCatalogueProvisioningTest method provisioningC_CreateAccounts_correct.

@Test
public void provisioningC_CreateAccounts_correct() {
    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);
    TestTreeResource root = entityManager.find(TestTreeResource.class, "P1");
    Assert.assertNull(root);
    // Save IDM node again (must invoke provisioning)
    // Root first
    treeNodeService.save(nodeRoot);
    // Node next
    treeNodeService.save(nodeOne);
    // Check state before provisioning
    root = entityManager.find(TestTreeResource.class, "P1");
    Assert.assertNotNull(root);
    one = entityManager.find(TestTreeResource.class, "P12");
    Assert.assertNotNull(one);
}
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

TestTreeResource (eu.bcvsolutions.idm.acc.entity.TestTreeResource)13 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)8 Test (org.junit.Test)8 Transactional (org.springframework.transaction.annotation.Transactional)6 IdmRoleCatalogueDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto)4 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)4 IdmRoleCatalogueFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter)3 IdmTreeNodeFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter)3 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)1