use of uk.gov.ida.integrationtest.hub.samlsoapproxy.apprule.support.MatchingServiceDetails in project verify-hub by alphagov.
the class PrometheusMetricsIntegrationTest method setUp.
@BeforeEach
public void setUp() throws JsonProcessingException {
client = samlSoapProxyApp.getClient();
final MatchingServiceDetails msaOneDetails = new MatchingServiceDetails(msaStubOne.getAttributeQueryRequestUri(), MSA_ONE_ENTITY_ID, RP_ONE_ENTITY_ID);
final MatchingServiceDetails msaTwoDetails = new MatchingServiceDetails(msaStubTwo.getAttributeQueryRequestUri(), MSA_TWO_ENTITY_ID, RP_TWO_ENTITY_ID);
final MatchingServiceDetails msaThreeDetails = new MatchingServiceDetails(msaStubThree.getAttributeQueryRequestUri(), MSA_THREE_ENTITY_ID, RP_THREE_ENTITY_ID);
final MatchingServiceDetails msaFourDetails = new MatchingServiceDetails(msaStubFour.getAttributeQueryRequestUri(), MSA_FOUR_ENTITY_ID, RP_FOUR_ENTITY_ID);
Set<MatchingServiceDetails> msaDetailsSet = new HashSet<>(Set.of(msaOneDetails, msaTwoDetails, msaThreeDetails, msaFourDetails));
final Element msaOneResponse = aHealthyHealthCheckResponse(MSA_ONE_ENTITY_ID, MSA_ONE_RESPONSE_ID, MSA_ONE_VERSION);
final Element msaTwoResponse = aHealthyHealthCheckResponse(MSA_TWO_ENTITY_ID, MSA_TWO_RESPONSE_ID, MSA_TWO_VERSION);
final Element msaFourResponse = aHealthyHealthCheckResponse(MSA_FOUR_ENTITY_ID, MSA_FOUR_RESPONSE_ID, MSA_FOUR_VERSION);
final SamlMessageDto msaOneSamlMessage = new SamlMessageDto(Base64.getEncoder().encodeToString(XmlUtils.writeToString(msaOneResponse).getBytes()));
final SamlMessageDto msaTwoSamlMessage = new SamlMessageDto(Base64.getEncoder().encodeToString(XmlUtils.writeToString(msaTwoResponse).getBytes()));
final SamlMessageDto msaFourSamlMessage = new SamlMessageDto(Base64.getEncoder().encodeToString(XmlUtils.writeToString(msaFourResponse).getBytes()));
final MatchingServiceHealthCheckerRequestDto msaOneHealthCheckerRequest = new MatchingServiceHealthCheckerRequestDto(RP_ONE_ENTITY_ID, MSA_ONE_ENTITY_ID);
final MatchingServiceHealthCheckerRequestDto msaTwoHealthCheckerRequest = new MatchingServiceHealthCheckerRequestDto(RP_TWO_ENTITY_ID, MSA_TWO_ENTITY_ID);
final MatchingServiceHealthCheckerRequestDto msaThreeHealthCheckerRequest = new MatchingServiceHealthCheckerRequestDto(RP_THREE_ENTITY_ID, MSA_THREE_ENTITY_ID);
final MatchingServiceHealthCheckerRequestDto msaFourHealthCheckerRequest = new MatchingServiceHealthCheckerRequestDto(RP_FOUR_ENTITY_ID, MSA_FOUR_ENTITY_ID);
eventSinkStub.setupStubForLogging();
configStub.setUpStubForMatchingServiceHealthCheckRequests(msaDetailsSet);
configStub.setupStubForCertificates(MSA_ONE_ENTITY_ID, TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PUBLIC_ENCRYPTION_CERT);
configStub.setupStubForCertificates(MSA_TWO_ENTITY_ID, TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PUBLIC_ENCRYPTION_CERT);
configStub.setupStubForCertificates(MSA_FOUR_ENTITY_ID, TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PUBLIC_ENCRYPTION_CERT);
msaStubOne.prepareForHealthCheckRequest(XmlUtils.writeToString(SOAP_MESSAGE_MANAGER.wrapWithSoapEnvelope(msaOneResponse)));
msaStubTwo.prepareForHealthCheckRequest(XmlUtils.writeToString(SOAP_MESSAGE_MANAGER.wrapWithSoapEnvelope(msaTwoResponse)));
msaStubFour.prepareForHealthCheckRequest(XmlUtils.writeToString(SOAP_MESSAGE_MANAGER.wrapWithSoapEnvelope(msaFourResponse)));
samlEngineStub.prepareForHealthCheckSamlGeneration(msaOneHealthCheckerRequest);
samlEngineStub.prepareForHealthCheckSamlGeneration(msaTwoHealthCheckerRequest);
samlEngineStub.prepareForHealthCheckSamlGeneration(msaThreeHealthCheckerRequest);
samlEngineStub.prepareForHealthCheckSamlGeneration(msaFourHealthCheckerRequest);
samlEngineStub.setupStubForAttributeResponseTranslate(msaOneSamlMessage, anInboundResponseFromMatchingServiceDto().withIssuer(MSA_ONE_ENTITY_ID).withStatus(Healthy).build());
samlEngineStub.setupStubForAttributeResponseTranslate(msaTwoSamlMessage, anInboundResponseFromMatchingServiceDto().withIssuer(MSA_TWO_ENTITY_ID).withStatus(Healthy).build());
samlEngineStub.setupStubForAttributeResponseTranslate(msaFourSamlMessage, anInboundResponseFromMatchingServiceDto().withIssuer(MSA_FOUR_ENTITY_ID).withStatus(Healthy).build());
}
Aggregations