@Test public void testList() { expect(topicManager.listLocalTopics()) .andReturn(completedFuture(Arrays.asList(TOPIC_1, TOPIC_2, TOPIC_3))); replay(topicManager); Response response = request("/topics", Versions.KAFKA_V2_JSON).get(); assertOKResponse(response, Versions.KAFKA_V2_JSON); final List<String> topicsResponse = TestUtils .tryReadEntityOrLog(response, new GenericType<List<String>>() { }); assertEquals( Arrays.asList(TOPIC_1.getName(), TOPIC_2.getName(), TOPIC_3.getName()), topicsResponse); }
@GET @PerformanceMetric("topics.list+v2") public void list(@Suspended AsyncResponse asyncResponse) { TopicManager topicManager = topicManagerProvider.get(); CompletableFuture<List<String>> response = topicManager.listLocalTopics() .thenApply(topics -> topics.stream().map(Topic::getName).collect(Collectors.toList())); AsyncResponses.asyncResume(asyncResponse, response); }
TopicsResource { @GET @PerformanceMetric("topics.list+v2") public void list(@Suspended AsyncResponse asyncResponse) { TopicManager topicManager = topicManagerProvider.get(); CompletableFuture<List<String>> response = topicManager.listLocalTopics() .thenApply(topics -> topics.stream().map(Topic::getName).collect(Collectors.toList())); AsyncResponses.asyncResume(asyncResponse, response); } }
TopicsResource { @GET @PerformanceMetric("topics.list+v2") public void list(@Suspended AsyncResponse asyncResponse) { TopicManager topicManager = topicManagerProvider.get(); CompletableFuture<List<String>> response = topicManager.listLocalTopics() .thenApply(topics -> topics.stream().map(Topic::getName).collect(Collectors.toList())); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  TopicsResource(
      Provider<TopicManager> topicManagerProvider,
      Provider<TopicConfigManager> topicConfigManagerProvider); }
TopicsResource { @GET @PerformanceMetric("topics.list+v2") public void list(@Suspended AsyncResponse asyncResponse) { TopicManager topicManager = topicManagerProvider.get(); CompletableFuture<List<String>> response = topicManager.listLocalTopics() .thenApply(topics -> topics.stream().map(Topic::getName).collect(Collectors.toList())); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  TopicsResource(
      Provider<TopicManager> topicManagerProvider,
      Provider<TopicConfigManager> topicConfigManagerProvider); @GET @PerformanceMetric("topics.list+v2") void list(@Suspended AsyncResponse asyncResponse); @GET @Path("/{topic}") @PerformanceMetric("topic.get+v2") void getTopic(
      @Suspended AsyncResponse asyncResponse, @PathParam("topic") String topicName); }
TopicsResource { @GET @PerformanceMetric("topics.list+v2") public void list(@Suspended AsyncResponse asyncResponse) { TopicManager topicManager = topicManagerProvider.get(); CompletableFuture<List<String>> response = topicManager.listLocalTopics() .thenApply(topics -> topics.stream().map(Topic::getName).collect(Collectors.toList())); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  TopicsResource(
      Provider<TopicManager> topicManagerProvider,
      Provider<TopicConfigManager> topicConfigManagerProvider); @GET @PerformanceMetric("topics.list+v2") void list(@Suspended AsyncResponse asyncResponse); @GET @Path("/{topic}") @PerformanceMetric("topic.get+v2") void getTopic(
      @Suspended AsyncResponse asyncResponse, @PathParam("topic") String topicName);  }