Search in sources :

Example 1 with StyxServer

use of com.hotels.styx.testapi.StyxServer in project styx by ExpediaGroup.

the class ProtocolMetricsTest method recordsServerSideHttp.

@Test
public void recordsServerSideHttp() {
    styxServer = new StyxServer.Builder().addRoute("/", origin.port()).start();
    HttpResponse response = doGet("/");
    assertThat(response.status(), is(OK));
    assertThat(styxServer.metrics().meter("styx.server.http.requests").getCount(), is(1L));
    assertThat(styxServer.metrics().meter("styx.server.https.requests").getCount(), is(0L));
    assertThat(styxServer.metrics().meter("styx.server.http.responses.200").getCount(), is(1L));
    assertThat(styxServer.metrics().meter("styx.server.https.responses.200").getCount(), is(0L));
}
Also used : StyxServer(com.hotels.styx.testapi.StyxServer) HttpResponse(com.hotels.styx.api.HttpResponse) Test(org.junit.jupiter.api.Test)

Example 2 with StyxServer

use of com.hotels.styx.testapi.StyxServer in project styx by ExpediaGroup.

the class ProtocolMetricsTest method recordsServerSideHttps.

@Test
public void recordsServerSideHttps() {
    styxServer = new StyxServer.Builder().addRoute("/", origin.port()).start();
    HttpResponse response = doHttpsGet("/");
    assertThat(response.status(), is(OK));
    assertThat(styxServer.metrics().meter("styx.server.http.requests").getCount(), is(0L));
    assertThat(styxServer.metrics().meter("styx.server.https.requests").getCount(), is(1L));
    assertThat(styxServer.metrics().meter("styx.server.http.responses.200").getCount(), is(0L));
    assertThat(styxServer.metrics().meter("styx.server.https.responses.200").getCount(), is(1L));
}
Also used : StyxServer(com.hotels.styx.testapi.StyxServer) HttpResponse(com.hotels.styx.api.HttpResponse) Test(org.junit.jupiter.api.Test)

Aggregations

HttpResponse (com.hotels.styx.api.HttpResponse)2 StyxServer (com.hotels.styx.testapi.StyxServer)2 Test (org.junit.jupiter.api.Test)2