Search in sources :

Example 1 with HealthCheckResponseDetail

use of io.confluent.ksql.rest.entity.HealthCheckResponseDetail in project ksql by confluentinc.

the class KsqlClientTest method shouldRequestServerHealthcheck.

@Test
public void shouldRequestServerHealthcheck() {
    // Given:
    Map<String, HealthCheckResponseDetail> map = new HashMap<>();
    map.put("foo", new HealthCheckResponseDetail(true));
    HealthCheckResponse healthCheckResponse = new HealthCheckResponse(true, map);
    server.setResponseObject(healthCheckResponse);
    // When:
    KsqlTarget target = ksqlClient.target(serverUri);
    RestResponse<HealthCheckResponse> response = target.getServerHealth();
    // Then:
    assertThat(server.getHttpMethod(), is(HttpMethod.GET));
    assertThat(server.getBody().length(), is(0));
    assertThat(server.getPath(), is("/healthcheck"));
    assertThat(server.getHeaders().get("Accept"), is("application/json"));
    assertThat(response.get(), is(healthCheckResponse));
}
Also used : HealthCheckResponse(io.confluent.ksql.rest.entity.HealthCheckResponse) HashMap(java.util.HashMap) HealthCheckResponseDetail(io.confluent.ksql.rest.entity.HealthCheckResponseDetail) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Aggregations

HealthCheckResponse (io.confluent.ksql.rest.entity.HealthCheckResponse)1 HealthCheckResponseDetail (io.confluent.ksql.rest.entity.HealthCheckResponseDetail)1 HashMap (java.util.HashMap)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1