use of eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto 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.IdmTreeNodeDto 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.IdmTreeNodeDto 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.IdmTreeNodeDto 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.IdmTreeNodeDto in project CzechIdMng by bcvsolutions.
the class IdmTreeNodeServiceIntegrationTest method testCreateNode.
@Test
public void testCreateNode() {
IdmTreeNodeDto node = null;
Exception ex = null;
try {
node = helper.createTreeNode(null, "TEST_NODE", null);
} catch (Exception e) {
ex = e;
}
Assert.assertNotNull(ex);
IdmTreeTypeDto type = helper.createTreeType("TEST_TYPE_A");
type = treeTypeService.save(type);
ex = null;
try {
node = helper.createTreeNode(type, "TEST_NODE", null);
} catch (Exception e) {
ex = e;
}
Assert.assertNull(ex);
}
Aggregations