use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testTreeTypeFilter.
@Test
public void testTreeTypeFilter() {
IdmIdentityDto person = getIdmIdentity("ThisIsTestName007", "ThisIsTestName007", "ThisIsTestName007@gemail.eu", "000000007", false);
IdmTreeTypeDto type = getHelper().createTreeType("ThisIsTestType002");
IdmTreeNodeDto node = getHelper().createTreeNode(type, "ThisIsTestNode002", null);
UUID typeUuid = type.getId();
getHelper().createContract(person, node);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setTreeType(typeUuid);
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong TreeType", 1, result.getTotalElements());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testIncludeGuaranteesFilter.
@Test
public void testIncludeGuaranteesFilter() {
IdmIdentityDto person = getIdmIdentity("aThisIsTestName009", "ThisIsTestName009", "ThisIsTestName009@gemail.eu", "000000009", false);
IdmIdentityDto manager2 = getIdmIdentity("manager009", "ThisIsTestName009", "ThisIsTestName009@gemail.eu", "000000009", false);
IdmIdentityDto manager = getIdmIdentity("ThisIsTestName010", "ThisIsTestName010", "ThisIsTestName010@gemail.eu", "000000010", false);
IdmTreeTypeDto type1 = getHelper().createTreeType("ThisIsTestType0004");
IdmTreeNodeDto node1 = getHelper().createTreeNode(type1, "ThisIsTestNode0004", null);
IdmTreeNodeDto node2 = getHelper().createTreeNode(type1, "NextThisIsTestNode0004", node1);
IdmIdentityContractDto contract = getHelper().createContract(person, node2);
getHelper().createContractGuarantee(contract.getId(), manager2.getId());
getHelper().createContract(manager, node1);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setManagersFor(person.getId());
filter.setIncludeGuarantees(true);
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong Managers2For", 2, result.getTotalElements());
filter.setIncludeGuarantees(false);
result = identityService.find(filter, null);
assertEquals("Wrong Managers2For test 2", 1, result.getTotalElements());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testSameButDifferentTreeTypeFilter.
@Test
public void testSameButDifferentTreeTypeFilter() {
IdmIdentityDto person1 = getIdmIdentity("thistn01", "thistn01", "thistn02@a.eu", "000010001", false);
getIdmIdentity("thistn01", "thistn01", "thistn02@a.eu", "000010001", false);
IdmTreeTypeDto type1 = getHelper().createTreeType("typeName001");
IdmTreeTypeDto type2 = getHelper().createTreeType("typeName002");
IdmTreeNodeDto node1 = getHelper().createTreeNode(type1, "nodeName001", null);
getHelper().createTreeNode(type2, "nodeName002", null);
getHelper().createContract(person1, node1);
getHelper().createContract(person1, node1);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setFirstName(person1.getFirstName());
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong sameButDiff filter", 2, result.getTotalElements());
filter.setTreeType(type1.getId());
result = identityService.find(filter, null);
assertEquals("Wrong sameButDiff filter 2", 1, result.getTotalElements());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testManagersForFilter.
@Test
public void testManagersForFilter() {
FilterBuilder<IdmIdentity, DataFilter> filterBuilderSubordinates = filterManager.getBuilder(IdmIdentity.class, IdmIdentityFilter.PARAMETER_SUBORDINATES_FOR);
FilterBuilder<IdmIdentity, DataFilter> filterBuilderManagers = filterManager.getBuilder(IdmIdentity.class, IdmIdentityFilter.PARAMETER_MANAGERS_FOR);
FilterBuilder<IdmIdentityContract, DataFilter> filterBuilderContractByManager = filterManager.getBuilder(IdmIdentityContract.class, IdmIdentityContractFilter.PARAMETER_SUBORDINATES_FOR);
Assert.assertEquals(DefaultManagersFilter.FILTER_NAME, filterBuilderManagers.getId());
Assert.assertEquals(DefaultSubordinatesFilter.FILTER_NAME, filterBuilderSubordinates.getId());
Assert.assertEquals(DefaultContractByManagerFilter.FILTER_NAME, filterBuilderContractByManager.getId());
Assert.assertFalse(filterBuilderSubordinates.isDisabled());
Assert.assertFalse(filterBuilderManagers.isDisabled());
Assert.assertFalse(filterBuilderContractByManager.isDisabled());
//
IdmIdentityDto person = getIdmIdentity("ThisIsTestName009", "ThisIsTestName009", "ThisIsTestName009@gemail.eu", "000000009", false);
IdmIdentityDto manager = getIdmIdentity("ThisIsTestName010", "ThisIsTestName010", "ThisIsTestName010@gemail.eu", "000000010", false);
IdmTreeTypeDto type1 = getHelper().createTreeType();
IdmTreeNodeDto node2 = getHelper().createTreeNode(type1, null);
IdmTreeNodeDto node1 = getHelper().createTreeNode(type1, node2);
getHelper().createContract(manager, node2);
getHelper().createContract(person, node1);
//
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setIncludeGuarantees(false);
filter.setManagersFor(person.getId());
filter.setManagersByTreeType(type1.getId());
List<IdmIdentityDto> results = identityService.find(filter, null).getContent();
Assert.assertEquals(1, results.size());
Assert.assertEquals(manager.getId(), results.get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleValidRequestIntegrationTest method deleteIdentity.
@Test
public void deleteIdentity() {
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();
identityService.delete(identity);
list = identityRoleValidRequestService.find(null).getContent();
assertNotEquals(size, list.size());
list = identityRoleValidRequestService.findAllValidRequestForIdentityId(identity.getId());
assertEquals(true, list.isEmpty());
}
Aggregations