brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/8] incubator-brooklyn git commit: Test correct persistence of attributeWhenReady
Date Thu, 07 Jan 2016 16:10:47 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master e300cf33c -> 7bcb3920d


Test correct persistence of attributeWhenReady


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

Branch: refs/heads/master
Commit: 68d8018ae7c71df69006271a2a4c31e0f5350461
Parents: cd504e2
Author: Guglielmo Nigri <guglielmo.nigri@cloudsoftcorp.com>
Authored: Tue Dec 22 16:43:22 2015 +0100
Committer: Guglielmo Nigri <guglielmo.nigri@cloudsoftcorp.com>
Committed: Tue Dec 29 12:23:48 2015 +0100

----------------------------------------------------------------------
 .../brooklyn/camp/brooklyn/DslAndRebindYamlTest.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/68d8018a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
index 31a7951..8f0f560 100644
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
+++ b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
@@ -27,6 +27,7 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.entity.Attributes;
@@ -39,6 +40,7 @@ import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.test.EntityTestUtils;
 import org.apache.brooklyn.util.collections.MutableSet;
 import org.apache.brooklyn.util.core.task.Tasks;
+import org.apache.brooklyn.util.guava.Maybe;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -124,6 +126,19 @@ public class DslAndRebindYamlTest extends AbstractYamlTest {
     }
 
     @Test
+    public void testDslAttributeWhenReadyPersisted() throws Exception {
+        Entity testEntity = entityWithAttributeWhenReady();
+        Application app2 = rebind(testEntity.getApplication());
+        Entity e2 = Iterables.getOnlyElement( app2.getChildren() );
+
+        Maybe<Object> maybe = ((EntityInternal)e2).config().getLocalRaw(TestEntity.CONF_NAME);
+        Assert.assertTrue(maybe.isPresentAndNonNull());
+        Assert.assertTrue(BrooklynDslDeferredSupplier.class.isInstance(maybe.get()));
+        BrooklynDslDeferredSupplier deferredSupplier = (BrooklynDslDeferredSupplier) maybe.get();
+        Assert.assertEquals(deferredSupplier.toString(), "$brooklyn:entity(\"x\").attributeWhenReady(\"foo\")");
+    }
+
+    @Test
     public void testDslAttributeWhenReadyRebind() throws Exception {
         Entity testEntity = entityWithAttributeWhenReady();
         ((EntityInternal)testEntity).sensors().set(Sensors.newStringSensor("foo"), "bar");


Mime
View raw message