Search in sources :

Example 21 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class DefaultFormServiceIntegrationTest method testUnpersistedOwnerWithId.

@Test
public void testUnpersistedOwnerWithId() {
    // unpersisted identity
    Identifiable owner = new IdmIdentity(UUID.randomUUID());
    assertTrue(formService.getValues(owner).isEmpty());
}
Also used : IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Identifiable(eu.bcvsolutions.idm.core.api.domain.Identifiable) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 22 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class UsernameIdentityFilterBuilderIntegrationTest method testFindIdentityByUuid.

@Test
public void testFindIdentityByUuid() {
    // prepare data
    IdmIdentityDto identityOne = getHelper().createIdentity((GuardedString) null);
    IdmIdentityDto identityTwo = getHelper().createIdentity((GuardedString) null);
    // 
    IdmIdentityFilter dataFilter = new IdmIdentityFilter();
    dataFilter.setUsername(identityOne.getUsername());
    List<IdmIdentity> identities = filter.find(dataFilter, null).getContent();
    // 
    assertEquals(1, identities.size());
    assertEquals(identityOne.getId(), identities.get(0).getId());
    // 
    dataFilter.setUsername(identityTwo.getUsername());
    identities = filter.find(dataFilter, null).getContent();
    assertEquals(1, identities.size());
    assertEquals(identityTwo.getId(), identities.get(0).getId());
}
Also used : IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 23 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class CodeableFilterBuilderIntegrationTest method testFindIdentityByUsername.

@Test
public void testFindIdentityByUsername() {
    // prepare data
    IdmIdentityDto identityOne = getHelper().createIdentity((GuardedString) null);
    IdmIdentityDto identityTwo = getHelper().createIdentity((GuardedString) null);
    IdmRoleDto roleOne = getHelper().createRole();
    // 
    DataFilter dataFilter = new DataFilter(IdmIdentityDto.class);
    dataFilter.setCodeableIdentifier(identityOne.getUsername());
    List<IdmIdentity> identities = identityFilter.find(dataFilter, null).getContent();
    // 
    assertEquals(1, identities.size());
    assertEquals(identityOne.getId(), identities.get(0).getId());
    // 
    dataFilter.setCodeableIdentifier(identityTwo.getUsername());
    identities = identityFilter.find(dataFilter, null).getContent();
    assertEquals(1, identities.size());
    assertEquals(identityTwo.getId(), identities.get(0).getId());
    // 
    dataFilter.setCodeableIdentifier(roleOne.getId().toString());
    assertEquals(0, identityFilter.find(dataFilter, null).getTotalElements());
}
Also used : DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 24 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class CodeableFilterBuilderIntegrationTest method testFindIdentityByUuid.

@Test
public void testFindIdentityByUuid() {
    // prepare data
    IdmIdentityDto identityOne = getHelper().createIdentity((GuardedString) null);
    IdmIdentityDto identityTwo = getHelper().createIdentity((GuardedString) null);
    IdmRoleDto roleOne = getHelper().createRole();
    // 
    DataFilter dataFilter = new DataFilter(IdmIdentityDto.class);
    dataFilter.setCodeableIdentifier(identityOne.getId().toString());
    List<IdmIdentity> identities = identityFilter.find(dataFilter, null).getContent();
    // 
    assertEquals(1, identities.size());
    assertEquals(identityOne.getId(), identities.get(0).getId());
    // 
    dataFilter.setCodeableIdentifier(identityTwo.getId().toString());
    identities = identityFilter.find(dataFilter, null).getContent();
    assertEquals(1, identities.size());
    assertEquals(identityTwo.getId(), identities.get(0).getId());
    // 
    dataFilter.setCodeableIdentifier(roleOne.getId().toString());
    assertEquals(0, identityFilter.find(dataFilter, null).getTotalElements());
}
Also used : DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 25 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class DefaultFilterManagerUnitTest method testFindByFilterBuilderClass.

@Test
@SuppressWarnings("serial")
public void testFindByFilterBuilderClass() {
    FilterBuilderDto dto = new FilterBuilderDto();
    dto.setModule("test");
    dto.setEntityClass(IdmIdentity.class);
    dto.setFilterBuilderClass(IdmIdentityService.class);
    // 
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setFilterBuilderClass(IdmIdentityService.class.getCanonicalName());
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setFilterBuilderClass(IdmIdentityService.class.getSimpleName());
    Assert.assertFalse(manager.passFilter(dto, filter));
    // inline classes with null cannonical name
    dto.setFilterBuilderClass((new IdmIdentity() {
    }).getClass());
    filter.setFilterBuilderClass(IdmIdentity.class.getCanonicalName());
    Assert.assertFalse(manager.passFilter(dto, filter));
}
Also used : FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Aggregations

IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)58 Test (org.junit.Test)44 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)28 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)20 IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)18 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)13 Transactional (org.springframework.transaction.annotation.Transactional)11 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)9 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)9 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)7 DataFilter (eu.bcvsolutions.idm.core.api.dto.filter.DataFilter)6 List (java.util.List)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 IdmIdentityContract (eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract)5 Assert (org.junit.Assert)5 IdmAuthorityChange (eu.bcvsolutions.idm.core.model.entity.IdmAuthorityChange)4 UUID (java.util.UUID)4 Identifiable (eu.bcvsolutions.idm.core.api.domain.Identifiable)3 IdmEntityEventDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto)3 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)3