@Test public void getReassignment_existingClusterTopicPartition_returnsReassignment() throws Exception { expect(reassignmentManager.getReassignment(CLUSTER_ID, TOPIC_1, PARTITION_ID_1)) .andReturn( CompletableFuture.completedFuture(Optional.of(REASSIGNMENT_1))); replay(reassignmentManager); FakeAsyncResponse response = new FakeAsyncResponse(); getReassignmentAction.getReassignment(response, CLUSTER_ID, TOPIC_1, PARTITION_ID_1); GetReassignmentResponse expected = GetReassignmentResponse.create( ReassignmentData.builder() .setMetadata( Resource.Metadata.builder() .setSelf("/v3/clusters/cluster-1/topics/topic-1/partitions/1" + "/reassignment") .setResourceName( "crn: .build()) .setClusterId(CLUSTER_ID) .setTopicName(TOPIC_1) .setPartitionId(PARTITION_ID_1) .setAddingReplicas(ADDING_REPLICAS_1) .setRemovingReplicas(REMOVING_REPLICAS_1) .setReplicas(Resource.Relationship .create("/v3/clusters/cluster-1/topics/topic-1/partitions/1/replicas")) .build()); assertEquals(expected, response.getValue()); }
@GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") public void getReassignment( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName, @PathParam("partitionId") Integer partitionId) { CompletableFuture<GetReassignmentResponse> response = reassignmentManager.get().getReassignment(clusterId, topicName, partitionId) .thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new)) .thenApply( reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment))); AsyncResponses.asyncResume(asyncResponse, response); }
GetReassignmentAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") public void getReassignment( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName, @PathParam("partitionId") Integer partitionId) { CompletableFuture<GetReassignmentResponse> response = reassignmentManager.get().getReassignment(clusterId, topicName, partitionId) .thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new)) .thenApply( reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment))); AsyncResponses.asyncResume(asyncResponse, response); } }
GetReassignmentAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") public void getReassignment( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName, @PathParam("partitionId") Integer partitionId) { CompletableFuture<GetReassignmentResponse> response = reassignmentManager.get().getReassignment(clusterId, topicName, partitionId) .thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new)) .thenApply( reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment))); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  GetReassignmentAction(
      Provider<ReassignmentManager> reassignmentManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory); }
GetReassignmentAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") public void getReassignment( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName, @PathParam("partitionId") Integer partitionId) { CompletableFuture<GetReassignmentResponse> response = reassignmentManager.get().getReassignment(clusterId, topicName, partitionId) .thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new)) .thenApply( reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment))); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  GetReassignmentAction(
      Provider<ReassignmentManager> reassignmentManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory); @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") void getReassignment(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName,
      @PathParam("partitionId") Integer partitionId); }
GetReassignmentAction { @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") public void getReassignment( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName, @PathParam("partitionId") Integer partitionId) { CompletableFuture<GetReassignmentResponse> response = reassignmentManager.get().getReassignment(clusterId, topicName, partitionId) .thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new)) .thenApply( reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment))); AsyncResponses.asyncResume(asyncResponse, response); } @Inject  GetReassignmentAction(
      Provider<ReassignmentManager> reassignmentManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory); @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.partitions.reassignment.get") void getReassignment(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName,
      @PathParam("partitionId") Integer partitionId);  }