Search in sources :

Example 16 with ResponseProcessingDetails

use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.

the class Cycle3MatchRequestSentStateControllerTest method statusShouldSendNoMatchResponseToTransaction_whenNoMatchResponseSentFromMatchingServiceCycle3Match.

@Test
public void statusShouldSendNoMatchResponseToTransaction_whenNoMatchResponseSentFromMatchingServiceCycle3Match() {
    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) Matchers.anyString(org.mockito.Matchers.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.Test)

Example 17 with ResponseProcessingDetails

use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.

the class MatchingServiceResourcesIntegrationTest method fullSuccessfulJourneyThroughAllStates.

@Test
public void fullSuccessfulJourneyThroughAllStates() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled(sessionId);
    aCycle3AttributeHasBeenSentToPolicyFromTheUser(sessionId, "#1");
    aNoMatchResponseHasBeenReceivedAndUserAccountCreationIsEnabled(sessionId);
    aUserAccountCreationResponseIsReceived(sessionId, MatchingServiceIdaStatus.UserAccountCreated);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.RESPONSE_PROCESSING_DETAILS_RESOURCE).build(sessionId);
    Response response = getResponse(policy.uri(uri.toASCIIString()));
    assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    ResponseProcessingDetails responseProcessingDetails = response.readEntity(ResponseProcessingDetails.class);
    assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_USER_ACCOUNT_CREATED_RESPONSE_TO_TRANSACTION);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
    assertThat(getSessionStateName(sessionId)).isEqualTo(UserAccountCreatedState.class.getName());
}
Also used : Response(javax.ws.rs.core.Response) UserAccountCreatedState(uk.gov.ida.hub.policy.domain.state.UserAccountCreatedState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) URI(java.net.URI) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.Test)

Example 18 with ResponseProcessingDetails

use of uk.gov.ida.hub.policy.domain.ResponseProcessingDetails in project verify-hub by alphagov.

the class MatchingServiceResourcesIntegrationTest method isResponseFromHubReady_shouldThrowExceptionWhenMatchingServiceWaitPeriodHasBeenExceeded.

@Test
public void isResponseFromHubReady_shouldThrowExceptionWhenMatchingServiceWaitPeriodHasBeenExceeded() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    theMatchingServiceResponseTimeoutHasBeenExceeded();
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.RESPONSE_PROCESSING_DETAILS_RESOURCE).build(sessionId);
    Response response = getResponse(policy.uri(uri.toASCIIString()));
    assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    ResponseProcessingDetails responseProcessingDetails = response.readEntity(ResponseProcessingDetails.class);
    assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SHOW_MATCHING_ERROR_PAGE);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
    assertThat(getSessionStateName(sessionId)).isEqualTo(MatchingServiceRequestErrorState.class.getName());
}
Also used : Response(javax.ws.rs.core.Response) MatchingServiceRequestErrorState(uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) URI(java.net.URI) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.Test)

Aggregations

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