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);
}
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());
}
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());
}
Aggregations