diff --git a/.gitignore b/.gitignore index eab1f67..c19d760 100644 --- a/.gitignore +++ b/.gitignore @@ -331,10 +331,11 @@ ASALocalRun/ ## ## Visual Studio Code ## -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +*/!.vscode/extensions.json +*/!.vscode/launch.json +*/!.vscode/settings.json +*/!.vscode/tasks.json +*/.vscode/* +*/.vscode/ReportGenerator/* *.lnk diff --git a/Adaptation/.config/dotnet-tools.json b/Adaptation/.config/dotnet-tools.json new file mode 100644 index 0000000..cd368e1 --- /dev/null +++ b/Adaptation/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-reportgenerator-globaltool": { + "version": "5.1.15", + "commands": [ + "reportgenerator" + ] + } + } +} \ No newline at end of file diff --git a/Adaptation/.editorconfig b/Adaptation/.editorconfig index b84fca4..b45701e 100644 --- a/Adaptation/.editorconfig +++ b/Adaptation/.editorconfig @@ -76,12 +76,15 @@ csharp_using_directive_placement = outside_namespace dotnet_code_quality_unused_parameters = all dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter dotnet_code_quality.CAXXXX.api_surface = private, internal +dotnet_diagnostic.CA1816.severity = none # CA1816: Call GC.SuppressFinalize correctly dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations 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.CA1846.severity = none # CA1846: Prefer AsSpan over Substring +dotnet_diagnostic.CA1847.severity = none # CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters 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.IDE0004.severity = warning # IDE0004: Cast is redundant. 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) diff --git a/Adaptation/.vscode/settings.json b/Adaptation/.vscode/settings.json index f8fc527..3ecf96c 100644 --- a/Adaptation/.vscode/settings.json +++ b/Adaptation/.vscode/settings.json @@ -28,6 +28,7 @@ "TIBCO", "Wafr" ], + "coverage-gutters.coverageBaseDir": "../../../../MET08DDUPSP1TBI/05_TestResults/TestResults/**", "workbench.colorCustomizations": { "activityBar.activeBackground": "#50b98e", "activityBar.activeBorder": "#f0e8f6", diff --git a/Adaptation/FileHandlers/Archive/FileRead.cs b/Adaptation/FileHandlers/Archive/FileRead.cs index 6584c7f..f2239db 100644 --- a/Adaptation/FileHandlers/Archive/FileRead.cs +++ b/Adaptation/FileHandlers/Archive/FileRead.cs @@ -115,7 +115,7 @@ public class FileRead : Shared.FileRead, IFileRead } } - private void MoveArchive(DateTime dateTime) + private void MoveArchive(string reportFullPath, DateTime dateTime) { if (dateTime == DateTime.MinValue) { } @@ -128,12 +128,17 @@ public class FileRead : Shared.FileRead, IFileRead string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID); if (!Directory.Exists(jobIdDirectory)) _ = Directory.CreateDirectory(jobIdDirectory); - string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() }; - if ((matchDirectories is null) || matchDirectories.Length != 1) - throw new Exception("Didn't find directory by logistics sequence"); - string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]); - destinationArchiveDirectory = Path.Combine(destinationArchiveDirectory, Path.GetFileName(sourceDirectory)); - Directory.Move(sourceDirectory, destinationArchiveDirectory); + if (!Directory.GetDirectories(jobIdDirectory).Any()) + File.Copy(reportFullPath, Path.Combine(destinationArchiveDirectory, Path.GetFileName(reportFullPath))); + else + { + string[] matchDirectories = GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).ToArray(); + if (matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]); + destinationArchiveDirectory = Path.Combine(destinationArchiveDirectory, Path.GetFileName(sourceDirectory)); + Directory.Move(sourceDirectory, destinationArchiveDirectory); + } } private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) @@ -146,7 +151,7 @@ public class FileRead : Shared.FileRead, IFileRead List descriptions = GetDuplicatorDescriptions(jsonElements); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) - MoveArchive(dateTime); + MoveArchive(reportFullPath, dateTime); results = new Tuple>(pdsf.Item1, tests, jsonElements, new List()); return results; } diff --git a/Adaptation/FileHandlers/MoveMatchingFiles/FileRead.cs b/Adaptation/FileHandlers/MoveMatchingFiles/FileRead.cs index ad68b87..7ec2cfb 100644 --- a/Adaptation/FileHandlers/MoveMatchingFiles/FileRead.cs +++ b/Adaptation/FileHandlers/MoveMatchingFiles/FileRead.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using System.Text.Json; using System.Threading; @@ -153,18 +154,36 @@ public class FileRead : Shared.FileRead, IFileRead return results; } - private void MoveCollection(DateTime dateTime, List<(string matchingFile, string checkFile)> collection) + private static List<(string, string, string, string, string)> GetCollection(List<(string matchingFile, string checkFile)> collection) { - long preWait; + List<(string, string, string, string, string)> results = new(); string errFile; string checkDirectory; + string noWaitDirectory; foreach ((string matchingFile, string checkFile) in collection) { errFile = string.Concat(checkFile, ".err"); checkDirectory = Path.GetDirectoryName(checkFile); if (!Directory.Exists(checkDirectory)) _ = Directory.CreateDirectory(checkDirectory); + noWaitDirectory = Path.Combine(checkDirectory, "NoWaitDirectory"); + results.Add(new(matchingFile, checkFile, errFile, checkDirectory, noWaitDirectory)); + } + return results; + } + + private void MoveCollection(DateTime dateTime, List<(string matchingFile, string checkFile)> collection) + { + long preWait; + List<(string checkFile, string errFile)> postCollection = new(); + foreach ((string matchingFile, string checkFile, string errFile, string checkDirectory, string noWaitDirectory) in GetCollection(collection)) + { File.Move(matchingFile, checkFile); + if (Directory.Exists(noWaitDirectory)) + { + postCollection.Add(new(checkFile, errFile)); + continue; + } if (_FileConnectorConfiguration?.FileHandleWaitTime is null) preWait = DateTime.Now.AddMilliseconds(1234).Ticks; else @@ -182,10 +201,45 @@ public class FileRead : Shared.FileRead, IFileRead if (!File.Exists(checkFile)) break; if (new TimeSpan(DateTime.Now.Ticks - dateTime.Ticks).TotalSeconds > _BreakAfterSeconds) - throw new Exception($"Not all files were consumned after {_BreakAfterSeconds} second(s)!"); + throw new Exception($"Not all files were consumed after {_BreakAfterSeconds} second(s)!"); Thread.Sleep(500); } } + if (postCollection.Any()) + { + Thread.Sleep(500); + StringBuilder stringBuilder = new(); + foreach ((string checkFile, string errFile) in postCollection) + { + if (File.Exists(errFile)) + _ = stringBuilder.AppendLine(File.ReadAllText(errFile)); + if (File.Exists(checkFile)) + _ = stringBuilder.AppendLine($"<{checkFile}> was not consumed by the end!"); + } + if (stringBuilder.Length > 0) + throw new Exception(stringBuilder.ToString()); + } + } + + private static void CreatePointerFile(int numberLength, string parentDirectory, List matchingFiles) + { +#nullable enable + string checkFile; + string writeFile; + string? directoryName; + int parentDirectoryLength = parentDirectory.Length; + foreach (string matchingFile in matchingFiles) + { + directoryName = Path.GetDirectoryName(matchingFile); + if (directoryName is null) + continue; + checkFile = $"{matchingFile[0]}{directoryName.Substring(parentDirectoryLength + numberLength + 1)}"; + writeFile = Path.Combine(parentDirectory, $"{directoryName.Substring(parentDirectory.Length + 1, numberLength)}.txt"); + if (File.Exists(writeFile)) + continue; + File.AppendAllLines(writeFile, new string[] { parentDirectory, matchingFile, directoryName, checkFile }); + } +#nullable disable } private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) @@ -201,6 +255,9 @@ public class FileRead : Shared.FileRead, IFileRead List matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories); if (matchingFiles.Count != searchDirectories.Count) throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!"); + try + { CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); } + catch (Exception) { } List<(string matchingFile, string checkFile)> collection = GetCollection(numberLength, parentParentDirectory, matchingFiles); MoveCollection(dateTime, collection); return results; diff --git a/Adaptation/FileHandlers/OpenInsight/FileRead.cs b/Adaptation/FileHandlers/OpenInsight/FileRead.cs index 870f413..f8763a2 100644 --- a/Adaptation/FileHandlers/OpenInsight/FileRead.cs +++ b/Adaptation/FileHandlers/OpenInsight/FileRead.cs @@ -6,6 +6,7 @@ using Adaptation.Shared.Methods; using Adaptation.Shared.Metrology; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Text; @@ -19,6 +20,8 @@ public class FileRead : Shared.FileRead, IFileRead private string _LastLines; private readonly string _IqsConnectionString; private readonly string _OpenInsightFilePattern; + private readonly string _OpenInsightApiECDirectory; + private readonly string _OpenInsightApiIFXDirectory; 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) @@ -33,6 +36,8 @@ public class FileRead : Shared.FileRead, IFileRead if (!_IsDuplicator) throw new Exception(cellInstanceConnectionName); _LastLines = string.Empty; + _OpenInsightApiIFXDirectory = @"\\messdv002.na.infineon.com\Candela\Archive\API"; + _OpenInsightApiECDirectory = @"\\messv02ecc1.ec.local\EC_Metrology_Si\Archive\API"; _IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString"); _OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern"); } @@ -165,7 +170,7 @@ public class FileRead : Shared.FileRead, IFileRead return new Tuple(result.ToString(), x.Date); } - private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List descriptions, Test[] tests) + private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, string logistics, List descriptions, Test[] tests) { if (dateTime == DateTime.MinValue) { } @@ -186,17 +191,22 @@ public class FileRead : Shared.FileRead, IFileRead if (save && !string.IsNullOrEmpty(check)) { _LastLines = check; + int? count; long? subGroupId; long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; - if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN) || string.IsNullOrEmpty(descriptions[0].RDS)) - subGroupId = null; + if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN)) + (subGroupId, count) = (null, null); else - (subGroupId, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait); + (subGroupId, count, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait); if (subGroupId is null) collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines.Item1)); - else + else if (count is null) collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines.Item1)); + else + collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} E{count.Value} {_OpenInsightFilePattern}"), lines.Item1)); + string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + FromIQS.Save(_OpenInsightApiECDirectory, _OpenInsightApiIFXDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines.Item1, subGroupId, weekOfYear); } if (!Directory.Exists(duplicateDirectory)) _ = Directory.CreateDirectory(duplicateDirectory); @@ -216,7 +226,7 @@ public class FileRead : Shared.FileRead, IFileRead List descriptions = txt.ProcessData.GetDescriptions(jsonElements); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) - SaveOpenInsightFile(reportFullPath, dateTime, descriptions, tests); + SaveOpenInsightFile(reportFullPath, dateTime, pdsf.Item1, descriptions, tests); results = new Tuple>(pdsf.Item1, tests, jsonElements, new List()); return results; } diff --git a/Adaptation/FileHandlers/OpenInsight/FromIQS.cs b/Adaptation/FileHandlers/OpenInsight/FromIQS.cs index bfd065e..fc6d583 100644 --- a/Adaptation/FileHandlers/OpenInsight/FromIQS.cs +++ b/Adaptation/FileHandlers/OpenInsight/FromIQS.cs @@ -3,6 +3,7 @@ using System; using System.Data; using System.Data.SqlClient; using System.Globalization; +using System.IO; using System.Linq; using System.Text; using System.Text.Json; @@ -29,7 +30,12 @@ public class FromIQS .AppendLine(" pl.f_name pl_name, ") .AppendLine(" pd.f_name pd_name, ") .AppendLine(" td.f_test td_test, ") - .AppendLine(" td.f_name td_name ") + .AppendLine(" td.f_name td_name, ") + .AppendLine(" (select count(ev.f_evnt) ") + .AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ") + .AppendLine(" where ev.f_prcs = rd.f_prcs ") + .AppendLine(" and ev.f_part = pd.f_part ") + .AppendLine(" and ev.f_sgtm = se.f_sgtm) ev_count ") .AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ") .AppendLine(" join [spcepiworld].[dbo].[prcs_dat] rd ") .AppendLine(" on se.f_prcs = rd.f_prcs ") @@ -44,12 +50,13 @@ public class FromIQS .AppendLine(" where se.f_flag = 0 "); if (subGroupId is not null) _ = result.Append(" and se.f_sgrp = ").Append(subGroupId).AppendLine(" "); + if (!string.IsNullOrEmpty(description.RDS)) + _ = result.Append(" and pl.f_name = '").Append(description.RDS).AppendLine("' "); _ = result .Append(" and rd.f_name = '").Append(description.Reactor).AppendLine("' ") .Append(" and pd.f_name = '").Append(description.PSN).AppendLine("' ") .AppendLine(" and jd.f_name in ('SP1') ") .Append(" and jd.f_name = '").Append(logistics.MesEntity).AppendLine("' ") - .Append(" and pl.f_name = '").Append(description.RDS).AppendLine("' ") .Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ") .AppendLine(" for json path "); return result.ToString(); @@ -67,9 +74,10 @@ public class FromIQS return stringBuilder; } - internal static (long?, string) GetCommandText(string connectionString, Logistics logistics, txt.Description description, long breakAfter, long preWait) + internal static (long?, int?, string) GetCommandText(string connectionString, Logistics logistics, txt.Description description, long breakAfter, long preWait) { string dateTime; + int? count = null; string commandText; long? result = null; string dateFormat = txt.Description.GetDateFormat(); @@ -113,10 +121,99 @@ public class FromIQS { result = subGroupId; commandText = GetCommandText(logistics, description, dateTime, subGroupId); + if (jsonProperties.Any() && jsonProperties[10].Name == "ev_count" && int.TryParse(jsonProperties[10].Value.ToString(), out int evCount)) + count = evCount; } } } - return new(result, commandText); + return new(result, count, commandText); + } + + private static string GetJson(Logistics logistics, string logisticLines, txt.Description description) + { + string result; + StringBuilder stringBuilder = new(); + var @object = new + { + description.MesEntity, + description.Employee, + // description.Layer, + description.PSN, + description.RDS, + description.Reactor, + description.Recipe, + // description.Zone, + logistics.DateTimeFromSequence.Ticks + }; + string[] pair; + string safeValue; + string[] segments; + string serializerValue; + foreach (string line in logisticLines.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) + { + segments = line.Split('\t'); + if (segments.Length < 2) + continue; + segments = segments[1].Split(';'); + _ = stringBuilder.Append('{'); + foreach (string segment in segments) + { + pair = segment.Split('='); + if (pair.Length != 2 || pair[0].Length < 3) + continue; + serializerValue = JsonSerializer.Serialize(pair[1]); + safeValue = serializerValue.Substring(1, serializerValue.Length - 2); + _ = stringBuilder.Append('"').Append(pair[0].Substring(2)).Append('"').Append(':').Append('"').Append(safeValue).Append('"').Append(','); + } + if (stringBuilder.Length > 0) + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + _ = stringBuilder.Append('}').Append(','); + } + if (stringBuilder.Length > 0) + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + _ = stringBuilder.Append(']').Append('}'); + _ = stringBuilder.Insert(0, ",\"Logistics\":["); + string json = JsonSerializer.Serialize(@object); + _ = stringBuilder.Insert(0, json.Substring(0, json.Length - 1)); + JsonElement? jsonElement = JsonSerializer.Deserialize(stringBuilder.ToString()); + result = jsonElement is null ? "{}" : JsonSerializer.Serialize(jsonElement, new JsonSerializerOptions { WriteIndented = true }); + return result; + } + + internal static void Save(string openInsightApiECDirectory, string openInsightApiIFXDirectory, Logistics logistics, string reportFullPath, string logisticLines, txt.Description description, string lines, long? subGroupId, string weekOfYear) + { + string checkFile; + string fileName = Path.GetFileName(reportFullPath); + string json = GetJson(logistics, logisticLines, description); + string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory); + string? ifxPathRoot = Path.GetPathRoot(openInsightApiIFXDirectory); + bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot); + bool ifxExists = ifxPathRoot is not null && Directory.Exists(ifxPathRoot); + string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}"; + string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}"); + string ifxDirectory = Path.Combine(openInsightApiIFXDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}"); + if (ecExists && !Directory.Exists(ecDirectory)) + _ = Directory.CreateDirectory(ecDirectory); + if (ifxExists && !Directory.Exists(ifxDirectory)) + _ = Directory.CreateDirectory(ifxDirectory); + checkFile = Path.Combine(ecDirectory, fileName); + if (ecExists && !File.Exists(checkFile)) + File.Copy(reportFullPath, checkFile); + checkFile = Path.Combine(ifxDirectory, fileName); + if (ifxExists && !File.Exists(checkFile)) + File.Copy(reportFullPath, checkFile); + checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt"); + if (ecExists && !File.Exists(checkFile)) + File.WriteAllText(checkFile, lines); + checkFile = Path.Combine(ifxDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt"); + if (ifxExists && !File.Exists(checkFile)) + File.WriteAllText(checkFile, lines); + checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json"); + if (ecExists && !File.Exists(checkFile)) + File.WriteAllText(checkFile, json); + checkFile = Path.Combine(ifxDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json"); + if (ifxExists && !File.Exists(checkFile)) + File.WriteAllText(checkFile, json); } #nullable disable diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs index 1ecf698..49ea9cd 100644 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs @@ -641,7 +641,7 @@ public class WSRequest if (!wsResults.Success) throw new Exception(wsResults.ToString()); } - WS.Results metrologyWSRequest = JsonSerializer.Deserialize(json); + WS.Results metrologyWSRequest = JsonSerializer.Deserialize(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); long wsResultsHeaderID = metrologyWSRequest.HeaderID; string[] summaryFiles = Directory.GetFiles(matchDirectory, "*.txt", SearchOption.TopDirectoryOnly); if (summaryFiles.Length != 1) diff --git a/Adaptation/FileHandlers/Processed/FileRead.cs b/Adaptation/FileHandlers/Processed/FileRead.cs index b009e8c..3e37b43 100644 --- a/Adaptation/FileHandlers/Processed/FileRead.cs +++ b/Adaptation/FileHandlers/Processed/FileRead.cs @@ -118,7 +118,7 @@ public class FileRead : Shared.FileRead, IFileRead if (!Directory.Exists(jobIdDirectory)) _ = Directory.CreateDirectory(jobIdDirectory); string[] matchDirectories = GetInProcessDirectory(jobIdDirectory); - if ((matchDirectories is null) || matchDirectories.Length != 1) + if (matchDirectories.Length != 1) throw new Exception("Didn't find directory by logistics sequence"); if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime); diff --git a/Adaptation/FileHandlers/TIBCO/Transport/Job.cs b/Adaptation/FileHandlers/TIBCO/Transport/Job.cs index 9a6c1dc..1397933 100644 --- a/Adaptation/FileHandlers/TIBCO/Transport/Job.cs +++ b/Adaptation/FileHandlers/TIBCO/Transport/Job.cs @@ -149,11 +149,11 @@ public class Job private static bool IsInvalid(int? rdsNumber) => rdsNumber is null or < 100000 or > 100000000; - private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments) + private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments, bool hasRDS) { string rds; string reactor; - if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText)) + if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText) || (segments.Length > 1 && !hasRDS)) reactor = defaultReactor; else reactor = segments[0]; @@ -169,11 +169,11 @@ public class Job return new(reactor, rds); } - private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments) + private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments, bool hasRDS) { string psn; string layer; - if (segments.Length <= 2) + if (segments.Length <= 2 || (segments.Length > 1 && !hasRDS)) { psn = defaultPSN; layer = defaultLayer; @@ -222,8 +222,9 @@ public class Job string defaultLayer = string.Empty; string defaultReactor = string.Empty; string[] segments = input.MID.Split(new char[] { '-' }); + bool hasRDS = Regex.IsMatch(input.MID, "[-]?[0-9]{5,}[-]?"); string formattedText = Regex.Replace(input.MID, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; - (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, input.MID, formattedText, segments); + (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, input.MID, formattedText, segments, hasRDS); if (string.IsNullOrEmpty(rds)) rdsNumber = 0; else @@ -238,7 +239,7 @@ public class Job else { reactorNumber = reactorCheck; - (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments); + (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments, hasRDS); zone = GetZone(segments); } return new(layer, psn, rdsNumber, reactorNumber, zone); diff --git a/Adaptation/FileHandlers/txt/ProcessData.cs b/Adaptation/FileHandlers/txt/ProcessData.cs index d6dbcf8..0a81e44 100644 --- a/Adaptation/FileHandlers/txt/ProcessData.cs +++ b/Adaptation/FileHandlers/txt/ProcessData.cs @@ -457,11 +457,11 @@ public class ProcessData : IProcessData } } - private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments) + private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments, bool hasRDS) { string rds; string reactor; - if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText)) + if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText) || (segments.Length > 1 && !hasRDS)) reactor = defaultReactor; else reactor = segments[0]; @@ -477,11 +477,11 @@ public class ProcessData : IProcessData return new(reactor, rds); } - private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments) + private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments, bool hasRDS) { string psn; string layer; - if (segments.Length <= 2) + if (segments.Length <= 2 || (segments.Length > 1 && !hasRDS)) { psn = defaultPSN; layer = defaultLayer; @@ -563,8 +563,9 @@ public class ProcessData : IProcessData if (lot.Length > 2 && lot[0] == '1' && (lot[1] == 'T' || lot[1] == 't')) lot = lot.Substring(2); string[] segments = lot.Split('-'); - (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments); - (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments); + bool hasRDS = Regex.IsMatch(lot, "[-]?[0-9]{5,}[-]?"); + (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments, hasRDS); + (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments, hasRDS); zone = GetZone(segments); employee = defaultEmployee; } diff --git a/Adaptation/MET08DDUPSP1TBI-Development.yml b/Adaptation/MET08DDUPSP1TBI-Development.yml index 8d0de5d..a860f1e 100644 --- a/Adaptation/MET08DDUPSP1TBI-Development.yml +++ b/Adaptation/MET08DDUPSP1TBI-Development.yml @@ -66,15 +66,15 @@ steps: displayName: "Safe storage of app secrets - Adaptation" - task: CopyFiles@2 - displayName: 'Copy Files to: - GhostPCL' + displayName: "Copy Files to: - GhostPCL" inputs: - SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL\gpcl6win64 ' + SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL\gpcl6win64' TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' OverWrite: true enabled: false - task: CopyFiles@2 - displayName: 'Copy Files to: - LincPDFC' + displayName: "Copy Files to: - LincPDFC" inputs: SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC\v2.6.6.21' TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' @@ -82,7 +82,7 @@ steps: enabled: false - task: CopyFiles@2 - displayName: 'Copy Files to: - PDF-Text-Stripper' + displayName: "Copy Files to: - PDF-Text-Stripper" inputs: SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\PDF-Text-Stripper\v4.8.0.1' TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' @@ -93,38 +93,64 @@ steps: workingDirectory: Adaptation displayName: "Core Build - Adaptation" + - powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } + workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)" + displayName: "PowerShell Script" + continueOnError: true + - script: "dotnet test --configuration $(Configuration)" - workingDirectory: Tests + workingDirectory: Adaptation displayName: "Core Test" + - script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)' + displayName: "Move Results" + - script: '"C:\program files\dotnet\dotnet.exe" tool restore' workingDirectory: Adaptation displayName: "Tool Restore" enabled: false - - script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:.vscode/TestResults/*/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark' + - script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark' workingDirectory: Adaptation displayName: "Report Generator" enabled: false + - task: PublishTestResults@2 + displayName: "Publish Test Results **/*.trx" + inputs: + testResultsFormat: VSTest + testResultsFiles: "**/*.trx" + testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" + searchFolder: "$(System.DefaultWorkingDirectory)" + + - task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1 + displayName: "Create work item" + inputs: + teamProject: "Mesa_FI" + workItemType: Bug + title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration) + assignedTo: "$(Build.RequestedForId)" + enabled: false + - script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)' workingDirectory: Adaptation displayName: "Core Publish" + enabled: false - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)' - displayName: 'MSBuild Restore' + displayName: "MSBuild Restore" - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8' displayName: MSBuild - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt' - displayName: 'Commit Id' + displayName: "Commit Id" - task: CopyFiles@2 displayName: 'Copy Files to: D:\Framework4.8' inputs: SourceFolder: 'bin\$(Configuration)' - Contents: '*$(Build.Repository.Name)*' + Contents: "*$(Build.Repository.Name)*" TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' OverWrite: true enabled: false @@ -133,14 +159,14 @@ steps: displayName: 'Copy Files to: \\messv02ecc1.ec.local\EC_EAFRepository' inputs: SourceFolder: 'bin\$(Configuration)' - Contents: '*$(Build.Repository.Name)*' + Contents: "*$(Build.Repository.Name)*" TargetFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)' OverWrite: true enabled: false - script: | "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) - workingDirectory: Tests + workingDirectory: Adaptation displayName: "Core Clean - Tests" - script: | @@ -149,5 +175,5 @@ steps: displayName: "Core Clean - Adaptation" - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' - displayName: 'Force Fail' + displayName: "Force Fail" enabled: false diff --git a/Adaptation/MET08DDUPSP1TBI.Tests.csproj b/Adaptation/MET08DDUPSP1TBI.Tests.csproj index 0afefc4..659e4a5 100644 --- a/Adaptation/MET08DDUPSP1TBI.Tests.csproj +++ b/Adaptation/MET08DDUPSP1TBI.Tests.csproj @@ -33,8 +33,17 @@ Linux - - + + + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + + @@ -44,51 +53,31 @@ - + - - - - - - + + + NU1701 + - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + - + NU1701 NU1701 NU1701 NU1701 - - NU1701 - NU1701 - NU1701 - NU1701 - NU1701 - NU1701 - NU1701 - NU1701 - Always @@ -97,4 +86,18 @@ Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + \ No newline at end of file diff --git a/Adaptation/MET08DDUPSP1TBI.yml b/Adaptation/MET08DDUPSP1TBI.yml index 014b5a0..4b451ba 100644 --- a/Adaptation/MET08DDUPSP1TBI.yml +++ b/Adaptation/MET08DDUPSP1TBI.yml @@ -66,21 +66,21 @@ steps: displayName: "Safe storage of app secrets - Adaptation" - task: CopyFiles@2 - displayName: 'Copy Files to: - GhostPCL' + displayName: "Copy Files to: - GhostPCL" inputs: - SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL\gpcl6win64 ' + SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL\gpcl6win64' TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' OverWrite: true - task: CopyFiles@2 - displayName: 'Copy Files to: - LincPDFC' + displayName: "Copy Files to: - LincPDFC" inputs: SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC\v2.6.6.21' TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' OverWrite: true - task: CopyFiles@2 - displayName: 'Copy Files to: - PDF-Text-Stripper' + displayName: "Copy Files to: - PDF-Text-Stripper" inputs: SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\PDF-Text-Stripper\v4.8.0.1' TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' @@ -90,38 +90,64 @@ steps: workingDirectory: Adaptation displayName: "Core Build - Adaptation" + - powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } + workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)" + displayName: "PowerShell Script" + continueOnError: true + - script: "dotnet test --configuration $(Configuration)" - workingDirectory: Tests + workingDirectory: Adaptation displayName: "Core Test" + - script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)' + displayName: "Move Results" + - script: '"C:\program files\dotnet\dotnet.exe" tool restore' workingDirectory: Adaptation displayName: "Tool Restore" enabled: false - - script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:.vscode/TestResults/*/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark' + - script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark' workingDirectory: Adaptation displayName: "Report Generator" enabled: false + - task: PublishTestResults@2 + displayName: "Publish Test Results **/*.trx" + inputs: + testResultsFormat: VSTest + testResultsFiles: "**/*.trx" + testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" + searchFolder: "$(System.DefaultWorkingDirectory)" + + - task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1 + displayName: "Create work item" + inputs: + teamProject: "Mesa_FI" + workItemType: Bug + title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration) + assignedTo: "$(Build.RequestedForId)" + enabled: false + - script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)' workingDirectory: Adaptation displayName: "Core Publish" + enabled: false - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)' - displayName: 'MSBuild Restore' + displayName: "MSBuild Restore" - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8' displayName: MSBuild - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt' - displayName: 'Commit Id' + displayName: "Commit Id" - task: CopyFiles@2 displayName: 'Copy Files to: D:\Framework4.8' inputs: SourceFolder: 'bin\$(Configuration)' - Contents: '*$(Build.Repository.Name)*' + Contents: "*$(Build.Repository.Name)*" TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' OverWrite: true @@ -129,13 +155,13 @@ steps: displayName: 'Copy Files to: \\messv02ecc1.ec.local\EC_EAFRepository' inputs: SourceFolder: 'bin\$(Configuration)' - Contents: '*$(Build.Repository.Name)*' + Contents: "*$(Build.Repository.Name)*" TargetFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)' OverWrite: true - script: | "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) - workingDirectory: Tests + workingDirectory: Adaptation displayName: "Core Clean - Tests" - script: | @@ -144,5 +170,5 @@ steps: displayName: "Core Clean - Adaptation" - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' - displayName: 'Force Fail' + displayName: "Force Fail" enabled: false diff --git a/Adaptation/Shared/Metrology/WS.cs b/Adaptation/Shared/Metrology/WS.cs index 12f261b..844efea 100644 --- a/Adaptation/Shared/Metrology/WS.cs +++ b/Adaptation/Shared/Metrology/WS.cs @@ -30,7 +30,7 @@ public partial class WS }; HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result; resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result; - results = JsonSerializer.Deserialize(resultsJson); + results = JsonSerializer.Deserialize(resultsJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); } if (!results.Success) results.Errors.Add(results.ToString()); @@ -45,6 +45,7 @@ public partial class WS exception = exception.InnerException; } results.Errors ??= new List(); + results.Errors.Add(resultsJson); results.Errors.Add(stringBuilder.ToString()); } return new(resultsJson, results); diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSP1TBI.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSP1TBI.cs index d220619..3682fe2 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSP1TBI.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSP1TBI.cs @@ -41,7 +41,7 @@ public class MET08DDUPSP1TBI : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101-EQPT.cs index 00dbd62..f46e477 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101-EQPT.cs @@ -40,7 +40,7 @@ public class SP101_EQPT : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101.cs index 22e0747..09e81ab 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/SP101.cs @@ -41,7 +41,7 @@ public class SP101 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSP1TBI.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSP1TBI.cs index 53b2556..a376913 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSP1TBI.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSP1TBI.cs @@ -41,7 +41,7 @@ public class MET08DDUPSP1TBI : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101-EQPT.cs index d5f95f5..8e1e900 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101-EQPT.cs @@ -40,7 +40,7 @@ public class SP101_EQPT : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101.cs index 28551e4..cd67d4f 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/SP101.cs @@ -41,7 +41,7 @@ public class SP101 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.3/MET08DDUPSP1TBI.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.3/MET08DDUPSP1TBI.cs index 0f11a6b..d9b62a8 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.3/MET08DDUPSP1TBI.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.3/MET08DDUPSP1TBI.cs @@ -41,7 +41,7 @@ public class MET08DDUPSP1TBI : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSP1TBI.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSP1TBI.cs index a1da8ea..a14caca 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSP1TBI.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSP1TBI.cs @@ -43,7 +43,7 @@ public class MET08DDUPSP1TBI : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101-EQPT.cs index cf09058..d5ec785 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101-EQPT.cs @@ -42,7 +42,7 @@ public class SP101_EQPT : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101.cs index 3519f3a..c52b677 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/SP101.cs @@ -43,7 +43,7 @@ public class SP101 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101-EQPT.cs index d1a2c04..a530e64 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101-EQPT.cs @@ -42,7 +42,7 @@ public class SP101_EQPT : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101.cs index 2ce687d..1cd7778 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/SP101.cs @@ -43,7 +43,7 @@ public class SP101 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSP1TBI.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSP1TBI.cs index 782fd5e..8450496 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSP1TBI.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSP1TBI.cs @@ -43,7 +43,7 @@ public class MET08DDUPSP1TBI : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/Shared/LoggingUnitTesting.cs b/Adaptation/_Tests/Shared/LoggingUnitTesting.cs index f5c6a40..9628850 100644 --- a/Adaptation/_Tests/Shared/LoggingUnitTesting.cs +++ b/Adaptation/_Tests/Shared/LoggingUnitTesting.cs @@ -26,7 +26,7 @@ public class LoggingUnitTesting : UnitTesting, IDisposable base(testContext, declaringType) { _LoggerFactory = new LoggerFactory(); - if (testContext is null || declaringType is null) + if (testContext is null || declaringType is null || _IsEnvironment is null) { _ConfigurationRoot = null; _DefaultLogLevel = null; diff --git a/Adaptation/_Tests/Shared/UnitTesting.cs b/Adaptation/_Tests/Shared/UnitTesting.cs index 38cf36f..1833834 100644 --- a/Adaptation/_Tests/Shared/UnitTesting.cs +++ b/Adaptation/_Tests/Shared/UnitTesting.cs @@ -29,40 +29,45 @@ public class UnitTesting { string waitFor = "\"WaitFor\":"; string projectDirectory = GetProjectDirectory(testContext); - _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); - if (_HasWaitForProperty) + if (string.IsNullOrEmpty(projectDirectory)) + _IsEnvironment = null; + else { - for (int i = 0; i < int.MaxValue; i++) + _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); + if (_HasWaitForProperty) { - if (!_TestContextPropertiesAsJson.Contains($"{waitFor} \"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) - { - TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute(); - if (testCategoryAttribute is not null) + MethodBase methodBase = declaringType.GetMethod(testContext.TestName); + if (methodBase is not null) { - foreach (string testCategory in testCategoryAttribute.TestCategories) - _IsEnvironment = new IsEnvironment(testCategory); + TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute(); + if (testCategoryAttribute is not null) + { + foreach (string testCategory in testCategoryAttribute.TestCategories) + _IsEnvironment = new IsEnvironment(testCategory); + } } + _IsEnvironment ??= new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached); } - _IsEnvironment ??= new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached); } } internal static string GetProjectDirectory(TestContext testContext) { string result; - string[] checkFiles = null; + string[] checkFiles; result = Path.GetDirectoryName(testContext.DeploymentDirectory); for (int i = 0; i < int.MaxValue; i++) { @@ -73,8 +78,6 @@ public class UnitTesting break; result = Path.GetDirectoryName(result); } - if (string.IsNullOrEmpty(result) || checkFiles is null || !checkFiles.Any()) - throw new Exception(result); return result; } diff --git a/Adaptation/_Tests/Static/Job.cs b/Adaptation/_Tests/Static/Job.cs index a5f2987..2d624d7 100644 --- a/Adaptation/_Tests/Static/Job.cs +++ b/Adaptation/_Tests/Static/Job.cs @@ -32,7 +32,7 @@ public class Job : LoggingUnitTesting, IDisposable [ClassCleanup()] public static void ClassCleanup() { - LoggingUnitTesting.Logger?.LogInformation("Cleanup"); + LoggingUnitTesting?.Logger?.LogInformation("Cleanup"); LoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/Static/MET08DDUPSP1TBI.cs b/Adaptation/_Tests/Static/MET08DDUPSP1TBI.cs index 6db8512..55996c3 100644 --- a/Adaptation/_Tests/Static/MET08DDUPSP1TBI.cs +++ b/Adaptation/_Tests/Static/MET08DDUPSP1TBI.cs @@ -34,7 +34,7 @@ public class MET08DDUPSP1TBI : LoggingUnitTesting, IDisposable [ClassCleanup()] public static void ClassCleanup() { - LoggingUnitTesting.Logger?.LogInformation("Cleanup"); + LoggingUnitTesting?.Logger?.LogInformation("Cleanup"); LoggingUnitTesting?.Dispose(); } diff --git a/Adaptation/_Tests/Static/txt.cs b/Adaptation/_Tests/Static/txt.cs index fd54ec8..2a22410 100644 --- a/Adaptation/_Tests/Static/txt.cs +++ b/Adaptation/_Tests/Static/txt.cs @@ -34,7 +34,7 @@ public class TXT : LoggingUnitTesting, IDisposable [ClassCleanup()] public static void ClassCleanup() { - LoggingUnitTesting.Logger?.LogInformation("Cleanup"); + LoggingUnitTesting?.Logger?.LogInformation("Cleanup"); LoggingUnitTesting?.Dispose(); } @@ -128,6 +128,14 @@ public class TXT : LoggingUnitTesting, IDisposable Assert.IsTrue(descriptor.Reactor is "20"); Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); + descriptor = FileHandlers.txt.ProcessData.GetDescriptor("P2-LOW-RR"); + Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } diff --git a/MET08DDUPSP1TBI.csproj b/MET08DDUPSP1TBI.csproj index 4446285..3b38462 100644 --- a/MET08DDUPSP1TBI.csproj +++ b/MET08DDUPSP1TBI.csproj @@ -11,7 +11,8 @@ MET08DDUPSP1TBI MET08DDUPSP1TBI v4.8 - win-x86 + win-x86 + win 512 diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 8eb4406..e9714fb 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.47.1.0")] -[assembly: AssemblyFileVersion("2.47.1.0")] +[assembly: AssemblyVersion("2.47.5.0")] +[assembly: AssemblyFileVersion("2.47.5.0")]