use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class VersionTextHandlerTest method canProvideASingleVersionTextFile.
@Test
public void canProvideASingleVersionTextFile() {
VersionTextHandler handler = new VersionTextHandler(resources("classpath:/versions/version1.txt"));
HttpResponse response = Mono.from(handler.handle(get("/version.txt").build(), requestContext())).block();
assertThat(response.bodyAs(UTF_8), is("foo\n"));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class CurrentRequestsHandlerTest method testWithoutStackTrace.
@Test
public void testWithoutStackTrace() {
tracker.trackRequest(req1);
HttpResponse response = Mono.from(handler.handle(adminRequest, requestContext())).block();
String body = response.bodyAs(UTF_8);
assertFalse(body.contains(format("id=%d state", Thread.currentThread().getId())), format("This is received response body: ```%s```", body));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class CurrentRequestsHandlerTest method testStackTrace.
@Test
public void testStackTrace() {
Thread.currentThread().setName("Test-Thread");
tracker.trackRequest(req1);
HttpResponse response = Mono.from(handler.handle(adminRequest, requestContext())).block();
assertThat(response.bodyAs(UTF_8).contains("Test-Thread"), is(true));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class JVMMetricsHandlerTest method doesNotExposeIrrelevantMetrics.
@Test
public void doesNotExposeIrrelevantMetrics() {
HttpResponse response = call(get("/jvm").build());
assertThat(response.bodyAs(UTF_8), is(not(containsString("irrelevant"))));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class LoggingConfigurationHandlerTest method showsLogConfigContent.
@Test
public void showsLogConfigContent() throws IOException {
StartupConfig startupConfig = newStartupConfigBuilder().logbackConfigLocation(fixturesHome() + "/conf/environment/styx-config-test.yml").build();
LoggingConfigurationHandler handler = new LoggingConfigurationHandler(startupConfig.logConfigLocation());
HttpResponse response = Mono.from(handler.handle(get("/").build(), requestContext())).block();
String expected = Resources.load(new ClasspathResource("conf/environment/styx-config-test.yml", LoggingConfigurationHandlerTest.class));
assertThat(response.status(), is(OK));
assertThat(response.bodyAs(UTF_8), is(expected));
}
Aggregations