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