Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ABE53200B44 for ; Thu, 14 Jul 2016 17:42:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AAD89160A60; Thu, 14 Jul 2016 15:42:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CC3C1160A63 for ; Thu, 14 Jul 2016 17:42:17 +0200 (CEST) Received: (qmail 56950 invoked by uid 500); 14 Jul 2016 15:42:17 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 56906 invoked by uid 99); 14 Jul 2016 15:42:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 15:42:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A854BE383A; Thu, 14 Jul 2016 15:42:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: svet@apache.org To: commits@brooklyn.apache.org Date: Thu, 14 Jul 2016 15:42:16 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] brooklyn-library git commit: Use Entities.descendantsAndSelf archived-at: Thu, 14 Jul 2016 15:42:18 -0000 Repository: brooklyn-library Updated Branches: refs/heads/master cc058d8c5 -> 54ad07199 Use Entities.descendantsAndSelf Previously calling Entities.deprecated; that is not deprecated. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/cbbe15ab Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/cbbe15ab Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/cbbe15ab Branch: refs/heads/master Commit: cbbe15abdb678f9cd95596c1dd3fb2cf2bc537c5 Parents: e1db211 Author: Aled Sage Authored: Mon Jul 4 15:29:09 2016 +0100 Committer: Aled Sage Committed: Wed Jul 6 09:49:04 2016 +0100 ---------------------------------------------------------------------- .../brooklyn/qa/camp/EnrichersSlightlySimplerYamlTest.java | 4 ++-- .../apache/brooklyn/entity/dns/AbstractGeoDnsServiceTest.java | 4 ++-- .../brooklyn/entity/dns/geoscaling/GeoDnsServiceYamlTest.java | 6 ++++-- .../entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/cbbe15ab/qa/src/test/java/org/apache/brooklyn/qa/camp/EnrichersSlightlySimplerYamlTest.java ---------------------------------------------------------------------- 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.core.sensor.Sensors; 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 org.testng.annotations.Test; 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 @@ public class EnrichersSlightlySimplerYamlTest extends AbstractYamlTest { log.info("Started "+app+":"); Entities.dumpInfo(app); - List appservers = MutableList.copyOf(Entities.descendants(app, JavaWebAppSoftwareProcess.class)); + List appservers = ImmutableList.copyOf(Entities.descendantsAndSelf(app, JavaWebAppSoftwareProcess.class)); Assert.assertEquals(appservers.size(), 3); EntityInternal srv0 = (EntityInternal) appservers.get(0); http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/cbbe15ab/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceTest.java ---------------------------------------------------------------------- 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 @@ public class AbstractGeoDnsServiceTest extends BrooklynAppUnitTestSupport { 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.mapSizeEquals(2)); problemChild.sensors().set(Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); assertAttributeEventually(geoDns, AbstractGeoDnsService.TARGETS, CollectionFunctionals.mapSizeEquals(1)); @@ -284,7 +284,7 @@ public class AbstractGeoDnsServiceTest extends BrooklynAppUnitTestSupport { assertAttributeEventually(geoDns, AbstractGeoDnsService.TARGETS, CollectionFunctionals.mapSizeEquals(2)); final Map 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); } http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/cbbe15ab/software/webapp/src/test/java/org/apache/brooklyn/entity/dns/geoscaling/GeoDnsServiceYamlTest.java ---------------------------------------------------------------------- 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.dns.AbstractGeoDnsService; 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 @@ public class GeoDnsServiceYamlTest extends AbstractYamlTest { 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); } http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/cbbe15ab/software/webapp/src/test/java/org/apache/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java ---------------------------------------------------------------------- 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 @@ public class NginxRebindWithHaIntegrationTest extends RebindTestFixtureWithApp { 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 newFeeds = ((EntityInternal)newNginx).feeds().getFeeds(); LOG.info("feeds after rebind are: "+newFeeds);