Search in sources :

Example 1 with RequestState

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());
}
Also used : RequestState(eu.bcvsolutions.idm.core.api.domain.RequestState) IdmRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestFilter) ArrayList(java.util.ArrayList) IdmRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestDto) UUID(java.util.UUID) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

RequestState (eu.bcvsolutions.idm.core.api.domain.RequestState)1 IdmRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRequestDto)1 IdmRequestFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestFilter)1 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 Test (org.junit.Test)1