Search in sources :

Example 11 with ClusterStatusResponse

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());
}
Also used : EndpointResponse(io.confluent.ksql.rest.EndpointResponse) ClusterStatusResponse(io.confluent.ksql.rest.entity.ClusterStatusResponse) Test(org.junit.Test)

Aggregations

ClusterStatusResponse (io.confluent.ksql.rest.entity.ClusterStatusResponse)11 Test (org.junit.Test)8 IntegrationTest (io.confluent.common.utils.IntegrationTest)5 EndpointResponse (io.confluent.ksql.rest.EndpointResponse)2 ActiveStandbyEntity (io.confluent.ksql.rest.entity.ActiveStandbyEntity)2 KsqlHostInfoEntity (io.confluent.ksql.rest.entity.KsqlHostInfoEntity)2 LagInfoEntity (io.confluent.ksql.rest.entity.LagInfoEntity)2 StreamedRow (io.confluent.ksql.rest.entity.StreamedRow)2 Optional (java.util.Optional)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 BasicCredentials (io.confluent.ksql.rest.client.BasicCredentials)1 KsqlRestClient (io.confluent.ksql.rest.client.KsqlRestClient)1 RestResponse (io.confluent.ksql.rest.client.RestResponse)1 HeartbeatResponse (io.confluent.ksql.rest.entity.HeartbeatResponse)1 HostStatusEntity (io.confluent.ksql.rest.entity.HostStatusEntity)1 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)1 LagReportingMessage (io.confluent.ksql.rest.entity.LagReportingMessage)1 StateStoreLags (io.confluent.ksql.rest.entity.StateStoreLags)1 TestKsqlRestApp (io.confluent.ksql.rest.server.TestKsqlRestApp)1 KsqlRequestConfig (io.confluent.ksql.util.KsqlRequestConfig)1