CommonNodeLabelsManager extends AbstractService { public Map<NodeId, Set<NodeLabel>> getNodeLabelsInfo() { Map<NodeId, Set<NodeLabel>> nodeToLabels = generateNodeLabelsInfoPerNode(NodeLabel.class); return nodeToLabels; } CommonNodeLabelsManager(); @SuppressWarnings("unchecked") void addToCluserNodeLabels(Collection<NodeLabel> labels); @VisibleForTesting void addToCluserNodeLabelsWithDefaultExclusivity(Set<String> labels); void addLabelsToNode(Map<NodeId, Set<String>> addedLabelsToNode); void removeFromClusterNodeLabels(Collection<String> labelsToRemove); void removeLabelsFromNode(Map<NodeId, Set<String>> removeLabelsFromNode); void replaceLabelsOnNode(Map<NodeId, Set<String>> replaceLabelsToNode); Map<NodeId, Set<String>> getNodeLabels(); Map<NodeId, Set<NodeLabel>> getNodeLabelsInfo(); Map<String, Set<NodeId>> getLabelsToNodes(); Map<String, Set<NodeId>> getLabelsToNodes(Set<String> labels); Map<NodeLabel, Set<NodeId>> getLabelsInfoToNodes(); Map<NodeLabel, Set<NodeId>> getLabelsInfoToNodes(Set<String> labels); Set<String> getClusterNodeLabelNames(); List<NodeLabel> getClusterNodeLabels(); boolean isExclusiveNodeLabel(String nodeLabel); static void checkAndThrowLabelName(String label); Set<NodeLabel> getLabelsInfoByNode(NodeId nodeId); static final Set<String> EMPTY_STRING_SET; static final Set<NodeLabel> EMPTY_NODELABEL_SET; static final String ANY; static final Set<String> ACCESS_ANY_LABEL_SET; static final int WILDCARD_PORT; @VisibleForTesting
  static final String NODE_LABELS_NOT_ENABLED_ERR; static final String NO_LABEL; }
@Test(timeout = 5000) public void testGetNodeLabelsInfo() throws IOException { mgr.addToCluserNodeLabels(Arrays.asList(NodeLabel.newInstance("p1", false), NodeLabel.newInstance("p2", true), NodeLabel.newInstance("p3", false))); mgr.addLabelsToNode(ImmutableMap.of(toNodeId("n1"), toSet("p2"))); mgr.addLabelsToNode(ImmutableMap.of(toNodeId("n2"), toSet("p3"))); assertLabelInfoMapEquals(mgr.getNodeLabelsInfo(), ImmutableMap.of( toNodeId("n1"), toSet(NodeLabel.newInstance("p2", true)), toNodeId("n2"), toSet(NodeLabel.newInstance("p3", false)))); }