use of uk.gov.ida.eventsink.EventDetailsKey in project verify-hub by alphagov.
the class HubEventLoggerTest method logIdpFraudEvent_shouldLogFraudEventWithDetails.
@Test
public void logIdpFraudEvent_shouldLogFraudEventWithDetails() {
final String fraudEventId = "fraudEventId";
final String fraudIndicator = "FI02";
final FraudDetectedDetails fraudDetectedDetailsDto = aFraudDetectedDetails().withFraudEventId(fraudEventId).withFraudIndicator(fraudIndicator).build();
eventLogger.logIdpFraudEvent(SESSION_ID, IDP_ENTITY_ID, TRANSACTION_ENTITY_ID, PERSISTENT_ID, SESSION_EXPIRY_TIMESTAMP, fraudDetectedDetailsDto, Optional.of(PRINCIPAL_IP_ADDRESS_SEEN_BY_IDP), PRINCIPAL_IP_ADDRESS_SEEN_BY_HUB, REQUEST_ID);
final Map<EventDetailsKey, String> details = Maps.newHashMap();
details.put(session_event_type, FRAUD_DETECTED);
details.put(idp_entity_id, IDP_ENTITY_ID);
details.put(pid, PERSISTENT_ID.getNameId());
details.put(idp_fraud_event_id, fraudEventId);
details.put(gpg45_status, fraudIndicator);
details.put(principal_ip_address_as_seen_by_idp, PRINCIPAL_IP_ADDRESS_SEEN_BY_IDP);
details.put(principal_ip_address_as_seen_by_hub, PRINCIPAL_IP_ADDRESS_SEEN_BY_HUB);
final EventSinkHubEvent expectedEvent = createExpectedEventSinkHubEvent(details);
verify(eventSinkProxy).logHubEvent(argThat(new EventMatching(expectedEvent)));
verify(eventEmitter).record(argThat(new EventMatching(expectedEvent)));
}
use of uk.gov.ida.eventsink.EventDetailsKey in project verify-hub by alphagov.
the class HubEventLoggerTest method logMatchingServiceUserAccountCreationRequestSentEvent_shouldLogEvent.
@Test
public void logMatchingServiceUserAccountCreationRequestSentEvent_shouldLogEvent() {
eventLogger.logMatchingServiceUserAccountCreationRequestSentEvent(SESSION_ID, TRANSACTION_ENTITY_ID, SESSION_EXPIRY_TIMESTAMP, REQUEST_ID);
final Map<EventDetailsKey, String> details = Maps.newHashMap();
details.put(session_event_type, USER_ACCOUNT_CREATION_REQUEST_SENT);
final EventSinkHubEvent expectedEvent = createExpectedEventSinkHubEvent(details);
verify(eventSinkProxy).logHubEvent(argThat(new EventMatching(expectedEvent)));
verify(eventEmitter).record(argThat(new EventMatching(expectedEvent)));
}
use of uk.gov.ida.eventsink.EventDetailsKey in project verify-hub by alphagov.
the class HubEventLoggerTest method shouldLogErrorEventContainingAnErrorMessage.
@Test
public void shouldLogErrorEventContainingAnErrorMessage() {
eventLogger.logErrorEvent(ERROR_MESSAGE, SESSION_ID);
final Map<EventDetailsKey, String> details = Maps.newHashMap();
details.put(message, ERROR_MESSAGE);
final EventSinkHubEvent expectedEvent = new EventSinkHubEvent(SERVICE_INFO, SESSION_ID, ERROR_EVENT, details);
verify(eventSinkProxy).logHubEvent(argThat(new EventMatching(expectedEvent)));
verify(eventEmitter).record(argThat(new EventMatching(expectedEvent)));
}
use of uk.gov.ida.eventsink.EventDetailsKey in project verify-hub by alphagov.
the class HubEventLoggerTest method logIdpRequesterErrorEvent_shouldLogEvent.
@Test
public void logIdpRequesterErrorEvent_shouldLogEvent() {
final String errorMessage = "some error message";
eventLogger.logIdpRequesterErrorEvent(SESSION_ID, TRANSACTION_ENTITY_ID, SESSION_EXPIRY_TIMESTAMP, REQUEST_ID, Optional.fromNullable(errorMessage), PRINCIPAL_IP_ADDRESS_SEEN_BY_HUB);
final Map<EventDetailsKey, String> details = Maps.newHashMap();
details.put(message, errorMessage);
details.put(principal_ip_address_as_seen_by_hub, PRINCIPAL_IP_ADDRESS_SEEN_BY_HUB);
details.put(session_event_type, REQUESTER_ERROR);
final EventSinkHubEvent expectedEvent = createExpectedEventSinkHubEvent(details);
verify(eventSinkProxy).logHubEvent(argThat(new EventMatching(expectedEvent)));
verify(eventEmitter).record(argThat(new EventMatching(expectedEvent)));
}
use of uk.gov.ida.eventsink.EventDetailsKey in project verify-hub by alphagov.
the class HubEventLoggerTest method shouldLogErrorEventContainingIDPEntityId.
@Test
public void shouldLogErrorEventContainingIDPEntityId() {
final String idpEntityId = "IDP entity id";
eventLogger.logErrorEvent(ERROR_ID, idpEntityId, SESSION_ID);
final Map<EventDetailsKey, String> details = Maps.newHashMap();
details.put(idp_entity_id, idpEntityId);
details.put(error_id, ERROR_ID.toString());
final EventSinkHubEvent expectedEvent = new EventSinkHubEvent(SERVICE_INFO, SESSION_ID, ERROR_EVENT, details);
verify(eventSinkProxy).logHubEvent(argThat(new EventMatching(expectedEvent)));
verify(eventEmitter).record(argThat(new EventMatching(expectedEvent)));
}
Aggregations