Search in sources :

Example 1 with DiscoverRemoteHostsUtil

use of io.confluent.ksql.rest.util.DiscoverRemoteHostsUtil in project ksql by confluentinc.

the class RemoteHostExecutorTest method testReturnsHostsThatHaveThrownAnException.

@Test
public void testReturnsHostsThatHaveThrownAnException() {
    when(ksqlClient.makeKsqlRequest(any(), any(), any())).thenThrow(new KsqlRestClientException("error"));
    try (MockedStatic<DiscoverRemoteHostsUtil> hdu = mockStatic(DiscoverRemoteHostsUtil.class)) {
        hdu.when(() -> DiscoverRemoteHostsUtil.getRemoteHosts(any(), any())).thenReturn(hosts);
        Pair<Map<HostInfo, KsqlEntity>, Set<HostInfo>> remoteResults = augmenter.fetchAllRemoteResults();
        assertEquals(hosts, remoteResults.getRight());
        assertThat(remoteResults.getLeft().entrySet(), hasSize(0));
    }
}
Also used : KsqlRestClientException(io.confluent.ksql.rest.client.exception.KsqlRestClientException) Set(java.util.Set) DiscoverRemoteHostsUtil(io.confluent.ksql.rest.util.DiscoverRemoteHostsUtil) Map(java.util.Map) Test(org.junit.Test)

Aggregations

KsqlRestClientException (io.confluent.ksql.rest.client.exception.KsqlRestClientException)1 DiscoverRemoteHostsUtil (io.confluent.ksql.rest.util.DiscoverRemoteHostsUtil)1 Map (java.util.Map)1 Set (java.util.Set)1 Test (org.junit.Test)1