use of io.confluent.ksql.rest.entity.ClusterStatusResponse in project ksql by confluentinc.
the class ClusterStatusResourceTest method shouldReturnClusterStatus.
@Test
public void shouldReturnClusterStatus() {
// Given:
when(heartbeatAgent.getHostsStatus()).thenReturn(HOSTS);
when(lagReportingAgent.getLagPerHost(any())).thenReturn(Optional.empty());
// When:
final EndpointResponse response = clusterStatusResource.checkClusterStatus();
// Then:
assertThat(response.getStatus(), is(200));
assertThat(response.getEntity(), instanceOf(ClusterStatusResponse.class));
ClusterStatusResponse clusterStatusResponse = (ClusterStatusResponse) response.getEntity();
assertTrue(clusterStatusResponse.getClusterStatus().get(HOST1_ENTITY).getHostAlive());
assertFalse(clusterStatusResponse.getClusterStatus().get(HOST2_ENTITY).getHostAlive());
}
Aggregations