Search in sources :

Example 1 with EidasCycle3DTO

use of uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO in project verify-hub by alphagov.

the class EidasCycle3DataResourceTest method shouldGetCycle3AttributeRequestDataFromConfiguration.

@Test
public void shouldGetCycle3AttributeRequestDataFromConfiguration() throws JsonProcessingException {
    final SessionId sessionId = SessionIdBuilder.aSessionId().build();
    final String rpEntityId = new EidasCycle3DTO(sessionId).getRequestIssuerEntityId();
    final Response sessionCreatedResponse = createSessionInEidasAwaitingCycle3DataState(sessionId);
    assertThat(sessionCreatedResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    final MatchingProcessDto cycle3Attribute = new MatchingProcessDto(Optional.of("TUFTY_CLUB_CARD"));
    configStub.setUpStubForEnteringAwaitingCycle3DataState(rpEntityId, cycle3Attribute);
    samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
    final Cycle3AttributeRequestData actualResponse = getCycle3Data(sessionId);
    final Cycle3AttributeRequestData expectedResponse = aCycle3AttributeRequestData().withAttributeName(cycle3Attribute.getAttributeName().get()).withRequestIssuerId(rpEntityId).build();
    assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse);
}
Also used : Response(javax.ws.rs.core.Response) MatchingProcessDto(uk.gov.ida.hub.policy.domain.MatchingProcessDto) EidasCycle3DTO(uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO) Cycle3AttributeRequestData(uk.gov.ida.hub.policy.domain.Cycle3AttributeRequestData) Cycle3AttributeRequestDataBuilder.aCycle3AttributeRequestData(uk.gov.ida.hub.policy.builder.domain.Cycle3AttributeRequestDataBuilder.aCycle3AttributeRequestData) SessionId(uk.gov.ida.hub.policy.domain.SessionId) Test(org.junit.Test)

Example 2 with EidasCycle3DTO

use of uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO in project verify-hub by alphagov.

the class EidasCycle3DataResourceTest method createSessionInEidasAwaitingCycle3DataState.

private Response createSessionInEidasAwaitingCycle3DataState(final SessionId sessionId) {
    final URI uri = UriBuilder.fromPath(TEST_SESSION_RESOURCE_PATH + EIDAS_AWAITING_CYCLE_3_DATA_STATE).build();
    final EidasCycle3DTO dto = new EidasCycle3DTO(sessionId);
    return client.target(policy.uri(uri.toASCIIString())).request().post(Entity.json(dto));
}
Also used : EidasCycle3DTO(uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO) URI(java.net.URI)

Example 3 with EidasCycle3DTO

use of uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO in project verify-hub by alphagov.

the class EidasCycle3DataResourceTest method shouldReturnSuccessWhenDataSubmitted.

@Test
public void shouldReturnSuccessWhenDataSubmitted() throws JsonProcessingException {
    final SessionId sessionId = SessionIdBuilder.aSessionId().build();
    final String rpEntityId = new EidasCycle3DTO(sessionId).getRequestIssuerEntityId();
    final String msaEntityId = new EidasCycle3DTO(sessionId).getMatchingServiceAdapterEntityId();
    final Response sessionCreatedResponse = createSessionInEidasAwaitingCycle3DataState(sessionId);
    assertThat(sessionCreatedResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    final Cycle3UserInput cycle3UserInput = new Cycle3UserInput("test-value", "principal-ip-address-seen-by-hub");
    samlEngineStub.setupStubForEidasAttributeQueryRequestGeneration(AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto().build());
    configStub.setUpStubForMatchingServiceRequest(rpEntityId, msaEntityId);
    final MatchingProcessDto cycle3Attribute = new MatchingProcessDto(Optional.of("TUFTY_CLUB_CARD"));
    configStub.setUpStubForEnteringAwaitingCycle3DataState(rpEntityId, cycle3Attribute);
    samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
    postCycle3Data(sessionId, cycle3UserInput);
    assertThat(getSessionStateName(sessionId)).isEqualTo(EidasCycle3MatchRequestSentState.class.getName());
}
Also used : Response(javax.ws.rs.core.Response) MatchingProcessDto(uk.gov.ida.hub.policy.domain.MatchingProcessDto) EidasCycle3DTO(uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO) Cycle3UserInput(uk.gov.ida.hub.policy.domain.Cycle3UserInput) EidasCycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) Test(org.junit.Test)

Aggregations

EidasCycle3DTO (uk.gov.ida.integrationtest.hub.policy.rest.EidasCycle3DTO)3 Response (javax.ws.rs.core.Response)2 Test (org.junit.Test)2 MatchingProcessDto (uk.gov.ida.hub.policy.domain.MatchingProcessDto)2 SessionId (uk.gov.ida.hub.policy.domain.SessionId)2 URI (java.net.URI)1 Cycle3AttributeRequestDataBuilder.aCycle3AttributeRequestData (uk.gov.ida.hub.policy.builder.domain.Cycle3AttributeRequestDataBuilder.aCycle3AttributeRequestData)1 Cycle3AttributeRequestData (uk.gov.ida.hub.policy.domain.Cycle3AttributeRequestData)1 Cycle3UserInput (uk.gov.ida.hub.policy.domain.Cycle3UserInput)1 EidasCycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState)1