Search in sources :

Example 1 with Cycle3DTO

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

the class Cycle3DataResourceTest method createSessionInAwaitingCycle3DataState.

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

Example 2 with Cycle3DTO

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

the class Cycle3DataResourceTest method should_ReturnSuccessWhenDataSubmitted.

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

Example 3 with Cycle3DTO

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

the class Cycle3DataResourceTest method shouldGetCycle3AttributeRequestDataFromConfiguration.

@Test
public void shouldGetCycle3AttributeRequestDataFromConfiguration() throws JsonProcessingException {
    // Given
    SessionId sessionId = SessionIdBuilder.aSessionId().build();
    String rpEntityId = new Cycle3DTO(sessionId).getRequestIssuerId();
    Response sessionCreatedResponse = createSessionInAwaitingCycle3DataState(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);
    // When
    Cycle3AttributeRequestData actualResponse = getCycle3Data(sessionId);
    // Then
    Cycle3AttributeRequestData expectedResponse = aCycle3AttributeRequestData().withAttributeName(cycle3Attribute.getAttributeName().get()).withRequestIssuerId(rpEntityId).build();
    assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse);
}
Also used : Response(javax.ws.rs.core.Response) Cycle3DTO(uk.gov.ida.integrationtest.hub.policy.rest.Cycle3DTO) MatchingProcessDto(uk.gov.ida.hub.policy.domain.MatchingProcessDto) 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)

Aggregations

Cycle3DTO (uk.gov.ida.integrationtest.hub.policy.rest.Cycle3DTO)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 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)1