/// /// Copyright (c) 2015-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using Config.Entities; using TBF.Rig.Generic; namespace TBF.Rig.TestMethods.iPerlCommunication { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new TestMethodCfgCtrl(); } /// /// Serialized parameters /// public int CommTimeout; /// Communication timeout in ms (500 .. 5000) public int DelayBetweenRetries; /// Delay between communication retries in ms (0 .. 5000) public int MaxCommRetries; /// Max. number of retries (1 .. 10) public int NrThreads; /// Numbwr of parallel threads (1, 2 or 4) public int IperlCheckErrorsToStop; public int DfltQ2c_15_rl; public int DfltQ2c_15_lr; public int DfltQ2c_20_rl; public int DfltQ2c_20_lr; public int DfltQ2c_25_63_rl; public int DfltQ2c_25_63_lr; public int DfltQ2c_25_10_rl; public int DfltQ2c_25_10_lr; public int DfltQ2c_32_rl; public int DfltQ2c_32_lr; public int DfltQ2c_40_rl; public int DfltQ2c_40_lr; public bool UseWebService; public string BaseUrl; public string RelativeUrl; /// Test parameters [XmlIgnore] public iPerlCommunicationParams TestParams; public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; } public override IParamsProvider CreateTestParamsProvider() { return new iPerlCommunicationParams(true); } public override IParamsProvider GetUITestParamsProvider(Test test) { return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null; } /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { Name = "iPerlCommunication"; ParentName = string.Empty; CommTimeout = 1800; /// ms MaxCommRetries = 4; NrThreads = 2; /// 1, 2 or 4 threads IperlCheckErrorsToStop = 10; TestParams = CreateTestParamsProvider() as iPerlCommunicationParams; } public TestMethodCfg(IComponentFactory factory) : this() { this.Factory = factory; } public string ToString(int i) { return string.Format("Name={0}, CommTimeout={1}, MaxRetries={2}, NrThreads={3}", Name, CommTimeout, MaxCommRetries, NrThreads); } } }