From 3be69b54c210b06d65fd3824312777ffee9a2a1a Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 17 May 2023 10:18:32 -0700 Subject: [PATCH] Auto Bug Fix --- Adaptation/FileHandlers/json/ProcessData.cs | 14 ++- Adaptation/MESAFIBACKLOG-Development.yml | 2 +- Adaptation/MESAFIBACKLOG.Tests.csproj | 4 +- Adaptation/MESAFIBACKLOG.yml | 2 +- Adaptation/Shared/Test.cs | 3 +- Adaptation/_Tests/Static/BACKLOG.cs | 2 + Adaptation/_Tests/Static/MESAFIBACKLOG.cs | 96 +++++++++++++++++++++ FileHandlers/FileRead.cs | 2 +- 8 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 Adaptation/_Tests/Static/MESAFIBACKLOG.cs diff --git a/Adaptation/FileHandlers/json/ProcessData.cs b/Adaptation/FileHandlers/json/ProcessData.cs index 7c48405..97b2343 100644 --- a/Adaptation/FileHandlers/json/ProcessData.cs +++ b/Adaptation/FileHandlers/json/ProcessData.cs @@ -200,6 +200,7 @@ public class ProcessData : IProcessData UpdateIds(httpClient, basePage, api, checkFiles); else { + JsonPatchDocument document; string ids = GetIds(httpClient, basePage, api, query); Value[] workItems = GetWorkItems(httpClient, basePage, api, ids); Task workItemTask; @@ -215,7 +216,7 @@ public class ProcessData : IProcessData { if (counter > 5) break; - JsonPatchDocument document = new(); + document = new(); if (!DateTime.TryParse(keyValuePair.Value.Submitted, out dateTime)) dateTime = DateTime.MinValue; AddPatch(document, "/fields/System.AreaPath", project); @@ -231,6 +232,17 @@ public class ProcessData : IProcessData counter++; if (workItemTask.Result is null) continue; + if (keyValuePair.Value.Priority == "0 - BugFix") + { + document = new(); + AddPatch(document, "/fields/System.AreaPath", project); + AddPatch(document, "/fields/System.IterationPath", project); + AddPatch(document, "/fields/System.Title", keyValuePair.Value.Title); + AddPatch(document, "/fields/System.Description", $"{description}
{keyValuePair.Value.Definition}"); + // AddPatch(document, "/fields/System.AssignedTo", "Mike.Phares@infineon.com"); + workItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(document, project, "Bug"); + workItemTask.Wait(); + } } } } diff --git a/Adaptation/MESAFIBACKLOG-Development.yml b/Adaptation/MESAFIBACKLOG-Development.yml index ada105f..32f3b87 100644 --- a/Adaptation/MESAFIBACKLOG-Development.yml +++ b/Adaptation/MESAFIBACKLOG-Development.yml @@ -26,7 +26,7 @@ steps: displayName: Configuration - script: | - set nugetSource=https://messa017.infineon.com/v3/index.json + set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json echo %nugetSource% echo ##vso[task.setvariable variable=NugetSource;]%nugetSource% echo $(NugetSource) diff --git a/Adaptation/MESAFIBACKLOG.Tests.csproj b/Adaptation/MESAFIBACKLOG.Tests.csproj index cf1a026..c662cea 100644 --- a/Adaptation/MESAFIBACKLOG.Tests.csproj +++ b/Adaptation/MESAFIBACKLOG.Tests.csproj @@ -54,7 +54,6 @@ - @@ -68,8 +67,9 @@ - + + NU1701 diff --git a/Adaptation/MESAFIBACKLOG.yml b/Adaptation/MESAFIBACKLOG.yml index 3f65e0a..56c140e 100644 --- a/Adaptation/MESAFIBACKLOG.yml +++ b/Adaptation/MESAFIBACKLOG.yml @@ -27,7 +27,7 @@ steps: - script: | REM set nugetSource=https://eaf-prod.mes.infineon.com/v3/index.json - set nugetSource=https://messa017.infineon.com/v3/index.json + set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json echo %nugetSource% echo ##vso[task.setvariable variable=NugetSource;]%nugetSource% echo $(NugetSource) diff --git a/Adaptation/Shared/Test.cs b/Adaptation/Shared/Test.cs index aeb4bea..3aa3552 100644 --- a/Adaptation/Shared/Test.cs +++ b/Adaptation/Shared/Test.cs @@ -21,7 +21,7 @@ public enum Test Denton = 9, DiffusionLength = 45, GRATXTCenter = 51, - GRATXTEdge = 52, //Largest + GRATXTEdge = 52, GrowthRateXML = 50, Hall = 10, HgCV = 23, @@ -38,6 +38,7 @@ public enum Test RPMPLRatio = 17, RPMXY = 15, SP1 = 8, + SRP2100 = 53, //Largest Tencor = 7, UV = 35, VerificationLehighton = 14, diff --git a/Adaptation/_Tests/Static/BACKLOG.cs b/Adaptation/_Tests/Static/BACKLOG.cs index 707ace7..178a785 100644 --- a/Adaptation/_Tests/Static/BACKLOG.cs +++ b/Adaptation/_Tests/Static/BACKLOG.cs @@ -78,7 +78,9 @@ public class BACKLOG : LoggingUnitTesting, IDisposable NonThrowTryCatch(); } +#if DEBUG [Ignore] +#endif [TestMethod] public void Staging() { diff --git a/Adaptation/_Tests/Static/MESAFIBACKLOG.cs b/Adaptation/_Tests/Static/MESAFIBACKLOG.cs new file mode 100644 index 0000000..3795910 --- /dev/null +++ b/Adaptation/_Tests/Static/MESAFIBACKLOG.cs @@ -0,0 +1,96 @@ +using Adaptation._Tests.Shared; +using Microsoft.Extensions.Logging; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Text; + +namespace Adaptation._Tests.Static; + +[TestClass] +public class MESAFIBACKLOG : LoggingUnitTesting, IDisposable +{ + +#pragma warning disable CA2254 +#pragma warning disable IDE0060 + + internal static MESAFIBACKLOG LoggingUnitTesting { get; private set; } + + public MESAFIBACKLOG() : base(testContext: null, declaringType: null) + { + if (LoggingUnitTesting is null) + throw new Exception(); + } + + public MESAFIBACKLOG(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType) + { + } + + [ClassInitialize] + public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new MESAFIBACKLOG(testContext); + + [ClassCleanup()] + public static void ClassCleanup() + { + LoggingUnitTesting?.Logger?.LogInformation("Cleanup"); + LoggingUnitTesting?.Dispose(); + } + + [TestMethod] + public void TestDateTime() + { + DateTime dateTime = DateTime.Now; + Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString()); + } + +#if DEBUG + [Ignore] +#endif + [TestMethod] + public void Development() + { + MethodBase methodBase = new StackFrame().GetMethod(); + StringBuilder results = new(); + (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[] + { + new("MESAFIBACKLOG", "v2.49.0"), + }; + string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2"; + Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; + LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) + { + cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); + _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); + } + File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString()); + LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + +#if DEBUG + [Ignore] +#endif + [TestMethod] + public void Staging() + { + MethodBase methodBase = new StackFrame().GetMethod(); + StringBuilder results = new(); + (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[] + { + new("MESAFIBACKLOG", "v2.49.0"), + }; + string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2"; + Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; + LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) + { + cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); + _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); + } + File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString()); + LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + +} \ No newline at end of file diff --git a/FileHandlers/FileRead.cs b/FileHandlers/FileRead.cs index bb032ce..1d71315 100644 --- a/FileHandlers/FileRead.cs +++ b/FileHandlers/FileRead.cs @@ -165,7 +165,7 @@ public partial class FileRead : FileReaderHandler, ISMTP Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType); } if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind)) - throw new Exception(string.Concat('{', jsonProperty.Value.ValueKind, "} is not mapped!")); + throw new Exception(string.Concat('<', jsonProperty.Name, "> {", jsonProperty.Value.ValueKind, "} is not mapped!")); } foreach (JsonProperty jsonProperty in jsonProperties) {