@Test public void searchReassignments_nonExistingCluster_throwsNotFound() { expect(reassignmentManager.searchReassignmentsByTopicName(CLUSTER_ID, TOPIC_1)) .andReturn(failedFuture(new NotFoundException())); replay(reassignmentManager); FakeAsyncResponse response = new FakeAsyncResponse(); listReassignmentsByTopicAction.listReassignmentsByTopic(response, CLUSTER_ID, TOPIC_1); assertEquals(NotFoundException.class, response.getException().getClass()); }
@GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") public void listReassignmentsByTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName) { CompletableFuture<SearchReassignmentsByTopicResponse> response = reassignmentManager.get().searchReassignmentsByTopicName(clusterId, topicName) .thenApply( reassignments -> SearchReassignmentsByTopicResponse.create( ReassignmentDataList.builder() .setMetadata( ResourceCollection.Metadata.builder() .setSelf( urlFactory.create( "v3", "clusters", clusterId, "topics", topicName, "partitions", "-", "reassignments")) .build()) .setData( reassignments.stream() .map(this::toReassignmentData) .collect(Collectors.toList())) .build())); AsyncResponses.asyncResume(asyncResponse, response); }
SearchReassignmentsByTopicAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") public void listReassignmentsByTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName) { CompletableFuture<SearchReassignmentsByTopicResponse> response = reassignmentManager.get().searchReassignmentsByTopicName(clusterId, topicName) .thenApply( reassignments -> SearchReassignmentsByTopicResponse.create( ReassignmentDataList.builder() .setMetadata( ResourceCollection.Metadata.builder() .setSelf( urlFactory.create( "v3", "clusters", clusterId, "topics", topicName, "partitions", "-", "reassignments")) .build()) .setData( reassignments.stream() .map(this::toReassignmentData) .collect(Collectors.toList())) .build())); AsyncResponses.asyncResume(asyncResponse, response); } }
SearchReassignmentsByTopicAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") public void listReassignmentsByTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName) { CompletableFuture<SearchReassignmentsByTopicResponse> response = reassignmentManager.get().searchReassignmentsByTopicName(clusterId, topicName) .thenApply( reassignments -> SearchReassignmentsByTopicResponse.create( ReassignmentDataList.builder() .setMetadata( ResourceCollection.Metadata.builder() .setSelf( urlFactory.create( "v3", "clusters", clusterId, "topics", topicName, "partitions", "-", "reassignments")) .build()) .setData( reassignments.stream() .map(this::toReassignmentData) .collect(Collectors.toList())) .build())); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  SearchReassignmentsByTopicAction(
      Provider<ReassignmentManager> reassignmentManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory); }
SearchReassignmentsByTopicAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") public void listReassignmentsByTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName) { CompletableFuture<SearchReassignmentsByTopicResponse> response = reassignmentManager.get().searchReassignmentsByTopicName(clusterId, topicName) .thenApply( reassignments -> SearchReassignmentsByTopicResponse.create( ReassignmentDataList.builder() .setMetadata( ResourceCollection.Metadata.builder() .setSelf( urlFactory.create( "v3", "clusters", clusterId, "topics", topicName, "partitions", "-", "reassignments")) .build()) .setData( reassignments.stream() .map(this::toReassignmentData) .collect(Collectors.toList())) .build())); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  SearchReassignmentsByTopicAction(
      Provider<ReassignmentManager> reassignmentManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory); @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") void listReassignmentsByTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName); }
SearchReassignmentsByTopicAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") public void listReassignmentsByTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName) { CompletableFuture<SearchReassignmentsByTopicResponse> response = reassignmentManager.get().searchReassignmentsByTopicName(clusterId, topicName) .thenApply( reassignments -> SearchReassignmentsByTopicResponse.create( ReassignmentDataList.builder() .setMetadata( ResourceCollection.Metadata.builder() .setSelf( urlFactory.create( "v3", "clusters", clusterId, "topics", topicName, "partitions", "-", "reassignments")) .build()) .setData( reassignments.stream() .map(this::toReassignmentData) .collect(Collectors.toList())) .build())); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  SearchReassignmentsByTopicAction(
      Provider<ReassignmentManager> reassignmentManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory); @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions-reassignment.list") void listReassignmentsByTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName);  }