public virtual void VerifyHsTaskCountersXML(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); NUnit.Framework.Assert.IsNotNull("should have counters in the web service info", counters); string name = WebServicesTestUtils.GetXmlString(counters, "counterGroupName"); NUnit.Framework.Assert.IsTrue("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"); NUnit.Framework.Assert.IsTrue("counter name not set", (counterName != null && !counterName .IsEmpty())); long value = WebServicesTestUtils.GetXmlLong(counter, "value"); NUnit.Framework.Assert.IsTrue("value not >= 0", value >= 0); } } } }
/// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/> /// <exception cref="System.Exception"/> public virtual void VerifyClusterInfoXML(string xml) { 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"); NUnit.Framework.Assert.AreEqual("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")); } }
public virtual 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" )); }
/// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/> /// <exception cref="System.Exception"/> public virtual void VerifyNodesXML(NodeList nodes, MockNM nm) { 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")); } }
/// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/> /// <exception cref="System.Exception"/> public virtual void VerifyNodesXML(NodeList nodes) { for (int i = 0; i < nodes.GetLength(); i++) { Element element = (Element)nodes.Item(i); VerifyNodeInfoGeneric(WebServicesTestUtils.GetXmlString(element, "id"), WebServicesTestUtils .GetXmlString(element, "healthReport"), WebServicesTestUtils.GetXmlLong(element, "totalVmemAllocatedContainersMB"), WebServicesTestUtils.GetXmlLong(element, "totalPmemAllocatedContainersMB" ), WebServicesTestUtils.GetXmlLong(element, "totalVCoresAllocatedContainers"), WebServicesTestUtils .GetXmlBoolean(element, "vmemCheckEnabled"), WebServicesTestUtils.GetXmlBoolean( element, "pmemCheckEnabled"), WebServicesTestUtils.GetXmlLong(element, "lastNodeUpdateTime" ), WebServicesTestUtils.GetXmlBoolean(element, "nodeHealthy"), WebServicesTestUtils .GetXmlString(element, "nodeHostName"), WebServicesTestUtils.GetXmlString(element , "hadoopVersionBuiltOn"), WebServicesTestUtils.GetXmlString(element, "hadoopBuildVersion" ), WebServicesTestUtils.GetXmlString(element, "hadoopVersion"), WebServicesTestUtils .GetXmlString(element, "nodeManagerVersionBuiltOn"), WebServicesTestUtils.GetXmlString (element, "nodeManagerBuildVersion"), WebServicesTestUtils.GetXmlString(element, "nodeManagerVersion")); } }
public virtual void VerifyHsTaskAttemptXML(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" )); } }
/// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/> /// <exception cref="System.Exception"/> public virtual void VerifyAMInfoXML(string xml, AppContext ctx) { 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"); NUnit.Framework.Assert.AreEqual("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")); } }