Search in sources :

Example 1 with HeartbeatResponse

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

the class KsqlClientTest method shouldSendHeartbeatRequest.

@Test
public void shouldSendHeartbeatRequest() throws Exception {
    // Given:
    KsqlHostInfoEntity entity = new KsqlHostInfoEntity(serverUri.getHost(), serverUri.getPort());
    long timestamp = System.currentTimeMillis();
    server.setResponseObject(new HeartbeatResponse(true));
    // When:
    KsqlTarget target = ksqlClient.target(serverUri);
    target.postAsyncHeartbeatRequest(entity, timestamp);
    Buffer body = server.waitForRequestBody();
    HeartbeatMessage hbm = KsqlClientUtil.deserialize(body, HeartbeatMessage.class);
    // Then:
    assertThat(server.getHttpMethod(), is(HttpMethod.POST));
    assertThat(server.getPath(), is("/heartbeat"));
    assertThat(server.getHeaders().get("Accept"), is("application/json"));
    assertThat(hbm, is(new HeartbeatMessage(entity, timestamp)));
}
Also used : Buffer(io.vertx.core.buffer.Buffer) HeartbeatResponse(io.confluent.ksql.rest.entity.HeartbeatResponse) HeartbeatMessage(io.confluent.ksql.rest.entity.HeartbeatMessage) KsqlHostInfoEntity(io.confluent.ksql.rest.entity.KsqlHostInfoEntity) Test(org.junit.Test)

Example 2 with HeartbeatResponse

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

the class AuthorizationFunctionalTest method shouldAllowAccess_internal.

@Test
public void shouldAllowAccess_internal() {
    // Given:
    allowAccess(USER1, "POST", "/heartbeat");
    // When:
    final HeartbeatResponse response = makeHeartbeat(USER1);
    // Then:
    assertThat(response.getIsOk(), is(true));
}
Also used : HeartbeatResponse(io.confluent.ksql.rest.entity.HeartbeatResponse) IntegrationTest(io.confluent.common.utils.IntegrationTest) Test(org.junit.Test)

Aggregations

HeartbeatResponse (io.confluent.ksql.rest.entity.HeartbeatResponse)2 Test (org.junit.Test)2 IntegrationTest (io.confluent.common.utils.IntegrationTest)1 HeartbeatMessage (io.confluent.ksql.rest.entity.HeartbeatMessage)1 KsqlHostInfoEntity (io.confluent.ksql.rest.entity.KsqlHostInfoEntity)1 Buffer (io.vertx.core.buffer.Buffer)1