brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [25/29] git commit: change test logic to match EntityConfigMap behaviour for inheritance
Date Mon, 03 Nov 2014 15:52:09 GMT
change test logic to match EntityConfigMap behaviour for inheritance

two implications of recent changes to EntityConfigMap caused failures in these tests,
i think the new behaviour is desired:
* any unknown flags/config set at parent remain is now NOT interpreted as flags at children
* getAllConfig() includes unknown config


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

Branch: refs/heads/master
Commit: ebd446291d47dd72b494a7c9d24ace5c5cc2ae41
Parents: 139822a
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Thu Oct 30 22:54:12 2014 -0500
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Fri Oct 31 09:39:51 2014 -0500

----------------------------------------------------------------------
 .../java/brooklyn/entity/basic/EntityConfigTest.java  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ebd44629/core/src/test/java/brooklyn/entity/basic/EntityConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/basic/EntityConfigTest.java b/core/src/test/java/brooklyn/entity/basic/EntityConfigTest.java
index 3296941..da27c61 100644
--- a/core/src/test/java/brooklyn/entity/basic/EntityConfigTest.java
+++ b/core/src/test/java/brooklyn/entity/basic/EntityConfigTest.java
@@ -83,7 +83,7 @@ public class EntityConfigTest {
         EntityInternal entity = managementContext.getEntityManager().createEntity(EntitySpec.create(MyEntity.class)
                 .configure("notThere", "notThereVal"));
         
-        assertEquals(entity.getAllConfig(), ImmutableMap.of());
+        assertEquals(entity.getAllConfig(), ImmutableMap.of(ConfigKeys.newConfigKey(Object.class,
"notThere"), "notThereVal"));
         assertEquals(entity.getAllConfigBag().getAllConfig(), ImmutableMap.of("notThere",
"notThereVal"));
         assertEquals(entity.getLocalConfigBag().getAllConfig(), ImmutableMap.of("notThere",
"notThereVal"));
     }
@@ -98,8 +98,10 @@ public class EntityConfigTest {
         EntityInternal child = managementContext.getEntityManager().createEntity(EntitySpec.create(MyChildEntity.class)
                 .parent(entity));
 
-        assertEquals(child.getAllConfig(), ImmutableMap.of(MyChildEntity.MY_CHILD_CONFIG,
"myval1", MyChildEntity.MY_CHILD_CONFIG_WITH_FLAGNAME, "myval2"));
-        assertEquals(child.getAllConfigBag().getAllConfig(), ImmutableMap.of("mychildentity.myconfig",
"myval1", "mychildentity.myconfigwithflagname", "myval2", "notThere", "notThereVal"));
+        assertEquals(child.getAllConfig(), ImmutableMap.of(MyChildEntity.MY_CHILD_CONFIG,
"myval1", 
+            ConfigKeys.newConfigKey(Object.class, "mychildconfigflagname"), "myval2",
+            ConfigKeys.newConfigKey(Object.class, "notThere"), "notThereVal"));
+        assertEquals(child.getAllConfigBag().getAllConfig(), ImmutableMap.of("mychildentity.myconfig",
"myval1", "mychildconfigflagname", "myval2", "notThere", "notThereVal"));
         assertEquals(child.getLocalConfigBag().getAllConfig(), ImmutableMap.of());
     }
     
@@ -127,7 +129,8 @@ public class EntityConfigTest {
                 .configure("mychildentity.myconfigwithflagname", "overrideMyval")
                 .configure("notThere", "overrideNotThereVal"));
 
-        assertEquals(child.getAllConfig(), ImmutableMap.of(MyChildEntity.MY_CHILD_CONFIG_WITH_FLAGNAME,
"overrideMyval"));
+        assertEquals(child.getAllConfig(), ImmutableMap.of(MyChildEntity.MY_CHILD_CONFIG_WITH_FLAGNAME,
"overrideMyval",
+            ConfigKeys.newConfigKey(Object.class, "notThere"), "overrideNotThereVal"));
         assertEquals(child.getAllConfigBag().getAllConfig(), ImmutableMap.of("mychildentity.myconfigwithflagname",
"overrideMyval", "notThere", "overrideNotThereVal"));
         assertEquals(child.getLocalConfigBag().getAllConfig(), ImmutableMap.of("mychildentity.myconfigwithflagname",
"overrideMyval", "notThere", "overrideNotThereVal"));
     }
@@ -135,7 +138,8 @@ public class EntityConfigTest {
     @Test
     public void testChildCanOverrideConfigUsingFlagName() throws Exception {
         EntityInternal entity = managementContext.getEntityManager().createEntity(EntitySpec.create(MyEntity.class)
-                .configure("mychildconfigflagname", "myval"));
+                .configure(MyChildEntity.MY_CHILD_CONFIG_WITH_FLAGNAME, "myval"));
+        assertEquals(entity.getAllConfig(), ImmutableMap.of(MyChildEntity.MY_CHILD_CONFIG_WITH_FLAGNAME,
"myval"));
 
         EntityInternal child = managementContext.getEntityManager().createEntity(EntitySpec.create(MyChildEntity.class)
                 .parent(entity)


Mime
View raw message