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());
}
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());
}
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());
}
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());
}
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));
}
Aggregations