diff --git a/Adaptation/METCLIMATEC.Tests.csproj b/Adaptation/METCLIMATEC.Tests.csproj
index ff36bdc..5d76a08 100644
--- a/Adaptation/METCLIMATEC.Tests.csproj
+++ b/Adaptation/METCLIMATEC.Tests.csproj
@@ -69,7 +69,7 @@
- NU1701
+ NU1701
diff --git a/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/METCLIMATEC.cs b/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/METCLIMATEC.cs
index cc70b6c..e1c872d 100644
--- a/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/METCLIMATEC.cs
+++ b/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/METCLIMATEC.cs
@@ -1,4 +1,4 @@
-#if true
+#if v2_59_0
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/TRENDLOG.cs b/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/TRENDLOG.cs
index b2863b4..8f134b4 100644
--- a/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/TRENDLOG.cs
+++ b/Adaptation/_Tests/CreateSelfDescription/Production/v2.59.0/TRENDLOG.cs
@@ -1,4 +1,4 @@
-#if true
+#if v2_59_0
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/Adaptation/_Tests/CreateSelfDescription/Production/v2.60.0/METCLIMATEC.cs b/Adaptation/_Tests/CreateSelfDescription/Production/v2.60.0/METCLIMATEC.cs
new file mode 100644
index 0000000..3b74824
--- /dev/null
+++ b/Adaptation/_Tests/CreateSelfDescription/Production/v2.60.0/METCLIMATEC.cs
@@ -0,0 +1,117 @@
+#if true
+using Adaptation._Tests.Shared;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+
+namespace Adaptation._Tests.CreateSelfDescription.Production.v2_60_0;
+
+[TestClass]
+public class METCLIMATEC : EAFLoggingUnitTesting
+{
+
+#pragma warning disable CA2254
+#pragma warning disable IDE0060
+
+ internal static string DummyRoot { get; private set; }
+ internal static METCLIMATEC EAFLoggingUnitTesting { get; private set; }
+
+ static METCLIMATEC() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
+
+ public METCLIMATEC() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
+ {
+ if (EAFLoggingUnitTesting is null)
+ throw new Exception();
+ }
+
+ public METCLIMATEC(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
+ {
+ }
+
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext testContext)
+ {
+ EAFLoggingUnitTesting ??= new METCLIMATEC(testContext);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
+ string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
+ File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
+ File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
+ }
+
+ [ClassCleanup()]
+ public static void ClassCleanup()
+ {
+ EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup");
+ EAFLoggingUnitTesting?.Dispose();
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__MoveMatchingFiles()
+ {
+ string check = "*.pdsf";
+ MethodBase methodBase = new StackFrame().GetMethod();
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__IQSSi()
+ {
+ string check = "*.pdsf";
+ MethodBase methodBase = new StackFrame().GetMethod();
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__Processed()
+ {
+ string check = "*.pdsf";
+ MethodBase methodBase = new StackFrame().GetMethod();
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__Archive()
+ {
+ string check = "*.pdsf";
+ MethodBase methodBase = new StackFrame().GetMethod();
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__Dummy()
+ {
+ string check = "637953064190000000.zip";
+ MethodBase methodBase = new StackFrame().GetMethod();
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+}
+#endif
\ No newline at end of file
diff --git a/Adaptation/_Tests/CreateSelfDescription/Production/v2.60.0/TRENDLOG.cs b/Adaptation/_Tests/CreateSelfDescription/Production/v2.60.0/TRENDLOG.cs
new file mode 100644
index 0000000..bc48370
--- /dev/null
+++ b/Adaptation/_Tests/CreateSelfDescription/Production/v2.60.0/TRENDLOG.cs
@@ -0,0 +1,66 @@
+#if true
+using Adaptation._Tests.Shared;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+
+namespace Adaptation._Tests.CreateSelfDescription.Production.v2_60_0;
+
+[TestClass]
+public class TRENDLOG : EAFLoggingUnitTesting
+{
+
+#pragma warning disable CA2254
+#pragma warning disable IDE0060
+
+ internal static string DummyRoot { get; private set; }
+ internal static TRENDLOG EAFLoggingUnitTesting { get; private set; }
+
+ static TRENDLOG() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
+
+ public TRENDLOG() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
+ {
+ if (EAFLoggingUnitTesting is null)
+ throw new Exception();
+ }
+
+ public TRENDLOG(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
+ {
+ }
+
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext testContext)
+ {
+ EAFLoggingUnitTesting ??= new TRENDLOG(testContext);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
+ string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
+ File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
+ File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
+ }
+
+ [ClassCleanup()]
+ public static void ClassCleanup()
+ {
+ EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup");
+ EAFLoggingUnitTesting?.Dispose();
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__TRENDLOG__csv()
+ {
+ string check = "*.csv.trg";
+ MethodBase methodBase = new StackFrame().GetMethod();
+ // string check = "Dev *, A*, present-value, *D*-*-*-*.csv.trg";
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
+ EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+}
+#endif
\ No newline at end of file
diff --git a/Adaptation/_Tests/Extract/Production/v2.59.0/METCLIMATEC.cs b/Adaptation/_Tests/Extract/Production/v2.59.0/METCLIMATEC.cs
index 3eac330..ae7ba40 100644
--- a/Adaptation/_Tests/Extract/Production/v2.59.0/METCLIMATEC.cs
+++ b/Adaptation/_Tests/Extract/Production/v2.59.0/METCLIMATEC.cs
@@ -1,4 +1,4 @@
-#if true
+#if v2_59_0
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
diff --git a/Adaptation/_Tests/Extract/Production/v2.59.0/TRENDLOG.cs b/Adaptation/_Tests/Extract/Production/v2.59.0/TRENDLOG.cs
index 1bedac2..f53405a 100644
--- a/Adaptation/_Tests/Extract/Production/v2.59.0/TRENDLOG.cs
+++ b/Adaptation/_Tests/Extract/Production/v2.59.0/TRENDLOG.cs
@@ -1,4 +1,4 @@
-#if true
+#if v2_59_0
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/Adaptation/_Tests/Extract/Production/v2.60.0/METCLIMATEC.cs b/Adaptation/_Tests/Extract/Production/v2.60.0/METCLIMATEC.cs
new file mode 100644
index 0000000..78d7ff9
--- /dev/null
+++ b/Adaptation/_Tests/Extract/Production/v2.60.0/METCLIMATEC.cs
@@ -0,0 +1,100 @@
+#if true
+using Adaptation._Tests.Shared;
+using Adaptation.Shared;
+using Adaptation.Shared.Methods;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Diagnostics;
+using System.Reflection;
+
+namespace Adaptation._Tests.Extract.Production.v2_60_0;
+
+[TestClass]
+public class METCLIMATEC
+{
+
+#pragma warning disable CA2254
+#pragma warning disable IDE0060
+
+ private static CreateSelfDescription.Production.v2_60_0.METCLIMATEC _METCLIMATEC;
+
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext testContext)
+ {
+ CreateSelfDescription.Production.v2_60_0.METCLIMATEC.ClassInitialize(testContext);
+ _METCLIMATEC = CreateSelfDescription.Production.v2_60_0.METCLIMATEC.EAFLoggingUnitTesting;
+ }
+
+ private static void NonThrowTryCatch()
+ {
+ try
+ { throw new Exception(); }
+ catch (Exception) { }
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__MoveMatchingFiles() => _METCLIMATEC.Production__v2_60_0__METCLIMATEC__MoveMatchingFiles();
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__MoveMatchingFiles637953064190000000__Normal()
+ {
+ string check = "*.pdsf";
+ bool validatePDSF = false;
+ MethodBase methodBase = new StackFrame().GetMethod();
+ _METCLIMATEC.Production__v2_60_0__METCLIMATEC__MoveMatchingFiles();
+ Assert.IsFalse(string.IsNullOrEmpty(_METCLIMATEC.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
+ string[] variables = _METCLIMATEC.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
+ IFileRead fileRead = _METCLIMATEC.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
+ Logistics logistics = new(fileRead);
+ _ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
+ NonThrowTryCatch();
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__IQSSi() => _METCLIMATEC.Production__v2_60_0__METCLIMATEC__IQSSi();
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__IQSSi638465291633220310__Normal()
+ {
+ string check = "*.pdsf";
+ _METCLIMATEC.Production__v2_60_0__METCLIMATEC__IQSSi();
+ MethodBase methodBase = new StackFrame().GetMethod();
+ string[] variables = _METCLIMATEC.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
+ IFileRead fileRead = _METCLIMATEC.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
+ Logistics logistics = new(fileRead);
+ _ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
+ NonThrowTryCatch();
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__Processed() => _METCLIMATEC.Production__v2_60_0__METCLIMATEC__Processed();
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__Archive() => _METCLIMATEC.Production__v2_60_0__METCLIMATEC__Archive();
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__METCLIMATEC__Dummy() => _METCLIMATEC.Production__v2_60_0__METCLIMATEC__Dummy();
+
+}
+#endif
\ No newline at end of file
diff --git a/Adaptation/_Tests/Extract/Production/v2.60.0/TRENDLOG.cs b/Adaptation/_Tests/Extract/Production/v2.60.0/TRENDLOG.cs
new file mode 100644
index 0000000..4849211
--- /dev/null
+++ b/Adaptation/_Tests/Extract/Production/v2.60.0/TRENDLOG.cs
@@ -0,0 +1,86 @@
+#if true
+using Adaptation.Shared;
+using Adaptation.Shared.Methods;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Text.Json;
+
+namespace Adaptation._Tests.Extract.Production.v2_60_0;
+
+[TestClass]
+public class TRENDLOG
+{
+
+#pragma warning disable CA2254
+#pragma warning disable IDE0060
+
+ private static CreateSelfDescription.Production.v2_60_0.TRENDLOG _TRENDLOG;
+
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext testContext)
+ {
+ CreateSelfDescription.Production.v2_60_0.TRENDLOG.ClassInitialize(testContext);
+ _TRENDLOG = CreateSelfDescription.Production.v2_60_0.TRENDLOG.EAFLoggingUnitTesting;
+ }
+
+ private static void NonThrowTryCatch()
+ {
+ try
+ { throw new Exception(); }
+ catch (Exception) { }
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__TRENDLOG__csv() => _TRENDLOG.Production__v2_60_0__TRENDLOG__csv();
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__TRENDLOG__csv638465291633220310__Normal()
+ {
+ bool validatePDSF = false;
+ string check = "*.csv.trg";
+ _TRENDLOG.Production__v2_60_0__TRENDLOG__csv();
+ MethodBase methodBase = new StackFrame().GetMethod();
+ // string check = "Dev *, A*, present-value, *D*-*-*-*.csv.trg";
+ Assert.IsFalse(string.IsNullOrEmpty(_TRENDLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
+ string[] variables = _TRENDLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
+ IFileRead fileRead = _TRENDLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
+ Tuple> extractResult = fileRead.ReExtract();
+ Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
+ Assert.IsNotNull(extractResult.Item3);
+ Assert.IsNotNull(extractResult.Item4);
+ NonThrowTryCatch();
+ }
+
+#if DEBUG
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Production__v2_60_0__TRENDLOG__csv638465291633220312__Normal()
+ {
+ bool validatePDSF = false;
+ string check = "*.csv.trg";
+ _TRENDLOG.Production__v2_60_0__TRENDLOG__csv();
+ MethodBase methodBase = new StackFrame().GetMethod();
+ // string check = "Dev *, A*, present-value, *D*-*-*-*.csv.trg";
+ Assert.IsFalse(string.IsNullOrEmpty(_TRENDLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
+ string[] variables = _TRENDLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
+ IFileRead fileRead = _TRENDLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
+ Tuple> extractResult = fileRead.ReExtract();
+ Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
+ Assert.IsNotNull(extractResult.Item3);
+ Assert.IsNotNull(extractResult.Item4);
+ NonThrowTryCatch();
+ }
+
+}
+#endif
\ No newline at end of file
diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs
index dad8ffe..8c0bc93 100644
--- a/Adaptation/_Tests/Shared/AdaptationTesting.cs
+++ b/Adaptation/_Tests/Shared/AdaptationTesting.cs
@@ -56,11 +56,33 @@ public class AdaptationTesting : ISMTP
public Dictionary ParameterizedModelObjectDefinitionTypes => _ParameterizedModelObjectDefinitionTypes;
public Dictionary>> EquipmentDictionaryEventDescriptions => _EquipmentDictionaryEventDescriptions;
- void ISMTP.SendLowPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
+ void ISMTP.SendLowPriorityEmailMessage(string subject, string body) =>
+ throw new NotImplementedException();
- void ISMTP.SendHighPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
+ void ISMTP.SendHighPriorityEmailMessage(string subject, string body) =>
+ throw new NotImplementedException();
- void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
+ void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) =>
+ throw new NotImplementedException();
+
+ internal static T ParseXML(string @this, bool throwExceptions) where T : class
+ {
+ object result = null;
+ try
+ {
+ Stream stream = ToStream(@this.Trim());
+ XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
+ XmlSerializer xmlSerializer = new(typeof(T), typeof(T).GetNestedTypes());
+ result = xmlSerializer.Deserialize(xmlReader);
+ stream.Dispose();
+ }
+ catch (Exception)
+ {
+ if (throwExceptions)
+ throw;
+ }
+ return result as T;
+ }
public AdaptationTesting(string dummyRoot, TestContext testContext, bool skipEquipmentDictionary, string testContextPropertiesAsJson, bool hasWaitForProperty)
{
@@ -105,93 +127,6 @@ public class AdaptationTesting : ISMTP
return result;
}
- public static string GetTestResultsDirectory(string testContextTestResultsDirectory, bool hasWaitForProperty)
- {
- string result = string.Empty;
- string testResults = "05_TestResults";
- 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
- {
- string rootDirectory = Path.GetPathRoot(checkDirectory);
- for (int i = 0; i < int.MaxValue; i++)
- {
- 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))
- throw new Exception();
- return result;
- }
-
- private string GetTestResultsDirectory(bool hasWaitForProperty)
- {
- string result = GetTestResultsDirectory(_TestContext.TestResultsDirectory, hasWaitForProperty);
- return result;
- }
-
- protected static string GetCellInstanceConnectionName(string cellInstanceConnectionName)
- {
- string result;
- if (string.IsNullOrEmpty(cellInstanceConnectionName) || cellInstanceConnectionName[cellInstanceConnectionName.Length - 1] != '_')
- result = cellInstanceConnectionName;
- else
- {
- bool check = false;
- List chars = new();
- StringBuilder stringBuilder = new();
- for (int i = cellInstanceConnectionName.Length - 1; i > -1; i--)
- {
- if (!check && cellInstanceConnectionName[i] != '_')
- check = true;
- else if (!check && cellInstanceConnectionName[i] == '_')
- chars.Add('-');
- if (check)
- chars.Add(cellInstanceConnectionName[i]);
- }
- for (int i = chars.Count - 1; i > -1; i--)
- _ = stringBuilder.Append(chars[i]);
- result = stringBuilder.ToString();
- }
- return result;
- }
-
- private static string GetMethodBaseNameWithActualCICN(string methodBaseName, string cellInstanceName, string cellInstanceConnectionNameFromMethodBaseName, string cellInstanceConnectionName, string ticks)
- {
- string results;
- if (string.IsNullOrEmpty(cellInstanceConnectionNameFromMethodBaseName) || string.IsNullOrEmpty(cellInstanceConnectionName))
- results = methodBaseName;
- else if (cellInstanceConnectionNameFromMethodBaseName.Length != cellInstanceConnectionName.Length)
- throw new Exception();
- else
- {
- string[] segments = methodBaseName.Split(new string[] { cellInstanceName }, StringSplitOptions.None);
- if (segments.Length == 2)
- results = methodBaseName.Replace(cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName);
- else if (segments.Length != 3)
- throw new Exception();
- else if (string.IsNullOrEmpty(ticks))
- results = string.Concat(segments[0], cellInstanceName, segments[1], cellInstanceConnectionName);
- else if (!segments[2].Contains(ticks))
- throw new Exception();
- else
- results = string.Concat(segments[0], cellInstanceName, segments[1], cellInstanceConnectionName, ticks, segments[2].Split(new string[] { ticks }, StringSplitOptions.None)[1]);
- }
- if (methodBaseName.Length != results.Length)
- throw new Exception();
- return results;
- }
-
public static MethodBaseName GetMethodBaseName(string dummyRoot, string environment, bool hasWaitForProperty, string methodBaseName, string testResultsDirectory)
{
MethodBaseName result;
@@ -275,74 +210,58 @@ public class AdaptationTesting : ISMTP
return result;
}
- private MethodBaseName GetMethodBaseName(MethodBase methodBase)
+ protected static string GetCellInstanceConnectionName(string cellInstanceConnectionName)
{
- MethodBaseName result;
- string testResultsDirectory = GetTestResultsDirectory(_HasWaitForProperty);
- result = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, methodBase.Name, testResultsDirectory);
+ string result;
+ if (string.IsNullOrEmpty(cellInstanceConnectionName) || cellInstanceConnectionName[cellInstanceConnectionName.Length - 1] != '_')
+ result = cellInstanceConnectionName;
+ else
+ {
+ bool check = false;
+ List chars = new();
+ StringBuilder stringBuilder = new();
+ for (int i = cellInstanceConnectionName.Length - 1; i > -1; i--)
+ {
+ if (!check && cellInstanceConnectionName[i] != '_')
+ check = true;
+ else if (!check && cellInstanceConnectionName[i] == '_')
+ chars.Add('-');
+ if (check)
+ chars.Add(cellInstanceConnectionName[i]);
+ }
+ for (int i = chars.Count - 1; i > -1; i--)
+ _ = stringBuilder.Append(chars[i]);
+ result = stringBuilder.ToString();
+ }
return result;
}
- private string[] GetTextFiles(MethodBaseName mbn)
+ private static string GetMethodBaseNameWithActualCICN(string methodBaseName, string cellInstanceName, string cellInstanceConnectionNameFromMethodBaseName, string cellInstanceConnectionName, string ticks)
{
- 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
- {
- 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);
- }
- }
+ string results;
+ if (string.IsNullOrEmpty(cellInstanceConnectionNameFromMethodBaseName) || string.IsNullOrEmpty(cellInstanceConnectionName))
+ results = methodBaseName;
+ else if (cellInstanceConnectionNameFromMethodBaseName.Length != cellInstanceConnectionName.Length)
+ throw new Exception();
else
{
- results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly);
- if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && results.Length == 0)
- {
- _ = Process.Start("explorer.exe", mbn.TextFileDirectory);
- File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty);
- }
+ string[] segments = methodBaseName.Split(new string[] { cellInstanceName }, StringSplitOptions.None);
+ if (segments.Length == 2)
+ results = methodBaseName.Replace(cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName);
+ else if (segments.Length != 3)
+ throw new Exception();
+ else if (string.IsNullOrEmpty(ticks))
+ results = string.Concat(segments[0], cellInstanceName, segments[1], cellInstanceConnectionName);
+ else if (!segments[2].Contains(ticks))
+ throw new Exception();
+ else
+ results = string.Concat(segments[0], cellInstanceName, segments[1], cellInstanceConnectionName, ticks, segments[2].Split(new string[] { ticks }, StringSplitOptions.None)[1]);
}
+ if (methodBaseName.Length != results.Length)
+ throw new Exception();
return results;
}
- protected static Stream ToStream(string @this)
- {
- MemoryStream memoryStream = new();
- StreamWriter streamWriter = new(memoryStream);
- streamWriter.Write(@this);
- streamWriter.Flush();
- memoryStream.Position = 0;
- return memoryStream;
- }
-
- internal static T ParseXML(string @this, bool throwExceptions) where T : class
- {
- object result = null;
- try
- {
- Stream stream = ToStream(@this.Trim());
- XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
- XmlSerializer xmlSerializer = new(typeof(T), typeof(T).GetNestedTypes());
- result = xmlSerializer.Deserialize(xmlReader);
- stream.Dispose();
- }
- catch (Exception)
- {
- if (throwExceptions)
- throw;
- }
- return result as T;
- }
-
public static CellInstanceVersion GetCellInstanceVersion(string url)
{
CellInstanceVersion result;
@@ -368,6 +287,54 @@ public class AdaptationTesting : ISMTP
return result;
}
+ public static string GetTestResultsDirectory(string testContextTestResultsDirectory, bool hasWaitForProperty)
+ {
+ string result = string.Empty;
+ string testResults = "05_TestResults";
+ 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
+ {
+ string rootDirectory = Path.GetPathRoot(checkDirectory);
+ for (int i = 0; i < int.MaxValue; i++)
+ {
+ 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))
+ throw new Exception();
+ return result;
+ }
+
+ public string[] GetCSharpText(string testName)
+ {
+ string[] results;
+ 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(mbn.CellInstanceName, mbn.CellInstanceVersionName);
+ results = GetCSharpTextB(fileInfo, mbn.CellInstanceName, mbn.CellInstanceVersionName, cellInstanceVersionTuple.Item2);
+ return results;
+ }
+
+ private string GetTestResultsDirectory(bool hasWaitForProperty)
+ {
+ string result = GetTestResultsDirectory(_TestContext.TestResultsDirectory, hasWaitForProperty);
+ return result;
+ }
+
protected Tuple GetCellInstanceVersionTuple(string cellInstanceName, string cellInstanceVersionName)
{
Tuple result;
@@ -382,41 +349,6 @@ public class AdaptationTesting : ISMTP
return result;
}
- protected static Dictionary GetComponentModelComponentsIndexes(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
- {
- Dictionary results = new();
- ComponentsCellComponent componentsCellComponent;
- if (cellInstanceVersion.ComponentModel.Components is not null)
- {
- for (int i = 0; i < cellInstanceVersion.ComponentModel.Components.Length; i++)
- {
- componentsCellComponent = cellInstanceVersion.ComponentModel.Components[i];
- for (int j = 0; j < componentsCellComponent.Children.Length; j++)
- {
- if (string.IsNullOrEmpty(componentsCellComponent.Children[j].Equipment.Name))
- continue;
- results.Add(componentsCellComponent.Children[j].Name, new int[] { i, j });
- }
- }
- }
- if (results.Count == 0 || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName)))
- throw new Exception("Match not found (check test method name matches Mango)!");
- return results;
- }
-
- protected static int[] GetCellInstanceConnectionNameIndexes(string cellInstanceConnectionName, Dictionary componentModelComponentsIndexes)
- {
- int[] result;
- if (string.IsNullOrEmpty(cellInstanceConnectionName))
- result = componentModelComponentsIndexes.ElementAt(0).Value;
- else
- {
- if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.TryGetValue(cellInstanceConnectionName, out result))
- throw new Exception();
- }
- return result;
- }
-
protected string[] GetCSharpTextB(FileInfo fileInfo, string cellInstanceName, string cellInstanceVersionName, CellInstanceVersion cellInstanceVersion)
{
List results = new();
@@ -608,6 +540,62 @@ public class AdaptationTesting : ISMTP
return results.ToArray();
}
+ public string[] GetConfiguration(MethodBase methodBase)
+ {
+ string[] results;
+ 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(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);
+ if (fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value < 0)
+ fileScanningIntervalInSecondsLine = $"-\t{fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value:0000}\t{Path.GetFileName(fileInfo.DirectoryName)}";
+ else
+ 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, mbn.CellInstanceConnectionName);
+ Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple);
+ Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
+ Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
+ Tuple>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
+ Dictionary objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2, cellInstanceVersionTuple.Item2.EdaConnection.PortNumber);
+ string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true });
+ results = new string[] { fileInfo.FullName, json };
+ return results;
+ }
+
+ private MethodBaseName GetMethodBaseName(MethodBase methodBase)
+ {
+ MethodBaseName result;
+ string testResultsDirectory = GetTestResultsDirectory(_HasWaitForProperty);
+ result = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, methodBase.Name, testResultsDirectory);
+ return result;
+ }
+
+ protected Tuple GetFileConnectorConfigurationTuple(Tuple cellInstanceVersionTuple, string cellInstanceConnectionName)
+ {
+ Tuple result;
+ FileConnectorConfiguration fileConnectorConfiguration;
+ string cellInstanceServiceV2With = string.Concat(cellInstanceVersionTuple.Item1, '/', cellInstanceConnectionName);
+ if (!_FileConnectorConfigurations.TryGetValue(cellInstanceServiceV2With, out fileConnectorConfiguration))
+ {
+ Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
+ int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
+ ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersionTuple.Item2.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
+ string json = JsonSerializer.Serialize(componentsCellComponentCellComponent.Equipment, new JsonSerializerOptions { WriteIndented = true });
+ fileConnectorConfiguration = GetFileConnectorConfiguration(json, componentsCellComponentCellComponent);
+ _FileConnectorConfigurations.Add(cellInstanceServiceV2With, fileConnectorConfiguration);
+ }
+ result = new Tuple(cellInstanceServiceV2With, fileConnectorConfiguration);
+ return result;
+ }
+
protected static FileConnectorConfiguration GetFileConnectorConfiguration(string json, ComponentsCellComponentCellComponent componentsCellComponentCellComponent)
{
FileConnectorConfiguration result;
@@ -640,21 +628,55 @@ public class AdaptationTesting : ISMTP
return result;
}
- protected Tuple GetFileConnectorConfigurationTuple(Tuple cellInstanceVersionTuple, string cellInstanceConnectionName)
+ protected Tuple GetEquipmentTypeVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
{
- Tuple result;
- FileConnectorConfiguration fileConnectorConfiguration;
- string cellInstanceServiceV2With = string.Concat(cellInstanceVersionTuple.Item1, '/', cellInstanceConnectionName);
- if (!_FileConnectorConfigurations.TryGetValue(cellInstanceServiceV2With, out fileConnectorConfiguration))
+ Tuple result;
+ EquipmentTypeVersion equipmentTypeVersion;
+ Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersion, cellInstanceConnectionName);
+ int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
+ ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
+ string equipmentTypeServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentTypeServiceV2/", componentsCellComponentCellComponent.Equipment.EquipmentType.Name, "/", componentsCellComponentCellComponent.Equipment.EquipmentType.Version, "/configuration");
+ if (!_EquipmentTypeVersions.TryGetValue(equipmentTypeServiceV2, out equipmentTypeVersion))
{
- Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
- int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
- ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersionTuple.Item2.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
- string json = JsonSerializer.Serialize(componentsCellComponentCellComponent.Equipment, new JsonSerializerOptions { WriteIndented = true });
- fileConnectorConfiguration = GetFileConnectorConfiguration(json, componentsCellComponentCellComponent);
- _FileConnectorConfigurations.Add(cellInstanceServiceV2With, fileConnectorConfiguration);
+ equipmentTypeVersion = GetEquipmentTypeVersion(equipmentTypeServiceV2);
+ _EquipmentTypeVersions.Add(equipmentTypeServiceV2, equipmentTypeVersion);
+ }
+ result = new Tuple(equipmentTypeServiceV2, componentsCellComponentCellComponent.Equipment.EquipmentType.Name, componentsCellComponentCellComponent.Equipment.EquipmentType.Version, equipmentTypeVersion);
+ return result;
+ }
+
+ protected static Dictionary GetComponentModelComponentsIndexes(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
+ {
+ Dictionary results = new();
+ ComponentsCellComponent componentsCellComponent;
+ if (cellInstanceVersion.ComponentModel.Components is not null)
+ {
+ for (int i = 0; i < cellInstanceVersion.ComponentModel.Components.Length; i++)
+ {
+ componentsCellComponent = cellInstanceVersion.ComponentModel.Components[i];
+ for (int j = 0; j < componentsCellComponent.Children.Length; j++)
+ {
+ if (string.IsNullOrEmpty(componentsCellComponent.Children[j].Equipment.Name))
+ continue;
+ results.Add(componentsCellComponent.Children[j].Name, new int[] { i, j });
+ }
+ }
+ }
+ if (results.Count == 0 || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName)))
+ throw new Exception("Match not found (check test method name matches Mango)!");
+ return results;
+ }
+
+ protected static int[] GetCellInstanceConnectionNameIndexes(string cellInstanceConnectionName, Dictionary componentModelComponentsIndexes)
+ {
+ int[] result;
+ if (string.IsNullOrEmpty(cellInstanceConnectionName))
+ result = componentModelComponentsIndexes.ElementAt(0).Value;
+ else
+ {
+ if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.TryGetValue(cellInstanceConnectionName, out result))
+ throw new Exception();
}
- result = new Tuple(cellInstanceServiceV2With, fileConnectorConfiguration);
return result;
}
@@ -683,35 +705,6 @@ public class AdaptationTesting : ISMTP
return result;
}
- protected Tuple GetEquipmentTypeVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
- {
- Tuple result;
- EquipmentTypeVersion equipmentTypeVersion;
- Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersion, cellInstanceConnectionName);
- int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
- ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
- string equipmentTypeServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentTypeServiceV2/", componentsCellComponentCellComponent.Equipment.EquipmentType.Name, "/", componentsCellComponentCellComponent.Equipment.EquipmentType.Version, "/configuration");
- if (!_EquipmentTypeVersions.TryGetValue(equipmentTypeServiceV2, out equipmentTypeVersion))
- {
- equipmentTypeVersion = GetEquipmentTypeVersion(equipmentTypeServiceV2);
- _EquipmentTypeVersions.Add(equipmentTypeServiceV2, equipmentTypeVersion);
- }
- result = new Tuple(equipmentTypeServiceV2, componentsCellComponentCellComponent.Equipment.EquipmentType.Name, componentsCellComponentCellComponent.Equipment.EquipmentType.Version, equipmentTypeVersion);
- return result;
- }
-
- protected Tuple GetParameterizedModelObjectDefinitionTypeTuple(Tuple equipmentTypeVersionTuple)
- {
- Tuple result;
- string parameterizedModelObjectDefinitionType;
- if (_FileConnectorConfigurations.ContainsKey(equipmentTypeVersionTuple.Item1))
- parameterizedModelObjectDefinitionType = _ParameterizedModelObjectDefinitionTypes[equipmentTypeVersionTuple.Item1];
- else
- parameterizedModelObjectDefinitionType = equipmentTypeVersionTuple.Item4.FileHandlerObjectTypes.ParameterizedModelObjectDefinition.Type;
- result = new Tuple(equipmentTypeVersionTuple.Item1, parameterizedModelObjectDefinitionType);
- return result;
- }
-
protected IList GetModelObjectParameters(string json)
{
IList results;
@@ -736,18 +729,38 @@ public class AdaptationTesting : ISMTP
return results;
}
- protected Tuple> GetModelObjectParameters(Tuple equipmentTypeVersionTuple)
+ protected Tuple GetEquipmentDictionaryVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName, EquipmentTypeVersion equipmentTypeVersion)
{
- Tuple> result;
- IList modelObjectParameters;
- if (_FileConnectorConfigurations.ContainsKey(equipmentTypeVersionTuple.Item1))
- modelObjectParameters = _ModelObjectParameters[equipmentTypeVersionTuple.Item1];
+ Tuple result;
+ string equipmentDictionaryName;
+ string equipmentDictionaryVersionName;
+ EquipmentDictionaryVersion equipmentDictionaryVersion;
+ Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersion, cellInstanceConnectionName);
+ int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
+ ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
+ string[] segments = GetEquipmentDictionaryStrings(componentsCellComponentCellComponent.Equipment, equipmentTypeVersion);
+ if (_SkipEquipmentDictionary || segments is null || segments.Length != 2 || string.IsNullOrEmpty(segments[0]) || string.IsNullOrEmpty(segments[1]))
+ {
+ equipmentDictionaryName = string.Empty;
+ equipmentDictionaryVersionName = string.Empty;
+ }
else
{
- string json = JsonSerializer.Serialize(equipmentTypeVersionTuple.Item4, new JsonSerializerOptions { WriteIndented = true });
- modelObjectParameters = GetModelObjectParameters(json);
+ equipmentDictionaryName = segments[0];
+ equipmentDictionaryVersionName = segments[1];
}
- result = new Tuple>(equipmentTypeVersionTuple.Item1, modelObjectParameters);
+ string equipmentDictionaryServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentDictionaryServiceV2/", equipmentDictionaryName, "/", equipmentDictionaryVersionName, "/configuration");
+ if (string.IsNullOrEmpty(equipmentDictionaryName) || string.IsNullOrEmpty(equipmentDictionaryVersionName))
+ equipmentDictionaryVersion = null;
+ else
+ {
+ if (!_EquipmentDictionaryVersions.TryGetValue(equipmentDictionaryServiceV2, out equipmentDictionaryVersion))
+ {
+ equipmentDictionaryVersion = GetEquipmentDictionaryVersion(equipmentDictionaryServiceV2);
+ _EquipmentDictionaryVersions.Add(equipmentDictionaryServiceV2, equipmentDictionaryVersion);
+ }
+ }
+ result = new Tuple(equipmentDictionaryServiceV2, equipmentDictionaryName, equipmentDictionaryVersionName, equipmentDictionaryVersion);
return result;
}
@@ -802,70 +815,6 @@ public class AdaptationTesting : ISMTP
return result;
}
- protected Tuple GetEquipmentDictionaryVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName, EquipmentTypeVersion equipmentTypeVersion)
- {
- Tuple result;
- string equipmentDictionaryName;
- string equipmentDictionaryVersionName;
- EquipmentDictionaryVersion equipmentDictionaryVersion;
- Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersion, cellInstanceConnectionName);
- int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
- ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
- string[] segments = GetEquipmentDictionaryStrings(componentsCellComponentCellComponent.Equipment, equipmentTypeVersion);
- if (_SkipEquipmentDictionary || segments is null || segments.Length != 2 || string.IsNullOrEmpty(segments[0]) || string.IsNullOrEmpty(segments[1]))
- {
- equipmentDictionaryName = string.Empty;
- equipmentDictionaryVersionName = string.Empty;
- }
- else
- {
- equipmentDictionaryName = segments[0];
- equipmentDictionaryVersionName = segments[1];
- }
- string equipmentDictionaryServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentDictionaryServiceV2/", equipmentDictionaryName, "/", equipmentDictionaryVersionName, "/configuration");
- if (string.IsNullOrEmpty(equipmentDictionaryName) || string.IsNullOrEmpty(equipmentDictionaryVersionName))
- equipmentDictionaryVersion = null;
- else
- {
- if (!_EquipmentDictionaryVersions.TryGetValue(equipmentDictionaryServiceV2, out equipmentDictionaryVersion))
- {
- equipmentDictionaryVersion = GetEquipmentDictionaryVersion(equipmentDictionaryServiceV2);
- _EquipmentDictionaryVersions.Add(equipmentDictionaryServiceV2, equipmentDictionaryVersion);
- }
- }
- result = new Tuple(equipmentDictionaryServiceV2, equipmentDictionaryName, equipmentDictionaryVersionName, equipmentDictionaryVersion);
- return result;
- }
-
- protected Tuple>> GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(Tuple equipmentDictionaryVersionTuple)
- {
- Tuple>> result;
- List> results;
- List> collection;
- if (_SkipEquipmentDictionary)
- results = new List>();
- else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1))
- throw new Exception();
- else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null)
- results = new List>();
- else if (_EquipmentDictionaryEventDescriptions.TryGetValue(equipmentDictionaryVersionTuple.Item1, out collection))
- results = collection;
- else
- {
- results = new List>();
- foreach (EquipmentDictionaryVersionEventsEvent equipmentDictionaryVersionEventsEvent in equipmentDictionaryVersionTuple.Item4.Events.Event)
- {
- if (string.IsNullOrEmpty(equipmentDictionaryVersionEventsEvent.Description))
- continue;
- if (!equipmentDictionaryVersionEventsEvent.IsAlwaysEnabled)
- continue;
- results.Add(new Tuple(equipmentDictionaryVersionEventsEvent.Name, equipmentDictionaryVersionEventsEvent.Description));
- }
- }
- result = new Tuple>>(equipmentDictionaryVersionTuple.Item1, results);
- return result;
- }
-
protected Dictionary GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, List> equipmentDictionaryIsAlwaysEnabledEvents, int edaConnectionPortNumber)
{
Dictionary results = new()
@@ -886,108 +835,6 @@ public class AdaptationTesting : ISMTP
return results;
}
- public string[] GetCSharpText(string testName)
- {
- string[] results;
- 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(mbn.CellInstanceName, mbn.CellInstanceVersionName);
- results = GetCSharpTextB(fileInfo, mbn.CellInstanceName, mbn.CellInstanceVersionName, cellInstanceVersionTuple.Item2);
- return results;
- }
-
- public string[] GetConfiguration(MethodBase methodBase)
- {
- string[] results;
- 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(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);
- if (fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value < 0)
- fileScanningIntervalInSecondsLine = $"-\t{fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value:0000}\t{Path.GetFileName(fileInfo.DirectoryName)}";
- else
- 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, mbn.CellInstanceConnectionName);
- Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple);
- Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
- Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
- Tuple>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
- Dictionary objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2, cellInstanceVersionTuple.Item2.EdaConnection.PortNumber);
- string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true });
- results = new string[] { fileInfo.FullName, json };
- return results;
- }
-
- public IFileRead Get(MethodBase methodBase, string sourceFileLocation, string sourceFileFilter, bool useCyclicalForDescription)
- {
- IFileRead result;
- MethodBaseName mbn = GetMethodBaseName(methodBase);
- FileInfo fileInfo = new(mbn.FileFullName);
- Dictionary fileParameter = new();
- if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
- _ = Directory.CreateDirectory(fileInfo.Directory.FullName);
- Dictionary> dummyRuns = new();
- Dictionary> staticRuns = new();
- 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, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
- _ = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
- if (!string.IsNullOrEmpty(sourceFileLocation) && sourceFileLocation != fileConnectorConfigurationTuple.Item2.SourceFileLocation)
- fileConnectorConfigurationTuple.Item2.SourceFileLocation = sourceFileLocation;
- if (!string.IsNullOrEmpty(sourceFileFilter) && sourceFileFilter != fileConnectorConfigurationTuple.Item2.SourceFileFilter)
- {
- fileConnectorConfigurationTuple.Item2.SourceFileFilter = sourceFileFilter;
- fileConnectorConfigurationTuple.Item2.SourceFileFilters = sourceFileFilter.Split('|').ToList();
- }
- if (_TestContext.FullyQualifiedTestClassName.Contains(nameof(Extract)))
- {
- try
- {
- 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);
- }
- }
- catch (IOException ex)
- {
- if (!ex.Message.Contains("SMB1"))
- throw;
- }
- }
- result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, connectionCount: cellInstanceVersionTuple.Item2.EquipmentConnections.Length);
- return result;
- }
-
public string[] GetVariables(MethodBase methodBase, string check, bool validatePDSF = true)
{
string[] results;
@@ -1090,80 +937,118 @@ public class AdaptationTesting : ISMTP
return results;
}
- internal static Tuple GetLogisticsColumnsAndBody(string fileFullName)
+ private string[] GetTextFiles(MethodBaseName mbn)
{
- Tuple results;
- results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(fileFullName);
- Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
- Assert.IsTrue(results.Item2.Length > 0, "Column check");
- Assert.IsTrue(results.Item3.Length > 0, "Body check");
- return results;
- }
-
- internal static Tuple GetLogisticsColumnsAndBody(string searchDirectory, string searchPattern)
- {
- Tuple results;
- if (searchPattern.Length > 3 && !searchPattern.Contains('*') && File.Exists(searchPattern))
- results = GetLogisticsColumnsAndBody(searchPattern);
+ 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
+ {
+ 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
{
- string[] pdsfFiles;
- pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
- if (pdsfFiles.Length == 0)
- _ = Process.Start("explorer.exe", searchDirectory);
- Assert.IsTrue(pdsfFiles.Length != 0, "GetFiles check");
- results = GetLogisticsColumnsAndBody(pdsfFiles[0]);
+ results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly);
+ if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && results.Length == 0)
+ {
+ _ = Process.Start("explorer.exe", mbn.TextFileDirectory);
+ File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty);
+ }
}
- Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
- Assert.IsTrue(results.Item2.Length > 0, "Column check");
- Assert.IsTrue(results.Item3.Length > 0, "Body check");
return results;
}
- internal static Tuple GetLogisticsColumnsAndBody(IFileRead fileRead, Logistics logistics, Tuple> extractResult, Tuple pdsf)
+ public IFileRead Get(MethodBase methodBase, string sourceFileLocation, string sourceFileFilter, bool useCyclicalForDescription)
{
- Tuple results;
- string text = ProcessDataStandardFormat.GetPDSFText(fileRead, logistics, extractResult.Item3, logisticsText: pdsf.Item1);
- string[] lines = text.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
- results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(logistics.ReportFullPath, lines);
- Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
- Assert.IsTrue(results.Item2.Length > 0, "Column check");
- Assert.IsTrue(results.Item3.Length > 0, "Body check");
- return results;
- }
-
- internal static string[] GetItem2(Tuple pdsf, Tuple pdsfNew)
- {
- JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
- string jsonOld = JsonSerializer.Serialize(pdsf.Item2, pdsf.Item2.GetType(), jsonSerializerOptions);
- string jsonNew = JsonSerializer.Serialize(pdsfNew.Item2, pdsfNew.Item2.GetType(), jsonSerializerOptions);
- return new string[] { jsonOld, jsonNew };
- }
-
- internal static string[] GetItem3(Tuple pdsf, Tuple pdsfNew)
- {
- string joinOld = string.Join(System.Environment.NewLine, from l in pdsf.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
- string joinNew = string.Join(System.Environment.NewLine, from l in pdsfNew.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
- return new string[] { joinOld, joinNew };
- }
-
- internal static void UpdatePassDirectory(string searchDirectory)
- {
- DateTime dateTime = DateTime.Now;
- try
- { Directory.SetLastWriteTime(searchDirectory, dateTime); }
- catch (Exception) { }
- string ticksDirectory = Path.GetDirectoryName(searchDirectory);
- try
- { Directory.SetLastWriteTime(ticksDirectory, dateTime); }
- catch (Exception) { }
- string[] directories = Directory.GetDirectories(searchDirectory, "*", SearchOption.TopDirectoryOnly);
- foreach (string directory in directories)
+ IFileRead result;
+ MethodBaseName mbn = GetMethodBaseName(methodBase);
+ FileInfo fileInfo = new(mbn.FileFullName);
+ Dictionary fileParameter = new();
+ if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
+ _ = Directory.CreateDirectory(fileInfo.Directory.FullName);
+ Dictionary> dummyRuns = new();
+ Dictionary> staticRuns = new();
+ 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, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
+ _ = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
+ if (!string.IsNullOrEmpty(sourceFileLocation) && sourceFileLocation != fileConnectorConfigurationTuple.Item2.SourceFileLocation)
+ fileConnectorConfigurationTuple.Item2.SourceFileLocation = sourceFileLocation;
+ if (!string.IsNullOrEmpty(sourceFileFilter) && sourceFileFilter != fileConnectorConfigurationTuple.Item2.SourceFileFilter)
+ {
+ fileConnectorConfigurationTuple.Item2.SourceFileFilter = sourceFileFilter;
+ fileConnectorConfigurationTuple.Item2.SourceFileFilters = sourceFileFilter.Split('|').ToList();
+ }
+ if (_TestContext.FullyQualifiedTestClassName.Contains(nameof(Extract)))
{
try
- { Directory.SetLastWriteTime(directory, dateTime); }
- catch (Exception) { }
+ {
+ 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.Split('|')[0]))
+ _ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder.Split('|')[0]);
+ }
+ }
+ catch (IOException ex)
+ {
+ if (!ex.Message.Contains("SMB1"))
+ throw;
+ }
}
+ result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, connectionCount: cellInstanceVersionTuple.Item2.EquipmentConnections.Length);
+ return result;
+ }
+
+ internal static ProcessDataStandardFormat GetProcessDataStandardFormat(string fileFullName)
+ {
+ ProcessDataStandardFormat result;
+ result = ProcessDataStandardFormat.GetProcessDataStandardFormat(fileFullName);
+ Assert.IsTrue(result.Logistics.Count > 0, "Logistics check");
+ Assert.IsFalse(string.IsNullOrEmpty(result.Logistics[0]));
+ Assert.IsTrue(result.Columns.Count > 0, "Column check");
+ Assert.IsTrue(result.Body.Count > 0, "Body check");
+ return result;
+ }
+
+ internal static ProcessDataStandardFormat GetProcessDataStandardFormat(IFileRead fileRead, Logistics logistics, Tuple> extractResult, ProcessDataStandardFormat processDataStandardFormat)
+ {
+ ProcessDataStandardFormat result;
+ string text = ProcessDataStandardFormat.GetPDSFText(fileRead, logistics, extractResult.Item3, logisticsText: processDataStandardFormat.Logistics[0]);
+ string[] lines = text.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
+ result = ProcessDataStandardFormat.GetProcessDataStandardFormat(logistics.ReportFullPath, lines);
+ Assert.IsTrue(result.Logistics.Count > 0, "Logistics check");
+ Assert.IsFalse(string.IsNullOrEmpty(result.Logistics[0]));
+ Assert.IsTrue(result.Columns.Count > 0, "Column check");
+ Assert.IsTrue(result.Body.Count > 0, "Body check");
+ return result;
}
internal static string GetFileName(MethodBase methodBase)
@@ -1199,6 +1084,25 @@ public class AdaptationTesting : ISMTP
return result;
}
+ internal static void UpdatePassDirectory(string searchDirectory)
+ {
+ DateTime dateTime = DateTime.Now;
+ try
+ { Directory.SetLastWriteTime(searchDirectory, dateTime); }
+ catch (Exception) { }
+ string ticksDirectory = Path.GetDirectoryName(searchDirectory);
+ try
+ { Directory.SetLastWriteTime(ticksDirectory, dateTime); }
+ catch (Exception) { }
+ string[] directories = Directory.GetDirectories(searchDirectory, "*", SearchOption.TopDirectoryOnly);
+ foreach (string directory in directories)
+ {
+ try
+ { Directory.SetLastWriteTime(directory, dateTime); }
+ catch (Exception) { }
+ }
+ }
+
internal static void CompareSaveTSV(string textFileDirectory, string[] join)
{
if (join[0] != join[1])
@@ -1219,14 +1123,25 @@ public class AdaptationTesting : ISMTP
}
}
- internal static void CompareSave(string textFileDirectory, Tuple pdsf, Tuple pdsfNew)
+ internal static ProcessDataStandardFormat GetProcessDataStandardFormat(string searchDirectory, string searchPattern)
{
- if (pdsf.Item1 != pdsfNew.Item1)
+ ProcessDataStandardFormat result;
+ if (searchPattern.Length > 3 && !searchPattern.Contains('*') && File.Exists(searchPattern))
+ result = GetProcessDataStandardFormat(searchPattern);
+ else
{
- _ = Process.Start("explorer.exe", textFileDirectory);
- File.WriteAllText(Path.Combine(textFileDirectory, "0.dat"), pdsf.Item1);
- File.WriteAllText(Path.Combine(textFileDirectory, "1.dat"), pdsfNew.Item1);
+ string[] pdsfFiles;
+ pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
+ if (pdsfFiles.Length == 0)
+ _ = Process.Start("explorer.exe", searchDirectory);
+ Assert.AreNotEqual(0, pdsfFiles.Length, "GetFiles check");
+ result = GetProcessDataStandardFormat(pdsfFiles[0]);
}
+ Assert.IsTrue(result.Logistics.Count > 0, "Logistics check");
+ Assert.IsFalse(string.IsNullOrEmpty(result.Logistics[0]));
+ Assert.IsTrue(result.Columns.Count > 0, "Column check");
+ Assert.IsTrue(result.Body.Count > 0, "Body check");
+ return result;
}
internal static IFileRead GetWriteConfigurationGetFileRead(MethodBase methodBase, string check, AdaptationTesting adaptationTesting)
@@ -1240,6 +1155,21 @@ public class AdaptationTesting : ISMTP
return result;
}
+ internal static string[] GetItem2(ProcessDataStandardFormat processDataStandardFormat, ProcessDataStandardFormat processDataStandardFormatNew)
+ {
+ JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
+ string jsonOld = JsonSerializer.Serialize(processDataStandardFormat.Columns, processDataStandardFormat.Columns.GetType(), jsonSerializerOptions);
+ string jsonNew = JsonSerializer.Serialize(processDataStandardFormatNew.Columns, processDataStandardFormatNew.Columns.GetType(), jsonSerializerOptions);
+ return new string[] { jsonOld, jsonNew };
+ }
+
+ internal static string[] GetItem3(ProcessDataStandardFormat processDataStandardFormat, ProcessDataStandardFormat processDataStandardFormatNew)
+ {
+ string joinOld = string.Join(System.Environment.NewLine, from l in processDataStandardFormat.Body select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
+ string joinNew = string.Join(System.Environment.NewLine, from l in processDataStandardFormatNew.Body select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
+ return new string[] { joinOld, joinNew };
+ }
+
internal static string ReExtractCompareUpdatePassDirectory(string[] variables, IFileRead fileRead, Logistics logistics, bool validatePDSF = true)
{
string result;
@@ -1252,20 +1182,20 @@ public class AdaptationTesting : ISMTP
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
if (!validatePDSF)
- _ = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, new(string.Empty, Array.Empty(), Array.Empty()));
+ _ = GetProcessDataStandardFormat(fileRead, logistics, extractResult, ProcessDataStandardFormat.GetEmpty(logistics));
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);
+ ProcessDataStandardFormat processDataStandardFormat = GetProcessDataStandardFormat(variables[2], variables[4]);
+ ProcessDataStandardFormat processDataStandardFormatNew = GetProcessDataStandardFormat(fileRead, logistics, extractResult, processDataStandardFormat);
+ CompareSave(variables[5], processDataStandardFormat, processDataStandardFormatNew);
+ Assert.AreEqual(processDataStandardFormatNew.Logistics, processDataStandardFormat.Logistics, "Item1 check!");
+ string[] json = GetItem2(processDataStandardFormat, processDataStandardFormatNew);
CompareSaveJSON(variables[5], json);
- Assert.IsTrue(json[0] == json[1], "Item2 check!");
- string[] join = GetItem3(pdsf, pdsfNew);
+ Assert.AreEqual(json[1], json[0], "Item2 check!");
+ string[] join = GetItem3(processDataStandardFormat, processDataStandardFormatNew);
CompareSaveTSV(variables[5], join);
- Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!");
+ Assert.AreEqual(join[1], join[0], "Item3 (Join) check!");
}
UpdatePassDirectory(variables[2]);
}
@@ -1273,6 +1203,89 @@ public class AdaptationTesting : ISMTP
return result;
}
-}
-// namespace Adaptation._Tests.Helpers { public class AdaptationTesting { } }
-// 2022-08-05 -> AdaptationTesting
\ No newline at end of file
+ internal static void CompareSave(string textFileDirectory, ProcessDataStandardFormat processDataStandardFormat, ProcessDataStandardFormat processDataStandardFormatNew)
+ {
+ if (processDataStandardFormat.Logistics[0] != processDataStandardFormatNew.Logistics[0])
+ {
+ _ = Process.Start("explorer.exe", textFileDirectory);
+ File.WriteAllText(Path.Combine(textFileDirectory, "0.dat"), processDataStandardFormat.Logistics[0]);
+ File.WriteAllText(Path.Combine(textFileDirectory, "1.dat"), processDataStandardFormatNew.Logistics[0]);
+ }
+ }
+
+ protected static Stream ToStream(string @this)
+ {
+ MemoryStream memoryStream = new();
+ StreamWriter streamWriter = new(memoryStream);
+ streamWriter.Write(@this);
+ streamWriter.Flush();
+ memoryStream.Position = 0;
+ return memoryStream;
+ }
+
+ protected Tuple GetParameterizedModelObjectDefinitionTypeTuple(Tuple equipmentTypeVersionTuple)
+ {
+ Tuple result;
+ string parameterizedModelObjectDefinitionType;
+ if (_FileConnectorConfigurations.ContainsKey(equipmentTypeVersionTuple.Item1))
+ parameterizedModelObjectDefinitionType = _ParameterizedModelObjectDefinitionTypes[equipmentTypeVersionTuple.Item1];
+ else
+ parameterizedModelObjectDefinitionType = equipmentTypeVersionTuple.Item4.FileHandlerObjectTypes.ParameterizedModelObjectDefinition.Type;
+ result = new Tuple(equipmentTypeVersionTuple.Item1, parameterizedModelObjectDefinitionType);
+ return result;
+ }
+
+ protected Tuple> GetModelObjectParameters(Tuple equipmentTypeVersionTuple)
+ {
+ Tuple> result;
+ IList modelObjectParameters;
+ if (_FileConnectorConfigurations.ContainsKey(equipmentTypeVersionTuple.Item1))
+ modelObjectParameters = _ModelObjectParameters[equipmentTypeVersionTuple.Item1];
+ else
+ {
+ string json = JsonSerializer.Serialize(equipmentTypeVersionTuple.Item4, new JsonSerializerOptions { WriteIndented = true });
+ modelObjectParameters = GetModelObjectParameters(json);
+ }
+ result = new Tuple>(equipmentTypeVersionTuple.Item1, modelObjectParameters);
+ return result;
+ }
+
+ protected Tuple>> GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(Tuple equipmentDictionaryVersionTuple)
+ {
+ Tuple>> result;
+ List> results;
+ List> collection;
+ if (_SkipEquipmentDictionary)
+ results = new List>();
+ else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1))
+ throw new Exception();
+ else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null)
+ results = new List>();
+ else if (_EquipmentDictionaryEventDescriptions.TryGetValue(equipmentDictionaryVersionTuple.Item1, out collection))
+ results = collection;
+ else
+ {
+ results = new List>();
+ foreach (EquipmentDictionaryVersionEventsEvent equipmentDictionaryVersionEventsEvent in equipmentDictionaryVersionTuple.Item4.Events.Event)
+ {
+ if (string.IsNullOrEmpty(equipmentDictionaryVersionEventsEvent.Description))
+ continue;
+ if (!equipmentDictionaryVersionEventsEvent.IsAlwaysEnabled)
+ continue;
+ results.Add(new Tuple(equipmentDictionaryVersionEventsEvent.Name, equipmentDictionaryVersionEventsEvent.Description));
+ }
+ }
+ result = new Tuple>>(equipmentDictionaryVersionTuple.Item1, results);
+ return result;
+ }
+
+ public (string i, string v, string c, string n, int p, string f) GetCellInstanceVersionCore(string testName)
+ {
+ (string, string, string, string, int, string) results;
+ MethodBaseName mbn = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, testName, @"D:\Tmp\Phares");
+ Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName);
+ results = new(mbn.CellInstanceName, mbn.CellInstanceVersionName, cellInstanceVersionTuple.Item2.CellCommunicatingRule, cellInstanceVersionTuple.Item2.CellNotCommunicatingRule, cellInstanceVersionTuple.Item2.EdaConnection.PortNumber, cellInstanceVersionTuple.Item2.FrozenBy);
+ return results;
+ }
+
+}
\ No newline at end of file
diff --git a/Adaptation/_Tests/Static/METCLIMATEC.cs b/Adaptation/_Tests/Static/METCLIMATEC.cs
index 2ac922e..83ff4b1 100644
--- a/Adaptation/_Tests/Static/METCLIMATEC.cs
+++ b/Adaptation/_Tests/Static/METCLIMATEC.cs
@@ -51,7 +51,7 @@ public class METCLIMATEC : LoggingUnitTesting, IDisposable
public void TestDateTime()
{
DateTime dateTime = DateTime.Now;
- Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
+ Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt"));
}
#if DEBUG
@@ -64,7 +64,7 @@ public class METCLIMATEC : LoggingUnitTesting, IDisposable
StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{
- new("METCLIMATEC", "v2.59.0"),
+ new("METCLIMATEC", "v2.60.0"),
};
string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
diff --git a/Adaptation/_Tests/Static/csv.cs b/Adaptation/_Tests/Static/csv.cs
index e3a75b8..1c70efc 100644
--- a/Adaptation/_Tests/Static/csv.cs
+++ b/Adaptation/_Tests/Static/csv.cs
@@ -51,7 +51,7 @@ public class CSV : LoggingUnitTesting, IDisposable
public void TestDateTime()
{
DateTime dateTime = DateTime.Now;
- Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
+ Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt"));
}
#if DEBUG
@@ -64,7 +64,7 @@ public class CSV : LoggingUnitTesting, IDisposable
StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{
- new("TRENDLOG", "v2.59.0"),
+ new("TRENDLOG", "v2.60.0"),
};
string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
diff --git a/METCLIMATEC.csproj b/METCLIMATEC.csproj
index 77c684f..f70df30 100644
--- a/METCLIMATEC.csproj
+++ b/METCLIMATEC.csproj
@@ -147,6 +147,7 @@
+
@@ -168,10 +169,10 @@
- 2.59.0
+ 2.60.0
- 8.0.3
+ 8.0.5
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 084cd17..9a7650b 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.59.0.0")]
-[assembly: AssemblyFileVersion("2.59.0.0")]
+[assembly: AssemblyVersion("2.60.0.0")]
+[assembly: AssemblyFileVersion("2.60.0.0")]