brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/2] brooklyn-server git commit: Fix AutoScalerPolicyRebindTest: when highlights change, request re-persist
Date Tue, 11 Sep 2018 10:38:38 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master c782aae54 -> f6ad11846


Fix AutoScalerPolicyRebindTest: when highlights change, request re-persist


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

Branch: refs/heads/master
Commit: cf1e72b989f9e62af6f1951631f2ea5a5fde5c29
Parents: c782aae
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Sep 11 00:28:12 2018 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Sep 11 00:30:11 2018 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java     | 2 ++
 .../java/org/apache/brooklyn/core/policy/AbstractPolicy.java     | 4 +---
 .../brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java  | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/cf1e72b9/core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java
index 8838eab..1e4407c 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java
@@ -488,6 +488,7 @@ public abstract class AbstractEntityAdjunct extends AbstractBrooklynObject
imple
      */
     protected void setHighlight(String name, HighlightTuple tuple) {
         highlights.put(name, tuple);
+        requestPersist();
     }
 
     /** As {@link #setHighlight(String, HighlightTuple)}, convenience for recording an item
which is intended to be ongoing. */
@@ -574,6 +575,7 @@ public abstract class AbstractEntityAdjunct extends AbstractBrooklynObject
imple
     public void setHighlights(Map<String, HighlightTuple> highlights) {
         if(highlights != null) {
             this.highlights.putAll(highlights);
+            requestPersist();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/cf1e72b9/core/src/main/java/org/apache/brooklyn/core/policy/AbstractPolicy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/policy/AbstractPolicy.java b/core/src/main/java/org/apache/brooklyn/core/policy/AbstractPolicy.java
index 01cce23..c29bedd 100644
--- a/core/src/main/java/org/apache/brooklyn/core/policy/AbstractPolicy.java
+++ b/core/src/main/java/org/apache/brooklyn/core/policy/AbstractPolicy.java
@@ -99,9 +99,7 @@ public abstract class AbstractPolicy extends AbstractEntityAdjunct implements
Po
     @Override
     protected void onChanged() {
         // currently changes simply trigger re-persistence; there is no intermediate listener
as we do for EntityChangeListener
-        if (getManagementContext() != null) {
-            getManagementContext().getRebindManager().getChangeListener().onChanged(this);
-        }
+        requestPersist();
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/cf1e72b9/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java
b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java
index bf7d150..e30ae77 100644
--- a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java
+++ b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java
@@ -157,8 +157,7 @@ public class AutoScalerPolicyRebindTest extends RebindTestFixtureWithApp
{
         Map<String, HighlightTuple> highlights = new HashMap<>();
         highlights.put("testNameTask",  new HighlightTuple("testDescription", 123L, "testTaskId"));
 
-
-        Policy originalPolicy = origCluster.policies().iterator().next();
+        AutoScalerPolicy originalPolicy = (AutoScalerPolicy) Iterables.getOnlyElement(origCluster.policies());
         ((AbstractEntityAdjunct)originalPolicy).setHighlights(highlights);
 
         TestApplication newApp = rebind();


Mime
View raw message