use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestIntegrationTest method deleteIdentityRole.
@Test
public void deleteIdentityRole() {
IdmIdentityDto identity = createAndSaveIdentity();
IdmRoleDto role = createAndSaveRole();
IdmTreeTypeDto treeType = createAndSaveTreeType();
IdmTreeNodeDto treeNode = createAndSaveTreeNode(treeType);
IdmIdentityContractDto identityContract = createAndSaveIdentityContract(identity, treeNode);
LocalDate from = new LocalDate();
from = from.plusDays(5);
IdmIdentityRoleDto identityRole = createAndSaveIdentityRole(identityContract, role, null, from);
List<IdmIdentityRoleValidRequestDto> list = identityRoleValidRequestService.find(null).getContent();
int size = list.size();
idmIdentityRoleSerivce.delete(identityRole);
list = identityRoleValidRequestService.find(null).getContent();
assertNotEquals(size, list.size());
list = identityRoleValidRequestService.findAllValidRequestForIdentityRoleId(identityRole.getId());
assertEquals(true, list.isEmpty());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto 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 = new LocalDate();
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());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestIntegrationTest method createAndSaveIdentityContract.
private IdmIdentityContractDto createAndSaveIdentityContract(IdmIdentityDto user, IdmTreeNodeDto node) {
IdmIdentityContractDto entity = new IdmIdentityContractDto();
entity.setIdentity(user.getId());
entity.setWorkPosition(node == null ? null : node.getId());
return saveInTransaction(entity, identityContractService);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto 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 = new LocalDate();
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.IdmIdentityContractDto in project CzechIdMng by bcvsolutions.
the class IdentityTransitiveEvaluatorsIntegrationTest method testReadProfile.
@Test
public void testReadProfile() {
IdmIdentityDto identity = prepareIdentityProfile();
//
try {
loginService.login(new LoginDto(identity.getUsername(), identity.getPassword()));
//
IdmIdentityDto read = identityService.get(identity.getId(), IdmBasePermission.READ);
assertEquals(identity, read);
//
List<IdmIdentityContractDto> contracts = identityContractService.find(null, IdmBasePermission.READ).getContent();
assertEquals(1, contracts.size());
IdmIdentityContractDto contract = contracts.get(0);
assertEquals(identity.getId(), contract.getIdentity());
//
List<IdmIdentityRoleDto> roles = identityRoleService.find(null, IdmBasePermission.READ).getContent();
assertEquals(1, roles.size());
assertEquals(contract.getId(), roles.get(0).getIdentityContract());
} finally {
logout();
}
}
Aggregations