@Test public void listReplicas_nonExistingTopicOrCluster_throwsNotFound() throws Exception { expect(partitionManager.getPartition(CLUSTER_ID, TOPIC_NAME, PARTITION_ID_1)) .andReturn(failedFuture(new NotFoundException())); replay(partitionManager); try { replicaManager.listReplicas(CLUSTER_ID, TOPIC_NAME, PARTITION_ID_1).get(); fail(); } catch (ExecutionException e) { assertEquals(NotFoundException.class, e.getCause().getClass()); } }
@Override public CompletableFuture<List<PartitionReplica>> listReplicas( String clusterId, String topicName, int partitionId) { return partitionManager.getPartition(clusterId, topicName, partitionId) .thenApply(partition -> checkEntityExists( partition, "Partition %d of topic %s could not be found on cluster %s.", partitionId, topicName, clusterId)) .thenApply(Partition::getReplicas); }
ReplicaManagerImpl implements ReplicaManager { @Override public CompletableFuture<List<PartitionReplica>> listReplicas( String clusterId, String topicName, int partitionId) { return partitionManager.getPartition(clusterId, topicName, partitionId) .thenApply(partition -> checkEntityExists( partition, "Partition %d of topic %s could not be found on cluster %s.", partitionId, topicName, clusterId)) .thenApply(Partition::getReplicas); } }
ReplicaManagerImpl implements ReplicaManager { @Override public CompletableFuture<List<PartitionReplica>> listReplicas( String clusterId, String topicName, int partitionId) { return partitionManager.getPartition(clusterId, topicName, partitionId) .thenApply(partition -> checkEntityExists( partition, "Partition %d of topic %s could not be found on cluster %s.", partitionId, topicName, clusterId)) .thenApply(Partition::getReplicas); } @Inject  ReplicaManagerImpl(
      Admin adminClient, BrokerManager brokerManager, PartitionManager partitionManager); }
ReplicaManagerImpl implements ReplicaManager { @Override public CompletableFuture<List<PartitionReplica>> listReplicas( String clusterId, String topicName, int partitionId) { return partitionManager.getPartition(clusterId, topicName, partitionId) .thenApply(partition -> checkEntityExists( partition, "Partition %d of topic %s could not be found on cluster %s.", partitionId, topicName, clusterId)) .thenApply(Partition::getReplicas); } @Inject  ReplicaManagerImpl(
      Admin adminClient, BrokerManager brokerManager, PartitionManager partitionManager); @Override CompletableFuture<List<PartitionReplica>> listReplicas(
      String clusterId, String topicName, int partitionId); @Override CompletableFuture<Optional<PartitionReplica>> getReplica(
      String clusterId, String topicName, int partitionId, int brokerId); @Override CompletableFuture<List<PartitionReplica>> searchReplicasByBrokerId(
      String clusterId, int brokerId); }
ReplicaManagerImpl implements ReplicaManager { @Override public CompletableFuture<List<PartitionReplica>> listReplicas( String clusterId, String topicName, int partitionId) { return partitionManager.getPartition(clusterId, topicName, partitionId) .thenApply(partition -> checkEntityExists( partition, "Partition %d of topic %s could not be found on cluster %s.", partitionId, topicName, clusterId)) .thenApply(Partition::getReplicas); } @Inject  ReplicaManagerImpl(
      Admin adminClient, BrokerManager brokerManager, PartitionManager partitionManager); @Override CompletableFuture<List<PartitionReplica>> listReplicas(
      String clusterId, String topicName, int partitionId); @Override CompletableFuture<Optional<PartitionReplica>> getReplica(
      String clusterId, String topicName, int partitionId, int brokerId); @Override CompletableFuture<List<PartitionReplica>> searchReplicasByBrokerId(
      String clusterId, int brokerId);  }