use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.
the class Cycle0And1MatchRequestSentStateControllerTest method responseProcessingDetails_shouldReturnCompleteStatus_successResponseSentFromMatchingService.
@Test
public void responseProcessingDetails_shouldReturnCompleteStatus_successResponseSentFromMatchingService() {
ArgumentCaptor<SuccessfulMatchState> argumentCaptor = ArgumentCaptor.forClass(SuccessfulMatchState.class);
MatchFromMatchingService matchFromMatchingService = new MatchFromMatchingService(MATCHING_SERVICE_ENTITY_ID, REQUEST_ID, "assertionBlob", Optional.of(LevelOfAssurance.LEVEL_1));
controller.handleMatchResponseFromMatchingService(matchFromMatchingService);
IdentityProvidersConfigProxy identityProvidersConfigProxy = mock(IdentityProvidersConfigProxy.class);
verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
SuccessfulMatchStateController successfulMatchStateController = new SuccessfulMatchStateController(argumentCaptor.getValue(), responseFromHubFactory, identityProvidersConfigProxy);
final ResponseProcessingDetails responseProcessingDetails = successfulMatchStateController.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_SUCCESSFUL_MATCH_RESPONSE_TO_TRANSACTION);
assertThat(responseProcessingDetails.getSessionId()).isEqualTo(state.getSessionId());
}
use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.
the class EidasAwaitingCycle3DataStateControllerTest method getResponseProcessingDetails.
@Test
public void getResponseProcessingDetails() throws Exception {
ResponseProcessingDetails expectedResponse = new ResponseProcessingDetails(state.getSessionId(), ResponseProcessingStatus.GET_C3_DATA, state.getRequestIssuerEntityId());
ResponseProcessingDetails actualResponse = controller.getResponseProcessingDetails();
assertThat(actualResponse).isEqualTo(expectedResponse);
}
use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method shouldReturnWaitResponseWhenAskedAndInCycle3MatchRequestSentState.
@Test
public void shouldReturnWaitResponseWhenAskedAndInCycle3MatchRequestSentState() {
final String requestId = "requestId";
final SessionId sessionId = SessionId.createNewSessionId();
Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, null, null, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(Duration.standardMinutes(5));
final ResponseProcessingDetails responseProcessingDetails = controller.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.WAIT);
}
use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method statusShouldSendNoMatchResponseToTransactionWhenNoMatchResponseReceivedFromMatchingServiceCycle3Match.
@Test
public void statusShouldSendNoMatchResponseToTransactionWhenNoMatchResponseReceivedFromMatchingServiceCycle3Match() {
final String requestId = "requestId";
final SessionId sessionId = SessionId.createNewSessionId();
Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, null, null, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
ArgumentCaptor<NoMatchState> argumentCaptor = ArgumentCaptor.forClass(NoMatchState.class);
NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(matchingServiceEntityId, requestId);
controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
NoMatchStateController noMatchStateController = new NoMatchStateController(argumentCaptor.getValue(), responseFromHubFactory);
ResponseProcessingDetails responseProcessingDetails = noMatchStateController.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_NO_MATCH_RESPONSE_TO_TRANSACTION);
assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
}
use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method shouldMoveFromAwaitingC3StateToCycle3DataSentStateWhenCycle3DataIsReceived.
@Test
public void shouldMoveFromAwaitingC3StateToCycle3DataSentStateWhenCycle3DataIsReceived() {
final String requestId = "requestId";
final SessionId sessionId = SessionId.createNewSessionId();
Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, null, null, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(Duration.standardMinutes(5));
ResponseProcessingDetails responseProcessingDetails = controller.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.WAIT);
assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
}
Aggregations