use of uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckHandlerTest method handle_shouldRemoveDuplicatesFromMatchingServiceList.
@Test
public void handle_shouldRemoveDuplicatesFromMatchingServiceList() {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().withHealthCheckDisabled().withTransactionEntityId("1").build();
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto2 = aMatchingServiceConfigEntityDataDto().withHealthCheckDisabled().withTransactionEntityId("2").build();
when(matchingServiceConfigProxy.getMatchingServices()).thenReturn(asList(matchingServiceConfigEntityDataDto, matchingServiceConfigEntityDataDto2));
matchingServiceHealthCheckHandler.forceCheckAllMSAs();
verify(matchingServiceHealthChecker, times(1)).performHealthCheck(any(MatchingServiceConfigEntityDataDto.class));
}
use of uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckHandlerTest method handle_shouldReturnSuccessWhenMatchingServiceIsNotHealthy.
@Test
public void handle_shouldReturnSuccessWhenMatchingServiceIsNotHealthy() throws Exception {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto().build();
when(matchingServiceConfigProxy.getMatchingServices()).thenReturn(asList(matchingServiceConfigEntityDataDto));
when(matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto)).thenReturn(MatchingServiceHealthCheckResult.unhealthy(MatchingServiceHealthCheckDetailsBuilder.aMatchingServiceHealthCheckDetails().build()));
AggregatedMatchingServicesHealthCheckResult result = matchingServiceHealthCheckHandler.handle();
assertThat(result.isHealthy()).isEqualTo(false);
}
use of uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckHandlerTest method handle_shouldExecuteHealthCheckForMatchingServiceWithHealthCheckDisabledWhenForced.
@Test
public void handle_shouldExecuteHealthCheckForMatchingServiceWithHealthCheckDisabledWhenForced() {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().withHealthCheckDisabled().build();
when(matchingServiceConfigProxy.getMatchingServices()).thenReturn(asList(matchingServiceConfigEntityDataDto));
matchingServiceHealthCheckHandler.forceCheckAllMSAs();
verify(matchingServiceHealthChecker, times(1)).performHealthCheck(any(MatchingServiceConfigEntityDataDto.class));
}
use of uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckerTest method handle_shouldReturnFailureWithMessageForMatchingServiceThatCannotBeGeneratedBySamlEngine.
@Test
public void handle_shouldReturnFailureWithMessageForMatchingServiceThatCannotBeGeneratedBySamlEngine() throws Exception {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().build();
when(samlEngineProxy.generateHealthcheckAttributeQuery(any())).thenThrow(ApplicationException.createAuditedException(ExceptionType.INVALID_INPUT, UUID.randomUUID()));
MatchingServiceHealthCheckResult result = matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto);
assertThat(result.isHealthy()).isEqualTo(false);
assertThat(result.getDetails().getDetails()).isEqualTo("Saml-engine was unable to generate saml to send to MSA: uk.gov.ida.exceptions.ApplicationException: Exception of type [INVALID_INPUT] ");
}
use of uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckerTest method handle_shouldReturnResultWhenVersionReturnedByMsaIsNotSupported.
@Test
public void handle_shouldReturnResultWhenVersionReturnedByMsaIsNotSupported() {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().build();
prepareForHealthyResponse(matchingServiceConfigEntityDataDto, Optional.of(UNSUPPORTED_MSA_VERSION_NUMBER));
MatchingServiceHealthCheckResult result = matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto);
assertThat(result.getDetails().isVersionSupported()).isFalse();
}
Aggregations