Use Entities.descendantsAndSelf
Previously calling Entities.deprecated; that is not deprecated.
diff --git a/qa/src/test/java/org/apache/brooklyn/qa/camp/EnrichersSlightlySimplerYamlTest.java b/qa/src/test/java/org/apache/brooklyn/qa/camp/EnrichersSlightlySimplerYamlTest.java
index f5fc854..ffff7df 100644
--- a/qa/src/test/java/org/apache/brooklyn/qa/camp/EnrichersSlightlySimplerYamlTest.java
+++ b/qa/src/test/java/org/apache/brooklyn/qa/camp/EnrichersSlightlySimplerYamlTest.java
@@ -33,7 +33,6 @@
import org.apache.brooklyn.entity.group.DynamicCluster;
import org.apache.brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
import org.apache.brooklyn.util.collections.CollectionFunctionals;
-import org.apache.brooklyn.util.collections.MutableList;
import org.apache.brooklyn.util.math.MathPredicates;
import org.apache.brooklyn.util.text.StringPredicates;
import org.slf4j.Logger;
@@ -43,6 +42,7 @@
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
/** Tests some improvements to enricher classes to make them a bit more yaml friendly.
@@ -99,7 +99,7 @@
log.info("Started "+app+":");
Entities.dumpInfo(app);
- List<JavaWebAppSoftwareProcess> appservers = MutableList.copyOf(Entities.descendants(app, JavaWebAppSoftwareProcess.class));
+ List<JavaWebAppSoftwareProcess> appservers = ImmutableList.copyOf(Entities.descendantsAndSelf(app, JavaWebAppSoftwareProcess.class));
Assert.assertEquals(appservers.size(), 3);
EntityInternal srv0 = (EntityInternal) appservers.get(0);
diff --git a/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceTest.java b/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceTest.java
index 9a24e36..0f65d2b 100644
--- a/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceTest.java
+++ b/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceTest.java
@@ -268,7 +268,7 @@
app.start(ImmutableList.of(westChildWithLocation, eastChildWithLocationAndWithPrivateHostname));
publishSensors(2, true, true, true);
- TestEntity problemChild = Entities.descendants(app, TestEntity.class).iterator().next();
+ TestEntity problemChild = Iterables.get(Entities.descendantsAndSelf(app, TestEntity.class), 0);
assertAttributeEventually(geoDns, AbstractGeoDnsService.TARGETS, CollectionFunctionals.<String>mapSizeEquals(2));
problemChild.sensors().set(Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE);
assertAttributeEventually(geoDns, AbstractGeoDnsService.TARGETS, CollectionFunctionals.<String>mapSizeEquals(1));
@@ -284,7 +284,7 @@
assertAttributeEventually(geoDns, AbstractGeoDnsService.TARGETS, CollectionFunctionals.<String>mapSizeEquals(2));
final Map<String, String> targets = ImmutableMap.copyOf(geoDns.sensors().get(AbstractGeoDnsService.TARGETS));
- TestEntity problemChild = Entities.descendants(app, TestEntity.class).iterator().next();
+ TestEntity problemChild = Iterables.get(Entities.descendantsAndSelf(app, TestEntity.class), 0);
problemChild.sensors().set(Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE);
assertAttributeEqualsContinually(geoDns, AbstractGeoDnsService.TARGETS, targets);
}
diff --git a/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoDnsServiceYamlTest.java b/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoDnsServiceYamlTest.java
index 1f3f1b4..f54a0a7 100644
--- a/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoDnsServiceYamlTest.java
+++ b/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoDnsServiceYamlTest.java
@@ -29,6 +29,8 @@
import org.apache.brooklyn.entity.group.DynamicFabric;
import org.testng.annotations.Test;
+import com.google.common.collect.Iterables;
+
public class GeoDnsServiceYamlTest extends AbstractYamlTest {
@Test
@@ -36,8 +38,8 @@
final String resourceName = "classpath:/" + getClass().getPackage().getName().replace('.', '/') + "/geodns.yaml";
final String blueprint = loadYaml(resourceName);
Application app = EntityManagementUtils.createUnstarted(mgmt(), blueprint);
- GeoscalingDnsService geodns = Entities.descendants(app, GeoscalingDnsService.class).iterator().next();
- DynamicFabric fabric = Entities.descendants(app, DynamicFabric.class).iterator().next();
+ GeoscalingDnsService geodns = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, GeoscalingDnsService.class));
+ DynamicFabric fabric = Iterables.getOnlyElement(Entities.descendantsAndSelf(app, DynamicFabric.class));
assertEquals(geodns.config().get(AbstractGeoDnsService.ENTITY_PROVIDER), fabric);
}
diff --git a/software/webapp/src/test/java/org/apache/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java b/software/webapp/src/test/java/org/apache/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
index 724aed6..3e11c27 100644
--- a/software/webapp/src/test/java/org/apache/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
+++ b/software/webapp/src/test/java/org/apache/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
@@ -164,7 +164,7 @@
newApp = (TestApplication) RebindTestUtils.rebind(
RebindOptions.create().newManagementContext(newManagementContext).classLoader(classLoader));
- NginxController newNginx = Iterables.getOnlyElement(Entities.descendants(newApp, NginxController.class));
+ NginxController newNginx = Iterables.getOnlyElement(Entities.descendantsAndSelf(newApp, NginxController.class));
Collection<Feed> newFeeds = ((EntityInternal)newNginx).feeds().getFeeds();
LOG.info("feeds after rebind are: "+newFeeds);