Search in sources :

Example 1 with ResponseProcessingDetails

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());
}
Also used : NoMatchFromMatchingService(uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService) MatchFromMatchingServiceBuilder.aMatchFromMatchingService(uk.gov.ida.hub.policy.builder.domain.MatchFromMatchingServiceBuilder.aMatchFromMatchingService) MatchFromMatchingService(uk.gov.ida.hub.policy.domain.MatchFromMatchingService) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) SuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState) IdentityProvidersConfigProxy(uk.gov.ida.hub.policy.proxy.IdentityProvidersConfigProxy) Test(org.junit.Test)

Example 2 with ResponseProcessingDetails

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);
}
Also used : ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.Test)

Example 3 with ResponseProcessingDetails

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);
}
Also used : Cycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState) Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState(uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) SessionId(uk.gov.ida.hub.policy.domain.SessionId) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.jupiter.api.Test)

Example 4 with ResponseProcessingDetails

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);
}
Also used : NoMatchFromMatchingService(uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService) Cycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState) Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState(uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) SessionId(uk.gov.ida.hub.policy.domain.SessionId) NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.jupiter.api.Test)

Example 5 with ResponseProcessingDetails

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);
}
Also used : Cycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState) Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState(uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) SessionId(uk.gov.ida.hub.policy.domain.SessionId) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.jupiter.api.Test)

Aggregations

ResponseProcessingDetails (uk.gov.ida.hub.policy.domain.ResponseProcessingDetails)21 Test (org.junit.jupiter.api.Test)17 SessionId (uk.gov.ida.hub.policy.domain.SessionId)15 URI (java.net.URI)11 Response (javax.ws.rs.core.Response)11 NoMatchFromMatchingService (uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService)6 MatchingServiceRequestErrorState (uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState)6 Test (org.junit.Test)4 Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState)4 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)4 NoMatchState (uk.gov.ida.hub.policy.domain.state.NoMatchState)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 MatchFromMatchingServiceBuilder.aMatchFromMatchingService (uk.gov.ida.hub.policy.builder.domain.MatchFromMatchingServiceBuilder.aMatchFromMatchingService)2 MatchFromMatchingService (uk.gov.ida.hub.policy.domain.MatchFromMatchingService)2 MatchingProcess (uk.gov.ida.hub.policy.domain.MatchingProcess)2 SuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState)2 UserAccountCreationRequestSentState (uk.gov.ida.hub.policy.domain.state.UserAccountCreationRequestSentState)2 IdentityProvidersConfigProxy (uk.gov.ida.hub.policy.proxy.IdentityProvidersConfigProxy)2 Matchers.anyString (org.mockito.Matchers.anyString)1 AwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.AwaitingCycle3DataState)1