Java Code Examples for org.apache.hadoop.mapreduce.v2.app.AppContext#getBlacklistedNodes()

The following examples show how to use org.apache.hadoop.mapreduce.v2.app.AppContext#getBlacklistedNodes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAMWebServices.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void verifyBlacklistedNodesInfoXML(String xml, AppContext ctx)
    throws JSONException, Exception {
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList infonodes = dom.getElementsByTagName("blacklistednodesinfo");
  assertEquals("incorrect number of elements", 1, infonodes.getLength());
  NodeList nodes = dom.getElementsByTagName("blacklistedNodes");
  Set<String> blacklistedNodes = ctx.getBlacklistedNodes();
  assertEquals("incorrect number of elements", blacklistedNodes.size(),
      nodes.getLength());
  for (int i = 0; i < nodes.getLength(); i++) {
    Element element = (Element) nodes.item(i);
    assertTrue(
        blacklistedNodes.contains(element.getFirstChild().getNodeValue()));
  }
}
 
Example 2
Source File: TestAMWebServices.java    From big-c with Apache License 2.0 6 votes vote down vote up
public void verifyBlacklistedNodesInfoXML(String xml, AppContext ctx)
    throws JSONException, Exception {
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList infonodes = dom.getElementsByTagName("blacklistednodesinfo");
  assertEquals("incorrect number of elements", 1, infonodes.getLength());
  NodeList nodes = dom.getElementsByTagName("blacklistedNodes");
  Set<String> blacklistedNodes = ctx.getBlacklistedNodes();
  assertEquals("incorrect number of elements", blacklistedNodes.size(),
      nodes.getLength());
  for (int i = 0; i < nodes.getLength(); i++) {
    Element element = (Element) nodes.item(i);
    assertTrue(
        blacklistedNodes.contains(element.getFirstChild().getNodeValue()));
  }
}
 
Example 3
Source File: BlacklistedNodesInfo.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public BlacklistedNodesInfo(AppContext appContext) {
  blacklistedNodes = appContext.getBlacklistedNodes();
}
 
Example 4
Source File: BlacklistedNodesInfo.java    From big-c with Apache License 2.0 4 votes vote down vote up
public BlacklistedNodesInfo(AppContext appContext) {
  blacklistedNodes = appContext.getBlacklistedNodes();
}