Search in sources :

Example 46 with MatchingServiceConfigEntityDataDto

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);
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto) MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.builders.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto) Test(org.junit.jupiter.api.Test)

Example 47 with MatchingServiceConfigEntityDataDto

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));
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto) MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.builders.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto) Test(org.junit.jupiter.api.Test)

Example 48 with MatchingServiceConfigEntityDataDto

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);
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto) MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.builders.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto) Test(org.junit.jupiter.api.Test)

Example 49 with MatchingServiceConfigEntityDataDto

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));
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto) MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.builders.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto) Test(org.junit.jupiter.api.Test)

Example 50 with MatchingServiceConfigEntityDataDto

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);
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto) MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto(uk.gov.ida.hub.samlsoapproxy.builders.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto) Test(org.junit.jupiter.api.Test)

Aggregations

MatchingServiceConfigEntityDataDto (uk.gov.ida.hub.samlsoapproxy.contract.MatchingServiceConfigEntityDataDto)58 MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto (uk.gov.ida.hub.samlsoapproxy.builders.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto)51 Test (org.junit.jupiter.api.Test)33 Test (org.junit.Test)18 SamlMessageDto (uk.gov.ida.hub.samlsoapproxy.contract.SamlMessageDto)9 MatchingServiceHealthCheckResponseDto (uk.gov.ida.hub.samlsoapproxy.domain.MatchingServiceHealthCheckResponseDto)8 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 AttributeQuery (org.opensaml.saml.saml2.core.AttributeQuery)1 ApplicationException (uk.gov.ida.exceptions.ApplicationException)1 MatchingServiceConfigProxy (uk.gov.ida.hub.samlsoapproxy.proxy.MatchingServiceConfigProxy)1 SamlValidationSpecificationFailure (uk.gov.ida.saml.core.validation.SamlValidationSpecificationFailure)1