@Test public void listClusters_noNodes_returnListWithOwnClusterWithoutControllerAndEmptyNodes() throws Exception { expect(adminClient.describeCluster(anyObject())).andReturn(describeClusterResult); expect(describeClusterResult.clusterId()).andReturn(KafkaFuture.completedFuture(CLUSTER_ID)); expect(describeClusterResult.controller()).andReturn(KafkaFuture.completedFuture(null)); expect(describeClusterResult.nodes()).andReturn(KafkaFuture.completedFuture(null)); replay(adminClient, describeClusterResult); List<Cluster> clusters = clusterManager.listClusters().get(); List<Cluster> expected = singletonList(Cluster.create(CLUSTER_ID, null, emptyList())); assertEquals(expected, clusters); }
@Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } @Inject  ClusterManagerImpl(Admin adminClient); }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } @Inject  ClusterManagerImpl(Admin adminClient); @Override CompletableFuture<List<Cluster>> listClusters(); @Override CompletableFuture<Optional<Cluster>> getCluster(String clusterId); @Override CompletableFuture<Cluster> getLocalCluster(); }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } @Inject  ClusterManagerImpl(Admin adminClient); @Override CompletableFuture<List<Cluster>> listClusters(); @Override CompletableFuture<Optional<Cluster>> getCluster(String clusterId); @Override CompletableFuture<Cluster> getLocalCluster();  }