use of uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService in project verify-hub by alphagov.
the class Cycle0And1MatchRequestSentStateControllerTest method cycle0And1NoMatchResponseFromMatchingServiceWhenC3Enabled_shouldLogRelevantEvents.
@Test
public void cycle0And1NoMatchResponseFromMatchingServiceWhenC3Enabled_shouldLogRelevantEvents() {
MatchingProcess matchingProcess = mock(MatchingProcess.class);
when(matchingProcess.getAttributeName()).thenReturn(Optional.of("BLOCKBUSTER_CARD"));
when(transactionsConfigProxy.getMatchingProcess(TRANSACTION_ENTITY_ID)).thenReturn(matchingProcess);
when(transactionsConfigProxy.getUserAccountCreationAttributes(TRANSACTION_ENTITY_ID)).thenReturn(emptyList());
NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(MATCHING_SERVICE_ENTITY_ID, REQUEST_ID);
controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
verify(hubEventLogger, times(0)).logCycle01NoMatchEvent(state.getSessionId(), TRANSACTION_ENTITY_ID, REQUEST_ID, state.getSessionExpiryTimestamp());
verify(hubEventLogger, times(1)).logWaitingForCycle3AttributesEvent(state.getSessionId(), TRANSACTION_ENTITY_ID, REQUEST_ID, state.getSessionExpiryTimestamp());
}
use of uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService in project verify-hub by alphagov.
the class Cycle0And1MatchRequestSentStateControllerTest method responseProcessingDetails_shouldReturnNoMatchStatus_noMatchResponseSentFromMatchingService.
@Test
public void responseProcessingDetails_shouldReturnNoMatchStatus_noMatchResponseSentFromMatchingService() {
ArgumentCaptor<NoMatchState> argumentCaptor = ArgumentCaptor.forClass(NoMatchState.class);
NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(MATCHING_SERVICE_ENTITY_ID, REQUEST_ID);
when(transactionsConfigProxy.getMatchingProcess(TRANSACTION_ENTITY_ID)).thenReturn(new MatchingProcess(Optional.absent()));
when(transactionsConfigProxy.getUserAccountCreationAttributes(TRANSACTION_ENTITY_ID)).thenReturn(emptyList());
controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
NoMatchStateController noMatchStateController = new NoMatchStateController(argumentCaptor.getValue(), responseFromHubFactory);
final ResponseProcessingDetails responseProcessingDetails = noMatchStateController.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_NO_MATCH_RESPONSE_TO_TRANSACTION);
assertThat(responseProcessingDetails.getSessionId()).isEqualTo(state.getSessionId());
}
use of uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService 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.NoMatchFromMatchingService in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method shouldLogCycle3NoMatchEventToEventSinkForCycle3NoMatchResponseFromMatchingService.
@Test
public void shouldLogCycle3NoMatchEventToEventSinkForCycle3NoMatchResponseFromMatchingService() {
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<EventSinkHubEvent> argumentCaptor = ArgumentCaptor.forClass(EventSinkHubEvent.class);
NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(matchingServiceEntityId, requestId);
controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
verify(eventSinkProxy, times(1)).logHubEvent(argumentCaptor.capture());
final EventSinkHubEvent eventSinkHubEvent = argumentCaptor.getValue();
assertThat(eventSinkHubEvent.getEventType()).isEqualTo(EventSinkHubEventConstants.EventTypes.SESSION_EVENT);
assertThat(eventSinkHubEvent.getDetails().get(EventDetailsKey.session_event_type)).isEqualTo(CYCLE3_NO_MATCH);
assertThat(eventSinkHubEvent.getSessionId()).isEqualTo(sessionId.getSessionId());
assertThat(eventSinkHubEvent.getDetails().get(EventDetailsKey.request_id)).isEqualTo(requestId);
assertThat(eventSinkHubEvent.getOriginatingService()).isEqualTo(serviceInfo.getName());
}
use of uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService in project verify-hub by alphagov.
the class Cycle0And1MatchRequestSentStateControllerTest method shouldReturnNoMatchStatusWhenNoMatchResponseReceivedFromMatchingService.
@Test
public void shouldReturnNoMatchStatusWhenNoMatchResponseReceivedFromMatchingService() {
ArgumentCaptor<NoMatchState> argumentCaptor = ArgumentCaptor.forClass(NoMatchState.class);
NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(MATCHING_SERVICE_ENTITY_ID, REQUEST_ID);
when(transactionsConfigProxy.getMatchingProcess(TRANSACTION_ENTITY_ID)).thenReturn(new MatchingProcess(Optional.empty()));
when(transactionsConfigProxy.getUserAccountCreationAttributes(TRANSACTION_ENTITY_ID)).thenReturn(emptyList());
controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
NoMatchStateController noMatchStateController = new NoMatchStateController(argumentCaptor.getValue(), responseFromHubFactory);
final ResponseProcessingDetails responseProcessingDetails = noMatchStateController.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_NO_MATCH_RESPONSE_TO_TRANSACTION);
assertThat(responseProcessingDetails.getSessionId()).isEqualTo(state.getSessionId());
}
Aggregations