@Test public void deleteTopic_existingTopic_deletesTopic() { expect(topicManager.deleteTopic(CLUSTER_ID, TOPIC_1.getName())) .andReturn(completedFuture(null)); replay(topicManager); FakeAsyncResponse response = new FakeAsyncResponse(); topicsResource.deleteTopic(response, TOPIC_1.getClusterId(), TOPIC_1.getName()); assertNull(response.getValue()); assertNull(response.getException()); assertTrue(response.isDone()); }
@DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") public void deleteTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName ) { CompletableFuture<Void> response = topicManager.get().deleteTopic(clusterId, topicName); AsyncResponseBuilder.from(Response.status(Status.NO_CONTENT)) .entity(response) .asyncResume(asyncResponse); }
TopicsResource { @DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") public void deleteTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName ) { CompletableFuture<Void> response = topicManager.get().deleteTopic(clusterId, topicName); AsyncResponseBuilder.from(Response.status(Status.NO_CONTENT)) .entity(response) .asyncResume(asyncResponse); } }
TopicsResource { @DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") public void deleteTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName ) { CompletableFuture<Void> response = topicManager.get().deleteTopic(clusterId, topicName); AsyncResponseBuilder.from(Response.status(Status.NO_CONTENT)) .entity(response) .asyncResume(asyncResponse); } @Inject  TopicsResource(
      Provider<TopicManager> topicManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory
  ); }
TopicsResource { @DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") public void deleteTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName ) { CompletableFuture<Void> response = topicManager.get().deleteTopic(clusterId, topicName); AsyncResponseBuilder.from(Response.status(Status.NO_CONTENT)) .entity(response) .asyncResume(asyncResponse); } @Inject  TopicsResource(
      Provider<TopicManager> topicManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory
  ); @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.list") void listTopics(
      @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId); @GET @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.get") void getTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName
  ); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.create") void createTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @Valid CreateTopicRequest request
  ); @DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") void deleteTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName
  ); }
TopicsResource { @DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") public void deleteTopic( @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId, @PathParam("topicName") String topicName ) { CompletableFuture<Void> response = topicManager.get().deleteTopic(clusterId, topicName); AsyncResponseBuilder.from(Response.status(Status.NO_CONTENT)) .entity(response) .asyncResume(asyncResponse); } @Inject  TopicsResource(
      Provider<TopicManager> topicManager,
      CrnFactory crnFactory,
      UrlFactory urlFactory
  ); @GET @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.list") void listTopics(
      @Suspended AsyncResponse asyncResponse, @PathParam("clusterId") String clusterId); @GET @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.get") void getTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName
  ); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.create") void createTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @Valid CreateTopicRequest request
  ); @DELETE @Path("/{topicName}") @Produces(MediaType.APPLICATION_JSON) @PerformanceMetric("v3.topics.delete") void deleteTopic(
      @Suspended AsyncResponse asyncResponse,
      @PathParam("clusterId") String clusterId,
      @PathParam("topicName") String topicName
  );  }