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 TestRegisterNodeManagerRequest() { RegisterNodeManagerRequest request = RegisterNodeManagerRequest.NewInstance(NodeId .NewInstance("host", 1234), 1234, Resource.NewInstance(0, 0), "version", Arrays. AsList(NMContainerStatus.NewInstance(ContainerId.NewContainerId(ApplicationAttemptId .NewInstance(ApplicationId.NewInstance(1234L, 1), 1), 1), ContainerState.Running , Resource.NewInstance(1024, 1), "good", -1, Priority.NewInstance(0), 1234)), Arrays .AsList(ApplicationId.NewInstance(1234L, 1), ApplicationId.NewInstance(1234L, 2) )); // serialze to proto, and get request from proto RegisterNodeManagerRequest request1 = new RegisterNodeManagerRequestPBImpl(((RegisterNodeManagerRequestPBImpl )request).GetProto()); // check values NUnit.Framework.Assert.AreEqual(request1.GetNMContainerStatuses().Count, request. GetNMContainerStatuses().Count); NUnit.Framework.Assert.AreEqual(request1.GetNMContainerStatuses()[0].GetContainerId (), request.GetNMContainerStatuses()[0].GetContainerId()); NUnit.Framework.Assert.AreEqual(request1.GetRunningApplications().Count, request. GetRunningApplications().Count); NUnit.Framework.Assert.AreEqual(request1.GetRunningApplications()[0], request.GetRunningApplications ()[0]); NUnit.Framework.Assert.AreEqual(request1.GetRunningApplications()[1], request.GetRunningApplications ()[1]); }
public virtual void TestRegisterNodeManagerRequestWithNullArrays() { RegisterNodeManagerRequest request = RegisterNodeManagerRequest.NewInstance(NodeId .NewInstance("host", 1234), 1234, Resource.NewInstance(0, 0), "version", null, null ); // serialze to proto, and get request from proto RegisterNodeManagerRequest request1 = new RegisterNodeManagerRequestPBImpl(((RegisterNodeManagerRequestPBImpl )request).GetProto()); // check values NUnit.Framework.Assert.AreEqual(0, request1.GetNMContainerStatuses().Count); NUnit.Framework.Assert.AreEqual(0, request1.GetRunningApplications().Count); }
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()); }
/// <exception cref="Com.Google.Protobuf.ServiceException"/> public virtual YarnServerCommonServiceProtos.RegisterNodeManagerResponseProto RegisterNodeManager (RpcController controller, YarnServerCommonServiceProtos.RegisterNodeManagerRequestProto proto) { RegisterNodeManagerRequestPBImpl request = new RegisterNodeManagerRequestPBImpl(proto ); try { RegisterNodeManagerResponse response = real.RegisterNodeManager(request); return(((RegisterNodeManagerResponsePBImpl)response).GetProto()); } catch (YarnException e) { throw new ServiceException(e); } catch (IOException e) { throw new ServiceException(e); } }