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 2016/07/05 08:17:45 UTC

[3/4] brooklyn-server git commit: Use Entities.descendantsAndSelf

Use Entities.descendantsAndSelf


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

Branch: refs/heads/master
Commit: 89ef9d533a4492e826687755368ae2f50f612290
Parents: 41980ad
Author: Aled Sage <al...@gmail.com>
Authored: Mon Jul 4 11:00:02 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Jul 4 15:27:43 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/spi/dsl/methods/DslComponent.java  |  6 ++--
 .../camp/brooklyn/ByonLocationsYamlTest.java    |  2 +-
 .../brooklyn/ConfigInheritanceYamlTest.java     |  2 +-
 .../brooklyn/EmptySoftwareProcessYamlTest.java  |  2 +-
 .../brooklyn/EmptyWindowsProcessYamlTest.java   |  2 +-
 .../camp/brooklyn/EntitiesYamlTest.java         | 12 +++----
 .../camp/brooklyn/EntityNameYamlTest.java       |  2 +-
 .../catalog/CatalogYamlEntityNameTest.java      | 18 +++++-----
 .../CreatePasswordSensorIntegrationTest.java    |  2 +-
 .../apache/brooklyn/core/entity/Entities.java   | 36 +++++++++++---------
 .../core/mgmt/rebind/RebindEnricherTest.java    |  2 +-
 .../core/mgmt/rebind/RebindEntityTest.java      |  2 +-
 .../entity/group/DynamicClusterTest.java        | 10 +++---
 .../blueprints/AbstractBlueprintTest.java       |  2 +-
 .../Windows7zipBlueprintLiveTest.java           |  2 +-
 .../rest/resources/EntityConfigResource.java    |  4 +--
 16 files changed, 53 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
index e0641ca..8e5ed36 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
@@ -120,12 +120,10 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
                 case SCOPE_ROOT:
                     return Entities.catalogItemScopeRoot(entity);
                 case DESCENDANT:
-                    entitiesToSearch = Entities.descendants(entity);
-                    entitiesToSearch = Iterables.filter(entitiesToSearch, notSelfPredicate);
+                    entitiesToSearch = Entities.descendantsWithoutSelf(entity);
                     break;
                 case ANCESTOR:
-                    entitiesToSearch = Entities.ancestors(entity);
-                    entitiesToSearch = Iterables.filter(entitiesToSearch, notSelfPredicate);
+                    entitiesToSearch = Entities.ancestorsWithoutSelf(entity);
                     break;
                 case SIBLING:
                     entitiesToSearch = entity.getParent().getChildren();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
index 66e619f..3a87622 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
@@ -239,7 +239,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "    requiredOpenLoginPorts: [22, 1024]");
 
         Entity app = createStartWaitAndLogApplication(yaml);
-        DoNothingSoftwareProcess entity = (DoNothingSoftwareProcess) Iterables.find(Entities.descendants(app), Predicates.instanceOf(DoNothingSoftwareProcess.class));
+        DoNothingSoftwareProcess entity = (DoNothingSoftwareProcess) Iterables.find(Entities.descendantsAndSelf(app), Predicates.instanceOf(DoNothingSoftwareProcess.class));
         FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
         
         // Machine should have been given the inbound-ports

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
index 4a4721b..96d7966 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
@@ -788,7 +788,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "          mykey3: myval3");
 
         Entity app = createStartWaitAndLogApplication(yaml);
-        Entity entity = Iterables.find(Entities.descendants(app), Predicates.instanceOf(TestEntity.class));
+        Entity entity = Iterables.find(Entities.descendantsAndSelf(app), Predicates.instanceOf(TestEntity.class));
 
         assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), 
                 ImmutableMap.<String, Object>of("mykey1", "myval1", "mykey2", "myval2", "mykey3", "myval3"));

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
index 35a896a..889985a 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java
@@ -116,7 +116,7 @@ public class EmptySoftwareProcessYamlTest extends AbstractYamlTest {
                 "    "+BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION.getName()+": true");
         waitForApplicationTasks(app);
 
-        EmptySoftwareProcess entity = Iterables.getOnlyElement(Entities.descendants(app, EmptySoftwareProcess.class));
+        EmptySoftwareProcess entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, EmptySoftwareProcess.class));
         EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
         EntityAsserts.assertAttributeEqualsContinually(entity, Attributes.SERVICE_UP, true);
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java
index 3eaa963..65acd49 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptyWindowsProcessYamlTest.java
@@ -45,7 +45,7 @@ public class EmptyWindowsProcessYamlTest extends AbstractYamlTest {
                 "    onbox.base.dir.skipResolution: true");
         waitForApplicationTasks(app);
 
-        EmptyWindowsProcess entity = Iterables.getOnlyElement(Entities.descendants(app, EmptyWindowsProcess.class));
+        EmptyWindowsProcess entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, EmptyWindowsProcess.class));
         EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
         EntityAsserts.assertAttributeEqualsContinually(entity, Attributes.SERVICE_UP, true);
         

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
index e87a3f3..3677dce 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
@@ -422,10 +422,10 @@ public class EntitiesYamlTest extends AbstractYamlTest {
         Assert.assertEquals(root1, app);
         
         Entity c1 = Tasks.resolving(new DslComponent("c1").newTask(), Entity.class).context( ((EntityInternal)app).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(c1, Entities.descendants(app, EntityPredicates.displayNameEqualTo("child 1")).iterator().next());
+        Assert.assertEquals(c1, Iterables.getOnlyElement(Entities.descendantsAndSelf(app, EntityPredicates.displayNameEqualTo("child 1"))));
         
         Entity e1 = Tasks.resolving(new DslComponent(Scope.PARENT, "xxx").newTask(), Entity.class).context( ((EntityInternal)c1).getExecutionContext() ).embedResolutionInTask(true).get();
-        Assert.assertEquals(e1, Entities.descendants(app, EntityPredicates.displayNameEqualTo("entity 1")).iterator().next());
+        Assert.assertEquals(e1, Iterables.getOnlyElement(Entities.descendantsAndSelf(app, EntityPredicates.displayNameEqualTo("entity 1"))));
         
         Entity root2 = Tasks.resolving(new DslComponent(Scope.ROOT, "xxx").newTask(), Entity.class).context( ((EntityInternal)c1).getExecutionContext() ).embedResolutionInTask(true).get();
         Assert.assertEquals(root2, app);
@@ -743,8 +743,8 @@ public class EntitiesYamlTest extends AbstractYamlTest {
 
         Entity app = createAndStartApplication(yaml);
         waitForApplicationTasks(app);
-        DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendants(app, DynamicFabric.class));
-        Iterable<TestEntity> members = Entities.descendants(fabric, TestEntity.class);
+        DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, DynamicFabric.class));
+        Iterable<TestEntity> members = Entities.descendantsAndSelf(fabric, TestEntity.class);
         
         assertEquals(Iterables.size(members), 2);
     }
@@ -764,8 +764,8 @@ public class EntitiesYamlTest extends AbstractYamlTest {
 
         Entity app = createAndStartApplication(yaml);
         waitForApplicationTasks(app);
-        DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendants(app, DynamicFabric.class));
-        Iterable<TestEntity> members = Entities.descendants(fabric, TestEntity.class);
+        DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, DynamicFabric.class));
+        Iterable<TestEntity> members = Entities.descendantsAndSelf(fabric, TestEntity.class);
         
         assertEquals(Iterables.size(members), 2);
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntityNameYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntityNameYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntityNameYamlTest.java
index e78fb78..ae512dc 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntityNameYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntityNameYamlTest.java
@@ -70,7 +70,7 @@ public class EntityNameYamlTest extends AbstractYamlTest {
 
     protected void deployAndAssertDisplayName(String yaml, String expectedName) throws Exception {
         Entity app = createAndStartApplication(yaml);
-        Entity entity = Iterables.getOnlyElement(Entities.descendants(app, Predicates.instanceOf(TestEntity.class)));
+        Entity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, TestEntity.class));
         assertEquals(entity.getDisplayName(), expectedName);
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
index 23a0c6c..c6e79c6 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
@@ -45,14 +45,14 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
         Entity app = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName);
-        BasicEntity entity = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app), BasicEntity.class));
+        BasicEntity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, BasicEntity.class));
         assertEquals(entity.getDisplayName(), "nameInItemMetadata");
         
         Entity app2 = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName,
                 "  name: nameInEntity");
-        BasicEntity entity2 = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app2), BasicEntity.class));
+        BasicEntity entity2 = Iterables.getOnlyElement(Entities.descendantsAndSelf(app2, BasicEntity.class));
         assertEquals(entity2.getDisplayName(), "nameInEntity");
     }
     
@@ -78,14 +78,14 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
         Entity app = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName);
-        BasicEntity entity = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app), BasicEntity.class));
+        BasicEntity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, BasicEntity.class));
         assertEquals(entity.getDisplayName(), "nameInItemMetadata");
         
         Entity app2 = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName,
                 "  name: nameInEntity");
-        BasicEntity entity2 = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app2), BasicEntity.class));
+        BasicEntity entity2 = Iterables.getOnlyElement(Entities.descendantsAndSelf(app2, BasicEntity.class));
         assertEquals(entity2.getDisplayName(), "nameInEntity");
     }
     
@@ -105,14 +105,14 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
         Entity app = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName);
-        BasicEntity entity = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app), BasicEntity.class));
+        BasicEntity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, BasicEntity.class));
         assertEquals(entity.getDisplayName(), "defaultNameInItemEntity");
         
         Entity app2 = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName,
                 "  name: nameInEntity");
-        BasicEntity entity2 = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app2), BasicEntity.class));
+        BasicEntity entity2 = Iterables.getOnlyElement(Entities.descendantsAndSelf(app2, BasicEntity.class));
         assertEquals(entity2.getDisplayName(), "nameInEntity");
     }
     
@@ -139,7 +139,7 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
         Entity app = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName);
-        BasicEntity entity = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app), BasicEntity.class));
+        BasicEntity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, BasicEntity.class));
         assertEquals(entity.getDisplayName(), "defaultNameInItemEntity");
     }
     
@@ -166,7 +166,7 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
         Entity app = createAndStartApplication(
                 "services:",
                 "- type: "+symbolicName);
-        BasicEntity entity = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app), BasicEntity.class));
+        BasicEntity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, BasicEntity.class));
         assertEquals(entity.getDisplayName(), "defaultNameInSuperItemEntity");
     }
     
@@ -186,7 +186,7 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
                 "- type: "+symbolicName,
                 "  brooklyn.config:",
                 "    defaultDisplayName: defaultNameInEntity");
-        BasicEntity entity = Iterables.getOnlyElement(Iterables.filter(Entities.descendants(app), BasicEntity.class));
+        BasicEntity entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, BasicEntity.class));
         assertEquals(entity.getDisplayName(), "defaultNameInEntity");
     }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
index 360b705..fb35700 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/policy/CreatePasswordSensorIntegrationTest.java
@@ -44,7 +44,7 @@ public class CreatePasswordSensorIntegrationTest extends AbstractYamlTest {
         final Entity app = createAndStartApplication(loadYaml("EmptySoftwareProcessWithPassword.yaml"));
 
         waitForApplicationTasks(app);
-        EmptySoftwareProcess entity = Iterables.getOnlyElement(Entities.descendants(app, EmptySoftwareProcess.class));
+        EmptySoftwareProcess entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, EmptySoftwareProcess.class));
 
         assertPasswordLength(entity, PASSWORD_1, 15);
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java b/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
index cffbaea..1909845 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
@@ -661,6 +661,17 @@ public class Entities {
     }
 
     /**
+     * Returns the entity's children, its children's children, and so on.
+     *
+     * @see #descendants(Entity, Predicate, boolean)
+     */
+    public static Iterable<Entity> descendantsWithoutSelf(Entity root) {
+        Set<Entity> result = Sets.newLinkedHashSet();
+        descendantsWithoutSelf(root, result);
+        return result;
+    }
+
+    /**
      * Return all descendants of given entity of the given type, potentially including the given root.
      *
      * @see #descendants(Entity)
@@ -707,12 +718,17 @@ public class Entities {
         return result;
     }
 
-    private static Iterable<Entity> descendantsWithoutSelf(Entity root) {
+    /** Returns the entity's parent, its parent's parent, and so on. */
+    public static Iterable<Entity> ancestorsWithoutSelf(Entity root) {
         Set<Entity> result = Sets.newLinkedHashSet();
-        descendantsWithoutSelf(root, result);
+        Entity parent = (root != null) ? root.getParent() : null;
+        while (parent != null) {
+            result.add(parent);
+            parent = parent.getParent();
+        }
         return result;
     }
-    
+
     /**
      * Side-effects {@code result} to return descendants (not including {@code root}).
      */
@@ -726,20 +742,6 @@ public class Entities {
             tovisit.addAll(e.getChildren());
         }
     }
-
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
     
     /**
      * @deprecated since 0.10.0; see {@link #descendantsAndSelf(Entity, Predicate)}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java
index bc63aef..25c2ebc 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java
@@ -313,7 +313,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp {
         assertEquals(e1e.size(), 5);
 
         newApp = (TestApplication) rebind();
-        Entity e2 = Iterables.getOnlyElement( Entities.descendants(newApp, EntityPredicates.idEqualTo(e1.getId())) );
+        Entity e2 = Iterables.getOnlyElement( Entities.descendantsAndSelf(newApp, EntityPredicates.idEqualTo(e1.getId())) );
         Collection<Enricher> e2e = e2.getEnrichers();
         log.info("enrichers2: "+e2e);
         Entities.dumpInfo(e2);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
index 13697df..eb5fb54 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
@@ -310,7 +310,7 @@ public class RebindEntityTest extends RebindTestFixtureWithApp {
         origE.tags().addTag(origApp);
 
         newApp = rebind();
-        MyEntity newE = Iterables.getOnlyElement( Entities.descendants(newApp, MyEntity.class) );
+        MyEntity newE = Iterables.getOnlyElement( Entities.descendantsAndSelf(newApp, MyEntity.class) );
 
         assertTrue(newE.tags().containsTag("foo"), "tags are "+newE.tags().getTags());
         assertFalse(newE.tags().containsTag("bar"));

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
index 528a252..36d3c39 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
@@ -297,17 +297,17 @@ public class DynamicClusterTest extends BrooklynAppUnitTestSupport {
         cluster.start(ImmutableList.of(loc));
 
         cluster.resize(4);
-        assertEquals(Iterables.size(Entities.descendants(cluster, TestEntity.class)), 4);
+        assertEquals(Iterables.size(Entities.descendantsAndSelf(cluster, TestEntity.class)), 4);
         
         // check delta of 2 and delta of 1, because >1 is handled differently to =1
         cluster.resize(2);
-        assertEquals(Iterables.size(Entities.descendants(cluster, TestEntity.class)), 2);
+        assertEquals(Iterables.size(Entities.descendantsAndSelf(cluster, TestEntity.class)), 2);
         cluster.resize(1);
-        assertEquals(Iterables.size(Entities.descendants(cluster, TestEntity.class)), 1);
+        assertEquals(Iterables.size(Entities.descendantsAndSelf(cluster, TestEntity.class)), 1);
         cluster.resize(1);
-        assertEquals(Iterables.size(Entities.descendants(cluster, TestEntity.class)), 1);
+        assertEquals(Iterables.size(Entities.descendantsAndSelf(cluster, TestEntity.class)), 1);
         cluster.resize(0);
-        assertEquals(Iterables.size(Entities.descendants(cluster, TestEntity.class)), 0);
+        assertEquals(Iterables.size(Entities.descendantsAndSelf(cluster, TestEntity.class)), 0);
     }
 
     

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
----------------------------------------------------------------------
diff --git a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
index 371b83e..faab9fc 100644
--- a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
+++ b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
@@ -163,7 +163,7 @@ public abstract class AbstractBlueprintTest {
         
         Asserts.succeedsEventually(new Runnable() {
             public void run() {
-                for (Entity entity : Entities.descendants(app)) {
+                for (Entity entity : Entities.descendantsAndSelf(app)) {
                     assertNotEquals(entity.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE);
                     assertNotEquals(entity.getAttribute(Attributes.SERVICE_UP), false);
                     

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/Windows7zipBlueprintLiveTest.java
----------------------------------------------------------------------
diff --git a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/Windows7zipBlueprintLiveTest.java b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/Windows7zipBlueprintLiveTest.java
index bc3e627..b03c29d 100644
--- a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/Windows7zipBlueprintLiveTest.java
+++ b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/Windows7zipBlueprintLiveTest.java
@@ -81,7 +81,7 @@ public class Windows7zipBlueprintLiveTest extends AbstractBlueprintTest {
         
         Predicate<Application> asserter = new Predicate<Application>() {
             @Override public boolean apply(Application app) {
-                VanillaWindowsProcess entity = Iterables.getOnlyElement(Entities.descendants(app, VanillaWindowsProcess.class));
+                VanillaWindowsProcess entity = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, VanillaWindowsProcess.class));
                 String winRMAddress = entity.getAttribute(AdvertiseWinrmLoginPolicy.VM_USER_CREDENTIALS); 
                 String ipPort = Strings.getFirstWordAfter(winRMAddress, "@");
                 String user = Strings.getFirstWord(winRMAddress);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/89ef9d53/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java
index 4e7aca6..f682d37 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java
@@ -178,7 +178,7 @@ public class EntityConfigResource extends AbstractBrooklynRestResource implement
             ConfigKey ck = findConfig(entity, configName);
             ((EntityInternal) entity).config().set(ck, TypeCoercions.coerce(newValue, ck.getTypeToken()));
             if (Boolean.TRUE.equals(recurse)) {
-                for (Entity e2 : Entities.descendants(entity, Predicates.alwaysTrue(), false)) {
+                for (Entity e2 : Entities.descendantsWithoutSelf(entity)) {
                     ((EntityInternal) e2).config().set(ck, newValue);
                 }
             }
@@ -198,7 +198,7 @@ public class EntityConfigResource extends AbstractBrooklynRestResource implement
         LOG.debug("REST setting config " + configName + " on " + entity + " to " + newValue);
         ((EntityInternal) entity).config().set(ck, TypeCoercions.coerce(newValue, ck.getTypeToken()));
         if (Boolean.TRUE.equals(recurse)) {
-            for (Entity e2 : Entities.descendants(entity, Predicates.alwaysTrue(), false)) {
+            for (Entity e2 : Entities.descendantsWithoutSelf(entity)) {
                 ((EntityInternal) e2).config().set(ck, newValue);
             }
         }