use of eu.bcvsolutions.idm.core.api.dto.IdmRoleDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceIntegrationTest method guaranteeFilterTest.
@Test
public void guaranteeFilterTest() {
IdmIdentityDto identity = helper.createIdentity();
IdmRoleDto role = new IdmRoleDto();
role.setName("IgnacMikinaRole");
helper.createRole();
IdmRoleGuaranteeDto roleGuarantee = new IdmRoleGuaranteeDto();
roleGuarantee.setRole(role.getId());
roleGuarantee.setGuarantee(identity.getId());
role.setGuarantees(Lists.newArrayList(roleGuarantee));
role = roleService.save(role);
IdmRoleFilter filter = new IdmRoleFilter();
filter.setGuaranteeId(identity.getId());
Page<IdmRoleDto> result = roleService.find(filter, null);
assertEquals("Wrong guarantee", 1, result.getTotalElements());
assertEquals("Wrong guarantee id", role.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmRoleDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceIntegrationTest method testReferentialIntegrityAssignedRoles.
@Test(expected = ResultCodeException.class)
public void testReferentialIntegrityAssignedRoles() {
// prepare data
IdmIdentityDto identity = helper.createIdentity("delete-test");
IdmRoleDto role = helper.createRole("test-delete");
// assigned role
helper.createIdentityRole(identity, role);
//
roleService.delete(role);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmRoleDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleServiceIntegrationTest method textFilterTest.
@Test
public void textFilterTest() {
helper.createRole("SomeName001");
helper.createRole("SomeName002");
helper.createRole("SomeName003");
helper.createRole("SomeName104");
IdmRoleDto role5 = new IdmRoleDto();
role5.setDescription("SomeName005");
role5.setName("SomeName105");
role5 = roleService.save(role5);
IdmRoleFilter filter = new IdmRoleFilter();
filter.setText("SomeName00");
Page<IdmRoleDto> result = roleService.find(filter, null);
assertEquals("Wrong text filter", 4, result.getTotalElements());
assertEquals("Wrong text filter description", true, result.getContent().contains(role5));
}
use of eu.bcvsolutions.idm.core.api.dto.IdmRoleDto 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 = helper.createTreeType("ThisIsTestType007");
IdmTreeNodeDto node = helper.createTreeNode(type, "ThisIsTestNode008", null);
IdmIdentityContractDto contract = helper.createIdentityContact(person, node);
IdmRoleDto somerole = helper.createRole();
helper.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.IdmRoleDto 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());
}
Aggregations