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

[7/8] incubator-brooklyn git commit: Fix HttpRequestSensorTest.testHttpSensor

Fix HttpRequestSensorTest.testHttpSensor

- Change sensor period to 100ms, from default 5 mins.
  Otherwise if first poll happens before serviceUp=true, it will
  timeout in 30 seconds without a second poll.


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

Branch: refs/heads/master
Commit: 1cb987194411106460838d1b18d88dd4c11aeabf
Parents: 4de878c
Author: Aled Sage <al...@gmail.com>
Authored: Thu Nov 13 12:50:40 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Nov 13 23:10:04 2014 +0000

----------------------------------------------------------------------
 .../brooklyn/entity/software/http/HttpRequestSensorTest.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1cb98719/software/base/src/test/java/brooklyn/entity/software/http/HttpRequestSensorTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/software/http/HttpRequestSensorTest.java b/software/base/src/test/java/brooklyn/entity/software/http/HttpRequestSensorTest.java
index 04d64e0..db26223 100644
--- a/software/base/src/test/java/brooklyn/entity/software/http/HttpRequestSensorTest.java
+++ b/software/base/src/test/java/brooklyn/entity/software/http/HttpRequestSensorTest.java
@@ -33,6 +33,7 @@ import brooklyn.test.EntityTestUtils;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.test.entity.TestEntity;
 import brooklyn.util.config.ConfigBag;
+import brooklyn.util.time.Duration;
 
 import com.google.common.collect.ImmutableList;
 
@@ -59,11 +60,12 @@ public class HttpRequestSensorTest {
     @Test(groups="Integration")
     public void testHttpSensor() throws Exception {
         HttpRequestSensor<Integer> sensor = new HttpRequestSensor<Integer>(ConfigBag.newInstance()
+                .configure(HttpRequestSensor.SENSOR_PERIOD, Duration.millis(100))
                 .configure(HttpRequestSensor.SENSOR_NAME, SENSOR_STRING.getName())
                 .configure(HttpRequestSensor.SENSOR_TYPE, TARGET_TYPE)
                 .configure(HttpRequestSensor.JSON_PATH, "$.myKey")
                 .configure(HttpRequestSensor.SENSOR_URI, "http://echo.jsontest.com/myKey/myValue"));
-            sensor.apply(entity);
+        sensor.apply(entity);
         entity.setAttribute(Attributes.SERVICE_UP, true);
 
         EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_STRING, "myValue");