Search in sources :

Example 6 with ResponseProcessingDetails

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

the class MatchingServiceResourcesIntegrationTest method journeyWithFailedAccountCreation.

@Test
public void journeyWithFailedAccountCreation() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled(sessionId);
    configStub.setUpStubForEnteringAwaitingCycle3DataState(rpEntityId);
    aCycle3AttributeHasBeenSentToPolicyFromTheUser(sessionId, "#1");
    aNoMatchResponseHasBeenReceivedAndUserAccountCreationIsEnabled(sessionId);
    aUserAccountCreationResponseIsReceived(sessionId, MatchingServiceIdaStatus.UserAccountCreationFailed);
    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.USER_ACCOUNT_CREATION_FAILED);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
    assertThat(getSessionStateName(sessionId)).isEqualTo(UserAccountCreationFailedState.class.getName());
}
Also used : Response(javax.ws.rs.core.Response) SessionId(uk.gov.ida.hub.policy.domain.SessionId) URI(java.net.URI) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) UserAccountCreationFailedState(uk.gov.ida.hub.policy.domain.state.UserAccountCreationFailedState) Test(org.junit.Test)

Example 7 with ResponseProcessingDetails

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

the class MatchingServiceResourcesIntegrationTest method shouldReturnOkWhenAMatchingServiceFailureResponseIsReceived.

@Test
public void shouldReturnOkWhenAMatchingServiceFailureResponseIsReceived() throws Exception {
    SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.MATCHING_SERVICE_REQUEST_FAILURE_RESOURCE).build(sessionId);
    Response response = postResponse(policy.uri(uri.toASCIIString()), null);
    assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    assertThat(getSessionStateName(sessionId)).isEqualTo(MatchingServiceRequestErrorState.class.getName());
    // check that the state has been updated
    uri = UriBuilder.fromPath(Urls.PolicyUrls.RESPONSE_PROCESSING_DETAILS_RESOURCE).build(sessionId);
    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);
}
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)

Example 8 with ResponseProcessingDetails

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

the class MatchingServiceResourcesIntegrationTest method responseProcessingDetails_shouldReturnWaitingForC3Status_whenNoMatchResponseSentFromMatchingServiceAndC3Required.

@Test
public void responseProcessingDetails_shouldReturnWaitingForC3Status_whenNoMatchResponseSentFromMatchingServiceAndC3Required() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled(sessionId);
    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.GET_C3_DATA);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
    assertThat(getSessionStateName(sessionId)).isEqualTo(AwaitingCycle3DataState.class.getName());
}
Also used : Response(javax.ws.rs.core.Response) AwaitingCycle3DataState(uk.gov.ida.hub.policy.domain.state.AwaitingCycle3DataState) 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 9 with ResponseProcessingDetails

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

the class MatchingServiceResourcesIntegrationTest method isResponseFromHubReady_shouldThrowExceptionWhenCycle3MatchingServiceWaitPeriodHasBeenExceeded.

@Test
public void isResponseFromHubReady_shouldThrowExceptionWhenCycle3MatchingServiceWaitPeriodHasBeenExceeded() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled(sessionId);
    aCycle3AttributeHasBeenSentToPolicyFromTheUser(sessionId, "#1");
    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)

Example 10 with ResponseProcessingDetails

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

the class MatchingServiceResourcesIntegrationTest method isResponseFromHubReady_shouldReturnFailedStatusWhenAProblemHasOccurredWhilstMatchingCycle1.

@Test
public void isResponseFromHubReady_shouldReturnFailedStatusWhenAProblemHasOccurredWhilstMatchingCycle1() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    aMatchingServiceFailureResponseHasBeenReceived(sessionId);
    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