use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleGuaranteeRoleFilter in project CzechIdMng by bcvsolutions.
the class RoleExportBulkActionIntegrationTest method findRoleGuarantees.
private List<IdmRoleGuaranteeRoleDto> findRoleGuarantees(IdmRoleDto role) {
IdmRoleGuaranteeRoleFilter filter = new IdmRoleGuaranteeRoleFilter();
filter.setRole(role.getId());
return roleGuaranteeRoleService.find(filter, null).getContent();
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleGuaranteeRoleFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleGuaranteeServiceIntegrationTest method testFindRoleGuaranteeByRoleGuarantee.
@Test
public void testFindRoleGuaranteeByRoleGuarantee() {
IdmRoleDto guaranteeRole = getHelper().createRole();
IdmRoleDto guaranteeRoleTwo = getHelper().createRole();
//
IdmRoleDto role1 = getHelper().createRole();
IdmRoleDto role2 = getHelper().createRole();
IdmRoleDto role3 = getHelper().createRole();
//
IdmRoleGuaranteeRoleDto roleGuaranteeOne = new IdmRoleGuaranteeRoleDto();
roleGuaranteeOne.setRole(role1.getId());
roleGuaranteeOne.setGuaranteeRole(guaranteeRole.getId());
roleGuaranteeOne = roleGuaranteeRoleService.save(roleGuaranteeOne);
//
IdmRoleGuaranteeRoleDto roleGuaranteeTwo = new IdmRoleGuaranteeRoleDto();
roleGuaranteeTwo.setRole(role2.getId());
roleGuaranteeTwo.setGuaranteeRole(guaranteeRoleTwo.getId());
roleGuaranteeTwo = roleGuaranteeRoleService.save(roleGuaranteeTwo);
//
IdmRoleGuaranteeRoleDto roleGuaranteeThree = new IdmRoleGuaranteeRoleDto();
roleGuaranteeThree.setRole(role3.getId());
roleGuaranteeThree.setGuaranteeRole(guaranteeRole.getId());
roleGuaranteeThree = roleGuaranteeRoleService.save(roleGuaranteeThree);
//
IdmRoleGuaranteeRoleFilter filter = new IdmRoleGuaranteeRoleFilter();
filter.setGuaranteeRole(guaranteeRole.getId());
List<IdmRoleGuaranteeRoleDto> list = roleGuaranteeRoleService.find(filter, null).getContent();
Assert.assertEquals(2, list.size());
//
List<UUID> roles = list.stream().map(IdmRoleGuaranteeRoleDto::getRole).collect(Collectors.toList());
IdmRoleGuaranteeRoleDto roleGuaranteeFirst = list.get(0);
Assert.assertEquals(guaranteeRole.getId(), roleGuaranteeFirst.getGuaranteeRole());
Assert.assertTrue(roles.contains(role1.getId()));
Assert.assertFalse(roles.contains(role2.getId()));
Assert.assertTrue(roles.contains(role3.getId()));
}
Aggregations