@Test public void testWrongNodeType() { when(nodeInfo.isDistributor()).thenReturn(false); clusterStateView.handleUpdatedHostInfo(nodeInfo, createHostInfo("101")); verify(statsAggregator, never()).updateForDistributor(anyInt(), any()); }
public void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo) { if ( ! node.isDistributor()) return; final int hostVersion; if (hostInfo.getClusterStateVersionOrNull() == null) { return; } else { hostVersion = hostInfo.getClusterStateVersionOrNull(); } int currentStateVersion = clusterState.getVersion(); if (hostVersion != currentStateVersion) { log.log(Level.FINE, "Current state version is " + currentStateVersion + ", while host info received from distributor " + node.getNodeIndex() + " is " + hostVersion); return; } statsAggregator.updateForDistributor(node.getNodeIndex(), StorageNodeStatsBridge.generate(hostInfo.getDistributor())); }
ClusterStateView { public void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo) { if ( ! node.isDistributor()) return; final int hostVersion; if (hostInfo.getClusterStateVersionOrNull() == null) { return; } else { hostVersion = hostInfo.getClusterStateVersionOrNull(); } int currentStateVersion = clusterState.getVersion(); if (hostVersion != currentStateVersion) { log.log(Level.FINE, "Current state version is " + currentStateVersion + ", while host info received from distributor " + node.getNodeIndex() + " is " + hostVersion); return; } statsAggregator.updateForDistributor(node.getNodeIndex(), StorageNodeStatsBridge.generate(hostInfo.getDistributor())); } }
ClusterStateView { public void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo) { if ( ! node.isDistributor()) return; final int hostVersion; if (hostInfo.getClusterStateVersionOrNull() == null) { return; } else { hostVersion = hostInfo.getClusterStateVersionOrNull(); } int currentStateVersion = clusterState.getVersion(); if (hostVersion != currentStateVersion) { log.log(Level.FINE, "Current state version is " + currentStateVersion + ", while host info received from distributor " + node.getNodeIndex() + " is " + hostVersion); return; } statsAggregator.updateForDistributor(node.getNodeIndex(), StorageNodeStatsBridge.generate(hostInfo.getDistributor())); } ClusterStateView(ClusterState clusterState, ClusterStatsAggregator statsAggregator); }
ClusterStateView { public void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo) { if ( ! node.isDistributor()) return; final int hostVersion; if (hostInfo.getClusterStateVersionOrNull() == null) { return; } else { hostVersion = hostInfo.getClusterStateVersionOrNull(); } int currentStateVersion = clusterState.getVersion(); if (hostVersion != currentStateVersion) { log.log(Level.FINE, "Current state version is " + currentStateVersion + ", while host info received from distributor " + node.getNodeIndex() + " is " + hostVersion); return; } statsAggregator.updateForDistributor(node.getNodeIndex(), StorageNodeStatsBridge.generate(hostInfo.getDistributor())); } ClusterStateView(ClusterState clusterState, ClusterStatsAggregator statsAggregator); static ClusterStateView create(String serializedClusterState); static ClusterStateView create(final ClusterState clusterState); ClusterStateView cloneForNewState(); ClusterState getClusterState(); void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo); ClusterStatsAggregator getStatsAggregator(); String toString(); }
ClusterStateView { public void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo) { if ( ! node.isDistributor()) return; final int hostVersion; if (hostInfo.getClusterStateVersionOrNull() == null) { return; } else { hostVersion = hostInfo.getClusterStateVersionOrNull(); } int currentStateVersion = clusterState.getVersion(); if (hostVersion != currentStateVersion) { log.log(Level.FINE, "Current state version is " + currentStateVersion + ", while host info received from distributor " + node.getNodeIndex() + " is " + hostVersion); return; } statsAggregator.updateForDistributor(node.getNodeIndex(), StorageNodeStatsBridge.generate(hostInfo.getDistributor())); } ClusterStateView(ClusterState clusterState, ClusterStatsAggregator statsAggregator); static ClusterStateView create(String serializedClusterState); static ClusterStateView create(final ClusterState clusterState); ClusterStateView cloneForNewState(); ClusterState getClusterState(); void handleUpdatedHostInfo(NodeInfo node, HostInfo hostInfo); ClusterStatsAggregator getStatsAggregator(); String toString();  }