private void SetServiceMissingParams() { ObservableList <PluginPackage> Plugins = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <PluginPackage>(); foreach (PluginPackage pluginPackage in Plugins) { pluginPackage.PluginPackageOperations = new PluginPackageOperations(pluginPackage); } IEnumerable <PluginServiceInfo> Services = Plugins.SelectMany(x => ((PluginPackageOperations)x.PluginPackageOperations).Services); PluginServiceInfo PSI = Services.Where(x => x.ServiceId == Agent.ServiceId).FirstOrDefault(); PluginPackage PP = Plugins.Where(x => ((PluginPackageOperations)x.PluginPackageOperations).Services.Contains(PSI)).First(); PP.PluginPackageOperations = new PluginPackageOperations(PP); PP.PluginPackageOperations.LoadServicesFromJSON(); PSI = ((PluginPackageOperations)PP.PluginPackageOperations).Services.Where(x => x.ServiceId == Agent.ServiceId).FirstOrDefault(); foreach (var config in PSI.Configs) { if (Agent.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; Agent.DriverConfiguration.Add(DI); } } SetPlatformParameters(PSI); }
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; } UserConfiguredDefaultAttribute defaultVal = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDefaultAttribute), false) as UserConfiguredDefaultAttribute; UserConfiguredDescriptionAttribute desc = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDescriptionAttribute), false) as UserConfiguredDescriptionAttribute; DriverConfigParam DCP = new DriverConfigParam(); DCP.Parameter = mi.Name; if (defaultVal != null) { DCP.Value = defaultVal.DefaultValue; } if (desc != null) { DCP.Description = desc.Description; } DriverConfiguration.Add(DCP); } }
/// <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; Agent.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; Agent.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; Agent.DriverConfiguration.Add(DI); DriverConfigParam DI2 = new DriverConfigParam(); DI2.Parameter = "Save Response"; DI2.Value = bool.TrueString; DI2.Description = "Save Response"; DI2.IsPlatformParameter = true; Agent.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; Agent.DriverConfiguration.Add(DI3); } }
public override void PostDeserialization() { if (DriverType == eDriverType.WindowsAutomation) { //Upgrading Action timeout for windows driver from default 10 secs to 30 secs DriverConfigParam actionTimeoutParameter = DriverConfiguration.Where(x => x.Parameter == nameof(DriverBase.ActionTimeout)).FirstOrDefault(); if (actionTimeoutParameter != null && actionTimeoutParameter.Value == "10" && actionTimeoutParameter.Description.Contains("10")) { actionTimeoutParameter.Value = "30"; actionTimeoutParameter.Description = actionTimeoutParameter.Description.Replace("10", "30"); } } }
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); Agent.DriverConfiguration.Add(configParam); } }
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 DriverConfigParam GetDriverConfigParam(MemberInfo mi) { UserConfiguredDefaultAttribute defaultVal = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDefaultAttribute), false) as UserConfiguredDefaultAttribute; UserConfiguredDescriptionAttribute desc = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDescriptionAttribute), false) as UserConfiguredDescriptionAttribute; DriverConfigParam DCP = new DriverConfigParam(); DCP.Parameter = mi.Name; if (defaultVal != null) { DCP.Value = defaultVal.DefaultValue; } if (desc != null) { DCP.Description = desc.Description; } return(DCP); }
/// <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 (Agent.DriverConfiguration.Where(x => x.Parameter == configParam.Parameter).FirstOrDefault() == null) { Agent.DriverConfiguration.Add(configParam); } } }