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:50 UTC

[4/8] incubator-brooklyn git commit: BROOKLYN-83: fix SensorResourceTest

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/716ca465
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/716ca465
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/716ca465

Branch: refs/heads/master
Commit: 716ca46546e81b9eaf7e4a6f5c338ff9e307d595
Parents: 1cb9871
Author: Aled Sage <al...@gmail.com>
Authored: Thu Nov 13 12:58:55 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Nov 13 23:10:04 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/716ca465/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);