You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/07/14 15:42:16 UTC
[1/2] brooklyn-library git commit: Use Entities.descendantsAndSelf
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 <al...@gmail.com>
Authored: Mon Jul 4 15:29:09 2016 +0100
Committer: Aled Sage <al...@gmail.com>
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<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);
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.<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 @@ public class AbstractGeoDnsServiceTest extends BrooklynAppUnitTestSupport {
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);
}
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<Feed> newFeeds = ((EntityInternal)newNginx).feeds().getFeeds();
LOG.info("feeds after rebind are: "+newFeeds);
[2/2] brooklyn-library git commit: Closes #47
Posted by sv...@apache.org.
Closes #47
Use Entities.descendantsAndSelf
Previously calling Entities.deprecated; that is not deprecated.
This is dependent on first merging https://github.com/apache/brooklyn-server/pull/218
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/54ad0719
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/54ad0719
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/54ad0719
Branch: refs/heads/master
Commit: 54ad07199e52244aa32c46059b0ba17352314e06
Parents: cc058d8 cbbe15a
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Thu Jul 14 18:41:07 2016 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Thu Jul 14 18:41:07 2016 +0300
----------------------------------------------------------------------
.../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(-)
----------------------------------------------------------------------