ServerResource extends AbstractBrooklynRestResource implements ServerApi { @Override public String getPlaneId() { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SERVER_STATUS, null)) throw WebResourceUtils.forbidden("User '%s' is not authorized to perform this operation", Entitlements.getEntitlementContext().user()); Maybe<ManagementContext> mm = mgmtMaybe(); Maybe<String> result = (mm.isPresent()) ? mm.get().getManagementPlaneIdMaybe() : Maybe.absent(); return result.isPresent() ? result.get() : ""; }  @Override void reloadBrooklynProperties(); @Override void shutdown(final boolean stopAppsFirst, final boolean forceShutdownOnError,
            String shutdownTimeoutRaw, String requestTimeoutRaw, String delayForHttpReturnRaw,
            Long delayMillis); @Override VersionSummary getVersion(); @Override String getPlaneId(); @Override boolean isUp(); @Override boolean isShuttingDown(); @Override boolean isHealthy(); @Override Map<String,Object> getUpExtended(); @Override String getConfig(String configKey); @Override ManagementNodeState getHighAvailabilityNodeState(); @Override ManagementNodeState setHighAvailabilityNodeState(HighAvailabilityMode mode); @Override Map<String, Object> getHighAvailabilityMetrics(); @Override long getHighAvailabitlityPriority(); @Override long setHighAvailabilityPriority(long priority); @Override HighAvailabilitySummary getHighAvailabilityPlaneStates(); @Override Response clearHighAvailabilityPlaneStates(); @Override String getUser(); @Override Response exportPersistenceData(String preferredOrigin);  }
@Test public void testGetPlaneId() throws Exception { String planeId = client().path("/server/planeid").get(String.class); assertEquals(planeId, manager.getManagementPlaneIdMaybe().get()); }
@Test public void testGetHighAvailability() throws Exception { 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)); assertEquals(summary.getNodes().get(ownNodeId).getNodeId(), ownNodeId); assertEquals(summary.getNodes().get(ownNodeId).getStatus(), "MASTER"); assertNotNull(summary.getNodes().get(ownNodeId).getLocalTimestamp()); assertNotNull(summary.getNodes().get(ownNodeId).getRemoteTimestamp()); assertEquals(summary.getNodes().get(ownNodeId).getLocalTimestamp(), summary.getNodes().get(ownNodeId).getRemoteTimestamp()); }