use of uk.gov.ida.hub.policy.domain.MatchingProcessDto 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());
}
use of uk.gov.ida.hub.policy.domain.MatchingProcessDto 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);
}
use of uk.gov.ida.hub.policy.domain.MatchingProcessDto in project verify-hub by alphagov.
the class ConfigStubRule method setUpStubForEnteringAwaitingCycle3DataState.
public String setUpStubForEnteringAwaitingCycle3DataState(String rpEntityId) throws JsonProcessingException {
String uri = UriBuilder.fromPath(Urls.ConfigUrls.MATCHING_PROCESS_RESOURCE).build(rpEntityId).getPath();
final MatchingProcessDto cycle3Attribute = new MatchingProcessDto(Optional.of("TUFTY_CLUB_CARD"));
register(uri, OK, cycle3Attribute);
return cycle3Attribute.getAttributeName().get();
}
use of uk.gov.ida.hub.policy.domain.MatchingProcessDto 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);
}
use of uk.gov.ida.hub.policy.domain.MatchingProcessDto 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());
}
Aggregations