DynamicCluster.quarantineFailedEntities now defaults to true

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/256a70f7
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/256a70f7
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/256a70f7

Branch: refs/heads/0.6.0
Commit: 256a70f7751f5b26236286a668bb74e130242beb
Parents: 95cec8a
Author: Aled Sage <[email protected]>
Authored: Thu Nov 7 09:59:18 2013 +0000
Committer: Aled Sage <[email protected]>
Committed: Thu Nov 7 10:33:04 2013 +0000

----------------------------------------------------------------------
 .../entity/proxy/AbstractControllerTest.java    | 16 ++++++-------
 .../webapp/DynamicWebAppClusterTest.groovy      | 24 ++++++++------------
 2 files changed, 17 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/256a70f7/software/webapp/src/test/java/brooklyn/entity/proxy/AbstractControllerTest.java
----------------------------------------------------------------------
diff --git 
a/software/webapp/src/test/java/brooklyn/entity/proxy/AbstractControllerTest.java
 
b/software/webapp/src/test/java/brooklyn/entity/proxy/AbstractControllerTest.java
index 1704804..24e5c59 100644
--- 
a/software/webapp/src/test/java/brooklyn/entity/proxy/AbstractControllerTest.java
+++ 
b/software/webapp/src/test/java/brooklyn/entity/proxy/AbstractControllerTest.java
@@ -161,7 +161,7 @@ public class AbstractControllerTest {
     public void testUpdateCalledWithAddressesOfNewChildren() {
         // First child
         cluster.resize(1);
-        EntityLocal child = (EntityLocal) 
cluster.getChildren().iterator().next();
+        EntityLocal child = (EntityLocal) 
Iterables.getOnlyElement(cluster.getMembers());
         
         List<Collection<String>> u = 
Lists.newArrayList(controller.getUpdates());
         assertTrue(u.isEmpty(), "expected empty list but got "+u);
@@ -175,9 +175,9 @@ public class AbstractControllerTest {
         Asserts.succeedsEventually(new Runnable() {
             @Override
             public void run() {
-                assertEquals(cluster.getChildren().size(), 2);
+                assertEquals(cluster.getMembers().size(), 2);
             }});
-        EntityLocal child2 = (EntityLocal) 
Iterables.getOnlyElement(MutableSet.builder().addAll(cluster.getChildren()).remove(child).build());
+        EntityLocal child2 = (EntityLocal) 
Iterables.getOnlyElement(MutableSet.builder().addAll(cluster.getMembers()).remove(child).build());
         
         child2.setAttribute(ClusteredEntity.HTTP_PORT, 1234);
         child2.setAttribute(Startable.SERVICE_UP, true);
@@ -197,7 +197,7 @@ public class AbstractControllerTest {
     public void testUpdateCalledWithAddressesRemovedForStoppedChildren() {
         // Get some children, so we can remove one...
         cluster.resize(2);
-        for (Entity it: cluster.getChildren()) { 
+        for (Entity it: cluster.getMembers()) { 
             ((EntityLocal)it).setAttribute(ClusteredEntity.HTTP_PORT, 1234);
             ((EntityLocal)it).setAttribute(Startable.SERVICE_UP, true);
         }
@@ -205,7 +205,7 @@ public class AbstractControllerTest {
 
         // Now remove one child
         cluster.resize(1);
-        assertEquals(cluster.getChildren().size(), 1);
+        assertEquals(cluster.getMembers().size(), 1);
         assertEventuallyAddressesMatchCluster();
     }
 
@@ -213,7 +213,7 @@ public class AbstractControllerTest {
     public void 
testUpdateCalledWithAddressesRemovedForServiceDownChildrenThatHaveClearedHostnamePort()
 {
         // Get some children, so we can remove one...
         cluster.resize(2);
-        for (Entity it: cluster.getChildren()) { 
+        for (Entity it: cluster.getMembers()) { 
             ((EntityLocal)it).setAttribute(ClusteredEntity.HTTP_PORT, 1234);
             ((EntityLocal)it).setAttribute(Startable.SERVICE_UP, true);
         }
@@ -221,7 +221,7 @@ public class AbstractControllerTest {
 
         // Now unset host/port, and remove children
         // Note the unsetting of hostname is done in 
SoftwareProcessImpl.stop(), so this is realistic
-        for (Entity it : cluster.getChildren()) {
+        for (Entity it : cluster.getMembers()) {
             ((EntityLocal)it).setAttribute(ClusteredEntity.HTTP_PORT, null);
             ((EntityLocal)it).setAttribute(ClusteredEntity.HOSTNAME, null);
             ((EntityLocal)it).setAttribute(Startable.SERVICE_UP, false);
@@ -230,7 +230,7 @@ public class AbstractControllerTest {
     }
 
     private void assertEventuallyAddressesMatchCluster() {
-        assertEventuallyAddressesMatch(cluster.getChildren());
+        assertEventuallyAddressesMatch(cluster.getMembers());
     }
 
     private void assertEventuallyAddressesMatch(final Collection<Entity> 
expectedMembers) {

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/256a70f7/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppClusterTest.groovy
----------------------------------------------------------------------
diff --git 
a/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppClusterTest.groovy
 
b/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppClusterTest.groovy
index acc2185..a55e73f 100644
--- 
a/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppClusterTest.groovy
+++ 
b/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppClusterTest.groovy
@@ -91,38 +91,32 @@ public class DynamicWebAppClusterTest {
         
EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", 
TIMEOUT_MS), cluster, DynamicWebAppCluster.SERVICE_UP, false);
         
         // When child is !service_up, should continue to report false
-        Iterables.get(cluster.getChildren(), 
0).setAttribute(Startable.SERVICE_UP, false);
+        Iterables.get(cluster.getMembers(), 
0).setAttribute(Startable.SERVICE_UP, false);
         
EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 
SHORT_WAIT_MS), cluster, DynamicWebAppCluster.SERVICE_UP, false);
         
         cluster.resize(2);
         
         // When one of the two children is service_up, should report true
-        Iterables.get(cluster.getChildren(), 
0).setAttribute(Startable.SERVICE_UP, true);
+        Iterables.get(cluster.getMembers(), 
0).setAttribute(Startable.SERVICE_UP, true);
         
EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", 
TIMEOUT_MS), cluster, DynamicWebAppCluster.SERVICE_UP, true);
 
         // And if that serviceUp child goes away, should again report false
-        Entities.unmanage(Iterables.get(cluster.getChildren(), 0));
+        Entities.unmanage(Iterables.get(cluster.getMembers(), 0));
         
EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", 
TIMEOUT_MS), cluster, DynamicWebAppCluster.SERVICE_UP, false);
     }
     
-    // FIXME Fails because of the config-closure stuff; it now coerces closure 
every time 
-    // on entity.getConfig(key), rather than only once. So the call to 
cluster.factory.configure
-    // updated a different instance from that retrieved subsequently!
-    @Test(groups="WIP")
+    @Test
     public void testPropertiesToChildren() {
-        DynamicWebAppCluster cluster = new DynamicWebAppClusterImpl(
-            factory: { properties -> new TestJavaWebAppEntity(properties + 
["a": 1]) },
-            parent:app) {
-                protected Map getCustomChildFlags() { ["c":3] }
-        }
-        cluster.factory.configure(b: 2);
+        DynamicWebAppCluster cluster = 
app.createAndManageChild(EntitySpec.create(DynamicWebAppCluster.class)
+            .configure(DynamicWebAppCluster.FACTORY, { properties -> new 
TestJavaWebAppEntity(properties + ["a": 1]) })
+            .configure(DynamicWebAppCluster.CUSTOM_CHILD_FLAGS, ["b":2]));
+
         Entities.manage(cluster);
         
         app.start([new SimulatedLocation()])
         assertEquals 1, cluster.members.size()
-        def we = cluster.members[0]
+        TestJavaWebAppEntity we = Iterables.get(cluster.getMembers(), 0);
         assertEquals we.a, 1
         assertEquals we.b, 2
-        assertEquals we.c, 3
     }
 }

Reply via email to