MonitorResource implements Resource { @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seacloudsId}/sensors") @Deprecated @ApiOperation(value = "Get Sensors from a SeaClouds Application") public Response getEntitySensorMapList(@PathParam("seacloudsId") String seacloudsId) throws IOException { if (seacloudsId == 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(); } List<Map<String, Object>> entityList = new ArrayList<>(); List<EntitySummary> appEntities = getFlatEntityTree(seaCloudsApplicationData.getDeployerApplicationId()); for (EntitySummary entity : appEntities) { List<SensorSummary> entitySensors = deployer.getEntitySensors(seaCloudsApplicationData.getDeployerApplicationId(), entity.getId()); HashMap<String, Object> entityMap = new HashMap<>(); entityMap.put("id", entity.getId()); entityMap.put("name", entity.getName()); entityMap.put("type", entity.getType()); entityMap.put("sensors", entitySensors); entityList.add(entityMap); } return Response.ok(entityList).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);  }
@Test public void testGetSensors() throws Exception { List<Map<String, Object>> response = (List<Map<String, Object>>) monitorResource.getEntitySensorMapList(applicationData.getSeaCloudsApplicationId()).getEntity(); for (Map<String, Object> entityMetricsPair : response) { List sensors = (List) entityMetricsPair.get("sensors"); assertEquals(sensors.size(), 5); } }