RMNodeLabelsManager extends CommonNodeLabelsManager { @Override public void removeLabelsFromNode(Map<NodeId, Set<String>> removeLabelsFromNode) throws IOException { writeLock.lock(); try { Map<String, Host> before = cloneNodeMap(removeLabelsFromNode.keySet()); super.removeLabelsFromNode(removeLabelsFromNode); Map<String, Host> after = cloneNodeMap(removeLabelsFromNode.keySet()); updateResourceMappings(before, after); } finally { writeLock.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 testRemoveLabelsFromNode() throws Exception { mgr.addToCluserNodeLabelsWithDefaultExclusivity(toSet("p1", "p2", "p3")); mgr.replaceLabelsOnNode(ImmutableMap.of(toNodeId("n1"), toSet("p1"), toNodeId("n2"), toSet("p2"), toNodeId("n3"), toSet("p3"))); mgr.activateNode(NodeId.newInstance("n1", 1), SMALL_RESOURCE); try { mgr.removeLabelsFromNode(ImmutableMap.of(toNodeId("n1:1"), toSet("p1"))); Assert.fail("removeLabelsFromNode should trigger IOException"); } catch (IOException e) { } mgr.replaceLabelsOnNode(ImmutableMap.of(toNodeId("n1:1"), toSet("p1"))); try { mgr.removeLabelsFromNode(ImmutableMap.of(toNodeId("n1:1"), toSet("p1"))); } catch (IOException e) { Assert.fail("IOException from removeLabelsFromNode " + e); } }