use of io.confluent.kafkarest.entities.v2.BrokerList in project kafka-rest by confluentinc.
the class BrokersResourceTest method testList.
@Test
public void testList() {
expect(brokerManager.listLocalBrokers()).andReturn(completedFuture(Arrays.asList(BROKER_1, BROKER_2, BROKER_3)));
replay(brokerManager);
Response response = request("/brokers", Versions.KAFKA_V2_JSON).get();
assertOKResponse(response, Versions.KAFKA_V2_JSON);
final BrokerList returnedBrokerIds = TestUtils.tryReadEntityOrLog(response, new GenericType<BrokerList>() {
});
assertEquals(Arrays.asList(1, 2, 3), returnedBrokerIds.getBrokers());
}
use of io.confluent.kafkarest.entities.v2.BrokerList in project kafka-rest by confluentinc.
the class MetadataAPITest method testBrokers.
@Test
public void testBrokers() throws InterruptedException {
// Listing
Response response = request("/brokers").get();
assertOKResponse(response, Versions.KAFKA_V2_JSON);
final BrokerList brokers = tryReadEntityOrLog(response, BrokerList.class);
assertEquals(new BrokerList(Arrays.asList(0, 1)), brokers);
}
use of io.confluent.kafkarest.entities.v2.BrokerList in project kafka-rest by confluentinc.
the class BrokersResource method list.
@GET
@PerformanceMetric("brokers.list+v2")
@ResourceName("api.v2.brokers.list")
public void list(@Suspended AsyncResponse asyncResponse) {
CompletableFuture<BrokerList> response = brokerManager.get().listLocalBrokers().thenApply(brokers -> new BrokerList(brokers.stream().map(Broker::getBrokerId).collect(Collectors.toList())));
AsyncResponses.asyncResume(asyncResponse, response);
}
Aggregations