use of io.confluent.ksql.rest.entity.HeartbeatMessage in project ksql by confluentinc.
the class HeartbeatResourceTest method shouldSendHeartbeat.
@Test
public void shouldSendHeartbeat() {
// When:
final HeartbeatMessage request = new HeartbeatMessage(new KsqlHostInfoEntity("localhost", 8080), 1);
final EndpointResponse response = heartbeatResource.registerHeartbeat(request);
// Then:
assertThat(response.getStatus(), is(200));
assertThat(response.getEntity(), instanceOf(HeartbeatResponse.class));
}
use of io.confluent.ksql.rest.entity.HeartbeatMessage 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)));
}
Aggregations