brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] git commit: Fix for brooklyn.rest.resources.SensorResourceTest.testGetPlain error.
Date Wed, 09 Jul 2014 20:02:21 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 2ebc307a3 -> 0d1780e2d


Fix for brooklyn.rest.resources.SensorResourceTest.testGetPlain error.

Failing with expected "12345 frogs" but got "12345". The tearDown in EntityResourceTest
was cleaning the renderer registry in the middle of executing SensorResourceTests' methods.
Turns out TestNG interleaves the tests from separate classes in a single thread (the execution
is sequential).
EntityResourceTest seems like copy&pasted from SensorResourceTest with the tearDown
call not needed, removed tearDown and unrelated comments.


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

Branch: refs/heads/master
Commit: 860a939b080890139763251baf32fe673ebce681
Parents: 65bc06a
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Wed Jul 9 18:02:18 2014 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Wed Jul 9 18:02:18 2014 +0300

----------------------------------------------------------------------
 .../config/render/TestRendererHints.java         |  8 +++++++-
 .../rest/resources/EntityResourceTest.java       | 19 -------------------
 2 files changed, 7 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/860a939b/usage/rest-server/src/test/java/brooklyn/config/render/TestRendererHints.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/config/render/TestRendererHints.java
b/usage/rest-server/src/test/java/brooklyn/config/render/TestRendererHints.java
index abd0787..13860d7 100644
--- a/usage/rest-server/src/test/java/brooklyn/config/render/TestRendererHints.java
+++ b/usage/rest-server/src/test/java/brooklyn/config/render/TestRendererHints.java
@@ -21,7 +21,13 @@ package brooklyn.config.render;
 /** Methods used when testing the {@link RendererHints} regiostry. */
 public class TestRendererHints {
 
-    /** Clear the registry. */
+    /** Clear the registry. 
+     *
+     *  MUST be used by a single test only.
+     *  TestNG interleaves the tests (sequentially) which results in tearDown 
+     *  executing in the middle of another class' tests. Only one tearDown may
+     *  call this method.
+     **/
     public static void clearRegistry() {
         RendererHints.registry.clear();
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/860a939b/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java
b/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java
index f2526c3..9c56e81 100644
--- a/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java
+++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java
@@ -46,12 +46,6 @@ import com.google.common.collect.Iterables;
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.GenericType;
 
-/**
- * Test the {@link SensorApi} implementation.
- * <p>
- * Check that {@link SensorResource} correctly renders {@link AttributeSensor}
- * values, including {@link RendererHints.DisplayValue} hints.
- */
 @Test(singleThreaded = true)
 public class EntityResourceTest extends BrooklynRestResourceTest {
 
@@ -65,12 +59,6 @@ public class EntityResourceTest extends BrooklynRestResourceTest {
 
     private static final String entityEndpoint = "/v1/applications/simple-app/entities/simple-ent";
 
-    /**
-     * Sets up the application and entity.
-     * <p>
-     * Adds a sensor and sets its value to {@code 12345}. Configures a display value
-     * hint that appends {@code frogs} to the value of the sensor.
-     */
     @BeforeClass(alwaysRun = true)
     @Override
     public void setUp() throws Exception {
@@ -89,13 +77,6 @@ public class EntityResourceTest extends BrooklynRestResourceTest {
         });
     }
 
-    @AfterClass(alwaysRun = true)
-    @Override
-    public void tearDown() throws Exception {
-        TestRendererHints.clearRegistry();
-        super.tearDown();
-    }
-
     @Test
     public void testTagsSanity() throws Exception {
         entity.addTag("foo");


Mime
View raw message