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/.editorconfig b/Adaptation/.editorconfig index 2220133..b84fca4 100644 --- a/Adaptation/.editorconfig +++ b/Adaptation/.editorconfig @@ -80,9 +80,11 @@ dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array al dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name +dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant. dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2"); dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed +dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case @@ -215,7 +217,7 @@ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity dotnet_style_parentheses_in_other_operators = never_if_unnecessary dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity dotnet_style_predefined_type_for_locals_parameters_members = true -dotnet_style_predefined_type_for_member_access = true +dotnet_style_predefined_type_for_member_access = true:warning dotnet_style_prefer_auto_properties = true:warning dotnet_style_prefer_compound_assignment = true:warning dotnet_style_prefer_conditional_expression_over_assignment = false diff --git a/Adaptation/.vscode/format-report.json b/Adaptation/.vscode/format-report.json index 5632c60..0637a08 100644 --- a/Adaptation/.vscode/format-report.json +++ b/Adaptation/.vscode/format-report.json @@ -1,20 +1 @@ -[ - { - "DocumentId": { - "ProjectId": { - "Id": "42d7f187-9268-4dad-a1cf-c225ec4ce98c" - }, - "Id": "5fcb5135-ab8a-43c8-a4c7-a4453478f816" - }, - "FileName": "RijndaelEncryption.cs", - "FilePath": "T:\\MET08AFMD3100\\06_SourceCode\\EC\\Adaptation\\Shared\\RijndaelEncryption.cs", - "FileChanges": [ - { - "LineNumber": 16, - "CharNumber": 27, - "DiagnosticId": "IDE1006", - "FormatDescription": "warning IDE1006: Naming rule violation: Missing prefix: \u0027_\u0027" - } - ] - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/Adaptation/.vscode/settings.json b/Adaptation/.vscode/settings.json index 7619243..cf5388e 100644 --- a/Adaptation/.vscode/settings.json +++ b/Adaptation/.vscode/settings.json @@ -16,7 +16,8 @@ "titleBar.activeBackground": "#ca6bb7", "titleBar.activeForeground": "#15202b", "titleBar.inactiveBackground": "#ca6bb799", - "titleBar.inactiveForeground": "#15202b99" + "titleBar.inactiveForeground": "#15202b99", + "commandCenter.border": "#15202b99" }, "peacock.color": "#ca6bb7", "cSpell.enabled": false diff --git a/Adaptation/EC.Tests.csproj b/Adaptation/EC.Tests.csproj index b99615f..0943596 100644 --- a/Adaptation/EC.Tests.csproj +++ b/Adaptation/EC.Tests.csproj @@ -15,6 +15,7 @@ trx + XPlat Code Coverage ../../../../EC/05_TestResults/TestResults @@ -38,11 +39,11 @@ - + - + @@ -50,11 +51,11 @@ - + - + - + @@ -62,10 +63,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - + 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/Duplicator/Description.cs b/Adaptation/Shared/Duplicator/Description.cs index abbb7a4..b48872b 100644 --- a/Adaptation/Shared/Duplicator/Description.cs +++ b/Adaptation/Shared/Duplicator/Description.cs @@ -12,6 +12,7 @@ public class Description : IDescription, Properties.IDescription public int Test { get; set; } public int Count { get; set; } public int Index { get; set; } + public string RDS { get; set; } // public string EventName { get; set; } public string NullData { get; set; } diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs index f043d7c..56776b3 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; @@ -259,24 +260,23 @@ public class FileRead : Properties.IFileRead return results; } - protected static string GetTupleFile(Logistics logistics, Properties.IScopeInfo scopeInfo, string duplicateDirectory) + protected static string GetTupleFile(Logistics logistics, List descriptions, Properties.IScopeInfo scopeInfo, string duplicateDirectory) where T : Properties.IDescription { string result; string rds; string dateValue; - string datePlaceholder; - string[] segments = logistics.MID.Split('-'); - if (segments.Length < 2) - rds = "%RDS%"; + string rdsPlaceholder = "%RDS%"; + if (!descriptions.Any() || string.IsNullOrEmpty(descriptions[0].RDS)) + rds = logistics.MID; else - rds = segments[1]; - segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries); + rds = descriptions[0].RDS; + string[] segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries); if (segments.Length == 0) - result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace("%RDS%", rds)); + result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace(rdsPlaceholder, rds)); else { - datePlaceholder = "%DateTime%"; segments = segments[1].Split('%'); + string datePlaceholder = "%DateTime%"; dateValue = logistics.DateTimeFromSequence.ToString(segments[0]); foreach (string segment in scopeInfo.FileName.Split('%')) { @@ -284,14 +284,14 @@ public class FileRead : Properties.IFileRead continue; datePlaceholder = string.Concat('%', segment, '%'); } - result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace("%RDS%", rds).Replace(datePlaceholder, dateValue)); + result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace(rdsPlaceholder, rds).Replace(datePlaceholder, dateValue)); } if (result.Contains('%')) throw new Exception("Placeholder exists!"); return result; } - protected void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, string successDirectory, string duplicateDirectory, string duplicateFile, List<(Properties.IScopeInfo, string)> tuples) + protected void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, List descriptions, string successDirectory, string duplicateDirectory, string duplicateFile, List<(Properties.IScopeInfo, string)> collection) where T : Properties.IDescription { bool check; long preWait; @@ -305,20 +305,21 @@ public class FileRead : Properties.IFileRead preWait = dateTime.AddMilliseconds(1234).Ticks; else preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; - if (!tuples.Any()) + if (!collection.Any()) duplicateFiles.Add(duplicateFile); string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath)); - foreach ((Properties.IScopeInfo scopeInfo, string text) in tuples) + foreach ((Properties.IScopeInfo scopeInfo, string text) in collection) { if (scopeInfo.FileName.StartsWith(@"\")) tupleFile = scopeInfo.FileName; else if (!scopeInfo.FileName.Contains('%')) tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", scopeInfo.FileNameWithoutExtension, ".pdsfc"); else - tupleFile = GetTupleFile(logistics, scopeInfo, duplicateDirectory); + tupleFile = GetTupleFile(logistics, descriptions, scopeInfo, duplicateDirectory); duplicateFiles.Add(tupleFile); - File.WriteAllText(tupleFile, text); + if (_IsEAFHosted) + File.WriteAllText(tupleFile, text); } for (short i = 0; i < short.MaxValue; i++) { @@ -598,10 +599,10 @@ public class FileRead : Properties.IFileRead } } - protected void WaitForFileConsumption(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> tuples, string duplicateFile) + protected void WaitForFileConsumption(DateTime dateTime, List descriptions, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> collection, string duplicateFile) where T : Properties.IDescription { if (!isDummyRun && _IsEAFHosted) - WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples); + WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, descriptions, successDirectory, duplicateDirectory, duplicateFile, collection); else { long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; @@ -618,9 +619,9 @@ public class FileRead : Properties.IFileRead { string result; if (!string.IsNullOrEmpty(Path.GetFileName(directory))) - result = Path.GetFullPath(Path.GetDirectoryName(Path.GetDirectoryName(directory))); + result = Path.GetFullPath(GetParentParent(directory)); else - result = Path.GetFullPath(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(directory)))); + result = Path.GetFullPath(GetParentParent(Path.GetDirectoryName(directory))); if (!Directory.Exists(result)) _ = Directory.CreateDirectory(result); return result; @@ -641,6 +642,23 @@ public class FileRead : Properties.IFileRead return results; } + internal static string GetFileNameAfterUnderscoreSplit(string reportFullPath) + { + string result; + string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_'); + if (segments.Length <= 2) + result = segments[0]; + else + result = string.Concat(segments[0], segments[2]); + return result; + } + + internal static string GetParentParent(string value) + { + string result = Path.GetDirectoryName(Path.GetDirectoryName(value)); + return result; + } + } -// 2022-05-13 -> Shared - FileRead \ No newline at end of file +// 2022-06-08 -> Shared - FileRead \ No newline at end of file diff --git a/Adaptation/Shared/Logistics.cs b/Adaptation/Shared/Logistics.cs index c441b3f..38ed83c 100644 --- a/Adaptation/Shared/Logistics.cs +++ b/Adaptation/Shared/Logistics.cs @@ -9,34 +9,46 @@ namespace Adaptation.Shared; public class Logistics : ILogistics { - public object NullData { get; private set; } - public string JobID { get; private set; } //CellName - public long Sequence { get; private set; } //Ticks - public DateTime DateTimeFromSequence { get; private set; } - public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; } - public string MesEntity { get; private set; } //SPC - public string ReportFullPath { get; private set; } //Extract file - public string ProcessJobID { get; set; } //Reactor (duplicate but I want it in the logistics) - public string MID { get; set; } //Lot & Pocket || Lot - public List Tags { get; set; } - public List Logistics1 { get; set; } - public List Logistics2 { get; set; } + protected readonly DateTime _DateTimeFromSequence; + protected readonly FileInfo _FileInfo; + protected readonly string _JobID; + protected readonly List _Logistics1; + protected readonly List _Logistics2; + protected string _MID; + protected readonly string _MesEntity; + protected readonly object _NullData; + protected string _ProcessJobID; + protected readonly string _ReportFullPath; + protected readonly long _Sequence; + protected readonly double _TotalSecondsSinceLastWriteTimeFromSequence; + + public DateTime DateTimeFromSequence => _DateTimeFromSequence; + public FileInfo FileInfo => _FileInfo; + public string JobID => _JobID; + public List Logistics1 => _Logistics1; + public List Logistics2 => _Logistics2; + public string MID => _MID; + public string MesEntity => _MesEntity; + public object NullData => _NullData; + public string ProcessJobID => _ProcessJobID; + public string ReportFullPath => _ReportFullPath; + public long Sequence => _Sequence; + public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence; public Logistics(IFileRead fileRead) { DateTime dateTime = DateTime.Now; - NullData = null; - Sequence = dateTime.Ticks; - DateTimeFromSequence = dateTime; - JobID = fileRead.CellInstanceName; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; - MesEntity = DefaultMesEntity(dateTime); - ReportFullPath = string.Empty; - ProcessJobID = nameof(ProcessJobID); - MID = nameof(MID); - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); + _NullData = null; + _Sequence = dateTime.Ticks; + _DateTimeFromSequence = dateTime; + _JobID = fileRead.CellInstanceName; + _TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + _MesEntity = DefaultMesEntity(dateTime); + _ReportFullPath = string.Empty; + _ProcessJobID = nameof(ProcessJobID); + _MID = nameof(MID); + _Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + _Logistics2 = new List(); } public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null) @@ -45,19 +57,19 @@ public class Logistics : ILogistics throw new Exception(); if (string.IsNullOrEmpty(fileRead.MesEntity)) throw new Exception(); - NullData = fileRead.NullData; - FileInfo fileInfo = new(reportFullPath); - DateTime dateTime = fileInfo.LastWriteTime; - if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value) + _NullData = fileRead.NullData; + _FileInfo = new(reportFullPath); + DateTime dateTime = _FileInfo.LastWriteTime; + if (fileInfoLength.HasValue && _FileInfo.Length < fileInfoLength.Value) dateTime = dateTime.AddTicks(-1); - JobID = fileRead.CellInstanceName; - Sequence = dateTime.Ticks; - DateTimeFromSequence = dateTime; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; - MesEntity = fileRead.MesEntity; - ReportFullPath = fileInfo.FullName; - ProcessJobID = nameof(ProcessJobID); - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName); + _JobID = fileRead.CellInstanceName; + _Sequence = dateTime.Ticks; + _DateTimeFromSequence = dateTime; + _TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + _MesEntity = fileRead.MesEntity; + _ReportFullPath = _FileInfo.FullName; + _ProcessJobID = nameof(ProcessJobID); + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(_FileInfo.FullName); if (useSplitForMID) { if (fileNameWithoutExtension.IndexOf(".") > -1) @@ -67,10 +79,9 @@ public class Logistics : ILogistics if (fileNameWithoutExtension.IndexOf("-") > -1) fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim(); } - MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower()); - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); + _MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower()); + _Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + _Logistics2 = new List(); } public Logistics(string reportFullPath, string logistics) @@ -78,57 +89,57 @@ public class Logistics : ILogistics string key; DateTime dateTime; string[] segments; - Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); + _FileInfo = new(reportFullPath); + _Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1")) { - NullData = null; - JobID = "null"; - dateTime = new FileInfo(reportFullPath).LastWriteTime; - Sequence = dateTime.Ticks; - DateTimeFromSequence = dateTime; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; - MesEntity = DefaultMesEntity(dateTime); - ReportFullPath = reportFullPath; - ProcessJobID = "R##"; - MID = "null"; - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); + _NullData = null; + _JobID = "null"; + dateTime = _FileInfo.LastWriteTime; + _Sequence = dateTime.Ticks; + _DateTimeFromSequence = dateTime; + _TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + _MesEntity = DefaultMesEntity(dateTime); + _ReportFullPath = reportFullPath; + _ProcessJobID = "R##"; + _MID = "null"; + _Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + _Logistics2 = new List(); } else { string logistics1Line1 = Logistics1[0]; key = "NULL_DATA="; if (!logistics1Line1.Contains(key)) - NullData = null; + _NullData = null; else { segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - NullData = segments[1].Split(';')[0]; + _NullData = segments[1].Split(';')[0]; } key = "JOBID="; if (!logistics1Line1.Contains(key)) - JobID = "null"; + _JobID = "null"; else { segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - JobID = segments[1].Split(';')[0]; + _JobID = segments[1].Split(';')[0]; } key = "SEQUENCE="; if (!logistics1Line1.Contains(key)) - dateTime = new FileInfo(reportFullPath).LastWriteTime; + dateTime = _FileInfo.LastWriteTime; else { segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks) - dateTime = new FileInfo(reportFullPath).LastWriteTime; + dateTime = _FileInfo.LastWriteTime; else dateTime = new DateTime(sequence); } - Sequence = dateTime.Ticks; - DateTimeFromSequence = dateTime; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; - DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime; + _Sequence = dateTime.Ticks; + _DateTimeFromSequence = dateTime; + _TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + DateTime lastWriteTime = _FileInfo.LastWriteTime; if (TotalSecondsSinceLastWriteTimeFromSequence > 600) { if (lastWriteTime != dateTime) @@ -138,33 +149,32 @@ public class Logistics : ILogistics } key = "MES_ENTITY="; if (!logistics1Line1.Contains(key)) - MesEntity = DefaultMesEntity(dateTime); + _MesEntity = DefaultMesEntity(dateTime); else { segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - MesEntity = segments[1].Split(';')[0]; + _MesEntity = segments[1].Split(';')[0]; } - ReportFullPath = reportFullPath; + _ReportFullPath = reportFullPath; key = "PROCESS_JOBID="; if (!logistics1Line1.Contains(key)) - ProcessJobID = "R##"; + _ProcessJobID = "R##"; else { segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - ProcessJobID = segments[1].Split(';')[0]; + _ProcessJobID = segments[1].Split(';')[0]; } key = "MID="; if (!logistics1Line1.Contains(key)) - MID = "null"; + _MID = "null"; else { segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - MID = segments[1].Split(';')[0]; + _MID = segments[1].Split(';')[0]; } } Logistics2 logistics2; - Tags = new List(); - Logistics2 = new List(); + _Logistics2 = new List(); for (int i = 1; i < Logistics1.Count; i++) { if (Logistics1[i].StartsWith("LOGISTICS_2")) @@ -180,29 +190,12 @@ public class Logistics : ILogistics } } - public Logistics ShallowCopy() => (Logistics)MemberwiseClone(); - private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY"); - internal string GetLotViaMostCommonMethod() => MID.Substring(0, MID.Length - 2); - - internal string GetPocketNumberViaMostCommonMethod() => MID.Substring(MID.Length - 2); - - internal void Update(string dateTime, string processJobID, string mid) + internal void Update(string mid, string processJobID) { - if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted)) - dateTimeCasted = DateTime.Now; - NullData = null; - //JobID = Description.GetCellName(); - Sequence = dateTimeCasted.Ticks; - DateTimeFromSequence = dateTimeCasted; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds; - //MesEntity = DefaultMesEntity(dateTime); - //ReportFullPath = string.Empty; - ProcessJobID = processJobID; - MID = mid; - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); + _MID = mid; + _ProcessJobID = processJobID; } + } \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/WS.cs b/Adaptation/Shared/Metrology/WS.cs index b892219..12f261b 100644 --- a/Adaptation/Shared/Metrology/WS.cs +++ b/Adaptation/Shared/Metrology/WS.cs @@ -44,8 +44,7 @@ public partial class WS _ = stringBuilder.AppendLine(exception.Message); exception = exception.InnerException; } - if (results.Errors is null) - results.Errors = new List(); + results.Errors ??= new List(); results.Errors.Add(stringBuilder.ToString()); } return new(resultsJson, results); diff --git a/Adaptation/Shared/ProcessDataStandardFormat.cs b/Adaptation/Shared/ProcessDataStandardFormat.cs index 33a248e..b256f0f 100644 --- a/Adaptation/Shared/ProcessDataStandardFormat.cs +++ b/Adaptation/Shared/ProcessDataStandardFormat.cs @@ -12,8 +12,6 @@ namespace Adaptation.Shared; public class ProcessDataStandardFormat { - public const string RecordStart = "RECORD_START"; - public enum SearchFor { EquipmentIntegration = 1, @@ -93,8 +91,7 @@ public class ProcessDataStandardFormat string segment; List body = new(); StringBuilder logistics = new(); - if (lines is null) - lines = File.ReadAllLines(reportFullPath); + lines ??= File.ReadAllLines(reportFullPath); string[] segments; if (lines.Length < 7) segments = Array.Empty(); @@ -278,8 +275,7 @@ public class ProcessDataStandardFormat public static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List names, Dictionary> keyValuePairs, string dateFormat, string timeFormat, List pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List ignoreParameterNames = null) { StringBuilder result = new(); - if (ignoreParameterNames is null) - ignoreParameterNames = new List(); + ignoreParameterNames ??= new List(); if (useDateTimeFromSequence && !string.IsNullOrEmpty(format)) throw new Exception(); else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format)) @@ -359,8 +355,7 @@ public class ProcessDataStandardFormat if (string.IsNullOrEmpty(lines[i])) continue; segments = lines[i].Split(inputSeparator); - if (currentGroup is null) - currentGroup = segments.Length; + currentGroup ??= segments.Length; if (segments.Length != currentGroup) { currentGroup = segments.Length; diff --git a/Adaptation/Shared/Properties/IDescription.cs b/Adaptation/Shared/Properties/IDescription.cs index 93e6de5..1166e17 100644 --- a/Adaptation/Shared/Properties/IDescription.cs +++ b/Adaptation/Shared/Properties/IDescription.cs @@ -6,5 +6,6 @@ public interface IDescription int Test { get; } int Count { get; } int Index { get; } + string RDS { get; } } \ No newline at end of file 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/Shared/Properties/ILogistics.cs b/Adaptation/Shared/Properties/ILogistics.cs index dc1a106..398bed9 100644 --- a/Adaptation/Shared/Properties/ILogistics.cs +++ b/Adaptation/Shared/Properties/ILogistics.cs @@ -1,22 +1,23 @@ using System; using System.Collections.Generic; +using System.IO; namespace Adaptation.Shared.Properties; public interface ILogistics { - public object NullData { get; } - public string JobID { get; } //CellName - public long Sequence { get; } //Ticks public DateTime DateTimeFromSequence { get; } + public FileInfo FileInfo { get; } + public string JobID { get; } + public List Logistics1 { get; } + public List Logistics2 { get; } + public string MID { get; } + public string MesEntity { get; } + public object NullData { get; } + public string ProcessJobID { get; } + public string ReportFullPath { get; } + public long Sequence { get; } public double TotalSecondsSinceLastWriteTimeFromSequence { get; } - public string MesEntity { get; } //SPC - public string ReportFullPath { get; } //Extract file - public string ProcessJobID { get; set; } //Reactor (duplicate but I want it in the logistics) - public string MID { get; set; } //Lot & Pocket || Lot - public List Tags { get; set; } - public List Logistics1 { get; set; } - public List Logistics2 { get; set; } } \ No newline at end of file diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/EC.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/EC.cs index 1e92661..b7f51d3 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/EC.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/EC.cs @@ -14,23 +14,23 @@ public class EC : EAFLoggingUnitTesting #pragma warning disable CA2254 #pragma warning disable IDE0060 + internal static string DummyRoot { get; private set; } internal static EC EAFLoggingUnitTesting { get; private set; } - public EC() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + public EC() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { if (EAFLoggingUnitTesting is null) throw new Exception(); } - public EC(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + public EC(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) { } [ClassInitialize] public static void ClassInitialize(TestContext testContext) { - if (EAFLoggingUnitTesting is null) - EAFLoggingUnitTesting = new EC(testContext); + EAFLoggingUnitTesting ??= new EC(testContext); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize")); string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName); File.WriteAllText(fileNameAndText[0], fileNameAndText[1]); @@ -40,10 +40,8 @@ public class EC : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - if (EAFLoggingUnitTesting.Logger is not null) - EAFLoggingUnitTesting.Logger.LogInformation("Cleanup"); - if (EAFLoggingUnitTesting is not null) - EAFLoggingUnitTesting.Dispose(); + EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Dispose(); } } \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs index baa2c9d..c011f8e 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(); @@ -600,14 +621,10 @@ public class AdaptationTesting : ISMTP result = JsonSerializer.Deserialize(json, jsonSerializerOptions); if (string.IsNullOrEmpty(result.SourceFileFilter)) result.SourceFileFilter = string.Empty; - if (result.ErrorTargetFileLocation is null) - result.ErrorTargetFileLocation = string.Empty; - if (result.SourceFileLocation is null) - result.SourceFileLocation = string.Empty; - if (result.TargetFileLocation is null) - result.TargetFileLocation = string.Empty; - if (result.FolderAgeCheckIndividualSubFolders is null) - result.FolderAgeCheckIndividualSubFolders = false; + result.ErrorTargetFileLocation ??= string.Empty; + result.SourceFileLocation ??= string.Empty; + result.TargetFileLocation ??= string.Empty; + result.FolderAgeCheckIndividualSubFolders ??= false; result.ConnectionSettings = new List(); result.SourceFileFilters = result.SourceFileFilter.Split('|').ToList(); if (componentsCellComponentCellComponent.Equipment?.ConnectionSettings is not null) @@ -879,32 +896,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 +925,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 +939,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; @@ -954,40 +962,50 @@ public class AdaptationTesting : ISMTP } if (_TestContext.FullyQualifiedTestClassName.Contains(nameof(Extract))) { - if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation)) - _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation); - if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.SourceFileLocation)) - _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.SourceFileLocation); - if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.TargetFileLocation)) - _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.TargetFileLocation); + if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation)) + { + if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation)) + _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation); + } + if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.SourceFileLocation)) + { + if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.SourceFileLocation)) + _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.SourceFileLocation); + } + if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.TargetFileLocation)) + { + if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.TargetFileLocation)) + _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.TargetFileLocation); + } + if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder)) + { + if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder)) + _ = 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); @@ -998,18 +1016,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) @@ -1030,25 +1050,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])) @@ -1057,7 +1082,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(); @@ -1218,29 +1243,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..38cf36f 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) @@ -46,8 +55,7 @@ public class UnitTesting _IsEnvironment = new IsEnvironment(testCategory); } } - if (_IsEnvironment is null) - _IsEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached); + _IsEnvironment ??= new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached); } } diff --git a/Adaptation/appsettings.Development.json b/Adaptation/appsettings.Development.json index 923c216..f7e0b36 100644 --- a/Adaptation/appsettings.Development.json +++ b/Adaptation/appsettings.Development.json @@ -59,7 +59,7 @@ "Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k=" }, { - "Use": true, + "Use": false, "Letter": "k", "Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization", "User": "INFINEON\\MESGaNEAF", @@ -80,35 +80,35 @@ "Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=" }, { - "Use": true, + "Use": false, "Letter": "n", "Share": "\\\\10.95.154.22\\C", "User": "10.95.154.22\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "o", "Share": "\\\\10.95.154.16\\Aixtron", "User": "10.95.154.16\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "p", "Share": "\\\\10.95.154.15\\Aixtron", "User": "10.95.154.15\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "q", "Share": "\\\\10.95.154.21\\Data", "User": "10.95.154.21\\XRD04Admin", "Password": "v1NOsEOCvbnhzKabspPcCQ==" }, { - "Use": true, + "Use": false, "Letter": "r", "Share": "\\\\10.95.154.23\\Data", "User": "\"10.95.154.23\\infineon us\"", diff --git a/Adaptation/appsettings.json b/Adaptation/appsettings.json index bfeb1ac..d15d437 100644 --- a/Adaptation/appsettings.json +++ b/Adaptation/appsettings.json @@ -59,7 +59,7 @@ "Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k=" }, { - "Use": true, + "Use": false, "Letter": "k", "Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization", "User": "INFINEON\\MESGaNEAF", @@ -80,35 +80,35 @@ "Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=" }, { - "Use": true, + "Use": false, "Letter": "n", "Share": "\\\\10.95.154.22\\C", "User": "10.95.154.22\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "o", "Share": "\\\\10.95.154.16\\Aixtron", "User": "10.95.154.16\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "p", "Share": "\\\\10.95.154.15\\Aixtron", "User": "10.95.154.15\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "q", "Share": "\\\\10.95.154.21\\Data", "User": "10.95.154.21\\XRD04Admin", "Password": "v1NOsEOCvbnhzKabspPcCQ==" }, { - "Use": true, + "Use": false, "Letter": "r", "Share": "\\\\10.95.154.23\\Data", "User": "\"10.95.154.23\\infineon us\"", diff --git a/EC.csproj b/EC.csproj index ff68781..731dc49 100644 --- a/EC.csproj +++ b/EC.csproj @@ -107,6 +107,12 @@ + + Component + + + + @@ -144,7 +150,7 @@ - 2.43.0 + 2.47.0 6.0.3 diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 489a0b6..7eb7bc0 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.47.0.0")] +[assembly: AssemblyFileVersion("2.47.0.0")] diff --git a/appsettings.Development.json b/appsettings.Development.json index 923c216..f7e0b36 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -59,7 +59,7 @@ "Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k=" }, { - "Use": true, + "Use": false, "Letter": "k", "Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization", "User": "INFINEON\\MESGaNEAF", @@ -80,35 +80,35 @@ "Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=" }, { - "Use": true, + "Use": false, "Letter": "n", "Share": "\\\\10.95.154.22\\C", "User": "10.95.154.22\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "o", "Share": "\\\\10.95.154.16\\Aixtron", "User": "10.95.154.16\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "p", "Share": "\\\\10.95.154.15\\Aixtron", "User": "10.95.154.15\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "q", "Share": "\\\\10.95.154.21\\Data", "User": "10.95.154.21\\XRD04Admin", "Password": "v1NOsEOCvbnhzKabspPcCQ==" }, { - "Use": true, + "Use": false, "Letter": "r", "Share": "\\\\10.95.154.23\\Data", "User": "\"10.95.154.23\\infineon us\"", diff --git a/appsettings.json b/appsettings.json index bfeb1ac..d15d437 100644 --- a/appsettings.json +++ b/appsettings.json @@ -59,7 +59,7 @@ "Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k=" }, { - "Use": true, + "Use": false, "Letter": "k", "Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization", "User": "INFINEON\\MESGaNEAF", @@ -80,35 +80,35 @@ "Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=" }, { - "Use": true, + "Use": false, "Letter": "n", "Share": "\\\\10.95.154.22\\C", "User": "10.95.154.22\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "o", "Share": "\\\\10.95.154.16\\Aixtron", "User": "10.95.154.16\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "p", "Share": "\\\\10.95.154.15\\Aixtron", "User": "10.95.154.15\\Aixtron", "Password": "DYVBOr2HJdB7KOhd/IFhLA==" }, { - "Use": true, + "Use": false, "Letter": "q", "Share": "\\\\10.95.154.21\\Data", "User": "10.95.154.21\\XRD04Admin", "Password": "v1NOsEOCvbnhzKabspPcCQ==" }, { - "Use": true, + "Use": false, "Letter": "r", "Share": "\\\\10.95.154.23\\Data", "User": "\"10.95.154.23\\infineon us\"",