brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [2/3] brooklyn-server git commit: Adds plane-id to result of /v1/server/ha/states
Date Mon, 17 Jul 2017 14:57:19 GMT
Adds plane-id to result of /v1/server/ha/states

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

Branch: refs/heads/master
Commit: 498dff0550e3e439a476d2ee7b5fa9a794585d3c
Parents: 7bf13ae
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Jul 17 13:22:22 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Jul 17 13:22:22 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/rest/domain/HighAvailabilitySummary.java     | 10 +++++++++-
 .../rest/transform/HighAvailabilityTransformer.java       |  2 +-
 .../brooklyn/rest/resources/ServerResourceTest.java       |  2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/498dff05/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/HighAvailabilitySummary.java
----------------------------------------------------------------------
diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/HighAvailabilitySummary.java
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/HighAvailabilitySummary.java
index 037c08e..70752da 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/HighAvailabilitySummary.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/HighAvailabilitySummary.java
@@ -101,22 +101,29 @@ public class HighAvailabilitySummary implements Serializable {
         }
     }
 
+    private final String planeId;
     private final String ownId;
     private final String masterId;
     private final Map<String, HaNodeSummary> nodes;
     private final Map<String, URI> links;
 
     public HighAvailabilitySummary(
+            @JsonProperty("planeId") String planeId,
             @JsonProperty("ownId") String ownId,
             @JsonProperty("masterId") String masterId,
             @JsonProperty("nodes") Map<String, HaNodeSummary> nodes,
             @JsonProperty("links") Map<String, URI> links) {
+        this.planeId = planeId;
         this.ownId = ownId;
         this.masterId = masterId;
         this.nodes = (nodes == null) ? ImmutableMap.<String, HaNodeSummary>of() : nodes;
         this.links = (links == null) ? ImmutableMap.<String, URI>of() : ImmutableMap.copyOf(links);
     }
 
+    public String getPlaneId() {
+        return planeId;
+    }
+
     public String getOwnId() {
         return ownId;
     }
@@ -138,7 +145,8 @@ public class HighAvailabilitySummary implements Serializable {
         if (this == o) return true;
         if (!(o instanceof HighAvailabilitySummary)) return false;
         HighAvailabilitySummary that = (HighAvailabilitySummary) o;
-        return Objects.equals(ownId, that.ownId) &&
+        return Objects.equals(planeId, that.planeId) &&
+                Objects.equals(ownId, that.ownId) &&
                 Objects.equals(masterId, that.masterId) &&
                 Objects.equals(nodes, that.nodes) &&
                 Objects.equals(links, that.links);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/498dff05/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/HighAvailabilityTransformer.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/HighAvailabilityTransformer.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/HighAvailabilityTransformer.java
index 41b0f22..98909c8 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/HighAvailabilityTransformer.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/HighAvailabilityTransformer.java
@@ -40,7 +40,7 @@ public class HighAvailabilityTransformer {
         // TODO What links?
         ImmutableMap.Builder<String, URI> lb = ImmutableMap.<String, URI>builder();
 
-        return new HighAvailabilitySummary(ownNodeId, memento.getMasterNodeId(), nodes, lb.build());
+        return new HighAvailabilitySummary(memento.getPlaneId(), ownNodeId, memento.getMasterNodeId(),
nodes, lb.build());
     }
 
     public static HaNodeSummary haNodeSummary(ManagementNodeSyncRecord memento) {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/498dff05/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java
b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java
index 3087186..e1ca759 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/resources/ServerResourceTest.java
@@ -77,7 +77,9 @@ public class ServerResourceTest extends BrooklynRestResourceTest {
         HighAvailabilitySummary summary = client().path("/server/ha/states").get(HighAvailabilitySummary.class);
         log.info("HA summary is: "+summary);
         
+        String planeId = getManagementContext().getManagementPlaneIdMaybe().get();
         String ownNodeId = getManagementContext().getManagementNodeId();
+        assertEquals(summary.getPlaneId(), planeId);
         assertEquals(summary.getOwnId(), ownNodeId);
         assertEquals(summary.getMasterId(), ownNodeId);
         assertEquals(summary.getNodes().keySet(), ImmutableSet.of(ownNodeId));


Mime
View raw message