@Test public void getTopologyConfigWhileAuthenticated() { final Topology mockedTopology = RandomGenerator.randomObject(Topology.class); doReturn(mockedTopology) .when(topologyServiceMock) .getTopology(mockedTopology.getId(), TEST_SUBJECT_ID); mockAuthenticatedSubject(); TopologyConfig responseTopologyConfig = resource() .path("/api/topologies/" + mockedTopology.getId() + "/config") .accept(MediaType.APPLICATION_JSON).get(TopologyConfig.class); assertEquals("Response topology should match the mocked topology", mockedTopology.getCurrentConfig(), responseTopologyConfig); verify(topologyServiceMock) .getTopology(mockedTopology.getId(), TEST_SUBJECT_ID); }
@GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) public Topology getTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); return topologyService.getTopology(topologyId, userId); }
TopologyResource { @GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) public Topology getTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); return topologyService.getTopology(topologyId, userId); } }
TopologyResource { @GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) public Topology getTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); return topologyService.getTopology(topologyId, userId); } @Inject  TopologyResource(TopologyService topologyService); }
TopologyResource { @GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) public Topology getTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); return topologyService.getTopology(topologyId, userId); } @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}") @Produces(MediaType.APPLICATION_JSON) public Topology getTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); return topologyService.getTopology(topologyId, userId); } @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);  }