public virtual void TestRegisterNodeManagerRequest() { ApplicationId appId = ApplicationId.NewInstance(123456789, 1); ApplicationAttemptId attemptId = ApplicationAttemptId.NewInstance(appId, 1); ContainerId containerId = ContainerId.NewContainerId(attemptId, 1); NMContainerStatus containerReport = NMContainerStatus.NewInstance(containerId, ContainerState .Running, Resource.NewInstance(1024, 1), "diagnostics", 0, Priority.NewInstance( 10), 1234); IList <NMContainerStatus> reports = Arrays.AsList(containerReport); RegisterNodeManagerRequest request = RegisterNodeManagerRequest.NewInstance(NodeId .NewInstance("1.1.1.1", 1000), 8080, Resource.NewInstance(1024, 1), "NM-version-id" , reports, Arrays.AsList(appId)); RegisterNodeManagerRequest requestProto = new RegisterNodeManagerRequestPBImpl((( RegisterNodeManagerRequestPBImpl)request).GetProto()); NUnit.Framework.Assert.AreEqual(containerReport, requestProto.GetNMContainerStatuses ()[0]); NUnit.Framework.Assert.AreEqual(8080, requestProto.GetHttpPort()); NUnit.Framework.Assert.AreEqual("NM-version-id", requestProto.GetNMVersion()); NUnit.Framework.Assert.AreEqual(NodeId.NewInstance("1.1.1.1", 1000), requestProto .GetNodeId()); NUnit.Framework.Assert.AreEqual(Resource.NewInstance(1024, 1), requestProto.GetResource ()); NUnit.Framework.Assert.AreEqual(1, requestProto.GetRunningApplications().Count); NUnit.Framework.Assert.AreEqual(appId, requestProto.GetRunningApplications()[0]); }
public virtual void TestRegisterNodeManagerRequestPBImpl() { RegisterNodeManagerRequestPBImpl original = new RegisterNodeManagerRequestPBImpl( ); original.SetHttpPort(8080); original.SetNodeId(GetNodeId()); Resource resource = recordFactory.NewRecordInstance <Resource>(); resource.SetMemory(10000); resource.SetVirtualCores(2); original.SetResource(resource); RegisterNodeManagerRequestPBImpl copy = new RegisterNodeManagerRequestPBImpl(original .GetProto()); NUnit.Framework.Assert.AreEqual(8080, copy.GetHttpPort()); NUnit.Framework.Assert.AreEqual(9090, copy.GetNodeId().GetPort()); NUnit.Framework.Assert.AreEqual(10000, copy.GetResource().GetMemory()); NUnit.Framework.Assert.AreEqual(2, copy.GetResource().GetVirtualCores()); }