use of eu.bcvsolutions.idm.core.api.domain.RequestState in project CzechIdMng by bcvsolutions.
the class IdmRequestFilterTest method stateTest.
@Test
public void stateTest() {
UUID ownerId = UUID.randomUUID();
String ownerType = IdmIdentityDto.class.toString();
List<RequestState> states = new ArrayList<>();
RequestState state = RequestState.APPROVED;
states.add(state);
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
IdmRequestFilter filter = new IdmRequestFilter();
filter.setOwnerType(ownerType);
filter.setOwnerId(ownerId);
filter.setStates(states);
List<IdmRequestDto> content = requestService.find(filter, null).getContent();
Assert.assertEquals(3, content.size());
state = RequestState.CANCELED;
states.add(state);
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
filter.setStates(states);
content = requestService.find(filter, null).getContent();
Assert.assertEquals(6, content.size());
state = RequestState.EXCEPTION;
states.add(state);
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
filter.setStates(states);
content = requestService.find(filter, null).getContent();
Assert.assertEquals(9, content.size());
state = RequestState.IN_PROGRESS;
states.add(state);
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
changeState(state, createRequest(ownerType, ownerId));
filter.setStates(states);
content = requestService.find(filter, null).getContent();
Assert.assertEquals(12, content.size());
}
Aggregations