brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [1/4] incubator-brooklyn git commit: BROOKLYN-83: fix SensorResourceTest
Date Mon, 15 Dec 2014 15:51:59 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/0.7.0-M2-incubating 3b2eac0df -> 94b42b85e


BROOKLYN-83: fix SensorResourceTest

- On getting a sensor, if no "Accepts" header is given, then we don't
  control whether json or plain text comes back.
  It is dependent on the method order, which is compiler-specific.
- Therefore delete the test that gave no Accepts and then asserted
  it was json.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/2754796c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/2754796c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/2754796c

Branch: refs/heads/0.7.0-M2-incubating
Commit: 2754796cd9ee976cf3c32b8f9cc75c597032cbc9
Parents: c2af0b2
Author: Aled Sage <aled.sage@gmail.com>
Authored: Thu Nov 13 12:58:55 2014 +0000
Committer: Richard Downer <richard@apache.org>
Committed: Mon Dec 15 11:35:23 2014 +0000

----------------------------------------------------------------------
 .../rest/resources/SensorResourceTest.java      | 27 +++++++++-----------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2754796c/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java
b/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java
index 564435d..bb80035 100644
--- a/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java
+++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java
@@ -163,14 +163,12 @@ public class SensorResourceTest extends BrooklynRestResourceTest {
         return response;
     }
     
-    /** Check we can get a sensor, and it defaults is to non-raw json, that is a string picking
up the rendering hint */
-    @Test
-    public void testGet() throws Exception {
-        // the double quotes are here because getEntity(String) does not parse json
-        doSensorTest(null, null, "\"12345 frogs\"");
-    }
-
-    /** Same as {@link #testGet()}, but explicitly requesting json should give json */
+    /**
+     * Check we can get a sensor, explicitly requesting json; gives a string picking up the
rendering hint.
+     * 
+     * If no "Accepts" header is given, then we don't control whether json or plain text
comes back.
+     * It is dependent on the method order, which is compiler-specific.
+     */
     @Test
     public void testGetJson() throws Exception {
         doSensorTest(null, MediaType.APPLICATION_JSON_TYPE, "\"12345 frogs\"");
@@ -190,13 +188,12 @@ public class SensorResourceTest extends BrooklynRestResourceTest {
         doSensorTest(null, MediaType.TEXT_PLAIN_TYPE, "12345 frogs");
     }
 
-    /** Check setting {@code raw} to {@code true} when we get ignores display value hint
*/
-    @Test
-    public void testGetRaw() throws Exception {
-        doSensorTest(true, null, 12345);
-    }
-    
-    /** As {@link #testGetRaw()} with json explicitly set (is the same) */
+    /** 
+     * Check that when we set {@code raw = true}, the result ignores the display value hint.
+     *
+     * If no "Accepts" header is given, then we don't control whether json or plain text
comes back.
+     * It is dependent on the method order, which is compiler-specific.
+     */
     @Test
     public void testGetRawJson() throws Exception {
         doSensorTest(true, MediaType.APPLICATION_JSON_TYPE, 12345);


Mime
View raw message