Removed more not needed properties from api

This commit is contained in:
Mike Phares 2023-08-03 13:53:02 -07:00
parent c5e3acc3e4
commit ae47e7dbd5
4 changed files with 60 additions and 32 deletions

View File

@ -6,7 +6,6 @@ using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Adaptation.FileHandlers.MoveAllFiles.ApiController;

View File

@ -23,28 +23,28 @@ public class QaMetTest
public string RecipePattern { get; set; }
[JsonPropertyName("min")]
public double Min { get; set; }
public object Min { get; set; }
[JsonPropertyName("max")]
public double Max { get; set; }
public object Max { get; set; }
[JsonPropertyName("phaseMin")]
public double? PhaseMin { get; set; }
public object PhaseMin { get; set; }
[JsonPropertyName("slots")]
public object Slots { get; set; }
[JsonPropertyName("wfrQty")]
public int WfrQty { get; set; }
public int? WfrQty { get; set; }
[JsonPropertyName("reactSched")]
public bool ReactSched { get; set; }
public bool? ReactSched { get; set; }
[JsonPropertyName("interval")]
public int Interval { get; set; }
public int? Interval { get; set; }
[JsonPropertyName("start")]
public int Start { get; set; }
public int? Start { get; set; }
[JsonPropertyName("sequence")]
public string Sequence { get; set; }

View File

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.MoveAllFiles.OpenInsight;

View File

@ -47,7 +47,7 @@ public class API : LoggingUnitTesting, IDisposable
catch (Exception) { }
}
#if (!true)
#if true
[Ignore]
#endif
[TestMethod]
@ -55,38 +55,68 @@ public class API : LoggingUnitTesting, IDisposable
{
MethodBase methodBase = new StackFrame().GetMethod();
#nullable enable
int[] runDataSheets = new int[]
{
504162,
601132,
602591,
602705,
601247,
602092,
603002,
602666,
602804,
602598,
601939
};
string url;
string json;
int failures = 0;
string httpClientResult;
HttpClient httpClient = new();
// string rds = "504162";
string rds = "601132";
string url = $"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{rds}";
string httpClientResult = httpClient.GetStringAsync(url).Result;
FileHandlers.MoveAllFiles.OpenInsight.Root? root = JsonSerializer.Deserialize<FileHandlers.MoveAllFiles.OpenInsight.Root>(httpClientResult);
httpClient.Dispose();
Assert.IsNotNull(root?.Rds.ProdSpec.PrsStages);
FileHandlers.MoveAllFiles.OpenInsight.Root? root;
List<FileHandlers.MoveAllFiles.OpenInsight.QaMetTest>? collection;
Dictionary<string, List<FileHandlers.MoveAllFiles.OpenInsight.QaMetTest>> qaMetTests = new();
foreach (FileHandlers.MoveAllFiles.OpenInsight.PrsStage prsStage in root.Rds.ProdSpec.PrsStages)
foreach (int runDataSheet in runDataSheets)
{
if (prsStage.QaMetTests is null)
continue;
foreach (FileHandlers.MoveAllFiles.OpenInsight.QaMetTest qaMetTest in prsStage.QaMetTests)
url = $"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{runDataSheet}";
httpClientResult = httpClient.GetStringAsync(url).Result;
try
{ root = JsonSerializer.Deserialize<FileHandlers.MoveAllFiles.OpenInsight.Root>(httpClientResult); }
catch (Exception)
{
if (qaMetTest.ToolClass != "FTIR")
continue;
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
{
qaMetTests.Add(prsStage.Stage, new());
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
throw new Exception();
}
collection.Add(qaMetTest);
root = null;
failures += 1;
System.IO.File.WriteAllText($"D:/{runDataSheet}.json", httpClientResult);
}
if (root is null)
continue;
Assert.IsNotNull(root?.Rds.ProdSpec.PrsStages);
foreach (FileHandlers.MoveAllFiles.OpenInsight.PrsStage prsStage in root.Rds.ProdSpec.PrsStages)
{
if (prsStage.QaMetTests is null)
continue;
foreach (FileHandlers.MoveAllFiles.OpenInsight.QaMetTest qaMetTest in prsStage.QaMetTests)
{
if (qaMetTest.ToolClass != "FTIR")
continue;
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
{
qaMetTests.Add(prsStage.Stage, new());
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
throw new Exception();
}
collection.Add(qaMetTest);
}
}
Assert.IsTrue(qaMetTests.Count > 0);
}
Assert.IsTrue(qaMetTests.Count > 0);
string json = JsonSerializer.Serialize(qaMetTests, new JsonSerializerOptions { WriteIndented = true });
httpClient.Dispose();
json = JsonSerializer.Serialize(qaMetTests, new JsonSerializerOptions { WriteIndented = true });
Assert.IsTrue(!string.IsNullOrEmpty(json));
System.IO.File.WriteAllText("D:/.json", json);
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase?.Name, " - Exit"));
Assert.IsTrue(failures == 0);
NonThrowTryCatch();
#nullable restore
}