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());
}
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);
}
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);
}
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);
}
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;
}
Aggregations