private void SetServiceMissingParams() { ObservableList <PluginPackage> Plugins = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <PluginPackage>(); IEnumerable <PluginServiceInfo> Services = Plugins.SelectMany(x => x.Services); PluginServiceInfo PSI = Services.Where(x => x.ServiceId == ServiceId).FirstOrDefault(); PluginPackage PP = Plugins.Where(x => x.Services.Contains(PSI)).First(); PP.LoadServicesFromJSON(); PSI = PP.Services.Where(x => x.ServiceId == ServiceId).FirstOrDefault(); foreach (var config in PSI.Configs) { if (DriverConfiguration.Where(x => x.Parameter == config.Name).Count() == 0) { DriverConfigParam DI = new DriverConfigParam(); DI.Parameter = config.Name; DI.Value = config.DefaultValue; DI.Description = config.Description; DI.OptionalValues = config.OptionalValues; DI.Type = config.Type; DriverConfiguration.Add(DI); } } SetPlatformParameters(PSI); }
/// <summary> /// Set AGent Configuration with default values in addition to the configurations asked by Service /// </summary> /// <param name="PSI"></param> private void SetPlatformParameters(PluginServiceInfo PSI) { if (PSI.Interfaces.Where(x => x == "IWebPlatform").Count() > 0) { DriverConfigParam DI = new DriverConfigParam(); DI.Parameter = "Max Agent Load Time"; DI.Value = "30"; DI.Description = "Max Time allowed in seconds to start the agent0"; DI.IsPlatformParameter = true; DriverConfiguration.Add(DI); DriverConfigParam DI2 = new DriverConfigParam(); DI2.Parameter = "Auto Switch Frame"; DI2.Value = bool.TrueString; DI2.Description = "Automatic Switch Frame for POM Element"; DI2.IsPlatformParameter = true; DriverConfiguration.Add(DI2); } else if (PSI.Interfaces.Where(x => x == "IWebServicePlatform").Count() > 0) { DriverConfigParam DI = new DriverConfigParam(); DI.Parameter = "Save Request"; DI.Value = bool.FalseString; DI.Description = "Save Request"; DI.IsPlatformParameter = true; DriverConfiguration.Add(DI); DriverConfigParam DI2 = new DriverConfigParam(); DI2.Parameter = "Save Response"; DI2.Value = bool.TrueString; DI2.Description = "Save Response"; DI2.IsPlatformParameter = true; DriverConfiguration.Add(DI2); DriverConfigParam DI3 = new DriverConfigParam(); DI3.Parameter = "Path To Save"; DI3.Value = @"~\Documents"; DI3.Description = "Path to Save Request/Response Files"; DI3.IsPlatformParameter = true; DriverConfiguration.Add(DI3); } }
public DriverConfigParam GetOrCreateParam(string Parameter, string DefaultValue = null) { foreach (DriverConfigParam DCP1 in DriverConfiguration) { if (DCP1.Parameter == Parameter) { return(DCP1); } } DriverConfigParam DCP = new DriverConfigParam() { Parameter = Parameter, Value = DefaultValue }; DriverConfiguration.Add(DCP); return(DCP); }
public DriverConfigParam GetOrCreateParam(string parameter, string defaultValue = null) { DriverConfigParam configParam = DriverConfiguration.Where(x => x.Parameter == parameter).FirstOrDefault(); if (configParam != null) { return(configParam); } else { configParam = new DriverConfigParam() { Parameter = parameter, Value = defaultValue }; DriverConfiguration.Add(configParam); return(configParam); } }
private void SetDriverDefualtParams(Type t) { MemberInfo[] members = t.GetMembers(); UserConfiguredAttribute token = null; foreach (MemberInfo mi in members) { token = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredAttribute), false) as UserConfiguredAttribute; if (token == null) { continue; } DriverConfigParam configParam = GetDriverConfigParam(mi); DriverConfiguration.Add(configParam); } }
/// <summary> /// This function will add missing Driver config parameters to Driver configuration /// </summary> /// <param name="driverType"> Type of the driver</param> private void SetDriverMissingParams(Type driverType) { MemberInfo[] members = driverType.GetMembers(); UserConfiguredAttribute token = null; foreach (MemberInfo mi in members) { token = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredAttribute), false) as UserConfiguredAttribute; if (token == null) { continue; } DriverConfigParam configParam = GetDriverConfigParam(mi); if (DriverConfiguration.Where(x => x.Parameter == configParam.Parameter).FirstOrDefault() == null) { DriverConfiguration.Add(configParam); } } }