Search in sources :

Example 6 with TestTreeResource

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

the class DefaultTreeSynchronizationServiceTest method provisioningD_UpdateAccount.

@Test
public void provisioningD_UpdateAccount() {
    IdmTreeNodeFilter filter = new IdmTreeNodeFilter();
    filter.setProperty(NODE_NAME);
    filter.setValue("P1");
    IdmTreeNodeDto nodeRoot = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeRoot);
    filter.setValue("P12");
    IdmTreeNodeDto 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) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 7 with TestTreeResource

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

the class DefaultTreeSynchronizationServiceTest method provisioningC_CreateAccounts_correct.

@Test
public void provisioningC_CreateAccounts_correct() {
    IdmTreeNodeFilter filter = new IdmTreeNodeFilter();
    filter.setProperty(NODE_NAME);
    filter.setValue("P1");
    IdmTreeNodeDto nodeRoot = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeRoot);
    filter.setValue("P12");
    IdmTreeNodeDto 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) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 8 with TestTreeResource

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

the class DefaultRoleCatalogueProvisioningTest method changeOne.

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

Example 9 with TestTreeResource

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

the class DefaultTreeSynchronizationServiceTest method provisioningB_CreateAccounts_withException.

// Provisioning tree in incorrect order
@Test(expected = ProvisioningException.class)
public void provisioningB_CreateAccounts_withException() {
    IdmTreeNodeFilter filter = new IdmTreeNodeFilter();
    filter.setProperty(NODE_NAME);
    filter.setValue("P1");
    IdmTreeNodeDto nodeRoot = treeNodeService.find(filter, null).getContent().get(0);
    Assert.assertNotNull(nodeRoot);
    filter.setValue("P12");
    IdmTreeNodeDto 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.createProvisionigMapping();
    // 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) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 10 with TestTreeResource

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

the class DefaultTreeSynchronizationServiceTest method createNode.

private TestTreeResource createNode(String code, String parent) {
    TestTreeResource node = new TestTreeResource();
    node.setCode(code);
    node.setName(code);
    node.setParent(parent);
    node.setId(code);
    return node;
}
Also used : TestTreeResource(eu.bcvsolutions.idm.acc.entity.TestTreeResource)

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