@Test public void clearTopologyWhileAuthenticated() { final String requestTopologyId = "topology-test"; doNothing() .when(topologyServiceMock) .clearTopology(requestTopologyId, TEST_SUBJECT_ID); mockAuthenticatedSubject(); ClientResponse clientResponse = resource() .path("/api/topologies/" + requestTopologyId + "/clear") .get(ClientResponse.class); assertEquals("Response HTTP status code should be 200 (OK)", clientResponse.getStatus(), 200); verify(topologyServiceMock) .clearTopology(requestTopologyId, TEST_SUBJECT_ID); }
@GET @Path("/{topologyId}/clear") public Response clearTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); topologyService.clearTopology(topologyId, userId); return Response.ok().build(); }
TopologyResource { @GET @Path("/{topologyId}/clear") public Response clearTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); topologyService.clearTopology(topologyId, userId); return Response.ok().build(); } }
TopologyResource { @GET @Path("/{topologyId}/clear") public Response clearTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); topologyService.clearTopology(topologyId, userId); return Response.ok().build(); } @Inject  TopologyResource(TopologyService topologyService); }
TopologyResource { @GET @Path("/{topologyId}/clear") public Response clearTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); topologyService.clearTopology(topologyId, userId); return Response.ok().build(); } @Inject  TopologyResource(TopologyService topologyService); @GET @Produces(MediaType.APPLICATION_JSON) List<Topology> listTopologies(); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Topology createTopology(Topology topology); @GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) Topology getTopology(@PathParam("topologyId") String topologyId); @PUT @Path("/{topologyId}") @Consumes(MediaType.APPLICATION_JSON) Response updateTopology(@PathParam("topologyId") String topologyId, Topology topology); @DELETE @Path("/{topologyId}") Response deleteTopology(@PathParam("topologyId") String topologyId); @GET @Path("/{topologyId}/config") @Produces(MediaType.APPLICATION_JSON) TopologyConfig getTopologyConfig(@PathParam("topologyId") String topologyId); @PUT @Path("/{topologyId}/config") @Consumes(MediaType.APPLICATION_JSON) Response updateTopologyConfig(@PathParam("topologyId") String topologyId,
            TopologyConfig topologyConfig); @GET @Path("/{topologyId}/config/deployed") @Produces(MediaType.APPLICATION_JSON) TopologyConfig getDeployedTopologyConfig(@PathParam("topologyId") String topologyId); @GET @Path("/{topologyId}/info") @Produces(MediaType.APPLICATION_JSON) TopologyInfo getTopologyInfo(@PathParam("topologyId") String topologyId); @GET @Path("/{topologyId}/submit") @Produces(MediaType.APPLICATION_JSON) Topology submitTopology(@PathParam("topologyId") String topologyId,
            @QueryParam("clusterId") String clusterId,
            @QueryParam("logLevel") @DefaultValue("INFO") String logLevel,
            @QueryParam("classLoaderPolicy") @DefaultValue("FRAMEWORK_FIRST") String classLoaderPolicy); @GET @Path("/{topologyId}/kill") Response killTopology(@PathParam("topologyId") String topologyId,
            @QueryParam("waitTimeSecs") @DefaultValue("0") int waitTimeSecs,
            @QueryParam("async") @DefaultValue("false") boolean async); @GET @Path("/{topologyId}/clear") Response clearTopology(@PathParam("topologyId") String topologyId); @POST @Path("/{topologyId}/log") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) TopologyLogPage getTopologyLogCluster(@PathParam("topologyId") String topologyId,
            TopologyLogCriteria criteria); @GET @Path("/{topologyId}/log") @Produces(MediaType.APPLICATION_JSON) TopologyLog getTopologyLogLocal(@PathParam("topologyId") String topologyId,
            @QueryParam("offset") long offset, @QueryParam("limit") long limit); }
TopologyResource { @GET @Path("/{topologyId}/clear") public Response clearTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); topologyService.clearTopology(topologyId, userId); return Response.ok().build(); } @Inject  TopologyResource(TopologyService topologyService); @GET @Produces(MediaType.APPLICATION_JSON) List<Topology> listTopologies(); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Topology createTopology(Topology topology); @GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) Topology getTopology(@PathParam("topologyId") String topologyId); @PUT @Path("/{topologyId}") @Consumes(MediaType.APPLICATION_JSON) Response updateTopology(@PathParam("topologyId") String topologyId, Topology topology); @DELETE @Path("/{topologyId}") Response deleteTopology(@PathParam("topologyId") String topologyId); @GET @Path("/{topologyId}/config") @Produces(MediaType.APPLICATION_JSON) TopologyConfig getTopologyConfig(@PathParam("topologyId") String topologyId); @PUT @Path("/{topologyId}/config") @Consumes(MediaType.APPLICATION_JSON) Response updateTopologyConfig(@PathParam("topologyId") String topologyId,
            TopologyConfig topologyConfig); @GET @Path("/{topologyId}/config/deployed") @Produces(MediaType.APPLICATION_JSON) TopologyConfig getDeployedTopologyConfig(@PathParam("topologyId") String topologyId); @GET @Path("/{topologyId}/info") @Produces(MediaType.APPLICATION_JSON) TopologyInfo getTopologyInfo(@PathParam("topologyId") String topologyId); @GET @Path("/{topologyId}/submit") @Produces(MediaType.APPLICATION_JSON) Topology submitTopology(@PathParam("topologyId") String topologyId,
            @QueryParam("clusterId") String clusterId,
            @QueryParam("logLevel") @DefaultValue("INFO") String logLevel,
            @QueryParam("classLoaderPolicy") @DefaultValue("FRAMEWORK_FIRST") String classLoaderPolicy); @GET @Path("/{topologyId}/kill") Response killTopology(@PathParam("topologyId") String topologyId,
            @QueryParam("waitTimeSecs") @DefaultValue("0") int waitTimeSecs,
            @QueryParam("async") @DefaultValue("false") boolean async); @GET @Path("/{topologyId}/clear") Response clearTopology(@PathParam("topologyId") String topologyId); @POST @Path("/{topologyId}/log") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) TopologyLogPage getTopologyLogCluster(@PathParam("topologyId") String topologyId,
            TopologyLogCriteria criteria); @GET @Path("/{topologyId}/log") @Produces(MediaType.APPLICATION_JSON) TopologyLog getTopologyLogLocal(@PathParam("topologyId") String topologyId,
            @QueryParam("offset") long offset, @QueryParam("limit") long limit);  }