use of uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckerTest method shouldReturnDefaultVersionIfVersionFlagNotPresentInResponseIdForHealthyMatchingService.
@Test
public void shouldReturnDefaultVersionIfVersionFlagNotPresentInResponseIdForHealthyMatchingService() {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().build();
prepareForHealthyResponse(matchingServiceConfigEntityDataDto);
mockHealthcheckResponseId("healthcheck-response-id");
MatchingServiceHealthCheckResult result = matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto);
assertThat(result.getDetails().getVersionNumber()).isEqualTo(DEFAULT_VERSION_VALUE);
}
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_shouldReturnSuccessWhenMatchingServiceIsHealthy.
@Test
public void handle_shouldReturnSuccessWhenMatchingServiceIsHealthy() {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto().build();
when(matchingServiceConfigProxy.getMatchingServices()).thenReturn(singletonList(matchingServiceConfigEntityDataDto));
when(matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto)).thenReturn(MatchingServiceHealthCheckResult.healthy(MatchingServiceHealthCheckDetailsBuilder.aMatchingServiceHealthCheckDetails().build()));
AggregatedMatchingServicesHealthCheckResult result = matchingServiceHealthCheckHandler.handle();
assertThat(result.isHealthy()).isEqualTo(true);
}
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(singletonList(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 MatchingServiceHealthCheckHandlerTest method handle_shouldReturnSuccessWhenMatchingServiceIsNotHealthy.
@Test
public void handle_shouldReturnSuccessWhenMatchingServiceIsNotHealthy() {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto().build();
when(matchingServiceConfigProxy.getMatchingServices()).thenReturn(singletonList(matchingServiceConfigEntityDataDto));
when(matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto)).thenReturn(MatchingServiceHealthCheckResult.unhealthy(MatchingServiceHealthCheckDetailsBuilder.aMatchingServiceHealthCheckDetails().build()));
AggregatedMatchingServicesHealthCheckResult result = matchingServiceHealthCheckHandler.handle();
assertThat(result.isHealthy()).isEqualTo(false);
}
Aggregations