use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestFilter in project CzechIdMng by bcvsolutions.
the class IdmRequestFilterTest method dateTest.
@Test
public void dateTest() {
UUID ownerId = UUID.randomUUID();
String ownerType = IdmIdentityDto.class.toString();
IdmRequestDto createRequest = createRequest(ownerType, ownerId);
ZonedDateTime createdDate = createRequest.getCreated();
//
IdmRequestFilter filter = new IdmRequestFilter();
filter.setCreatedAfter(createdDate.minusSeconds(10));
filter.setCreatedBefore(createdDate.plusSeconds(10));
List<IdmRequestDto> content = requestService.find(filter, null).getContent();
Assert.assertEquals(1, content.size());
//
filter.setCreatedAfter(createdDate.minusSeconds(10));
filter.setCreatedBefore(createdDate.minusSeconds(9));
content = requestService.find(filter, null).getContent();
Assert.assertEquals(0, content.size());
//
filter.setCreatedAfter(createdDate.plusSeconds(10));
filter.setCreatedBefore(createdDate.plusSeconds(11));
content = requestService.find(filter, null).getContent();
Assert.assertEquals(0, content.size());
}
use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestFilter in project CzechIdMng by bcvsolutions.
the class IdmRequestFilterTest method ownerTypeTest.
@Test
public void ownerTypeTest() {
UUID ownerId = UUID.randomUUID();
String ownerType = IdmRoleDto.class.toString();
createRequest(ownerType, ownerId);
createRequest(ownerType, ownerId);
createRequest(ownerType, ownerId);
createRequest(IdmIdentityDto.class.toString(), ownerId);
IdmRequestFilter filter = new IdmRequestFilter();
filter.setOwnerType(ownerType);
filter.setOwnerId(ownerId);
List<IdmRequestDto> content = requestService.find(filter, null).getContent();
Assert.assertEquals(3, content.size());
}
Aggregations