@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()); }
@GET @PerformanceMetric("brokers.list+v2") 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); }
BrokersResource { @GET @PerformanceMetric("brokers.list+v2") 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); } }
BrokersResource { @GET @PerformanceMetric("brokers.list+v2") 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); } @Inject  BrokersResource(Provider<BrokerManager> brokerManager); }
BrokersResource { @GET @PerformanceMetric("brokers.list+v2") 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); } @Inject  BrokersResource(Provider<BrokerManager> brokerManager); @GET @PerformanceMetric("brokers.list+v2") void list(@Suspended AsyncResponse asyncResponse); }
BrokersResource { @GET @PerformanceMetric("brokers.list+v2") 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); } @Inject  BrokersResource(Provider<BrokerManager> brokerManager); @GET @PerformanceMetric("brokers.list+v2") void list(@Suspended AsyncResponse asyncResponse);  }