Search in sources :

Example 11 with IdmIdentityFilter

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());
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 12 with IdmIdentityFilter

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());
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 13 with IdmIdentityFilter

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());
}
Also used : IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 14 with IdmIdentityFilter

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());
}
Also used : IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 15 with IdmIdentityFilter

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());
}
Also used : IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)39 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)31 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)26 Test (org.junit.Test)26 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)9 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)8 UUID (java.util.UUID)7 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)6 SysSyncIdentityConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto)5 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)5 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)5 DefaultSynchronizationServiceTest (eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationServiceTest)5 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)5 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)5 PageRequest (org.springframework.data.domain.PageRequest)5 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)4 Sort (org.springframework.data.domain.Sort)3 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)2 IdmScriptAuthorityDto (eu.bcvsolutions.idm.core.api.dto.IdmScriptAuthorityDto)2 IdmScriptDto (eu.bcvsolutions.idm.core.api.dto.IdmScriptDto)2