use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class VerifyPreEndpointExecutionWorkChainComponentTest method verify_proxy_work_chain_stops_at_downstream_content_validation_if_content_validator_blows_up.
@Test
public void verify_proxy_work_chain_stops_at_downstream_content_validation_if_content_validator_blows_up() throws IOException, InterruptedException {
String fooValue = UUID.randomUUID().toString();
String postData = objectMapper.writeValueAsString(new PostObj(fooValue));
ExtractableResponse response = given().baseUri("http://127.0.0.1").port(serverConfig.endpointsPort()).basePath(WorkChainProxyEndpoint.PROXY_MATCHING_PATH).header(PROXY_ROUTER_DESTINATION_PORT_HEADER_KEY, String.valueOf(downstreamServerConfig.endpointsPort())).header(BLOW_UP_IN_CONTENT_VALIDATOR_HEADER_KEY, "true").body(postData).log().all().when().post().then().log().all().extract();
Thread.sleep(10);
verifyErrorReceived(response, CONTENT_VALIDATOR_API_ERROR);
verifyAsyncWorkerChainExecution(2, 1, 1, true, false);
}
use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class VerifyPreEndpointExecutionWorkChainComponentTest method verify_proxy_work_chain_stops_at_downstream_content_deserialization_if_content_deserializer_blows_up.
@Test
public void verify_proxy_work_chain_stops_at_downstream_content_deserialization_if_content_deserializer_blows_up() throws IOException, InterruptedException {
String fooValue = UUID.randomUUID().toString();
String postData = objectMapper.writeValueAsString(new PostObj(fooValue));
ExtractableResponse response = given().baseUri("http://127.0.0.1").port(serverConfig.endpointsPort()).basePath(WorkChainProxyEndpoint.PROXY_MATCHING_PATH).header(PROXY_ROUTER_DESTINATION_PORT_HEADER_KEY, String.valueOf(downstreamServerConfig.endpointsPort())).header(BLOW_UP_IN_CONTENT_DESERIALIZER_HEADER_KEY, "true").body(postData).log().all().when().post().then().log().all().extract();
Thread.sleep(10);
verifyErrorReceived(response, SampleCoreApiError.MALFORMED_REQUEST);
verifyAsyncWorkerChainExecution(2, 1, 0, true, false);
}
use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class VerifyPreEndpointExecutionWorkChainComponentTest method verify_work_chain_stops_at_content_deserialization_if_content_deserializer_blows_up.
@Test
public void verify_work_chain_stops_at_content_deserialization_if_content_deserializer_blows_up() throws IOException, InterruptedException {
String fooValue = UUID.randomUUID().toString();
String postData = objectMapper.writeValueAsString(new PostObj(fooValue));
ExtractableResponse response = given().baseUri("http://127.0.0.1").port(serverConfig.endpointsPort()).basePath(WorkChainEndpoint.WORK_CHAIN_MATCHING_PATH).header(BLOW_UP_IN_CONTENT_DESERIALIZER_HEADER_KEY, "true").body(postData).log().all().when().post().then().log().all().extract();
Thread.sleep(10);
verifyErrorReceived(response, SampleCoreApiError.MALFORMED_REQUEST);
verifyAsyncWorkerChainExecution(1, 1, 0, false, false);
}
use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class VerifyRequestSizeValidationComponentTest method should_return_expected_response_when_endpoint_disabled_ContentLength_header_above_global_size_validation.
@Test
public void should_return_expected_response_when_endpoint_disabled_ContentLength_header_above_global_size_validation() {
ExtractableResponse response = given().baseUri(BASE_URI).port(serverConfig.endpointsPort()).basePath(BasicEndpointWithRequestSizeValidationDisabled.MATCHING_PATH).log().all().body(generatePayloadOfSizeInBytes(GLOBAL_MAX_REQUEST_SIZE + 100)).when().post().then().log().headers().extract();
assertThat(response.statusCode()).isEqualTo(HttpResponseStatus.OK.code());
assertThat(response.asString()).isEqualTo(BasicEndpointWithRequestSizeValidationDisabled.RESPONSE_PAYLOAD);
}
use of io.restassured.response.ExtractableResponse in project riposte by Nike-Inc.
the class ArchaiusServerTest method verify_essential_behavior.
@Test
public void verify_essential_behavior() throws Exception {
// given
setAppAndEnvironment("archaiusserver", "compiletimetest");
int port = findFreePort();
ArchaiusServer server = generateArchaiusServer(port);
assertThat(System.getProperty("org.jboss.logging.provider")).isNull();
// when
server.launchServer(null);
ExtractableResponse<Response> response = given().baseUri("http://localhost").port(port).when().get(SomeEndpoint.MATCHING_PATH).then().extract();
// then
assertThat(response.statusCode()).isEqualTo(200);
assertThat(response.asString()).isEqualTo("overridevalue");
assertThat(System.getProperty("org.jboss.logging.provider")).isEqualTo("slf4j");
assertThat(ResourceLeakDetector.getLevel()).isEqualTo(ResourceLeakDetector.Level.PARANOID);
}
Aggregations