gpt4 book ai didi

org.apache.hadoop.yarn.webapp.WebServicesTestUtils.getXmlLong()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 20:37:05 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.webapp.WebServicesTestUtils.getXmlLong()方法的一些代码示例,展示了WebServicesTestUtils.getXmlLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebServicesTestUtils.getXmlLong()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.webapp.WebServicesTestUtils
类名称:WebServicesTestUtils
方法名:getXmlLong

WebServicesTestUtils.getXmlLong介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public void verifyAMTaskAttemptXML(Element element, TaskAttempt att,
  TaskType ttype) {
 verifyTaskAttemptGeneric(att, ttype,
   WebServicesTestUtils.getXmlString(element, "id"),
   WebServicesTestUtils.getXmlString(element, "state"),
   WebServicesTestUtils.getXmlString(element, "type"),
   WebServicesTestUtils.getXmlString(element, "rack"),
   WebServicesTestUtils.getXmlString(element, "nodeHttpAddress"),
   WebServicesTestUtils.getXmlString(element, "diagnostics"),
   WebServicesTestUtils.getXmlString(element, "assignedContainerId"),
   WebServicesTestUtils.getXmlLong(element, "startTime"),
   WebServicesTestUtils.getXmlLong(element, "finishTime"),
   WebServicesTestUtils.getXmlLong(element, "elapsedTime"),
   WebServicesTestUtils.getXmlFloat(element, "progress"));
 if (ttype == TaskType.REDUCE) {
  verifyReduceTaskAttemptGeneric(att,
    WebServicesTestUtils.getXmlLong(element, "shuffleFinishTime"),
    WebServicesTestUtils.getXmlLong(element, "mergeFinishTime"),
    WebServicesTestUtils.getXmlLong(element, "elapsedShuffleTime"),
    WebServicesTestUtils.getXmlLong(element, "elapsedMergeTime"),
    WebServicesTestUtils.getXmlLong(element, "elapsedReduceTime"));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public void verifyAMInfoXML(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 nodes = dom.getElementsByTagName("info");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyAMInfoGeneric(ctx,
    WebServicesTestUtils.getXmlString(element, "appId"),
    WebServicesTestUtils.getXmlString(element, "user"),
    WebServicesTestUtils.getXmlString(element, "name"),
    WebServicesTestUtils.getXmlLong(element, "startedOn"),
    WebServicesTestUtils.getXmlLong(element, "elapsedTime"));
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

protected String validateGetNewApplicationXMLResponse(String response)
  throws ParserConfigurationException, IOException, SAXException {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 InputSource is = new InputSource();
 is.setCharacterStream(new StringReader(response));
 Document dom = db.parse(is);
 NodeList nodes = dom.getElementsByTagName("NewApplication");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 Element element = (Element) nodes.item(0);
 String appId = WebServicesTestUtils.getXmlString(element, "application-id");
 assertTrue(!appId.isEmpty());
 NodeList maxResourceNodes =
   element.getElementsByTagName("maximum-resource-capability");
 assertEquals(1, maxResourceNodes.getLength());
 Element maxResourceCapability = (Element) maxResourceNodes.item(0);
 long memory =
   WebServicesTestUtils.getXmlLong(maxResourceCapability, "memory");
 long vCores =
   WebServicesTestUtils.getXmlLong(maxResourceCapability, "vCores");
 assertTrue(memory != 0);
 assertTrue(vCores != 0);
 return appId;
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public void verifyAMSingleTaskXML(Element element, Task task) {
 verifyTaskGeneric(task, WebServicesTestUtils.getXmlString(element, "id"),
   WebServicesTestUtils.getXmlString(element, "state"),
   WebServicesTestUtils.getXmlString(element, "type"),
   WebServicesTestUtils.getXmlString(element, "successfulAttempt"),
   WebServicesTestUtils.getXmlLong(element, "startTime"),
   WebServicesTestUtils.getXmlLong(element, "finishTime"),
   WebServicesTestUtils.getXmlLong(element, "elapsedTime"),
   WebServicesTestUtils.getXmlFloat(element, "progress"),
   WebServicesTestUtils.getXmlString(element, "status"));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public void verifyNodesXML(NodeList nodes, MockNM nm) throws JSONException,
  Exception {
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyNodeInfoGeneric(nm,
    WebServicesTestUtils.getXmlString(element, "state"),
    WebServicesTestUtils.getXmlString(element, "rack"),
    WebServicesTestUtils.getXmlString(element, "id"),
    WebServicesTestUtils.getXmlString(element, "nodeHostName"),
    WebServicesTestUtils.getXmlString(element, "nodeHTTPAddress"),
    WebServicesTestUtils.getXmlLong(element, "lastHealthUpdate"),
    WebServicesTestUtils.getXmlString(element, "healthReport"),
    WebServicesTestUtils.getXmlInt(element, "numContainers"),
    WebServicesTestUtils.getXmlLong(element, "usedMemoryMB"),
    WebServicesTestUtils.getXmlLong(element, "availMemoryMB"),
    WebServicesTestUtils.getXmlLong(element, "usedVirtualCores"),
    WebServicesTestUtils.getXmlLong(element,  "availableVirtualCores"),
    WebServicesTestUtils.getXmlString(element, "version"));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

protected String validateGetNewApplicationXMLResponse(String response)
  throws ParserConfigurationException, IOException, SAXException {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 InputSource is = new InputSource();
 is.setCharacterStream(new StringReader(response));
 Document dom = db.parse(is);
 NodeList nodes = dom.getElementsByTagName("NewApplication");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 Element element = (Element) nodes.item(0);
 String appId = WebServicesTestUtils.getXmlString(element, "application-id");
 assertTrue(!appId.isEmpty());
 NodeList maxResourceNodes =
   element.getElementsByTagName("maximum-resource-capability");
 assertEquals(1, maxResourceNodes.getLength());
 Element maxResourceCapability = (Element) maxResourceNodes.item(0);
 long memory =
   WebServicesTestUtils.getXmlLong(maxResourceCapability, "memory");
 long vCores =
   WebServicesTestUtils.getXmlLong(maxResourceCapability, "vCores");
 assertTrue(memory != 0);
 assertTrue(vCores != 0);
 return appId;
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public static DelegationToken getDelegationTokenFromXML(String tokenXML)
  throws IOException, ParserConfigurationException, SAXException {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 InputSource is = new InputSource();
 is.setCharacterStream(new StringReader(tokenXML));
 Document dom = db.parse(is);
 NodeList nodes = dom.getElementsByTagName("delegation-token");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 Element element = (Element) nodes.item(0);
 DelegationToken ret = new DelegationToken();
 String token = WebServicesTestUtils.getXmlString(element, "token");
 if (token != null) {
  ret.setToken(token);
 } else {
  long expiration =
    WebServicesTestUtils.getXmlLong(element, "expiration-time");
  ret.setNextExpirationTime(expiration);
 }
 return ret;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public static DelegationToken getDelegationTokenFromXML(String tokenXML)
  throws IOException, ParserConfigurationException, SAXException {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 InputSource is = new InputSource();
 is.setCharacterStream(new StringReader(tokenXML));
 Document dom = db.parse(is);
 NodeList nodes = dom.getElementsByTagName("delegation-token");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 Element element = (Element) nodes.item(0);
 DelegationToken ret = new DelegationToken();
 String token = WebServicesTestUtils.getXmlString(element, "token");
 if (token != null) {
  ret.setToken(token);
 } else {
  long expiration =
    WebServicesTestUtils.getXmlLong(element, "expiration-time");
  ret.setNextExpirationTime(expiration);
 }
 return ret;
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public void verifyClusterInfoXML(String xml) 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 nodes = dom.getElementsByTagName("clusterInfo");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyClusterGeneric(WebServicesTestUtils.getXmlLong(element, "id"),
    WebServicesTestUtils.getXmlLong(element, "startedOn"),
    WebServicesTestUtils.getXmlString(element, "state"),
    WebServicesTestUtils.getXmlString(element, "haState"),
    WebServicesTestUtils.getXmlString(
      element, "haZooKeeperConnectionState"),
    WebServicesTestUtils.getXmlString(element, "hadoopVersionBuiltOn"),
    WebServicesTestUtils.getXmlString(element, "hadoopBuildVersion"),
    WebServicesTestUtils.getXmlString(element, "hadoopVersion"),
    WebServicesTestUtils.getXmlString(element,
      "resourceManagerVersionBuiltOn"),
    WebServicesTestUtils.getXmlString(element,
      "resourceManagerBuildVersion"),
    WebServicesTestUtils.getXmlString(element, "resourceManagerVersion"));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public void verifyClusterInfoXML(String xml) throws Exception {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 InputSource is = new InputSource();
 is.setCharacterStream(new StringReader(xml));
 Document dom = db.parse(is);
 NodeList nodes = dom.getElementsByTagName("clusterInfo");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyClusterGeneric(WebServicesTestUtils.getXmlLong(element, "id"),
    WebServicesTestUtils.getXmlLong(element, "startedOn"),
    WebServicesTestUtils.getXmlString(element, "state"),
    WebServicesTestUtils.getXmlString(element, "haState"),
    WebServicesTestUtils.getXmlString(
      element, "haZooKeeperConnectionState"),
    WebServicesTestUtils.getXmlString(element, "hadoopVersionBuiltOn"),
    WebServicesTestUtils.getXmlString(element, "hadoopBuildVersion"),
    WebServicesTestUtils.getXmlString(element, "hadoopVersion"),
    WebServicesTestUtils.getXmlString(element,
                     "resourceManagerVersionBuiltOn"),
    WebServicesTestUtils.getXmlString(element,
                     "resourceManagerBuildVersion"),
    WebServicesTestUtils.getXmlString(element, "resourceManagerVersion"));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

protected static void verifyAppTimeoutXML(ClientResponse response,
  ApplicationTimeoutType type, String expireTime, long timeOutFromNow)
  throws ParserConfigurationException, IOException, SAXException {
 assertEquals(MediaType.APPLICATION_XML_TYPE + "; " + JettyUtils.UTF_8,
   response.getType().toString());
 String xml = response.getEntity(String.class);
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 InputSource is = new InputSource();
 is.setCharacterStream(new StringReader(xml));
 Document dom = db.parse(is);
 NodeList nodes = dom.getElementsByTagName("timeout");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 Element element = (Element) nodes.item(0);
 assertEquals(type.toString(),
   WebServicesTestUtils.getXmlString(element, "type"));
 assertEquals(expireTime,
   WebServicesTestUtils.getXmlString(element, "expiryTime"));
 assertTrue(WebServicesTestUtils.getXmlLong(element,
   "remainingTimeInSeconds") < timeOutFromNow);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public void verifyClusterInfoXML(String xml) 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 nodes = dom.getElementsByTagName("clusterInfo");
 assertEquals("incorrect number of elements", 1, nodes.getLength());
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyClusterGeneric(WebServicesTestUtils.getXmlLong(element, "id"),
    WebServicesTestUtils.getXmlLong(element, "startedOn"),
    WebServicesTestUtils.getXmlString(element, "state"),
    WebServicesTestUtils.getXmlString(element, "haState"),
    WebServicesTestUtils.getXmlString(
      element, "haZooKeeperConnectionState"),
    WebServicesTestUtils.getXmlString(element, "hadoopVersionBuiltOn"),
    WebServicesTestUtils.getXmlString(element, "hadoopBuildVersion"),
    WebServicesTestUtils.getXmlString(element, "hadoopVersion"),
    WebServicesTestUtils.getXmlString(element,
      "resourceManagerVersionBuiltOn"),
    WebServicesTestUtils.getXmlString(element,
      "resourceManagerBuildVersion"),
    WebServicesTestUtils.getXmlString(element, "resourceManagerVersion"));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public void verifyJobAttemptsXML(NodeList nodes, Job job) {
 assertEquals("incorrect number of elements", 2, nodes.getLength());
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyJobAttemptsGeneric(job,
    WebServicesTestUtils.getXmlString(element, "nodeHttpAddress"),
    WebServicesTestUtils.getXmlString(element, "nodeId"),
    WebServicesTestUtils.getXmlInt(element, "id"),
    WebServicesTestUtils.getXmlLong(element, "startTime"),
    WebServicesTestUtils.getXmlString(element, "containerId"),
    WebServicesTestUtils.getXmlString(element, "logsLink"));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void verifyAppAttemptsXML(NodeList nodes, RMAppAttempt appAttempt,
    String user) {
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyAppAttemptInfoGeneric(appAttempt,
      WebServicesTestUtils.getXmlInt(element, "id"),
      WebServicesTestUtils.getXmlLong(element, "startTime"),
      WebServicesTestUtils.getXmlString(element, "containerId"),
      WebServicesTestUtils.getXmlString(element, "nodeHttpAddress"),
      WebServicesTestUtils.getXmlString(element, "nodeId"),
      WebServicesTestUtils.getXmlString(element, "logsLink"), user);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public void verifyAppAttemptsXML(NodeList nodes, RMAppAttempt appAttempt,
  String user)
  throws JSONException, Exception {
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyAppAttemptInfoGeneric(appAttempt,
    WebServicesTestUtils.getXmlInt(element, "id"),
    WebServicesTestUtils.getXmlLong(element, "startTime"),
    WebServicesTestUtils.getXmlString(element, "containerId"),
    WebServicesTestUtils.getXmlString(element, "nodeHttpAddress"),
    WebServicesTestUtils.getXmlString(element, "nodeId"),
    WebServicesTestUtils.getXmlString(element, "logsLink"), user);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public void verifyAMTaskCountersXML(NodeList nodes, Task task) {
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  WebServicesTestUtils.checkStringMatch("id",
    MRApps.toString(task.getID()),
    WebServicesTestUtils.getXmlString(element, "id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  NodeList groups = element.getElementsByTagName("taskCounterGroup");
  for (int j = 0; j < groups.getLength(); j++) {
   Element counters = (Element) groups.item(j);
   assertNotNull("should have counters in the web service info", counters);
   String name = WebServicesTestUtils.getXmlString(counters,
     "counterGroupName");
   assertTrue("name not set", (name != null && !name.isEmpty()));
   NodeList counterArr = counters.getElementsByTagName("counter");
   for (int z = 0; z < counterArr.getLength(); z++) {
    Element counter = (Element) counterArr.item(z);
    String counterName = WebServicesTestUtils.getXmlString(counter,
      "name");
    assertTrue("counter name not set",
      (counterName != null && !counterName.isEmpty()));
    long value = WebServicesTestUtils.getXmlLong(counter, "value");
    assertTrue("value not >= 0", value >= 0);
   }
  }
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

(counterName != null && !counterName.isEmpty()));
long mapValue = WebServicesTestUtils.getXmlLong(counter,
  "mapCounterValue");
assertTrue("mapCounterValue not >= 0", mapValue >= 0);
long reduceValue = WebServicesTestUtils.getXmlLong(counter,
  "reduceCounterValue");
assertTrue("reduceCounterValue  >= 0", reduceValue >= 0);
long totalValue = WebServicesTestUtils.getXmlLong(counter,
  "totalCounterValue");
assertTrue("totalCounterValue  >= 0", totalValue >= 0);

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public void verifyAMTaskCountersXML(NodeList nodes, TaskAttempt att) {
 for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
    WebServicesTestUtils.getXmlString(element, "id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  NodeList groups = element.getElementsByTagName("taskAttemptCounterGroup");
  for (int j = 0; j < groups.getLength(); j++) {
   Element counters = (Element) groups.item(j);
   assertNotNull("should have counters in the web service info", counters);
   String name = WebServicesTestUtils.getXmlString(counters,
     "counterGroupName");
   assertTrue("name not set", (name != null && !name.isEmpty()));
   NodeList counterArr = counters.getElementsByTagName("counter");
   for (int z = 0; z < counterArr.getLength(); z++) {
    Element counter = (Element) counterArr.item(z);
    String counterName = WebServicesTestUtils.getXmlString(counter,
      "name");
    assertTrue("counter name not set",
      (counterName != null && !counterName.isEmpty()));
    long value = WebServicesTestUtils.getXmlLong(counter, "value");
    assertTrue("value not >= 0", value >= 0);
   }
  }
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

String unit = getXmlString(customResource, "units");
String resourceType = getXmlString(customResource, "resourceType");
Long value = getXmlLong(customResource, "value");

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public void verifyAppsXML(NodeList nodes, RMApp app) throws JSONException,
  Exception {
  for (int i = 0; i < nodes.getLength(); i++) {
  Element element = (Element) nodes.item(i);
  verifyAppInfoGeneric(app,
    WebServicesTestUtils.getXmlString(element, "id"),
    WebServicesTestUtils.getXmlString(element, "user"),
    WebServicesTestUtils.getXmlString(element, "name"),
    WebServicesTestUtils.getXmlString(element, "applicationType"),
    WebServicesTestUtils.getXmlString(element, "queue"),
    WebServicesTestUtils.getXmlString(element, "state"),
    WebServicesTestUtils.getXmlString(element, "finalStatus"),
    WebServicesTestUtils.getXmlFloat(element, "progress"),
    WebServicesTestUtils.getXmlString(element, "trackingUI"),
    WebServicesTestUtils.getXmlString(element, "diagnostics"),
    WebServicesTestUtils.getXmlLong(element, "clusterId"),
    WebServicesTestUtils.getXmlLong(element, "startedTime"),
    WebServicesTestUtils.getXmlLong(element, "finishedTime"),
    WebServicesTestUtils.getXmlLong(element, "elapsedTime"),
    WebServicesTestUtils.getXmlString(element, "amHostHttpAddress"),
    WebServicesTestUtils.getXmlString(element, "amContainerLogs"),
    WebServicesTestUtils.getXmlInt(element, "allocatedMB"),
    WebServicesTestUtils.getXmlInt(element, "allocatedVCores"),
    WebServicesTestUtils.getXmlInt(element, "runningContainers"),
    WebServicesTestUtils.getXmlInt(element, "preemptedResourceMB"),
    WebServicesTestUtils.getXmlInt(element, "preemptedResourceVCores"),
    WebServicesTestUtils.getXmlInt(element, "numNonAMContainerPreempted"),
    WebServicesTestUtils.getXmlInt(element, "numAMContainerPreempted"));
 }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com