RMNodeLabelsManager extends CommonNodeLabelsManager { public List<RMNodeLabel> pullRMNodeLabelsInfo() { readLock.lock(); try { List<RMNodeLabel> infos = new ArrayList<RMNodeLabel>(); for (Entry<String, RMNodeLabel> entry : labelCollections.entrySet()) { RMNodeLabel label = entry.getValue(); infos.add(label.getCopy()); } Collections.sort(infos); return infos; } finally { readLock.unlock(); } }  @Override void addLabelsToNode(Map<NodeId, Set<String>> addedLabelsToNode); @Override void removeFromClusterNodeLabels(Collection<String> labelsToRemove); @Override void addToCluserNodeLabels(Collection<NodeLabel> labels); @Override void removeLabelsFromNode(Map<NodeId, Set<String>> removeLabelsFromNode); @Override void replaceLabelsOnNode(Map<NodeId, Set<String>> replaceLabelsToNode); void activateNode(NodeId nodeId, Resource resource); void deactivateNode(NodeId nodeId); void updateNodeResource(NodeId node, Resource newResource); void reinitializeQueueLabels(Map<String, Set<String>> queueToLabels); Resource getQueueResource(String queueName, Set<String> queueLabels,
      Resource clusterResource); int getActiveNMCountPerLabel(String label); Set<String> getLabelsOnNode(NodeId nodeId); boolean containsNodeLabel(String label); Resource getResourceByLabel(String label, Resource clusterResource); boolean checkAccess(UserGroupInformation user); void setRMContext(RMContext rmContext); List<RMNodeLabel> pullRMNodeLabelsInfo();  }
@Test(timeout = 5000) public void testPullRMNodeLabelsInfo() throws IOException { mgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("x", "y", "z")); mgr.activateNode(NodeId.newInstance("n1", 1), Resource.newInstance(10, 0)); mgr.activateNode(NodeId.newInstance("n2", 1), Resource.newInstance(10, 0)); mgr.activateNode(NodeId.newInstance("n3", 1), Resource.newInstance(10, 0)); mgr.activateNode(NodeId.newInstance("n4", 1), Resource.newInstance(10, 0)); mgr.activateNode(NodeId.newInstance("n5", 1), Resource.newInstance(10, 0)); mgr.replaceLabelsOnNode(ImmutableMap.of(toNodeId("n1"), toSet("x"), toNodeId("n2"), toSet("x"), toNodeId("n3"), toSet("y"))); List<RMNodeLabel> infos = mgr.pullRMNodeLabelsInfo(); Assert.assertEquals(4, infos.size()); checkNodeLabelInfo(infos, RMNodeLabelsManager.NO_LABEL, 2, 20); checkNodeLabelInfo(infos, "x", 2, 20); checkNodeLabelInfo(infos, "y", 1, 10); checkNodeLabelInfo(infos, "z", 0, 0); }