use of eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testSubordinatesForFilter.
@Test
public void testSubordinatesForFilter() {
IdmIdentityDto person = getIdmIdentity("ThisIsTestName005", "ThisIsTestName005", "ThisIsTestName005@gemail.eu", "000000005", false);
IdmIdentityDto manager = getIdmIdentity("ThisIsTestName006", "ThisIsTestName006", "ThisIsTestName006@gemail.eu", "000000006", false);
UUID manager_id = manager.getId();
IdmTreeTypeDto type1 = helper.createTreeType("ThisIsTestType001");
IdmTreeNodeDto node2 = helper.createTreeNode(type1, "Somename002", null);
IdmTreeNodeDto node1 = helper.createTreeNode(type1, "ThisIsTestNode001", node2);
helper.createIdentityContact(manager, node2);
helper.createIdentityContact(person, node1);
// contract.setGuarantee(manager_id);
// IdmIdentityContractDto contract2 = idmIdentityContractService.save(contract);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setSubordinatesFor(manager_id);
filter.setSubordinatesByTreeType(type1.getId());
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong SubordinatesFor", 1, result.getTotalElements());
assertEquals("Wrong SuborganizedFor user ID", person.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testTreeNodeFilter.
@Test
public void testTreeNodeFilter() {
IdmIdentityDto person = getIdmIdentity("ThisIsTestName008", "ThisIsTestName008", "ThisIsTestName008@gemail.eu", "000000008", false);
IdmTreeTypeDto type = helper.createTreeType("ThisIsTestType003");
IdmTreeNodeDto node = helper.createTreeNode(type, "ThisIsTestNode003", null);
UUID nodeUuid = node.getId();
helper.createIdentityContact(person, node);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setTreeNode(nodeUuid);
filter.setRecursively(false);
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong TreeNode", 1, result.getTotalElements());
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testTextFilter.
@Test
public void testTextFilter() {
IdmIdentityDto person1 = getIdmIdentity("a1testuser", "b1testuser", "b1testuser@a.eu", "333010001", false);
IdmIdentityDto person2 = getIdmIdentity("a1testuser", "b2testuser", "b2testuser@a.eu", "333010003", false);
IdmIdentityDto person3 = getIdmIdentity("a1testuser", "b2testuser", "b3testuser@a.eu", "333010004", false);
IdmIdentityDto person4 = getIdmIdentity("a2testuser", "b3testuser", "b4testuser@a.eu", "333010005", false);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setText(person1.getFirstName());
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong Text filter - firstname", 3, result.getTotalElements());
filter.setText(person2.getLastName());
result = identityService.find(filter, null);
assertEquals("Wrong Text filter - lastname", 2, result.getTotalElements());
filter.setText(person3.getEmail());
result = identityService.find(filter, null);
assertEquals("Wrong Text filter - email", 1, result.getTotalElements());
filter.setText(person4.getUsername());
result = identityService.find(filter, null);
assertEquals("Wrong Text filter - username", person4.getId(), result.getContent().get(0).getId());
person1.setDescription("This is describtion");
IdmIdentityDto person5 = identityService.save(person1);
filter.setText(person5.getDescription());
result = identityService.find(filter, null);
assertEquals("Wrong Text filter - describtion", person1.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testNothingToFind.
@Test
public void testNothingToFind() {
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setFirstName("Adolf");
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong blank filter", 0, result.getTotalElements());
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter in project CzechIdMng by bcvsolutions.
the class IdentityFilterTest method testMoreFilters.
@Test
public void testMoreFilters() {
IdmIdentityDto person1 = getIdmIdentity("tn01", "tn01", "tn02@a.eu", "000010001", false);
IdmIdentityDto person2 = getIdmIdentity("tn01", "tn01", "tn02@a.eu", "000010001", false);
IdmIdentityDto person3 = getIdmIdentity("tn01", "tn01", "tn02@a.eu", "000010001", false);
getIdmIdentity("tn0001", "tn01", "tn02@a.eu", "000010001", false);
IdmIdentityFilter filter = new IdmIdentityFilter();
filter.setFirstName(person1.getFirstName());
filter.setLastName(person2.getLastName());
filter.setDisabled(false);
Page<IdmIdentityDto> result = identityService.find(filter, null);
assertEquals("Wrong more filter", 3, result.getTotalElements());
filter.setUsername(person3.getUsername());
result = identityService.find(filter, null);
assertEquals("Wrong more filter", 1, result.getTotalElements());
assertEquals("Wrong more filter user ID", person3.getId(), result.getContent().get(0).getId());
}
Aggregations