@Test public void testGetMetricValue() throws Exception { String response = (String) monitorResource.getMetricValue(applicationData.getSeaCloudsApplicationId(), AbstractResourceTest.RANDOM_STRING, AbstractResourceTest.RANDOM_STRING).getEntity(); assertEquals(Double.valueOf(response), 0.7d); }
@GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") public Response getMetricValue(@PathParam("seacloudsId") String seacloudsId, @PathParam("entityId") String brooklynEntityId, @PathParam("metricId") String brooklynMetricId) throws IOException { if (seacloudsId == null || brooklynEntityId == null || brooklynMetricId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.BAD_REQUEST).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seacloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String monitorResponse = deployer.getEntitySensorsValue(seaCloudsApplicationData.getDeployerApplicationId(), brooklynEntityId, brooklynMetricId); if (monitorResponse == null) { monitorResponse = "0"; } return Response.ok(monitorResponse).build(); } }
MonitorResource implements Resource { @GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") public Response getMetricValue(@PathParam("seacloudsId") String seacloudsId, @PathParam("entityId") String brooklynEntityId, @PathParam("metricId") String brooklynMetricId) throws IOException { if (seacloudsId == null || brooklynEntityId == null || brooklynMetricId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.BAD_REQUEST).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seacloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String monitorResponse = deployer.getEntitySensorsValue(seaCloudsApplicationData.getDeployerApplicationId(), brooklynEntityId, brooklynMetricId); if (monitorResponse == null) { monitorResponse = "0"; } return Response.ok(monitorResponse).build(); } } }
MonitorResource implements Resource { @GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") public Response getMetricValue(@PathParam("seacloudsId") String seacloudsId, @PathParam("entityId") String brooklynEntityId, @PathParam("metricId") String brooklynMetricId) throws IOException { if (seacloudsId == null || brooklynEntityId == null || brooklynMetricId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.BAD_REQUEST).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seacloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String monitorResponse = deployer.getEntitySensorsValue(seaCloudsApplicationData.getDeployerApplicationId(), brooklynEntityId, brooklynMetricId); if (monitorResponse == null) { monitorResponse = "0"; } return Response.ok(monitorResponse).build(); } } MonitorResource(DeployerProxy deployer); }
MonitorResource implements Resource { @GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") public Response getMetricValue(@PathParam("seacloudsId") String seacloudsId, @PathParam("entityId") String brooklynEntityId, @PathParam("metricId") String brooklynMetricId) throws IOException { if (seacloudsId == null || brooklynEntityId == null || brooklynMetricId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.BAD_REQUEST).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seacloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String monitorResponse = deployer.getEntitySensorsValue(seaCloudsApplicationData.getDeployerApplicationId(), brooklynEntityId, brooklynMetricId); if (monitorResponse == null) { monitorResponse = "0"; } return Response.ok(monitorResponse).build(); } } MonitorResource(DeployerProxy deployer); @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seacloudsId}/sensors") @Deprecated @ApiOperation(value = "Get Sensors from a SeaClouds Application") Response getEntitySensorMapList(@PathParam("seacloudsId") String seacloudsId); @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seacloudsId}/metrics") @Deprecated @ApiOperation(value = "Get Metrics from a SeaClouds Application") Response getEntityMetricMapList(@PathParam("seacloudsId") String seacloudsId); @GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") Response getMetricValue(@PathParam("seacloudsId") String seacloudsId,
                                   @PathParam("entityId") String brooklynEntityId,
                                   @PathParam("metricId") String brooklynMetricId); }
MonitorResource implements Resource { @GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") public Response getMetricValue(@PathParam("seacloudsId") String seacloudsId, @PathParam("entityId") String brooklynEntityId, @PathParam("metricId") String brooklynMetricId) throws IOException { if (seacloudsId == null || brooklynEntityId == null || brooklynMetricId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.BAD_REQUEST).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seacloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String monitorResponse = deployer.getEntitySensorsValue(seaCloudsApplicationData.getDeployerApplicationId(), brooklynEntityId, brooklynMetricId); if (monitorResponse == null) { monitorResponse = "0"; } return Response.ok(monitorResponse).build(); } } MonitorResource(DeployerProxy deployer); @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seacloudsId}/sensors") @Deprecated @ApiOperation(value = "Get Sensors from a SeaClouds Application") Response getEntitySensorMapList(@PathParam("seacloudsId") String seacloudsId); @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seacloudsId}/metrics") @Deprecated @ApiOperation(value = "Get Metrics from a SeaClouds Application") Response getEntityMetricMapList(@PathParam("seacloudsId") String seacloudsId); @GET @Timed @Produces(MediaType.TEXT_PLAIN) @Path("applications/{seacloudsId}/entities/{entityId}/metrics/{metricId}") @Deprecated @ApiOperation(value = "Get Metric Value from a particular <SeaCloudsApplication, EntityId, MetricId> combination") Response getMetricValue(@PathParam("seacloudsId") String seacloudsId,
                                   @PathParam("entityId") String brooklynEntityId,
                                   @PathParam("metricId") String brooklynMetricId);  }