From a3d769222a2f771260c00e51588360c461201176 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 14 Sep 2022 10:15:16 -0700 Subject: [PATCH] DEP08SIASM - v2.43.4 - Change to MonA --- .gitignore | 2 + Adaptation/.vscode/settings.json | 3 +- Adaptation/DEP08SIASM.Tests.csproj | 2 +- .../CellInstanceConnectionName.cs | 1 + .../MonitorApplication/FileRead.cs | 146 ++++++++ Adaptation/FileHandlers/jpeg/FileRead.cs | 4 +- .../Infineon/Monitoring/MonA/ExtWebClient.cs | 20 + Adaptation/Infineon/Monitoring/MonA/IMonIn.cs | 167 +++++++++ Adaptation/Infineon/Monitoring/MonA/MonIn.cs | 292 +++++++++++++++ Adaptation/Infineon/Monitoring/MonA/State.cs | 11 + Adaptation/Shared/FileRead.cs | 1 + Adaptation/Shared/Properties/IFileRead.cs | 1 + .../Staging/v2.39.2/DEP08SIASM.cs | 32 +- .../Staging/v2.39.2/R34-EQPT.cs | 8 +- .../Staging/v2.39.2/R34.cs | 8 +- .../Staging/v2.39.2/R36-EQPT.cs | 8 +- .../Staging/v2.39.2/R36.cs | 8 +- .../Staging/v2.43.0/DEP08SIASM.cs | 35 +- .../Staging/v2.43.0/R34-EQPT.cs | 8 +- .../Staging/v2.43.0/R34.cs | 8 +- .../Staging/v2.43.0/R36-EQPT.cs | 8 +- .../Staging/v2.43.0/R36.cs | 8 +- .../Extract/Staging/v2.39.2/DEP08SIASM.cs | 27 ++ .../Extract/Staging/v2.39.2/R34-EQPT.cs | 6 + .../_Tests/Extract/Staging/v2.39.2/R34.cs | 6 + .../Extract/Staging/v2.39.2/R36-EQPT.cs | 3 + .../_Tests/Extract/Staging/v2.39.2/R36.cs | 3 + .../Extract/Staging/v2.43.0/DEP08SIASM.cs | 30 ++ .../Extract/Staging/v2.43.0/R34-EQPT.cs | 6 + .../_Tests/Extract/Staging/v2.43.0/R34.cs | 6 + .../Extract/Staging/v2.43.0/R36-EQPT.cs | 3 + .../_Tests/Extract/Staging/v2.43.0/R36.cs | 3 + Adaptation/_Tests/Shared/AdaptationTesting.cs | 351 +++++++++--------- .../_Tests/Shared/EAFLoggingUnitTesting.cs | 4 +- Adaptation/_Tests/Shared/MethodBaseName.cs | 45 +++ Adaptation/_Tests/Shared/UnitTesting.cs | 19 +- Adaptation/package.json | 26 +- DEP08SIASM.csproj | 7 + Properties/AssemblyInfo.cs | 4 +- 39 files changed, 1116 insertions(+), 214 deletions(-) create mode 100644 Adaptation/FileHandlers/MonitorApplication/FileRead.cs create mode 100644 Adaptation/Infineon/Monitoring/MonA/ExtWebClient.cs create mode 100644 Adaptation/Infineon/Monitoring/MonA/IMonIn.cs create mode 100644 Adaptation/Infineon/Monitoring/MonA/MonIn.cs create mode 100644 Adaptation/Infineon/Monitoring/MonA/State.cs create mode 100644 Adaptation/_Tests/Shared/MethodBaseName.cs diff --git a/.gitignore b/.gitignore index 6ba6148..eab1f67 100644 --- a/.gitignore +++ b/.gitignore @@ -336,3 +336,5 @@ ASALocalRun/ !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json + +*.lnk diff --git a/Adaptation/.vscode/settings.json b/Adaptation/.vscode/settings.json index 94fe746..4d1a803 100644 --- a/Adaptation/.vscode/settings.json +++ b/Adaptation/.vscode/settings.json @@ -69,7 +69,8 @@ "titleBar.activeBackground": "#5684ce", "titleBar.activeForeground": "#e7e7e7", "titleBar.inactiveBackground": "#5684ce99", - "titleBar.inactiveForeground": "#e7e7e799" + "titleBar.inactiveForeground": "#e7e7e799", + "commandCenter.border": "#e7e7e799" }, "peacock.color": "#5684ce", "cSpell.enabled": false diff --git a/Adaptation/DEP08SIASM.Tests.csproj b/Adaptation/DEP08SIASM.Tests.csproj index 83f39da..73eacbf 100644 --- a/Adaptation/DEP08SIASM.Tests.csproj +++ b/Adaptation/DEP08SIASM.Tests.csproj @@ -15,6 +15,7 @@ trx + XPlat Code Coverage ../../../../DEP08SIASM/05_TestResults/TestResults @@ -62,7 +63,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/Adaptation/FileHandlers/CellInstanceConnectionName.cs b/Adaptation/FileHandlers/CellInstanceConnectionName.cs index 8b09867..f4dbcb5 100644 --- a/Adaptation/FileHandlers/CellInstanceConnectionName.cs +++ b/Adaptation/FileHandlers/CellInstanceConnectionName.cs @@ -15,6 +15,7 @@ public class CellInstanceConnectionName { nameof(DownloadJpegFile) => new DownloadJpegFile.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted), nameof(jpeg) => new jpeg.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted), + nameof(MonitorApplication) => new MonitorApplication.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted), nameof(OpenInsight) => new OpenInsight.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted), _ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped") }; diff --git a/Adaptation/FileHandlers/MonitorApplication/FileRead.cs b/Adaptation/FileHandlers/MonitorApplication/FileRead.cs new file mode 100644 index 0000000..a49c040 --- /dev/null +++ b/Adaptation/FileHandlers/MonitorApplication/FileRead.cs @@ -0,0 +1,146 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using Infineon.Monitoring.MonA; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.MonitorApplication; + +public class FileRead : Shared.FileRead, IFileRead +{ + + private readonly string _MonitorApplicationSite; + private readonly string _MonitorApplicationResourcePrefix; + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, Dictionary> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + _MonitorApplicationSite = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "MonitorApplication.Site"); + _MonitorApplicationResourcePrefix = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "MonitorApplication.ResourcePrefix"); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception) + { + string[] results = Move(extractResults, to, from, resolvedFileLocation, exception); + return results; + } + + JsonProperty[] IFileRead.GetDefault() + { + JsonProperty[] results = _Description.GetDefault(this, _Logistics); + return results; + } + + Dictionary IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> results; + if (string.IsNullOrEmpty(eventName)) + throw new Exception(); + _ReportFullPath = reportFullPath; + DateTime dateTime = DateTime.Now; + results = GetExtractResult(reportFullPath, dateTime); + if (results.Item3 is null) + results = new Tuple>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + private void SendData(DateTime dateTime, List descriptions) + { + if (dateTime == DateTime.MinValue) + { } + MonIn monIn = MonIn.GetInstance(); + string monitorApplicationResource = string.Concat(_MonitorApplicationResourcePrefix, _Logistics.MesEntity); + if (Enum.TryParse(descriptions[0].Lot, out State state)) + _ = monIn.SendStatus(_MonitorApplicationSite, monitorApplicationResource, "Heartbeat", state); + else + _ = monIn.SendStatus(_MonitorApplicationSite, monitorApplicationResource, "Heartbeat", State.Unknown); + if (string.IsNullOrEmpty(_MonitorApplicationResourcePrefix)) // Never! + { + int valueCount = 1; + string performanceName = string.Concat(monitorApplicationResource, "_Count"); + string description = string.Concat(valueCount, " file(s) are pending and older than x"); + _ = monIn.SendPerformanceMessage(_MonitorApplicationSite, monitorApplicationResource, performanceName, value: valueCount, description: description); + } + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + Tuple> results; + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); + List descriptions = jpeg.ProcessData.GetDescriptions(jsonElements); + Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); + if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) + SendData(dateTime, descriptions); + results = new Tuple>(pdsf.Item1, tests, jsonElements, new List()); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/jpeg/FileRead.cs b/Adaptation/FileHandlers/jpeg/FileRead.cs index 2fc6745..fa9a5eb 100644 --- a/Adaptation/FileHandlers/jpeg/FileRead.cs +++ b/Adaptation/FileHandlers/jpeg/FileRead.cs @@ -163,7 +163,9 @@ public class FileRead : Shared.FileRead, IFileRead IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _StartX, _StartY, _EndX, _EndY, _Size, _ColorCollections); if (iProcessData is not ProcessData processData) throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks)); - string mid = Regex.Replace(processData.Text, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; + string lastText = Regex.Replace(_LastText, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; + string text = Regex.Replace(processData.Text, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; + string mid = string.Concat(lastText, '-', text); SetFileParameterLotID(mid); string processJobID = iProcessData.GetCurrentReactor(this, _Logistics, _Reactors); _Logistics.Update(mid, processJobID); diff --git a/Adaptation/Infineon/Monitoring/MonA/ExtWebClient.cs b/Adaptation/Infineon/Monitoring/MonA/ExtWebClient.cs new file mode 100644 index 0000000..7e1ffe0 --- /dev/null +++ b/Adaptation/Infineon/Monitoring/MonA/ExtWebClient.cs @@ -0,0 +1,20 @@ +using System; +using System.Net; + +namespace Infineon.Monitoring.MonA; + +#nullable disable +#pragma warning disable SYSLIB0014 + +public class ExtWebClient : WebClient +{ + protected override WebRequest GetWebRequest(Uri address) + { + WebRequest webRequest = base.GetWebRequest(address); + if (webRequest != null) + webRequest.PreAuthenticate = PreAuthenticate; + return webRequest; + } + + public bool PreAuthenticate { get; set; } +} \ No newline at end of file diff --git a/Adaptation/Infineon/Monitoring/MonA/IMonIn.cs b/Adaptation/Infineon/Monitoring/MonA/IMonIn.cs new file mode 100644 index 0000000..6552d47 --- /dev/null +++ b/Adaptation/Infineon/Monitoring/MonA/IMonIn.cs @@ -0,0 +1,167 @@ +using System; + +namespace Infineon.Monitoring.MonA; + +public interface IMonIn +{ + string SendStatus(string site, string resource, string stateName, State state); + + string SendStatus( + string site, + DateTime timeStamp, + string resource, + string stateName, + State state); + + string SendStatus( + string site, + string resource, + string stateName, + State state, + string description); + + string SendStatus( + string site, + DateTime timeStamp, + string resource, + string stateName, + State state, + string description); + + string SendStatus( + string site, + string resource, + string subresource, + string stateName, + State state); + + string SendStatus( + string site, + DateTime timeStamp, + string resource, + string subresource, + string stateName, + State state); + + string SendStatus( + string site, + string resource, + string subresource, + string stateName, + State state, + string description); + + string SendStatus( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string stateName, + State state, + string description); + + string SendPerformanceMessage( + string site, + string resource, + string performanceName, + double value); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value); + + string SendPerformanceMessage( + string site, + string resource, + string performanceName, + double value, + string description); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value, + string description); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value, + int? interval); + + string SendPerformanceMessage( + string site, + string resource, + DateTime? timeStamp, + string performanceName, + double value, + string unit); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value, + string unit, + int? interval); + + string SendPerformanceMessage( + string site, + string resource, + string subresource, + string performanceName, + double value); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value); + + string SendPerformanceMessage( + string site, + string resource, + string subresource, + string performanceName, + double value, + string description); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + int? interval); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + string unit); + + string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + string description, + string unit, + int? interval); +} \ No newline at end of file diff --git a/Adaptation/Infineon/Monitoring/MonA/MonIn.cs b/Adaptation/Infineon/Monitoring/MonA/MonIn.cs new file mode 100644 index 0000000..e9ffce8 --- /dev/null +++ b/Adaptation/Infineon/Monitoring/MonA/MonIn.cs @@ -0,0 +1,292 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Net; +using System.Text; + +namespace Infineon.Monitoring.MonA; + +public class MonIn : IMonIn, IDisposable +{ + private static readonly DateTime _Utc1970DateTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + public const string MonInUrl = "http://moninhttp.{0}.infineon.com/input/text"; + private static readonly Dictionary _Instances = new(); + private readonly ExtWebClient _WebClient; + private readonly string _MonInUrl; + private static CultureInfo _CultureInfo; + + public static MonIn GetInstance(string url = "http://moninhttp.{0}.infineon.com/input/text") + { + MonIn instance; + if (_Instances.ContainsKey(url)) + { + instance = _Instances[url]; + } + else + { + lock (_Instances) + { + if (!_Instances.ContainsKey(url)) + { + instance = new MonIn(url); + _Instances.Add(url, instance); + } + else + instance = _Instances[url]; + } + } + return instance; + } + + private MonIn(string url) + { + _WebClient = new ExtWebClient(); + _WebClient.Headers[HttpRequestHeader.ContentType] = "application/text"; + _WebClient.Encoding = Encoding.UTF8; + _CultureInfo = new CultureInfo("en-US"); + _MonInUrl = url; + } + + public void SetBasicAuthentication(string username, string password) + { + _WebClient.PreAuthenticate = true; + _WebClient.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password)); + } + + public string SendStatus(string site, string resource, string stateName, State state) => SendStatus(site, new DateTime?(), resource, string.Empty, stateName, state, string.Empty); + + public string SendStatus( + string site, + DateTime timeStamp, + string resource, + string stateName, + State state) => SendStatus(site, new DateTime?(timeStamp), resource, string.Empty, stateName, state, string.Empty); + + public string SendStatus( + string site, + string resource, + string stateName, + State state, + string description) => SendStatus(site, new DateTime?(), resource, string.Empty, stateName, state, description); + + public string SendStatus( + string site, + DateTime timeStamp, + string resource, + string stateName, + State state, + string description) => SendStatus(site, new DateTime?(timeStamp), resource, string.Empty, stateName, state, description); + + public string SendStatus( + string site, + string resource, + string subresource, + string stateName, + State state) => SendStatus(site, new DateTime?(), resource, subresource, stateName, state, string.Empty); + + public string SendStatus( + string site, + DateTime timeStamp, + string resource, + string subresource, + string stateName, + State state) => SendStatus(site, new DateTime?(timeStamp), resource, subresource, stateName, state, string.Empty); + + public string SendStatus( + string site, + string resource, + string subresource, + string stateName, + State state, + string description) => SendStatus(site, new DateTime?(), resource, subresource, stateName, state, description); + + public string SendStatus( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string stateName, + State state, + string description) + { + string statusMessage = CreateStatusMessage(site, timeStamp, resource, subresource, stateName, state.ToString(), description); + lock (_WebClient) + return _WebClient.UploadString(string.Format(_MonInUrl, site), statusMessage); + } + + public string SendPerformanceMessage( + string site, + string resource, + string performanceName, + double value) => SendPerformanceMessage(site, new DateTime?(), resource, string.Empty, performanceName, value, string.Empty, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + string resource, + string performanceName, + double value, + string description) => SendPerformanceMessage(site, new DateTime?(), resource, string.Empty, performanceName, value, description, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value, + string description) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, description, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value, + int? interval) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, string.Empty, interval); + + public string SendPerformanceMessage( + string site, + string resource, + DateTime? timeStamp, + string performanceName, + double value, + string unit) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, unit, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string performanceName, + double value, + string unit, + int? interval) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, unit, interval); + + public string SendPerformanceMessage( + string site, + string resource, + string subresource, + string performanceName, + double value) => SendPerformanceMessage(site, new DateTime?(), resource, subresource, performanceName, value, string.Empty, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value) => SendPerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, string.Empty, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + string resource, + string subresource, + string performanceName, + double value, + string description) => SendPerformanceMessage(site, new DateTime?(), resource, subresource, performanceName, value, description, string.Empty, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + int? interval) => SendPerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, string.Empty, string.Empty, interval); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + string unit) => SendPerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, string.Empty, unit, new int?()); + + public string SendPerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + string description, + string unit, + int? interval) + { + string performanceMessage = CreatePerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, description, unit, interval); + lock (_WebClient) + return _WebClient.UploadString(string.Format(_MonInUrl, site), performanceMessage); + } + + private static string CreateStatusMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string stateName, + string state, + string description) + { + StringBuilder stringBuilder = new(); + if (string.IsNullOrEmpty(subresource)) + _ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), stateName.Trim(), state.Trim(), description.Trim()); + else + _ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), stateName.Trim(), state.Trim(), description.Trim()); + return stringBuilder.ToString(); + } + + private static string CreatePerformanceMessage( + string site, + DateTime? timeStamp, + string resource, + string subresource, + string performanceName, + double value, + string description, + string unit, + int? interval) + { + StringBuilder stringBuilder = new(); + if (string.IsNullOrEmpty(subresource)) + { + if (unit.Equals(string.Empty) && !interval.HasValue) + _ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), performanceName.Trim(), value, description.Trim()); + else + _ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} {5} {{interval={6}, unit={7}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : (object)string.Empty, unit.Trim()); + } + else if (unit.Equals(string.Empty) && !interval.HasValue) + _ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim()); + else + _ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} {6} {{interval={7}, unit={8}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : (object)string.Empty, unit.Trim()); + return stringBuilder.ToString(); + } + + private static string GetDateTimeNowAsPosix(DateTime timeStamp) + { + if (timeStamp > DateTime.Now) + timeStamp = DateTime.Now; + return ((int)timeStamp.ToUniversalTime().Subtract(_Utc1970DateTime).TotalSeconds).ToString(CultureInfo.InvariantCulture); + } + + public void Dispose() + { + KeyValuePair keyValuePair = new(); + foreach (KeyValuePair instance in _Instances) + { + if (instance.Value == this) + { + keyValuePair = instance; + break; + } + } + _ = _Instances.Remove(keyValuePair.Key); + _WebClient?.Dispose(); + } + +} \ No newline at end of file diff --git a/Adaptation/Infineon/Monitoring/MonA/State.cs b/Adaptation/Infineon/Monitoring/MonA/State.cs new file mode 100644 index 0000000..d6bface --- /dev/null +++ b/Adaptation/Infineon/Monitoring/MonA/State.cs @@ -0,0 +1,11 @@ +namespace Infineon.Monitoring.MonA; + +public enum State +{ + Up, + Ok, + Warning, + Critical, + Down, + Unknown, +} \ No newline at end of file diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs index d01861a..9e02131 100644 --- a/Adaptation/Shared/FileRead.cs +++ b/Adaptation/Shared/FileRead.cs @@ -54,6 +54,7 @@ public class FileRead : Properties.IFileRead string Properties.IFileRead.EventName => _EventName; string Properties.IFileRead.MesEntity => _MesEntity; bool Properties.IFileRead.IsEAFHosted => _IsEAFHosted; + bool Properties.IFileRead.IsDuplicator => _IsDuplicator; string Properties.IFileRead.EquipmentType => _EquipmentType; string Properties.IFileRead.ReportFullPath => _ReportFullPath; string Properties.IFileRead.CellInstanceName => _CellInstanceName; diff --git a/Adaptation/Shared/Properties/IFileRead.cs b/Adaptation/Shared/Properties/IFileRead.cs index 2e85ac9..5cf9a69 100644 --- a/Adaptation/Shared/Properties/IFileRead.cs +++ b/Adaptation/Shared/Properties/IFileRead.cs @@ -7,6 +7,7 @@ public interface IFileRead string MesEntity { get; } bool IsEAFHosted { get; } string EventName { get; } + bool IsDuplicator { get; } string EquipmentType { get; } string ReportFullPath { get; } string CellInstanceName { get; } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/DEP08SIASM.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/DEP08SIASM.cs index b3453de..4ea91b1 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/DEP08SIASM.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/DEP08SIASM.cs @@ -15,15 +15,16 @@ public class DEP08SIASM : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static DEP08SIASM EAFLoggingUnitTesting { get; private set; } - public DEP08SIASM() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public DEP08SIASM() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public DEP08SIASM(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public DEP08SIASM(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM() { @@ -57,6 +61,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM_() { @@ -67,6 +74,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM__() { @@ -77,6 +87,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM___() { @@ -87,6 +100,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM____() { @@ -97,6 +113,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM_____() { @@ -107,6 +126,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM______() { @@ -117,6 +139,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM_______() { @@ -127,6 +152,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM________() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34-EQPT.cs index 29caaab..978ccc9 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34-EQPT.cs @@ -15,15 +15,16 @@ public class R34_EQPT : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R34_EQPT EAFLoggingUnitTesting { get; private set; } - public R34_EQPT() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R34_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R34_EQPT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R34_EQPT(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R34_EQPT : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R34_EQPT__DownloadJpegFile() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34.cs index f2e79ff..42c1e14 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R34.cs @@ -15,15 +15,16 @@ public class R34 : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R34 EAFLoggingUnitTesting { get; private set; } - public R34() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R34() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R34(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R34(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R34 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R34__jpeg() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36-EQPT.cs index b58d526..ccbd113 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36-EQPT.cs @@ -15,15 +15,16 @@ public class R36_EQPT : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R36_EQPT EAFLoggingUnitTesting { get; private set; } - public R36_EQPT() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R36_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R36_EQPT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R36_EQPT(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R36_EQPT : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R36_EQPT__DownloadJpegFile() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36.cs index a93a11c..ad3d4fd 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.2/R36.cs @@ -15,15 +15,16 @@ public class R36 : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R36 EAFLoggingUnitTesting { get; private set; } - public R36() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R36() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R36(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R36(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R36 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R36__jpeg() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/DEP08SIASM.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/DEP08SIASM.cs index 4e666e8..573d3b9 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/DEP08SIASM.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/DEP08SIASM.cs @@ -15,15 +15,16 @@ public class DEP08SIASM : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static DEP08SIASM EAFLoggingUnitTesting { get; private set; } - public DEP08SIASM() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public DEP08SIASM() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public DEP08SIASM(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public DEP08SIASM(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__MoveMatchingFiles() { @@ -57,6 +61,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__OpenInsightMetrologyViewer() { @@ -67,6 +74,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__IQSSi() { @@ -77,6 +87,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__OpenInsight() { @@ -87,6 +100,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__OpenInsightMetrologyViewerAttachments() { @@ -97,6 +113,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__APC() { @@ -107,6 +126,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__SPaCe() { @@ -117,6 +139,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__Processed() { @@ -127,6 +152,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__Archive() { @@ -137,6 +165,9 @@ public class DEP08SIASM : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__Dummy() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34-EQPT.cs index 58815a5..e35c95b 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34-EQPT.cs @@ -15,15 +15,16 @@ public class R34_EQPT : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R34_EQPT EAFLoggingUnitTesting { get; private set; } - public R34_EQPT() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R34_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R34_EQPT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R34_EQPT(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R34_EQPT : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R34_EQPT__DownloadJpegFile() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34.cs index cd80e19..93f87c1 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R34.cs @@ -15,15 +15,16 @@ public class R34 : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R34 EAFLoggingUnitTesting { get; private set; } - public R34() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R34() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R34(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R34(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R34 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R34__jpeg() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36-EQPT.cs index 6614eac..64389b1 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36-EQPT.cs @@ -15,15 +15,16 @@ public class R36_EQPT : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R36_EQPT EAFLoggingUnitTesting { get; private set; } - public R36_EQPT() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R36_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R36_EQPT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R36_EQPT(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R36_EQPT : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R36_EQPT__DownloadJpegFile() { diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36.cs index 1d5c152..fe15b10 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/R36.cs @@ -15,15 +15,16 @@ public class R36 : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static R36 EAFLoggingUnitTesting { get; private set; } - public R36() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public R36() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public R36(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public R36(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } @@ -47,6 +48,9 @@ public class R36 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Dispose(); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R36__jpeg() { diff --git a/Adaptation/_Tests/Extract/Staging/v2.39.2/DEP08SIASM.cs b/Adaptation/_Tests/Extract/Staging/v2.39.2/DEP08SIASM.cs index e1e6071..fb1ef82 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.39.2/DEP08SIASM.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.39.2/DEP08SIASM.cs @@ -22,15 +22,27 @@ public class DEP08SIASM _DEP08SIASM = CreateSelfDescription.Staging.v2_39_2.DEP08SIASM.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM_() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM_(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM__() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM__(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM__637825304581476827__Normal() { @@ -43,18 +55,33 @@ public class DEP08SIASM _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics); } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM___() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM___(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM____() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM____(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM_____() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM_____(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM______() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM______(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__DEP08SIASM__DEP08SIASM_______() => _DEP08SIASM.Staging__v2_39_2__DEP08SIASM__DEP08SIASM_______(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.39.2/R34-EQPT.cs b/Adaptation/_Tests/Extract/Staging/v2.39.2/R34-EQPT.cs index 071618d..a3d1e77 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.39.2/R34-EQPT.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.39.2/R34-EQPT.cs @@ -18,9 +18,15 @@ public class R34_EQPT _R34_EQPT = CreateSelfDescription.Staging.v2_39_2.R34_EQPT.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R34_EQPT__DownloadJpegFile() => _R34_EQPT.Staging__v2_39_2__R34_EQPT__DownloadJpegFile(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R34_EQPT__DownloadJpegFile637812143477007703__Normal() => _R34_EQPT.Staging__v2_39_2__R34_EQPT__DownloadJpegFile(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.39.2/R34.cs b/Adaptation/_Tests/Extract/Staging/v2.39.2/R34.cs index 72534e5..b9bdee5 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.39.2/R34.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.39.2/R34.cs @@ -22,9 +22,15 @@ public class R34 _R34 = CreateSelfDescription.Staging.v2_39_2.R34.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R34__jpeg() => _R34.Staging__v2_39_2__R34__jpeg(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R34__jpeg637812143477007703__Normal() { diff --git a/Adaptation/_Tests/Extract/Staging/v2.39.2/R36-EQPT.cs b/Adaptation/_Tests/Extract/Staging/v2.39.2/R36-EQPT.cs index 400439d..78be740 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.39.2/R36-EQPT.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.39.2/R36-EQPT.cs @@ -18,6 +18,9 @@ public class R36_EQPT _R36_EQPT = CreateSelfDescription.Staging.v2_39_2.R36_EQPT.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R36_EQPT__DownloadJpegFile() => _R36_EQPT.Staging__v2_39_2__R36_EQPT__DownloadJpegFile(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.39.2/R36.cs b/Adaptation/_Tests/Extract/Staging/v2.39.2/R36.cs index bc208fc..d5848e2 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.39.2/R36.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.39.2/R36.cs @@ -18,6 +18,9 @@ public class R36 _R36 = CreateSelfDescription.Staging.v2_39_2.R36.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_39_2__R36__jpeg() => _R36.Staging__v2_39_2__R36__jpeg(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.43.0/DEP08SIASM.cs b/Adaptation/_Tests/Extract/Staging/v2.43.0/DEP08SIASM.cs index 85408c1..3287db9 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.43.0/DEP08SIASM.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.43.0/DEP08SIASM.cs @@ -18,33 +18,63 @@ public class DEP08SIASM _DEP08SIASM = CreateSelfDescription.Staging.v2_43_0.DEP08SIASM.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__MoveMatchingFiles() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__MoveMatchingFiles(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__OpenInsightMetrologyViewer() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__OpenInsightMetrologyViewer(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__IQSSi() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__IQSSi(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__OpenInsight() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__OpenInsight(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__OpenInsightMetrologyViewerAttachments() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__OpenInsightMetrologyViewerAttachments(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__APC() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__APC(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__SPaCe() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__SPaCe(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__Processed() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__Processed(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__Archive() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__Archive(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__DEP08SIASM__Dummy() => _DEP08SIASM.Staging__v2_43_0__DEP08SIASM__Dummy(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.43.0/R34-EQPT.cs b/Adaptation/_Tests/Extract/Staging/v2.43.0/R34-EQPT.cs index 9f0ddd4..7ccd0ce 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.43.0/R34-EQPT.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.43.0/R34-EQPT.cs @@ -18,9 +18,15 @@ public class R34_EQPT _R34_EQPT = CreateSelfDescription.Staging.v2_43_0.R34_EQPT.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R34_EQPT__DownloadJpegFile() => _R34_EQPT.Staging__v2_43_0__R34_EQPT__DownloadJpegFile(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R34_EQPT__DownloadJpegFile637812143477007703__Normal() => _R34_EQPT.Staging__v2_43_0__R34_EQPT__DownloadJpegFile(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.43.0/R34.cs b/Adaptation/_Tests/Extract/Staging/v2.43.0/R34.cs index 5f4800d..7bd867d 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.43.0/R34.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.43.0/R34.cs @@ -22,9 +22,15 @@ public class R34 _R34 = CreateSelfDescription.Staging.v2_43_0.R34.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R34__jpeg() => _R34.Staging__v2_43_0__R34__jpeg(); +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R34__jpeg637812143477007703__Normal() { diff --git a/Adaptation/_Tests/Extract/Staging/v2.43.0/R36-EQPT.cs b/Adaptation/_Tests/Extract/Staging/v2.43.0/R36-EQPT.cs index 5417cf2..219e741 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.43.0/R36-EQPT.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.43.0/R36-EQPT.cs @@ -18,6 +18,9 @@ public class R36_EQPT _R36_EQPT = CreateSelfDescription.Staging.v2_43_0.R36_EQPT.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R36_EQPT__DownloadJpegFile() => _R36_EQPT.Staging__v2_43_0__R36_EQPT__DownloadJpegFile(); diff --git a/Adaptation/_Tests/Extract/Staging/v2.43.0/R36.cs b/Adaptation/_Tests/Extract/Staging/v2.43.0/R36.cs index f1da372..3f66baf 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.43.0/R36.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.43.0/R36.cs @@ -18,6 +18,9 @@ public class R36 _R36 = CreateSelfDescription.Staging.v2_43_0.R36.EAFLoggingUnitTesting; } +#if true + [Ignore] +#endif [TestMethod] public void Staging__v2_43_0__R36__jpeg() => _R36.Staging__v2_43_0__R36__jpeg(); diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs index 997a93e..7e7c8cc 100644 --- a/Adaptation/_Tests/Shared/AdaptationTesting.cs +++ b/Adaptation/_Tests/Shared/AdaptationTesting.cs @@ -26,10 +26,13 @@ namespace Adaptation._Tests.Shared; public class AdaptationTesting : ISMTP { + protected readonly string _DummyRoot; protected readonly string _Environment; protected readonly string _HostNameAndPort; + protected readonly bool _HasWaitForProperty; protected readonly TestContext _TestContext; protected readonly bool _SkipEquipmentDictionary; + protected readonly string _TestContextPropertiesAsJson; protected readonly Dictionary _CellInstanceVersions; protected readonly Dictionary _EquipmentTypeVersions; protected readonly Dictionary _ParameterizedModelObjectDefinitionTypes; @@ -38,10 +41,13 @@ public class AdaptationTesting : ISMTP protected readonly Dictionary> _ModelObjectParameters; protected readonly Dictionary>> _EquipmentDictionaryEventDescriptions; + public string DummyRoot => _DummyRoot; public string Environment => _Environment; public TestContext TestContext => _TestContext; public string HostNameAndPort => _HostNameAndPort; + public bool HasWaitForProperty => _HasWaitForProperty; public bool SkipEquipmentDictionary => _SkipEquipmentDictionary; + public string TestContextPropertiesAsJson => _TestContextPropertiesAsJson; public Dictionary CellInstanceVersions => _CellInstanceVersions; public Dictionary EquipmentTypeVersions => _EquipmentTypeVersions; public Dictionary> ModelObjectParameters => _ModelObjectParameters; @@ -56,17 +62,22 @@ public class AdaptationTesting : ISMTP void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) => throw new NotImplementedException(); - public AdaptationTesting(TestContext testContext, bool skipEquipmentDictionary) + public AdaptationTesting(string dummyRoot, TestContext testContext, bool skipEquipmentDictionary, string testContextPropertiesAsJson, bool hasWaitForProperty) { string environment = GetEnvironment(testContext); string hostNameAndPort = GetHostNameAndPort(environment); + _DummyRoot = dummyRoot; _TestContext = testContext; _Environment = environment; _HostNameAndPort = hostNameAndPort; + _HasWaitForProperty = hasWaitForProperty; _SkipEquipmentDictionary = skipEquipmentDictionary; + _TestContextPropertiesAsJson = testContextPropertiesAsJson; _CellInstanceVersions = new Dictionary(); _EquipmentTypeVersions = new Dictionary(); + _EquipmentTypeVersions = new Dictionary(); + _ParameterizedModelObjectDefinitionTypes = new Dictionary(); _ParameterizedModelObjectDefinitionTypes = new Dictionary(); _EquipmentDictionaryVersions = new Dictionary(); _FileConnectorConfigurations = new Dictionary(); @@ -94,23 +105,28 @@ public class AdaptationTesting : ISMTP return result; } - protected string GetTestResultsDirectory() + public static string GetTestResultsDirectory(string testContextTestResultsDirectory, bool hasWaitForProperty) { string result = string.Empty; string testResults = "05_TestResults"; - string checkDirectory = _TestContext.TestResultsDirectory; - if (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults)) - throw new Exception(); - string rootDirectory = Path.GetPathRoot(checkDirectory); - for (int i = 0; i < int.MaxValue; i++) + string checkDirectory = testContextTestResultsDirectory; + if (hasWaitForProperty && (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults))) + throw new Exception($"A:{checkDirectory}; B:{testResults};"); + else if (!hasWaitForProperty && (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults))) + result = testContextTestResultsDirectory; + else { - checkDirectory = Path.GetDirectoryName(checkDirectory); - if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == rootDirectory) - break; - if (checkDirectory.EndsWith(testResults) && Directory.Exists(checkDirectory)) + string rootDirectory = Path.GetPathRoot(checkDirectory); + for (int i = 0; i < int.MaxValue; i++) { - result = checkDirectory; - break; + checkDirectory = Path.GetDirectoryName(checkDirectory); + if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == rootDirectory) + break; + if (checkDirectory.EndsWith(testResults) && Directory.Exists(checkDirectory)) + { + result = checkDirectory; + break; + } } } if (string.IsNullOrEmpty(result)) @@ -118,6 +134,12 @@ public class AdaptationTesting : ISMTP return result; } + private string GetTestResultsDirectory(bool hasWaitForProperty) + { + string result = GetTestResultsDirectory(_TestContext.TestResultsDirectory, hasWaitForProperty); + return result; + } + protected static string GetCellInstanceConnectionName(string cellInstanceConnectionName) { string result; @@ -170,28 +192,29 @@ public class AdaptationTesting : ISMTP return results; } - internal string[] GetSegments(string methodBaseName) + public static MethodBaseName GetMethodBaseName(string dummyRoot, string environment, bool hasWaitForProperty, string methodBaseName, string testResultsDirectory) { - List results; - string fileFullName; + MethodBaseName result; string comment; - string[] textFiles; + string fileFullName; + string dummyDirectory; + string withActualCICN; string separator = "__"; + string textFileDirectory; string connectionNameAndTicks; string cellInstanceConnectionName; string ticks = DateTime.Now.Ticks.ToString(); string cellInstanceConnectionNameFromMethodBaseName; - string testResultsDirectory = GetTestResultsDirectory(); string[] segments = methodBaseName.Split(new string[] { separator }, StringSplitOptions.None); - if (segments[0] != _Environment) + if (segments[0] != environment) throw new Exception(); string rawVersionName = segments[1]; string rawCellInstanceName = segments[2]; string cellInstanceVersionName = segments[1].Replace('_', '.'); string cellInstanceName = segments[2].Replace('_', '-').Replace("_EQPT", "-EQPT"); - string before = string.Concat(_Environment, separator, rawVersionName, separator, cellInstanceName, separator); + string before = string.Concat(environment, separator, rawVersionName, separator, cellInstanceName, separator); string after = methodBaseName.Substring(before.Length); - string versionDirectory = Path.Combine(testResultsDirectory, _Environment, cellInstanceName, cellInstanceVersionName); + string versionDirectory = Path.Combine(testResultsDirectory, environment, cellInstanceName, cellInstanceVersionName); if (!Directory.Exists(versionDirectory)) _ = Directory.CreateDirectory(versionDirectory); comment = segments[segments.Length - 1]; @@ -221,87 +244,76 @@ public class AdaptationTesting : ISMTP cellInstanceConnectionNameFromMethodBaseName = after; } cellInstanceConnectionName = GetCellInstanceConnectionName(cellInstanceConnectionNameFromMethodBaseName); - string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBaseName, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks); + withActualCICN = GetMethodBaseNameWithActualCICN(methodBaseName, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks); + if (hasWaitForProperty) + dummyDirectory = string.Empty; + else if (string.IsNullOrEmpty(ticks)) + dummyDirectory = string.Empty; + else + { + if (string.IsNullOrEmpty(dummyRoot)) + throw new Exception($"{nameof(dummyRoot)} is empty!"); + if (!withActualCICN.Contains(ticks)) + throw new Exception($"{withActualCICN} doesn't contain {ticks}!"); + segments = withActualCICN.Split(new string[] { ticks }, StringSplitOptions.None); + dummyDirectory = Path.Combine(dummyRoot, cellInstanceName, ticks, string.Join(null, segments)); + if (!Directory.Exists(dummyDirectory)) + _ = Directory.CreateDirectory(dummyDirectory); + } if (string.IsNullOrEmpty(ticks)) { - textFiles = Array.Empty(); - fileFullName = Path.Combine(versionDirectory, methodBaseNameWithActualCICN, $"{cellInstanceConnectionNameFromMethodBaseName}.json"); + textFileDirectory = string.Empty; + fileFullName = Path.Combine(versionDirectory, withActualCICN, $"{cellInstanceConnectionNameFromMethodBaseName}.json"); } else { - segments = methodBaseNameWithActualCICN.Split(new string[] { ticks }, StringSplitOptions.None); - string textDirectory = Path.Combine(versionDirectory, segments[0], string.Concat(ticks, segments[1])); + segments = withActualCICN.Split(new string[] { ticks }, StringSplitOptions.None); + textFileDirectory = Path.Combine(versionDirectory, segments[0], string.Concat(ticks, segments[1])); fileFullName = Path.Combine(versionDirectory, segments[0], $"{cellInstanceConnectionNameFromMethodBaseName}.json"); - if (!Directory.Exists(textDirectory)) + } + result = new(after, before, cellInstanceConnectionName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceName, cellInstanceVersionName, comment, dummyDirectory, fileFullName, rawCellInstanceName, rawVersionName, separator, testResultsDirectory, textFileDirectory, ticks, versionDirectory, withActualCICN); + return result; + } + + private MethodBaseName GetMethodBaseName(MethodBase methodBase) + { + MethodBaseName result; + string testResultsDirectory = GetTestResultsDirectory(_HasWaitForProperty); + result = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, methodBase.Name, testResultsDirectory); + return result; + } + + private string[] GetTextFiles(MethodBaseName mbn) + { + string[] results; + if (string.IsNullOrEmpty(mbn.TextFileDirectory)) + results = Array.Empty(); + else if (!Directory.Exists(mbn.TextFileDirectory)) + { + results = Array.Empty(); + if (!_HasWaitForProperty) + _ = Directory.CreateDirectory(mbn.TextFileDirectory); + else { - textFiles = Array.Empty(); - string renameDirectory = Path.Combine(Path.GetDirectoryName(textDirectory), $"_Rename - {Path.GetFileName(textDirectory)}"); + string renameDirectory = Path.Combine(Path.GetDirectoryName(mbn.TextFileDirectory), $"_Rename - {Path.GetFileName(mbn.TextFileDirectory)}"); _ = Directory.CreateDirectory(renameDirectory); _ = Process.Start("explorer.exe", renameDirectory); File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileFilter)}.txt"), string.Empty); File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileLocation)}.txt"), string.Empty); } - else + } + else + { + results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly); + if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && !results.Any()) { - textFiles = Directory.GetFiles(textDirectory, "*.txt", SearchOption.TopDirectoryOnly); - if (!textFiles.Any()) - { - _ = Process.Start("explorer.exe", textDirectory); - File.WriteAllText(Path.Combine(textDirectory, "_ Why.why"), string.Empty); - } + _ = Process.Start("explorer.exe", mbn.TextFileDirectory); + File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty); } } - results = new List - { - _Environment, - rawCellInstanceName, - cellInstanceName, - cellInstanceVersionName, - cellInstanceConnectionNameFromMethodBaseName, - cellInstanceConnectionName, - ticks, - comment, - fileFullName - }; - results.AddRange(textFiles); - return results.ToArray(); - } - - internal string[] GetSegments(MethodBase methodBase) - { - string[] results = GetSegments(methodBase.Name); return results; } - internal static string GetEnvironment(string[] segments) => segments[0]; - - internal static string GetRawCellInstanceName(string[] segments) => segments[1]; - - internal static string GetCellInstanceName(string[] segments) => segments[2]; - - internal static string GetCellInstanceVersionName(string[] segments) => segments[3]; - - internal static string GetCellInstanceConnectionNameFromMethodBaseName(string[] segments) => segments[4]; - - internal static string GetCellInstanceConnectionName(string[] segments) => segments[5]; - - internal static string GetTicks(string[] segments) => segments[6]; - - internal static string GetComment(string[] segments) => segments[7]; - - internal static FileInfo GetFileName(string[] segments) => new(segments[8]); - - internal static string[] GetTextFiles(string[] segments) - { - List results = new(); - if (segments.Length > 8) - { - for (int i = 9; i < segments.Length; i++) - results.Add(segments[i]); - } - return results.ToArray(); - } - protected static Stream ToStream(string @this) { MemoryStream memoryStream = new(); @@ -466,6 +478,7 @@ public class AdaptationTesting : ISMTP AppendLine("#pragma warning disable CA2254"). AppendLine("#pragma warning disable IDE0060"). AppendLine(). + AppendLine("internal static string DummyRoot { get; private set; }"). Append("internal static ").Append(cellInstanceNameWithoutHyphen).AppendLine(" EAFLoggingUnitTesting { get; private set; }"); else throw new Exception(); @@ -474,13 +487,15 @@ public class AdaptationTesting : ISMTP else if (i == 1) _ = stringBuilder. AppendLine(). - Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)"). + Append("static ").Append(cellInstanceNameWithoutHyphen).AppendLine("() => DummyRoot = @\"\\\\messv02ecc1.ec.local\\EC_Characterization_Si\\Dummy\";"). + AppendLine(). + Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)"). AppendLine("{"). AppendLine("if (EAFLoggingUnitTesting is null)"). AppendLine("throw new Exception();"). AppendLine("}"). AppendLine(). - Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)"). + Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)"). AppendLine("{"). AppendLine("}"). AppendLine(); @@ -541,6 +556,9 @@ public class AdaptationTesting : ISMTP if (i == 2) { _ = stringBuilder. + AppendLine("#if true"). + AppendLine("[Ignore]"). + AppendLine("#endif"). AppendLine("[TestMethod]"). Append("public void ").Append(methodName).Append("() => ").Append('_').Append(cellInstanceNameWithoutHyphen).Append('.').Append(methodName).AppendLine("();").AppendLine(); } @@ -550,13 +568,16 @@ public class AdaptationTesting : ISMTP throw new Exception("Versions should match!"); equipmentTypeName = componentsCellComponentCellComponent.Equipment.EquipmentType.Name; _ = stringBuilder. + AppendLine("#if true"). + AppendLine("[Ignore]"). + AppendLine("#endif"). AppendLine("[TestMethod]"). Append("public void ").Append(methodName).AppendLine("()"). AppendLine("{"). Append("string check = \"").Append(check.Split('\\').Last()).AppendLine("\";"). AppendLine("MethodBase methodBase = new StackFrame().GetMethod();"). AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Getting configuration\"));"). - AppendLine("_ = Shared.AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);"). + AppendLine("_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);"). AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Exit\"));"). AppendLine("}"). AppendLine(); @@ -879,32 +900,26 @@ public class AdaptationTesting : ISMTP public string[] GetCSharpText(string testName) { string[] results; - string[] segments = GetSegments(testName); - FileInfo fileInfo = GetFileName(segments); - string cellInstanceName = GetCellInstanceName(segments); - string cellInstanceVersionName = GetCellInstanceVersionName(segments); - string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); - if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) + string testResultsDirectory = GetTestResultsDirectory(_HasWaitForProperty); + MethodBaseName mbn = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, testName, testResultsDirectory); + FileInfo fileInfo = new(mbn.FileFullName); + if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) _ = Directory.CreateDirectory(fileInfo.Directory.FullName); - Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); - results = GetCSharpTextB(fileInfo, cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2); + Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName); + results = GetCSharpTextB(fileInfo, mbn.CellInstanceName, mbn.CellInstanceVersionName, cellInstanceVersionTuple.Item2); return results; } public string[] GetConfiguration(MethodBase methodBase) { string[] results; - string[] segments = GetSegments(methodBase.Name); - string ticks = GetTicks(segments); - FileInfo fileInfo = GetFileName(segments); - string cellInstanceName = GetCellInstanceName(segments); - string cellInstanceVersionName = GetCellInstanceVersionName(segments); - string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); - if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) + MethodBaseName mbn = GetMethodBaseName(methodBase); + FileInfo fileInfo = new(mbn.FileFullName); + if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) _ = Directory.CreateDirectory(fileInfo.Directory.FullName); - Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); - Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName); - if (string.IsNullOrEmpty(ticks) && fileConnectorConfigurationTuple.Item2?.FileScanningIntervalInSeconds is not null) + Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName); + Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, mbn.CellInstanceConnectionName); + if (string.IsNullOrEmpty(mbn.Ticks) && fileConnectorConfigurationTuple.Item2?.FileScanningIntervalInSeconds is not null) { string fileScanningIntervalInSecondsLine; string versionDirectory = Path.GetDirectoryName(fileInfo.DirectoryName); @@ -914,12 +929,12 @@ public class AdaptationTesting : ISMTP fileScanningIntervalInSecondsLine = $"+\t{fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value:+0000}\t{Path.GetFileName(fileInfo.DirectoryName)}"; File.AppendAllLines(Path.Combine(versionDirectory, "FileScanningIntervalInSeconds.txt"), new string[] { fileScanningIntervalInSecondsLine }); } - Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); + Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName); Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple); Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple); - Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4); + Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4); Tuple>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple); - Dictionary objects = GetKeyValuePairs(cellInstanceName, cellInstanceVersionName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2); + Dictionary objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2); string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true }); results = new string[] { fileInfo.FullName, json }; return results; @@ -928,22 +943,19 @@ public class AdaptationTesting : ISMTP public IFileRead Get(MethodBase methodBase, string sourceFileLocation, string sourceFileFilter, bool useCyclicalForDescription) { IFileRead result; - string[] segments = GetSegments(methodBase.Name); - FileInfo fileInfo = GetFileName(segments); - string cellInstanceName = GetCellInstanceName(segments); - string cellInstanceVersionName = GetCellInstanceVersionName(segments); + MethodBaseName mbn = GetMethodBaseName(methodBase); + FileInfo fileInfo = new(mbn.FileFullName); Dictionary fileParameter = new(); - string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); - if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) + if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) _ = Directory.CreateDirectory(fileInfo.Directory.FullName); Dictionary> dummyRuns = new(); Dictionary> staticRuns = new(); - Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); - Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName); - Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); + Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName); + Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, mbn.CellInstanceConnectionName); + Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName); Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple); Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple); - Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4); + Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4); _ = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple); if (!string.IsNullOrEmpty(sourceFileLocation) && sourceFileLocation != fileConnectorConfigurationTuple.Item2.SourceFileLocation) fileConnectorConfigurationTuple.Item2.SourceFileLocation = sourceFileLocation; @@ -975,33 +987,29 @@ public class AdaptationTesting : ISMTP _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder); } } - result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: false); + result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: false); return result; } - public string[] GetVariables(MethodBase methodBase, string check) + public string[] GetVariables(MethodBase methodBase, string check, bool validatePDSF = true) { string[] results; string[] lines; string ipdsfFile; - string textFileDirectory; + string[] segments; string fileNameWithoutExtension; string searchPattern = "*.ipdsf"; + string methodBaseNameWithActualCICN; string sourceFileFilter = string.Empty; string sourceFileLocation = string.Empty; - string[] segments = GetSegments(methodBase); - string ticks = GetTicks(segments); - FileInfo fileInfo = GetFileName(segments); - string[] textFiles = GetTextFiles(segments); - string cellInstanceName = GetCellInstanceName(segments); - string rawCellInstanceName = GetRawCellInstanceName(segments); - string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); - string cellInstanceConnectionNameFromMethodBaseName = GetCellInstanceConnectionNameFromMethodBaseName(segments); - string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBase.Name, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks); + MethodBaseName mbn = GetMethodBaseName(methodBase); + string[] textFiles = GetTextFiles(mbn); if (!textFiles.Any()) - textFileDirectory = string.Empty; - else - textFileDirectory = Path.GetDirectoryName(textFiles[0]); + { + if (_HasWaitForProperty) + throw new Exception("Set text file!"); + sourceFileLocation = mbn.DummyDirectory; + } foreach (string textFile in textFiles) { lines = File.ReadAllLines(textFile); @@ -1012,18 +1020,20 @@ public class AdaptationTesting : ISMTP sourceFileFilter = lines[0]; else if (fileNameWithoutExtension == nameof(FileConnectorConfiguration.SourceFileLocation)) { - segments = lines[0].Split(new string[] { ticks }, StringSplitOptions.None); + methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBase.Name, mbn.RawCellInstanceName, mbn.CellInstanceConnectionNameFromMethodBaseName, mbn.CellInstanceConnectionName, mbn.Ticks); + segments = lines[0].Split(new string[] { mbn.Ticks }, StringSplitOptions.None); if (segments.Length > 2) throw new Exception("Ticks should only appear once in source file location!"); if (segments.Length != 2) throw new Exception("Ticks missing from source file location!"); - if (segments[1].Contains(ticks)) + if (segments[1].Contains(mbn.Ticks)) throw new Exception("From source file location path should not contain ticks!"); - if (!segments[1].EndsWith(methodBaseNameWithActualCICN.Replace(ticks, string.Empty))) + if (!segments[1].EndsWith(methodBaseNameWithActualCICN.Replace(mbn.Ticks, string.Empty))) throw new Exception("Method name missing from source file location!"); sourceFileLocation = lines[0]; } } + FileInfo fileInfo = new(mbn.FileFullName); if (!Directory.Exists(fileInfo.Directory.FullName)) _ = Directory.CreateDirectory(fileInfo.Directory.FullName); if (!fileInfo.Exists) @@ -1044,25 +1054,30 @@ public class AdaptationTesting : ISMTP fileConnectorConfiguration.SourceFileFilter = sourceFileFilter; if (!string.IsNullOrEmpty(sourceFileLocation)) fileConnectorConfiguration.SourceFileLocation = sourceFileLocation; - if (string.IsNullOrEmpty(sourceFileLocation)) - ipdsfFile = searchPattern; + if (!validatePDSF) + ipdsfFile = string.Empty; else { - string ipdsfDirectory = Path.Combine(sourceFileLocation, "ipdsf"); - if (!Directory.Exists(ipdsfDirectory)) + if (string.IsNullOrEmpty(sourceFileLocation)) ipdsfFile = searchPattern; else { - string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly); - if (files.Any()) - ipdsfFile = files[0]; - else + string ipdsfDirectory = Path.Combine(sourceFileLocation, "ipdsf"); + if (!Directory.Exists(ipdsfDirectory)) ipdsfFile = searchPattern; + else + { + string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly); + if (files.Any()) + ipdsfFile = files[0]; + else + ipdsfFile = searchPattern; + } } + if (ipdsfFile == searchPattern) + throw new Exception(); } - if (ipdsfFile == searchPattern) - throw new Exception(); - results = new string[] { fileInfo.FullName, json, fileConnectorConfiguration.SourceFileLocation, fileConnectorConfiguration.SourceFileFilter, ipdsfFile, textFileDirectory }; + results = new string[] { fileInfo.FullName, json, fileConnectorConfiguration.SourceFileLocation, fileConnectorConfiguration.SourceFileFilter, ipdsfFile, mbn.TextFileDirectory }; if (string.IsNullOrEmpty(results[0])) throw new Exception(); if (string.IsNullOrEmpty(results[1])) @@ -1071,7 +1086,7 @@ public class AdaptationTesting : ISMTP throw new Exception(); if (string.IsNullOrEmpty(results[3])) throw new Exception(); - if (string.IsNullOrEmpty(results[4])) + if (validatePDSF && string.IsNullOrEmpty(results[4])) throw new Exception(); if (string.IsNullOrEmpty(results[5])) throw new Exception(); @@ -1232,29 +1247,33 @@ public class AdaptationTesting : ISMTP { string result; Tuple> extractResult = fileRead.ReExtract(); - Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1)); - Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!"); - Assert.IsNotNull(extractResult.Item4); - if (!validatePDSF) - _ = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, new(string.Empty, Array.Empty(), Array.Empty())); - else + if (!fileRead.IsDuplicator) { - Tuple pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]); - Tuple pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf); - CompareSave(variables[5], pdsf, pdsfNew); - Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!"); - string[] json = GetItem2(pdsf, pdsfNew); - CompareSaveJSON(variables[5], json); - Assert.IsTrue(json[0] == json[1], "Item2 check!"); - string[] join = GetItem3(pdsf, pdsfNew); - CompareSaveTSV(variables[5], join); - Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!"); + Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1)); + Assert.IsNotNull(extractResult.Item3); + Assert.IsNotNull(extractResult.Item4); + if (!validatePDSF) + _ = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, new(string.Empty, Array.Empty(), Array.Empty())); + else + { + Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!"); + Tuple pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]); + Tuple pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf); + CompareSave(variables[5], pdsf, pdsfNew); + Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!"); + string[] json = GetItem2(pdsf, pdsfNew); + CompareSaveJSON(variables[5], json); + Assert.IsTrue(json[0] == json[1], "Item2 check!"); + string[] join = GetItem3(pdsf, pdsfNew); + CompareSaveTSV(variables[5], join); + Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!"); + } + UpdatePassDirectory(variables[2]); } - UpdatePassDirectory(variables[2]); result = extractResult.Item1; return result; } } // namespace Adaptation._Tests.Helpers { public class AdaptationTesting { } } -// 2022-05-12 -> AdaptationTesting \ No newline at end of file +// 2022-08-05 -> AdaptationTesting \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs b/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs index 62a6cf7..bc6f20e 100644 --- a/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs +++ b/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs @@ -10,13 +10,13 @@ public class EAFLoggingUnitTesting : LoggingUnitTesting, IDisposable public AdaptationTesting AdaptationTesting => _AdaptationTesting; - public EAFLoggingUnitTesting(TestContext testContext, Type declaringType, bool skipEquipmentDictionary) : + public EAFLoggingUnitTesting(string dummyRoot, TestContext testContext, Type declaringType, bool skipEquipmentDictionary) : base(testContext, declaringType) { if (testContext is null || declaringType is null) _AdaptationTesting = null; else - _AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary); + _AdaptationTesting = new AdaptationTesting(dummyRoot, testContext, skipEquipmentDictionary, _TestContextPropertiesAsJson, _HasWaitForProperty); } public new void Dispose() diff --git a/Adaptation/_Tests/Shared/MethodBaseName.cs b/Adaptation/_Tests/Shared/MethodBaseName.cs new file mode 100644 index 0000000..b14c1f5 --- /dev/null +++ b/Adaptation/_Tests/Shared/MethodBaseName.cs @@ -0,0 +1,45 @@ +namespace Adaptation._Tests.Shared; + +public class MethodBaseName +{ + + public string After { get; private set; } + public string Before { get; private set; } + public string CellInstanceConnectionName { get; private set; } + public string CellInstanceConnectionNameFromMethodBaseName { get; private set; } + public string CellInstanceName { get; private set; } + public string CellInstanceVersionName { get; private set; } + public string Comment { get; private set; } + public string DummyDirectory { get; private set; } + public string FileFullName { get; private set; } + public string RawCellInstanceName { get; private set; } + public string RawVersionName { get; private set; } + public string Separator { get; private set; } + public string TestResultsDirectory { get; private set; } + public string TextFileDirectory { get; private set; } + public string Ticks { get; private set; } + public string VersionDirectory { get; private set; } + public string WithActualCICN { get; private set; } + + public MethodBaseName(string after, string before, string cellInstanceConnectionName, string cellInstanceConnectionNameFromMethodBaseName, string cellInstanceName, string cellInstanceVersionName, string comment, string dummyDirectory, string fileFullName, string rawCellInstanceName, string rawVersionName, string separator, string testResultsDirectory, string textFileDirectory, string ticks, string versionDirectory, string withActualCICN) + { + After = after; + Before = before; + CellInstanceConnectionName = cellInstanceConnectionName; + CellInstanceConnectionNameFromMethodBaseName = cellInstanceConnectionNameFromMethodBaseName; + CellInstanceName = cellInstanceName; + CellInstanceVersionName = cellInstanceVersionName; + Comment = comment; + DummyDirectory = dummyDirectory; + FileFullName = fileFullName; + RawCellInstanceName = rawCellInstanceName; + RawVersionName = rawVersionName; + Separator = separator; + TestResultsDirectory = testResultsDirectory; + TextFileDirectory = textFileDirectory; + Ticks = ticks; + VersionDirectory = versionDirectory; + WithActualCICN = withActualCICN; + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/UnitTesting.cs b/Adaptation/_Tests/Shared/UnitTesting.cs index 3477030..28df790 100644 --- a/Adaptation/_Tests/Shared/UnitTesting.cs +++ b/Adaptation/_Tests/Shared/UnitTesting.cs @@ -13,9 +13,13 @@ namespace Adaptation._Tests.Shared; public class UnitTesting { + protected readonly bool _HasWaitForProperty; protected readonly IsEnvironment _IsEnvironment; + protected readonly string _TestContextPropertiesAsJson; public IsEnvironment IsEnvironment => _IsEnvironment; + public bool HasWaitForProperty => _HasWaitForProperty; + public string TestContextPropertiesAsJson => _TestContextPropertiesAsJson; public UnitTesting(TestContext testContext, Type declaringType) { @@ -23,18 +27,23 @@ public class UnitTesting _IsEnvironment = null; else { + string waitFor = "\"WaitFor\":"; string projectDirectory = GetProjectDirectory(testContext); - string json = JsonSerializer.Serialize(testContext.Properties); + _TestContextPropertiesAsJson = JsonSerializer.Serialize(testContext.Properties, new JsonSerializerOptions { WriteIndented = true }); + _HasWaitForProperty = _TestContextPropertiesAsJson.Contains(waitFor); string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode"); if (!Directory.Exists(vsCodeDirectory)) _ = Directory.CreateDirectory(vsCodeDirectory); string launchText = GetLaunchText(); File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText); - for (int i = 0; i < int.MaxValue; i++) + if (_HasWaitForProperty) { - if (!json.Contains("Debugger.IsAttached") || Debugger.IsAttached) - break; - Thread.Sleep(500); + for (int i = 0; i < int.MaxValue; i++) + { + if (!_TestContextPropertiesAsJson.Contains($"{waitFor} \"Debugger.IsAttached\"") || Debugger.IsAttached) + break; + Thread.Sleep(500); + } } MethodBase methodBase = declaringType.GetMethod(testContext.TestName); if (methodBase is not null) diff --git a/Adaptation/package.json b/Adaptation/package.json index 3111665..3ba701a 100644 --- a/Adaptation/package.json +++ b/Adaptation/package.json @@ -1,5 +1,14 @@ { "scripts": { + "AA-CreateSelfDescription.Staging.v2_43_4-R34_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_4 & ClassName~R34_EQPT\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "AB-CreateSelfDescription.Staging.v2_43_4-R36_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_4 & ClassName~R36_EQPT\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "BA-CreateSelfDescription.Staging.v2_43_4-R34": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_4 & ClassName~R34\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "BB-CreateSelfDescription.Staging.v2_43_4-R36": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_4 & ClassName~R36\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "CA-CreateSelfDescription.Staging.v2_43_4-DEP08SIASM": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_4 & ClassName~DEP08SIASM\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "DA-CreateSelfDescription.Staging.v2_43_4": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_4\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "EA-Extract.Staging.v2_43_4-R34_EQPT-Staging__v2_43_4__R34_EQPT__DownloadJpegFile637812143477007703__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_4 & ClassName~R34_EQPT & Name~Staging__v2_43_4__R34_EQPT__DownloadJpegFile637812143477007703__Normal\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "FA-Extract.Staging.v2_43_4-R34-Staging__v2_43_4__R34__jpeg637812143477007703__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_4 & ClassName~R34 & Name~Staging__v2_43_4__R34__jpeg637812143477007703__Normal\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", + "GA-Extract.Staging.v2_43_4-R34-Staging__v2_43_4__DEP08SIASM__DEP08SIASM__637825304581476827__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_4 & ClassName~DEP08SIASM & Name~Staging__v2_43_4__DEP08SIASM__DEP08SIASM__637825304581476827__Normal\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")", "Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "nuget-clear": "dotnet nuget locals all --clear", "build": "dotnet build --runtime win-x64 --self-contained", @@ -9,21 +18,6 @@ "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn", "MSBuild": "\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe\" /target:Build /restore:True /p:RestoreSources=https://api.nuget.org/v3/index.json%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=Debug;TargetFrameworkVersion=v4.8 ../DEP08SIASM.csproj", "pull": "git pull", - "garbage-collect": "git gc", - "AT-CreateSelfDescription.Staging.v2_43_0-DEP08SIASM": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~DEP08SIASM\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "AV-CreateSelfDescription.Staging.v2_43_0-R34_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~R34_EQPT\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "AW-CreateSelfDescription.Staging.v2_43_0-R34": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~R34\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "AX-CreateSelfDescription.Staging.v2_43_0-R36_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~R36_EQPT\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "AY-CreateSelfDescription.Staging.v2_43_0-R36": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~R36\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "AZ-CreateSelfDescription.Staging.v2_43_0": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BA-Extract.Staging.v2_43_0-R34_EQPT-Staging__v2_43_0__R34_EQPT__DownloadJpegFile637812143477007703__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~R34_EQPT & Name~Staging__v2_43_0__R34_EQPT__DownloadJpegFile637812143477007703__Normal\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BB-Extract.Staging.v2_43_0-R34-Staging__v2_43_0__R34__jpeg637812143477007703__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~R34 & Name~Staging__v2_43_0__R34__jpeg637812143477007703__Normal\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BC-Extract.Staging.v2_43_0-R34-Staging__v2_43_0__DEP08SIASM__DEP08SIASM__637825304581476827__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~DEP08SIASM & Name~Staging__v2_43_0__DEP08SIASM__DEP08SIASM__637825304581476827__Normal\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BT-Extract.Staging.v2_43_0-DEP08SIASM": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~DEP08SIASM\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BV-Extract.Staging.v2_43_0-R34_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~R34_EQPT\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BW-Extract.Staging.v2_43_0-R34": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~R34\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BX-Extract.Staging.v2_43_0-R36_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~R36_EQPT\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BY-Extract.Staging.v2_43_0-R36": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~R36\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", - "BZ-Extract.Staging.v2_43_0": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")" + "garbage-collect": "git gc" } } \ No newline at end of file diff --git a/DEP08SIASM.csproj b/DEP08SIASM.csproj index 474870d..6e8b720 100644 --- a/DEP08SIASM.csproj +++ b/DEP08SIASM.csproj @@ -93,6 +93,7 @@ + @@ -100,6 +101,12 @@ + + Component + + + + diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index f06ac1b..e96c8e8 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.43.0.0")] -[assembly: AssemblyFileVersion("2.43.0.0")] +[assembly: AssemblyVersion("2.43.4.0")] +[assembly: AssemblyFileVersion("2.43.4.0")]