You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by gr...@apache.org on 2016/07/27 15:09:15 UTC

brooklyn-server git commit: Fix error in ConditionalEntity test

Repository: brooklyn-server
Updated Branches:
  refs/heads/master 3c261a3af -> 4a65aed0d


Fix error in ConditionalEntity test


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

Branch: refs/heads/master
Commit: 4a65aed0d47c14690c04263cc64f703d2af7a168
Parents: 3c261a3
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Wed Jul 27 16:09:02 2016 +0100
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Wed Jul 27 16:09:02 2016 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/entity/stock/ConditionalEntityImpl.java  | 4 ++--
 .../org/apache/brooklyn/entity/stock/ConditionalEntityTest.java  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4a65aed0/core/src/main/java/org/apache/brooklyn/entity/stock/ConditionalEntityImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/entity/stock/ConditionalEntityImpl.java b/core/src/main/java/org/apache/brooklyn/entity/stock/ConditionalEntityImpl.java
index f9949b9..6c73a87 100644
--- a/core/src/main/java/org/apache/brooklyn/entity/stock/ConditionalEntityImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/entity/stock/ConditionalEntityImpl.java
@@ -32,8 +32,8 @@ public class ConditionalEntityImpl extends BasicStartableImpl implements Conditi
         EntitySpec<?> spec = config().get(CONDITIONAL_ENTITY_SPEC);
         Boolean create = config().get(CREATE_CONDITIONAL_ENTITY);
 
-        // Child not yet created; Entity spec is present; Create flag is true if set
-        if (child == null && spec != null && (create == null || Boolean.TRUE.equals(create))) {
+        // Child not yet created; Entity spec is present; Create flag is true
+        if (child == null && spec != null && Boolean.TRUE.equals(create)) {
             Entity created = addChild(EntitySpec.create(spec));
             sensors().set(CONDITIONAL_ENTITY, created);
         }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4a65aed0/core/src/test/java/org/apache/brooklyn/entity/stock/ConditionalEntityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/stock/ConditionalEntityTest.java b/core/src/test/java/org/apache/brooklyn/entity/stock/ConditionalEntityTest.java
index 8666b89..0e1a56e 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/stock/ConditionalEntityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/stock/ConditionalEntityTest.java
@@ -74,7 +74,7 @@ public class ConditionalEntityTest extends BrooklynAppUnitTestSupport {
     }
 
     @Test
-    public void testDoesNotAddsConditionalWhenConfigured() throws Exception {
+    public void testDoesNotAddConditionalWhenConfigured() throws Exception {
         optional = app.addChild(EntitySpec.create(ConditionalEntity.class)
                 .configure(ConditionalEntity.CREATE_CONDITIONAL_ENTITY, false)
                 .configure(ConditionalEntity.CONDITIONAL_ENTITY_SPEC, EntitySpec.create(TestEntity.class)));
@@ -84,7 +84,7 @@ public class ConditionalEntityTest extends BrooklynAppUnitTestSupport {
     }
 
     @Test
-    public void testDoesNotAddsConditionalWhenNotConfigured() throws Exception {
+    public void testDoesNotAddConditionalWhenOnlySpecConfigured() throws Exception {
         optional = app.addChild(EntitySpec.create(ConditionalEntity.class)
                 .configure(ConditionalEntity.CONDITIONAL_ENTITY_SPEC, EntitySpec.create(TestEntity.class)));
         app.start(ImmutableList.of(loc1));