You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/11/14 00:12:48 UTC
[2/8] incubator-brooklyn git commit: Fix
ApplicationResourceIntegrationTest
Fix ApplicationResourceIntegrationTest
- can get back json or plain string from
client().resource(stateSensor).get(String.class);
accept either
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/374a9db8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/374a9db8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/374a9db8
Branch: refs/heads/master
Commit: 374a9db8f4589c39dc6e85cbf0ab1d0f1533657f
Parents: 6791d51
Author: Aled Sage <al...@gmail.com>
Authored: Thu Nov 13 10:55:21 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Nov 13 23:04:25 2014 +0000
----------------------------------------------------------------------
.../resources/ApplicationResourceIntegrationTest.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/374a9db8/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
index 955e592..88b7b8d 100644
--- a/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
+++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
@@ -61,7 +61,7 @@ public class ApplicationResourceIntegrationTest extends BrooklynRestResourceTest
.build();
@Test(groups="Integration")
- public void testDeployRedisApplication() throws InterruptedException, TimeoutException {
+ public void testDeployRedisApplication() throws Exception {
ClientResponse response = clientDeploy(redisSpec);
assertEquals(response.getStatus(), 201);
@@ -101,16 +101,19 @@ public class ApplicationResourceIntegrationTest extends BrooklynRestResourceTest
}
@Test(groups="Integration", dependsOnMethods = { "testListSensorsRedis", "testListEntities" })
- public void testTriggerRedisStopEffector() throws InterruptedException {
+ public void testTriggerRedisStopEffector() throws Exception {
ClientResponse response = client().resource("/v1/applications/redis-app/entities/redis-ent/effectors/stop")
.type(MediaType.APPLICATION_JSON_TYPE)
.post(ClientResponse.class, ImmutableMap.of());
assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode());
final URI stateSensor = URI.create("/v1/applications/redis-app/entities/redis-ent/sensors/service.state");
- final String expectedStatus = String.format("\"%s\"", Lifecycle.STOPPED.toString());
+ final String expectedStatus = Lifecycle.STOPPED.toString();
Asserts.succeedsEventually(MutableMap.of("timeout", 60 * 1000), new Runnable() {
public void run() {
+ // Accept with and without quotes; if don't specify "Accepts" header, then
+ // might get back json or plain text (depending on compiler / java runtime
+ // used for SensorApi!)
String val = client().resource(stateSensor).get(String.class);
assertTrue(expectedStatus.equalsIgnoreCase(val) || ("\""+expectedStatus+"\"").equalsIgnoreCase(val), "state="+val);
}
@@ -118,7 +121,7 @@ public class ApplicationResourceIntegrationTest extends BrooklynRestResourceTest
}
@Test(groups="Integration", dependsOnMethods = "testTriggerRedisStopEffector" )
- public void testDeleteRedisApplication() throws TimeoutException, InterruptedException {
+ public void testDeleteRedisApplication() throws Exception {
int size = getManagementContext().getApplications().size();
ClientResponse response = client().resource("/v1/applications/redis-app")
.delete(ClientResponse.class);