public virtual void TestGetApplicationsRequest() { GetApplicationsRequest request = GetApplicationsRequest.NewInstance(); EnumSet <YarnApplicationState> appStates = EnumSet.Of(YarnApplicationState.Accepted ); request.SetApplicationStates(appStates); ICollection <string> tags = new HashSet <string>(); tags.AddItem("tag1"); request.SetApplicationTags(tags); ICollection <string> types = new HashSet <string>(); types.AddItem("type1"); request.SetApplicationTypes(types); long startBegin = Runtime.CurrentTimeMillis(); long startEnd = Runtime.CurrentTimeMillis() + 1; request.SetStartRange(startBegin, startEnd); long finishBegin = Runtime.CurrentTimeMillis() + 2; long finishEnd = Runtime.CurrentTimeMillis() + 3; request.SetFinishRange(finishBegin, finishEnd); long limit = 100L; request.SetLimit(limit); ICollection <string> queues = new HashSet <string>(); queues.AddItem("queue1"); request.SetQueues(queues); ICollection <string> users = new HashSet <string>(); users.AddItem("user1"); request.SetUsers(users); ApplicationsRequestScope scope = ApplicationsRequestScope.All; request.SetScope(scope); GetApplicationsRequest requestFromProto = new GetApplicationsRequestPBImpl(((GetApplicationsRequestPBImpl )request).GetProto()); // verify the whole record equals with original record NUnit.Framework.Assert.AreEqual(requestFromProto, request); // verify all properties are the same as original request NUnit.Framework.Assert.AreEqual("ApplicationStates from proto is not the same with original request" , requestFromProto.GetApplicationStates(), appStates); NUnit.Framework.Assert.AreEqual("ApplicationTags from proto is not the same with original request" , requestFromProto.GetApplicationTags(), tags); NUnit.Framework.Assert.AreEqual("ApplicationTypes from proto is not the same with original request" , requestFromProto.GetApplicationTypes(), types); NUnit.Framework.Assert.AreEqual("StartRange from proto is not the same with original request" , requestFromProto.GetStartRange(), new LongRange(startBegin, startEnd)); NUnit.Framework.Assert.AreEqual("FinishRange from proto is not the same with original request" , requestFromProto.GetFinishRange(), new LongRange(finishBegin, finishEnd)); NUnit.Framework.Assert.AreEqual("Limit from proto is not the same with original request" , requestFromProto.GetLimit(), limit); NUnit.Framework.Assert.AreEqual("Queues from proto is not the same with original request" , requestFromProto.GetQueues(), queues); NUnit.Framework.Assert.AreEqual("Users from proto is not the same with original request" , requestFromProto.GetUsers(), users); }
public static GetApplicationsRequest NewInstance(ApplicationsRequestScope scope, ICollection <string> users, ICollection <string> queues, ICollection <string> applicationTypes , ICollection <string> applicationTags, EnumSet <YarnApplicationState> applicationStates , LongRange startRange, LongRange finishRange, long limit) { GetApplicationsRequest request = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <GetApplicationsRequest >(); if (scope != null) { request.SetScope(scope); } request.SetUsers(users); request.SetQueues(queues); request.SetApplicationTypes(applicationTypes); request.SetApplicationTags(applicationTags); request.SetApplicationStates(applicationStates); if (startRange != null) { request.SetStartRange(startRange.GetMinimumLong(), startRange.GetMaximumLong()); } if (finishRange != null) { request.SetFinishRange(finishRange.GetMinimumLong(), finishRange.GetMaximumLong() ); } if (limit != null) { request.SetLimit(limit); } return(request); }
public static GetApplicationsRequest NewInstance(ApplicationsRequestScope scope) { GetApplicationsRequest request = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <GetApplicationsRequest >(); request.SetScope(scope); return(request); }
public override void SetScope(ApplicationsRequestScope scope) { MaybeInitBuilder(); if (scope == null) { builder.ClearScope(); } this.scope = scope; }
private void InitScope() { if (this.scope != null) { return; } YarnServiceProtos.GetApplicationsRequestProtoOrBuilder p = viaProto ? proto : builder; this.scope = ProtoUtils.ConvertFromProtoFormat(p.GetScope()); }
public abstract void SetScope(ApplicationsRequestScope scope);
/* * ApplicationsRequestScope */ public static YarnServiceProtos.ApplicationsRequestScopeProto ConvertToProtoFormat (ApplicationsRequestScope e) { return(YarnServiceProtos.ApplicationsRequestScopeProto.ValueOf(e.ToString())); }
public static ApplicationsRequestScope ConvertFromProtoFormat(YarnServiceProtos.ApplicationsRequestScopeProto e) { return(ApplicationsRequestScope.ValueOf(e.ToString())); }