use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testSubordinatesForFilter.
@Test
public void testSubordinatesForFilter() {
IdmIdentityDto person = getIdmIdentity("ThisIsTestName005", "ThisIsTestName005", "ThisIsTestName005@gemail.eu", "000000005", false);
IdmIdentityDto manager = getIdmIdentity("ThisIsTestName006", "ThisIsTestName006", "ThisIsTestName006@gemail.eu", "000000006", false);
UUID manager_id = manager.getId();
IdmTreeTypeDto type1 = getHelper().createTreeType("ThisIsTestType001");
IdmTreeNodeDto node2 = getHelper().createTreeNode(type1, "Somename002", null);
IdmTreeNodeDto node1 = getHelper().createTreeNode(type1, "ThisIsTestNode001", node2);
getHelper().createContract(manager, node2);
getHelper().createContract(person, node1);
// contract.setGuarantee(manager_id);
// IdmIdentityContractDto contract2 = idmIdentityContractService.save(contract);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setSubordinatesFor(manager_id);
filter.setSubordinatesByTreeType(type1.getId());
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong SubordinatesFor", 1, result.getTotalElements());
assertEquals("Wrong SuborganizedFor user ID", person.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testTreeNodeFilter.
@Test
public void testTreeNodeFilter() {
IdmIdentityDto person = getIdmIdentity("ThisIsTestName008", "ThisIsTestName008", "ThisIsTestName008@gemail.eu", "000000008", false);
IdmTreeTypeDto type = getHelper().createTreeType("ThisIsTestType003");
IdmTreeNodeDto node = getHelper().createTreeNode(type, "ThisIsTestNode003", null);
UUID nodeUuid = node.getId();
getHelper().createContract(person, node);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setTreeNode(nodeUuid);
filter.setRecursively(false);
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong TreeNode", 1, result.getTotalElements());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testRoleFilter.
@Test
public void testRoleFilter() {
IdmIdentityDto person = getIdmIdentity("ThisIsTestName013", "ThisIsTestName013", "ThisIsTestName013@gemail.eu", "100000013", false);
IdmTreeTypeDto type = getHelper().createTreeType("ThisIsTestType007");
IdmTreeNodeDto node = getHelper().createTreeNode(type, "ThisIsTestNode008", null);
IdmIdentityContractDto contract = getHelper().createContract(person, node);
IdmRoleDto somerole = getHelper().createRole();
getHelper().createIdentityRole(contract, somerole);
UUID roleId = somerole.getId();
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setRoles(Collections.singletonList(roleId));
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong Roles", 1, result.getTotalElements());
assertEquals("Wrong Roles user ID", person.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestIntegrationTest method deleteIdentityContract.
@Test
public void deleteIdentityContract() {
IdmIdentityDto identity = createAndSaveIdentity();
IdmRoleDto role = createAndSaveRole();
IdmTreeTypeDto treeType = createAndSaveTreeType();
IdmTreeNodeDto treeNode = createAndSaveTreeNode(treeType);
IdmIdentityContractDto identityContract = createAndSaveIdentityContract(identity, treeNode);
LocalDate from = LocalDate.now();
from = from.plusDays(5);
createAndSaveIdentityRole(identityContract, role, null, from);
List<IdmIdentityRoleValidRequestDto> list = identityRoleValidRequestService.find(null).getContent();
int size = list.size();
identityContractService.delete(identityContract);
list = identityRoleValidRequestService.find(null).getContent();
assertNotEquals(size, list.size());
list = identityRoleValidRequestService.findAllValidRequestForIdentityContractId(identityContract.getId());
assertEquals(true, list.isEmpty());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestIntegrationTest method deleteRole.
@Test(expected = ResultCodeException.class)
public void deleteRole() {
IdmIdentityDto identity = createAndSaveIdentity();
IdmRoleDto role = createAndSaveRole();
IdmTreeTypeDto treeType = createAndSaveTreeType();
IdmTreeNodeDto treeNode = createAndSaveTreeNode(treeType);
IdmIdentityContractDto identityContract = createAndSaveIdentityContract(identity, treeNode);
LocalDate from = LocalDate.now();
from = from.plusDays(5);
createAndSaveIdentityRole(identityContract, role, null, from);
List<IdmIdentityRoleValidRequestDto> list = identityRoleValidRequestService.find(null).getContent();
int size = list.size();
// role has identity, ok - throw error
roleService.delete(role);
list = identityRoleValidRequestService.find(null).getContent();
assertNotEquals(size, list.size());
list = identityRoleValidRequestService.findAllValidRequestForRoleId(role.getId());
assertEquals(true, list.isEmpty());
}
Aggregations