@Test(dependsOnMethods = "testTriggerSampleEffector") public void testPolicyWhichCapitalizes() { String policiesEndpoint = "/v1/applications/simple-app/entities/simple-ent/policies"; Set<PolicySummary> policies = client().resource(policiesEndpoint).get(new GenericType<Set<PolicySummary>>(){}); assertEquals(policies.size(), 0); ClientResponse response = client().resource(policiesEndpoint) .queryParam("type", CapitalizePolicy.class.getCanonicalName()) .type(MediaType.APPLICATION_JSON_TYPE) .post(ClientResponse.class, Maps.newHashMap()); assertEquals(response.getStatus(), 200); PolicySummary policy = response.getEntity(PolicySummary.class); assertNotNull(policy.getId()); String newPolicyId = policy.getId(); log.info("POLICY CREATED: " + newPolicyId); policies = client().resource(policiesEndpoint).get(new GenericType<Set<PolicySummary>>() {}); assertEquals(policies.size(), 1); Lifecycle status = client().resource(policiesEndpoint + "/" + newPolicyId).get(Lifecycle.class); log.info("POLICY STATUS: " + status); response = client().resource(policiesEndpoint+"/"+newPolicyId+"/start") .post(ClientResponse.class); assertEquals(response.getStatus(), 204); status = client().resource(policiesEndpoint + "/" + newPolicyId).get(Lifecycle.class); assertEquals(status, Lifecycle.RUNNING); response = client().resource(policiesEndpoint+"/"+newPolicyId+"/stop") .post(ClientResponse.class); assertEquals(response.getStatus(), 204); status = client().resource(policiesEndpoint + "/" + newPolicyId).get(Lifecycle.class); assertEquals(status, Lifecycle.STOPPED); response = client().resource(policiesEndpoint+"/"+newPolicyId+"/destroy") .post(ClientResponse.class); assertEquals(response.getStatus(), 204); response = client().resource(policiesEndpoint+"/"+newPolicyId).get(ClientResponse.class); log.info("POLICY STATUS RESPONSE AFTER DESTROY: " + response.getStatus()); assertEquals(response.getStatus(), 404); policies = client().resource(policiesEndpoint).get(new GenericType<Set<PolicySummary>>() {}); assertEquals(0, policies.size()); }
@Override public ApplicationSummary get(String application) { return ApplicationTransformer.summaryFromApplication(brooklyn().getApplication(application)); }
ApplicationResource extends AbstractBrooklynRestResource implements ApplicationApi { @Override public ApplicationSummary get(String application) { return ApplicationTransformer.summaryFromApplication(brooklyn().getApplication(application)); } }
ApplicationResource extends AbstractBrooklynRestResource implements ApplicationApi { @Override public ApplicationSummary get(String application) { return ApplicationTransformer.summaryFromApplication(brooklyn().getApplication(application)); }  }
ApplicationResource extends AbstractBrooklynRestResource implements ApplicationApi { @Override public ApplicationSummary get(String application) { return ApplicationTransformer.summaryFromApplication(brooklyn().getApplication(application)); }  @Deprecated @Override JsonNode applicationTree(); @Override JsonNode fetch(String entityIds); @Override List<ApplicationSummary> list(String typeRegex); @Override ApplicationSummary get(String application); Response create(ApplicationSpec applicationSpec); @Override Response createFromYaml(String yaml); @Override Response createPoly(byte[] inputToAutodetectType); @Override Response createFromForm(String contents); @Override Response delete(String application); @Override List<EntitySummary> getDescendants(String application, String typeRegex); @Override Map<String, Object> getDescendantsSensor(String application, String sensor, String typeRegex); static Map<String, Object> getSensorMap(String sensor, Iterable<Entity> descs); }
ApplicationResource extends AbstractBrooklynRestResource implements ApplicationApi { @Override public ApplicationSummary get(String application) { return ApplicationTransformer.summaryFromApplication(brooklyn().getApplication(application)); }  @Deprecated @Override JsonNode applicationTree(); @Override JsonNode fetch(String entityIds); @Override List<ApplicationSummary> list(String typeRegex); @Override ApplicationSummary get(String application); Response create(ApplicationSpec applicationSpec); @Override Response createFromYaml(String yaml); @Override Response createPoly(byte[] inputToAutodetectType); @Override Response createFromForm(String contents); @Override Response delete(String application); @Override List<EntitySummary> getDescendants(String application, String typeRegex); @Override Map<String, Object> getDescendantsSensor(String application, String sensor, String typeRegex); static Map<String, Object> getSensorMap(String sensor, Iterable<Entity> descs);  }