@Test public void testTagsSanity() throws Exception { entity.tags().addTag("foo"); ClientResponse response = client().resource(entityEndpoint + "/tags") .accept(MediaType.APPLICATION_JSON_TYPE) .get(ClientResponse.class); String data = response.getEntity(String.class); try { List<Object> tags = new ObjectMapper().readValue(data, new TypeReference<List<Object>>() {}); Assert.assertTrue(tags.contains("foo")); Assert.assertFalse(tags.contains("bar")); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Error with deserialization of tags list: "+e+"\n"+data, e); } }
@Override public EntitySummary get(String application, String entityName) { Entity entity = brooklyn().getEntity(application, entityName); if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) { return EntityTransformer.entitySummary(entity); } throw WebResourceUtils.unauthorized("User '%s' is not authorized to get entity '%s'", Entitlements.getEntitlementContext().user(), entity); }
EntityResource extends AbstractBrooklynRestResource implements EntityApi { @Override public EntitySummary get(String application, String entityName) { Entity entity = brooklyn().getEntity(application, entityName); if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) { return EntityTransformer.entitySummary(entity); } throw WebResourceUtils.unauthorized("User '%s' is not authorized to get entity '%s'", Entitlements.getEntitlementContext().user(), entity); } }
EntityResource extends AbstractBrooklynRestResource implements EntityApi { @Override public EntitySummary get(String application, String entityName) { Entity entity = brooklyn().getEntity(application, entityName); if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) { return EntityTransformer.entitySummary(entity); } throw WebResourceUtils.unauthorized("User '%s' is not authorized to get entity '%s'", Entitlements.getEntitlementContext().user(), entity); }  }
EntityResource extends AbstractBrooklynRestResource implements EntityApi { @Override public EntitySummary get(String application, String entityName) { Entity entity = brooklyn().getEntity(application, entityName); if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) { return EntityTransformer.entitySummary(entity); } throw WebResourceUtils.unauthorized("User '%s' is not authorized to get entity '%s'", Entitlements.getEntitlementContext().user(), entity); }  @Override List<EntitySummary> list(final String application); @Override EntitySummary get(String application, String entityName); @Override List<EntitySummary> getChildren(final String application, final String entity); @Override List<EntitySummary> getChildrenOld(String application, String entity); @Override Response addChildren(String applicationToken, String entityToken, Boolean start, String timeoutS, String yaml); @Override List<TaskSummary> listTasks(String applicationId, String entityId); @Override TaskSummary getTask(final String application, final String entityToken, String taskId); @SuppressWarnings("unchecked") @Override List<Object> listTags(String applicationId, String entityId); @Override Response getIcon(String applicationId, String entityId); @Override Response rename(String application, String entity, String newName); @Override Response expunge(String application, String entity, boolean release); @Override List<EntitySummary> getDescendants(String application, String entity, String typeRegex); @Override Map<String, Object> getDescendantsSensor(String application, String entity, String sensor, String typeRegex); @Override List<LocationSummary> getLocations(String application, String entity); @Override String getSpec(String applicationToken, String entityToken); }
EntityResource extends AbstractBrooklynRestResource implements EntityApi { @Override public EntitySummary get(String application, String entityName) { Entity entity = brooklyn().getEntity(application, entityName); if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) { return EntityTransformer.entitySummary(entity); } throw WebResourceUtils.unauthorized("User '%s' is not authorized to get entity '%s'", Entitlements.getEntitlementContext().user(), entity); }  @Override List<EntitySummary> list(final String application); @Override EntitySummary get(String application, String entityName); @Override List<EntitySummary> getChildren(final String application, final String entity); @Override List<EntitySummary> getChildrenOld(String application, String entity); @Override Response addChildren(String applicationToken, String entityToken, Boolean start, String timeoutS, String yaml); @Override List<TaskSummary> listTasks(String applicationId, String entityId); @Override TaskSummary getTask(final String application, final String entityToken, String taskId); @SuppressWarnings("unchecked") @Override List<Object> listTags(String applicationId, String entityId); @Override Response getIcon(String applicationId, String entityId); @Override Response rename(String application, String entity, String newName); @Override Response expunge(String application, String entity, boolean release); @Override List<EntitySummary> getDescendants(String application, String entity, String typeRegex); @Override Map<String, Object> getDescendantsSensor(String application, String entity, String sensor, String typeRegex); @Override List<LocationSummary> getLocations(String application, String entity); @Override String getSpec(String applicationToken, String entityToken);  }