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/.groovy b/.groovy deleted file mode 100644 index 7a9c234..0000000 --- a/.groovy +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env groovy -/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */ -import groovy.transform.Field - -@Field String _DDrive = 'D:/' -@Field String _AssemblyName = '...' -@Field String _TargetLocation = '...' -@Field String _GitCommitSeven = '...' -@Field String _GitName = 'MET08DDUPSFS6420' -@Field String _TestProjectDirectory = 'Adaptation' -@Field String _AgentStaging = 'mestsa07ec-ecmeseaf' -@Field String _DDriveNet = "${_DDrive}Framework4.8" -@Field String _AgentProduction = 'messa08ec-ecmeseaf' -@Field String _AgentDevelopment = 'mestsa003-mesedasvc' -@Field String _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe' -@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe' - -pipeline { - agent { - label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else' - } - parameters { - string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server') - string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...') - } - stages { - stage('Git') { - steps { - bat(returnStatus: true, script: 'git init') - bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git') - bat(returnStatus: true, script: 'git pull origin master') - } - } - stage('Setup') { - steps { - script { - _AssemblyName = "${env.JOB_NAME}" - _GitCommitSeven = '1234567' - // _GitCommitSeven = env.GIT_COMMIT.substring(0, 7) - def files = findFiles(glob: '*.csproj') - if (files.length != 1) { - error("Build failed because couldn't find a *.csproj file") - } - echo """ - ${files[0].name} - ${files[0].path} - ${files[0].directory} - ${files[0].length} - ${files[0].lastModified} - """ - _AssemblyName = files[0].name.split('[.]csproj')[0] - _TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}" - } - } - } - stage('Info') { - steps { - echo "_AssemblyName ${_AssemblyName}" // ... - echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11 - echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11 - echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master - echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41 - echo "GIT_SERVER ${params.GIT_SERVER}" // ... - echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git - echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11 - echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/ - echo "JOB_NAME ${env.JOB_NAME}" // ... - echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\... - } - } - // stage('Restore') { - // steps { - // bat(returnStatus: true, script: 'dotnet --info') - // } - // } - stage('Safe storage of app secrets') { - steps { - dir(_TestProjectDirectory) { - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets init') - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"') - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"') - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"') - } - } - } - stage('Core Build') { - steps { - echo "Build number is ${currentBuild.number}" - dir(_TestProjectDirectory) { - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'build --runtime win-x64 --self-contained --verbosity quiet') - } - } - } - // stage('Test') { - // options { - // timeout(time: 10, unit: 'MINUTES') - // } - // steps { - // dir(_TestProjectDirectory) { - // bat('dotnet --info') - // } - // } - // } - stage('Framework Build') { - steps { - echo "Build number is ${currentBuild.number}" - bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' + - '/target:Restore ' + - '/detailedsummary ' + - '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' + - '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' + - _AssemblyName + '.csproj') - bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' + - '/target:Build ' + - '/detailedsummary ' + - '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' + - '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' + - _AssemblyName + '.csproj') - } - } - stage('Commit Id') { - steps { - dir('bin/Debug') { - writeFile file: "${_AssemblyName}.txt", text: "${env.GIT_COMMIT}-${env.BUILD_NUMBER}-${env.GIT_URL}" - } - } - } - stage('Package') { - steps { - fileOperations([fileZipOperation(folderPath: 'bin/Debug', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug")]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug", targetNameExpression: '')]) - } - } - // stage('Force Fail') { - // steps { - // error("Build failed because of this and that..") - // } - // } - stage('Copy Files to: file-share') { - steps { - dir('bin/Debug') { - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - } - } - } - } - post { - always { - dir('bin') { - deleteDir() - } - dir('obj') { - deleteDir() - } - dir(_TestProjectDirectory + '/bin') { - deleteDir() - } - dir(_TestProjectDirectory + '/obj') { - deleteDir() - } - // cleanWs() - } - } -} 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/Reactor.js b/Adaptation/.vscode/Reactor.js index 4a8fd5e..0365ca4 100644 --- a/Adaptation/.vscode/Reactor.js +++ b/Adaptation/.vscode/Reactor.js @@ -9,8 +9,8 @@ getValue(self, self.length, $('dcp.TENCOR1/pcl/MesEntity', ''), $('dcp.TENCOR1/p function getValue(value, length, mesEntity, recipe, processJobId) { if (recipe.toUpperCase() === 'adsf') return mesEntity; - else if (length !== 0 || processJobId === '-') - return value; - else + else if (length === 0) return processJobId; + else + return value; } \ No newline at end of file diff --git a/Adaptation/.vscode/launch.json b/Adaptation/.vscode/launch.json index cc0975b..cfb4688 100644 --- a/Adaptation/.vscode/launch.json +++ b/Adaptation/.vscode/launch.json @@ -4,7 +4,7 @@ "name": ".NET Core Attach", "type": "coreclr", "request": "attach", - "processId": 20888 + "processId": 13036 } ] } diff --git a/Adaptation/.vscode/psn.js b/Adaptation/.vscode/psn.js index 30368a4..94db65b 100644 --- a/Adaptation/.vscode/psn.js +++ b/Adaptation/.vscode/psn.js @@ -9,8 +9,8 @@ getValue(self, self.length, getContextData('2', 'cds.PRODUCT', ''), $('dcp.TENCO function getValue(value, length, product, recipe) { if (recipe.toUpperCase() === 'asdf') return 'asdf'; - else if (length !== 0 || product === '-') - return value; - else + else if (length === 0) return product; + else + return value; } \ No newline at end of file diff --git a/Adaptation/.vscode/settings.json b/Adaptation/.vscode/settings.json index 49c2c62..3865fe5 100644 --- a/Adaptation/.vscode/settings.json +++ b/Adaptation/.vscode/settings.json @@ -22,6 +22,7 @@ "TIBCO", "Villach" ], + "coverage-gutters.coverageBaseDir": "../../../../MET08DDUPSFS6420/05_TestResults/TestResults/**", "workbench.colorCustomizations": { "activityBar.activeBackground": "#7933a3", "activityBar.activeBorder": "#31240f", 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 a8ab718..a702307 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; @@ -18,6 +19,8 @@ public class FileRead : Shared.FileRead, IFileRead 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) @@ -31,6 +34,8 @@ public class FileRead : Shared.FileRead, IFileRead throw new Exception(cellInstanceConnectionName); if (!_IsDuplicator) throw new Exception(cellInstanceConnectionName); + _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"); } @@ -230,7 +235,7 @@ public class FileRead : Shared.FileRead, IFileRead return result.ToString(); } - private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List descriptions, Test[] tests) + private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, string logistics, List descriptions, Test[] tests) { bool isDummyRun = false; List<(Shared.Properties.IScopeInfo, string)> collection = new(); @@ -247,17 +252,22 @@ public class FileRead : Shared.FileRead, IFileRead string lines = GetLines(_Logistics, descriptions); if (!string.IsNullOrEmpty(lines)) { + 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)); - else + else if (count is null) collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines)); + else + collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} E{count.Value} {_OpenInsightFilePattern}"), lines)); + string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + FromIQS.Save(_OpenInsightApiECDirectory, _OpenInsightApiIFXDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, subGroupId, weekOfYear); } } if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) @@ -274,7 +284,7 @@ public class FileRead : Shared.FileRead, IFileRead List descriptions = pcl.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 c316cfd..21cedbb 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 ('TENCOR1', 'TENCOR2', 'TENCOR3') ") .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, pcl.Description description, long breakAfter, long preWait) + internal static (long?, int?, string) GetCommandText(string connectionString, Logistics logistics, pcl.Description description, long breakAfter, long preWait) { string dateTime; + int? count = null; string commandText; long? result = null; string dateFormat = pcl.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, pcl.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, pcl.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/FileRead.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs index 16c95fd..c7212a3 100644 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs @@ -30,9 +30,6 @@ public class FileRead : Shared.FileRead, IFileRead if (!_IsDuplicator) throw new Exception(cellInstanceConnectionName); _OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI"); - string barcode = TestMe.GetBarcode("192.168.0.121"); - if (string.IsNullOrEmpty(barcode)) - { } } void IFileRead.Move(Tuple> extractResults, Exception exception) diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/TestMe.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/TestMe.cs deleted file mode 100644 index da8b5ad..0000000 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/TestMe.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Net.Http; -using System.Text.Json; - -namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer; - -public class TestMe -{ - - private static List GetURLCollection(string barcodeServerIP) - { - List results = new(); - int weekOfYear; - string checkURL; - DateTime dateTime; - string weekDirectory; - string weekOfYearPadded; - string lastURL = string.Empty; - Calendar calendar = new CultureInfo("en-US").Calendar; - for (int i = 1; i < 3; i++) - { - if (i == 1) - dateTime = DateTime.Now; - else - dateTime = DateTime.Now.AddHours(-4); - weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday) - 1; - weekOfYearPadded = weekOfYear.ToString("00"); - weekDirectory = $"{dateTime:yyyy}_Week_{weekOfYearPadded}/{dateTime:yyyy-MM-dd}"; - checkURL = string.Concat("http://", barcodeServerIP, '/', weekDirectory); - if (i == 1 || checkURL != lastURL) - { - results.Add(string.Concat(checkURL, "/A")); - results.Add(string.Concat(checkURL, "/B")); - } - lastURL = checkURL; - } - return results; - } - - private static List GetURLPossible(HttpClient httpClient, List urlCollection, JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions) - { - List results = new(); - string json; - NginxFileSystem[] nginxFileSystemCollection; - DateTime minimumDateTime = DateTime.Now.AddHours(-4); - string nginxFormat = "ddd, dd MMM yyyy HH:mm:ss zzz"; - foreach (string url in urlCollection) - { - try - { - json = httpClient.GetStringAsync(url).Result; - nginxFileSystemCollection = JsonSerializer.Deserialize(json, propertyNameCaseInsensitiveJsonSerializerOptions); - foreach (NginxFileSystem nginxFileSystem in nginxFileSystemCollection) - { - if (!DateTime.TryParseExact(nginxFileSystem.MTime.Replace("GMT", "+00:00"), nginxFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime)) - continue; - if (dateTime < minimumDateTime) - continue; - results.Add(string.Concat(url, '/', nginxFileSystem.Name)); - } - } - catch - { } - } - return results; - } - - private static List<(string, BarcodeRecord)> GetBarcodePossible(HttpClient httpClient, JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions, List possibleURLCollection) - { - List<(string, BarcodeRecord)> results = new(); - string json; - BarcodeRecord barcodeRecord; - foreach (string possibleURL in possibleURLCollection) - { - try - { - json = httpClient.GetStringAsync(possibleURL).Result; - barcodeRecord = JsonSerializer.Deserialize(json, propertyNameCaseInsensitiveJsonSerializerOptions); - results.Add(new(possibleURL, barcodeRecord)); - } - catch - { } - } - return results; - } - - public static string GetBarcode(string barcodeServerIP) - { - string result = string.Empty; - using HttpClient httpClient = new(); - List urlCollection = GetURLCollection(barcodeServerIP); - JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions = new() { PropertyNameCaseInsensitive = true }; - List possibleURLCollection = GetURLPossible(httpClient, urlCollection, propertyNameCaseInsensitiveJsonSerializerOptions); - List<(string, BarcodeRecord)> possibleBarcodeCollection = GetBarcodePossible(httpClient, propertyNameCaseInsensitiveJsonSerializerOptions, possibleURLCollection); - foreach ((string url, BarcodeRecord barcodeRecord) in possibleBarcodeCollection) - { - if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(barcodeRecord.Barcode)) - continue; - } - return result; - } - -} \ No newline at end of file diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs index 4779312..7ad0038 100644 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs @@ -298,7 +298,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[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly); if (pclFiles.Length != 1) diff --git a/Adaptation/FileHandlers/Processed/FileRead.cs b/Adaptation/FileHandlers/Processed/FileRead.cs index ff94090..846b0f2 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/pcl/ProcessData.cs b/Adaptation/FileHandlers/pcl/ProcessData.cs index 0107cb9..b5f3b63 100644 --- a/Adaptation/FileHandlers/pcl/ProcessData.cs +++ b/Adaptation/FileHandlers/pcl/ProcessData.cs @@ -250,11 +250,11 @@ public class ProcessData : IProcessData return result; } - 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]; @@ -270,11 +270,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; @@ -356,8 +356,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/MET08DDUPSFS6420-Development.yml b/Adaptation/MET08DDUPSFS6420-Development.yml new file mode 100644 index 0000000..ede4952 --- /dev/null +++ b/Adaptation/MET08DDUPSFS6420-Development.yml @@ -0,0 +1,179 @@ +trigger: + branches: + include: + - development + paths: + include: + - "Adaptation/*" + +pool: + name: Mesa-Windows-Service + demands: MET08DDUPSFS6420-Development + +steps: + - script: | + set coreVersion=net6.0 + echo %coreVersion% + echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion% + echo $(CoreVersion) + displayName: CoreVersion + + - script: | + set configuration=Debug + echo %configuration% + echo ##vso[task.setvariable variable=Configuration;]%configuration% + echo ($Configuration) + displayName: Configuration + + - script: | + set nugetSource=https://messa017.infineon.com/v3/index.json + echo %nugetSource% + echo ##vso[task.setvariable variable=NugetSource;]%nugetSource% + echo $(NugetSource) + displayName: NugetSource + + - script: | + set gitCommit=$(Build.SourceVersion) + set gitCommitSeven=%gitCommit:~0,7% + echo %gitCommitSeven% + echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven% + echo $(GitCommitSeven) + displayName: GitCommitSeven + + - script: | + echo $(Build.BuildId) + echo $(Build.Reason) + echo $(Build.Repository.Id) + echo $(Build.Repository.Name) + echo $(Build.SourceVersion) + echo $(CoreVersion) + echo $(Configuration) + echo $(NugetSource) + echo $(GitCommitSeven) + REM echo $(pipelinePassword) + displayName: "Echo Check" + + - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' + displayName: "Nuget Clear" + # enabled: false + + - script: | + "C:\program files\dotnet\dotnet.exe" user-secrets init + "C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)" + "C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommitSeven" "$(GitCommitSeven)" + "C:\program files\dotnet\dotnet.exe" user-secrets list + workingDirectory: Adaptation + displayName: "Safe storage of app secrets - Adaptation" + + - task: CopyFiles@2 + displayName: "Copy Files to: - GhostPCL" + inputs: + 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" + inputs: + SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC\v2.6.6.21' + TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' + OverWrite: true + enabled: false + + - task: CopyFiles@2 + 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' + OverWrite: true + enabled: false + + - script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)' + 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: 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:$(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" + + - 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" + + - task: CopyFiles@2 + displayName: 'Copy Files to: D:\Framework4.8' + inputs: + SourceFolder: 'bin\$(Configuration)' + Contents: "*$(Build.Repository.Name)*" + TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' + OverWrite: true + enabled: false + + - task: CopyFiles@2 + displayName: 'Copy Files to: \\messv02ecc1.ec.local\EC_EAFRepository' + inputs: + SourceFolder: 'bin\$(Configuration)' + 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: Adaptation + displayName: "Core Clean - Tests" + + - script: | + "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) + workingDirectory: Adaptation + displayName: "Core Clean - Adaptation" + + - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' + displayName: "Force Fail" + enabled: false diff --git a/Adaptation/MET08DDUPSFS6420.Tests.csproj b/Adaptation/MET08DDUPSFS6420.Tests.csproj index 7c51f23..3b846af 100644 --- a/Adaptation/MET08DDUPSFS6420.Tests.csproj +++ b/Adaptation/MET08DDUPSFS6420.Tests.csproj @@ -33,49 +33,8 @@ Linux - - - - - - - - - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - NU1701 - NU1701 - NU1701 - - - NU1701 + + NU1701 NU1701 NU1701 @@ -83,6 +42,41 @@ NU1701 NU1701 NU1701 + + + + + + + + + + + + + + + + NU1701 + + + + + + + + + + + + + + NU1701 + + + NU1701 + NU1701 + NU1701 @@ -92,4 +86,18 @@ Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + \ No newline at end of file diff --git a/Adaptation/MET08DDUPSFS6420.yml b/Adaptation/MET08DDUPSFS6420.yml new file mode 100644 index 0000000..f081305 --- /dev/null +++ b/Adaptation/MET08DDUPSFS6420.yml @@ -0,0 +1,174 @@ +trigger: + branches: + include: + - master + paths: + include: + - "Adaptation/*" + +pool: + name: Mesa-Windows-Service + demands: MET08DDUPSFS6420 + +steps: + - script: | + set coreVersion=net6.0 + echo %coreVersion% + echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion% + echo $(CoreVersion) + displayName: CoreVersion + + - script: | + set configuration=Release + echo %configuration% + echo ##vso[task.setvariable variable=Configuration;]%configuration% + echo ($Configuration) + displayName: Configuration + + - script: | + set nugetSource=https://messa08ec.ec.local/v3/index.json + echo %nugetSource% + echo ##vso[task.setvariable variable=NugetSource;]%nugetSource% + echo $(NugetSource) + displayName: NugetSource + + - script: | + set gitCommit=$(Build.SourceVersion) + set gitCommitSeven=%gitCommit:~0,7% + echo %gitCommitSeven% + echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven% + echo $(GitCommitSeven) + displayName: GitCommitSeven + + - script: | + echo $(Build.BuildId) + echo $(Build.Reason) + echo $(Build.Repository.Id) + echo $(Build.Repository.Name) + echo $(Build.SourceVersion) + echo $(CoreVersion) + echo $(Configuration) + echo $(NugetSource) + echo $(GitCommitSeven) + REM echo $(pipelinePassword) + displayName: "Echo Check" + + - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' + displayName: "Nuget Clear" + enabled: false + + - script: | + "C:\program files\dotnet\dotnet.exe" user-secrets init + "C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)" + "C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommitSeven" "$(GitCommitSeven)" + "C:\program files\dotnet\dotnet.exe" user-secrets list + workingDirectory: Adaptation + displayName: "Safe storage of app secrets - Adaptation" + + - task: CopyFiles@2 + displayName: "Copy Files to: - GhostPCL" + inputs: + 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" + 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" + inputs: + SourceFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\PDF-Text-Stripper\v4.8.0.1' + TargetFolder: 'Adaptation\bin\$(Configuration)\net6.0\win-x64' + OverWrite: true + + - script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)' + 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: 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:$(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" + + - 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" + + - task: CopyFiles@2 + displayName: 'Copy Files to: D:\Framework4.8' + inputs: + SourceFolder: 'bin\$(Configuration)' + Contents: "*$(Build.Repository.Name)*" + TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' + OverWrite: true + + - task: CopyFiles@2 + displayName: 'Copy Files to: \\messv02ecc1.ec.local\EC_EAFRepository' + inputs: + SourceFolder: 'bin\$(Configuration)' + 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: Adaptation + displayName: "Core Clean - Tests" + + - script: | + "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) + workingDirectory: Adaptation + displayName: "Core Clean - Adaptation" + + - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' + 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.36.3/TENCOR1.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.36.3/TENCOR1.cs index 1fcc8af..dad4505 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.36.3/TENCOR1.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.36.3/TENCOR1.cs @@ -41,7 +41,7 @@ public class TENCOR1 : 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/MET08DDUPSFS6420.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSFS6420.cs index 794acc3..e2163e6 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSFS6420.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/MET08DDUPSFS6420.cs @@ -43,7 +43,7 @@ public class MET08DDUPSFS6420 : 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/TENCOR1.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR1.cs index 58b5d72..28702bc 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR1.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR1.cs @@ -40,7 +40,7 @@ public class TENCOR1 : 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/TENCOR2.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR2.cs index 00a5750..4cc5886 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR2.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR2.cs @@ -40,7 +40,7 @@ public class TENCOR2 : 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/TENCOR3-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR3-EQPT.cs index c1ac17e..9895efd 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR3-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR3-EQPT.cs @@ -41,7 +41,7 @@ public class TENCOR3_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/TENCOR3.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR3.cs index 271bffc..eedbb09 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR3.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.39.0/TENCOR3.cs @@ -41,7 +41,7 @@ public class TENCOR3 : 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/MET08DDUPSFS6420.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSFS6420.cs index b7e8ad1..127768b 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSFS6420.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08DDUPSFS6420.cs @@ -41,7 +41,7 @@ public class MET08DDUPSFS6420 : 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/MET08DDUPSFS6420.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSFS6420.cs index 548b58e..855333b 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSFS6420.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/MET08DDUPSFS6420.cs @@ -43,7 +43,7 @@ public class MET08DDUPSFS6420 : 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/TENCOR1.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR1.cs index 90c9d2e..ff2819f 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR1.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR1.cs @@ -43,7 +43,7 @@ public class TENCOR1 : 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/TENCOR2.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR2.cs index eeba618..33dd92d 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR2.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR2.cs @@ -43,7 +43,7 @@ public class TENCOR2 : 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/TENCOR3.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR3.cs index 6860524..efd6725 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR3.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.4/TENCOR3.cs @@ -43,7 +43,7 @@ public class TENCOR3 : 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/TENCOR1.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR1.cs similarity index 94% rename from Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR1.cs rename to Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR1.cs index 697cf2c..325be8d 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR1.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR1.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; -namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_1; +namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_0; [TestClass] public class TENCOR1 : EAFLoggingUnitTesting @@ -43,15 +43,15 @@ public class TENCOR1 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] - public void Staging__v2_47_1__TENCOR1__pcl() + public void Staging__v2_47_0__TENCOR1__pcl() { string check = "*.pcl"; MethodBase methodBase = new StackFrame().GetMethod(); diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR2.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR2.cs similarity index 94% rename from Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR2.cs rename to Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR2.cs index cfdbba3..b3c9509 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR2.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR2.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; -namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_1; +namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_0; [TestClass] public class TENCOR2 : EAFLoggingUnitTesting @@ -43,15 +43,15 @@ public class TENCOR2 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] - public void Staging__v2_47_1__TENCOR2__pcl() + public void Staging__v2_47_0__TENCOR2__pcl() { string check = "*.pcl"; MethodBase methodBase = new StackFrame().GetMethod(); diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR3.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR3.cs similarity index 94% rename from Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR3.cs rename to Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR3.cs index b988adc..1de2e80 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/TENCOR3.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.0/TENCOR3.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; -namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_1; +namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_0; [TestClass] public class TENCOR3 : EAFLoggingUnitTesting @@ -43,15 +43,15 @@ public class TENCOR3 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] - public void Staging__v2_47_1__TENCOR3__pcl() + public void Staging__v2_47_0__TENCOR3__pcl() { string check = "*.pcl"; MethodBase methodBase = new StackFrame().GetMethod(); diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSFS6420.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSFS6420.cs index b2a74f5..8606b65 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSFS6420.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.47.1/MET08DDUPSFS6420.cs @@ -43,11 +43,11 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting [ClassCleanup()] public static void ClassCleanup() { - EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); + EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Dispose(); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -60,7 +60,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -73,7 +73,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -86,7 +86,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -99,7 +99,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -112,7 +112,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -125,7 +125,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -138,7 +138,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -151,7 +151,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -164,7 +164,7 @@ public class MET08DDUPSFS6420 : EAFLoggingUnitTesting EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] diff --git a/Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR1.cs b/Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR1.cs similarity index 70% rename from Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR1.cs rename to Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR1.cs index fa9a0b2..23d5d8d 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR1.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR1.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Reflection; -namespace Adaptation._Tests.Extract.Staging.v2_47_1; +namespace Adaptation._Tests.Extract.Staging.v2_47_0; [TestClass] public class TENCOR1 @@ -14,31 +14,31 @@ public class TENCOR1 #pragma warning disable CA2254 #pragma warning disable IDE0060 - private static CreateSelfDescription.Staging.v2_47_1.TENCOR1 _TENCOR1; + private static CreateSelfDescription.Staging.v2_47_0.TENCOR1 _TENCOR1; [ClassInitialize] public static void ClassInitialize(TestContext testContext) { - CreateSelfDescription.Staging.v2_47_1.TENCOR1.ClassInitialize(testContext); - _TENCOR1 = CreateSelfDescription.Staging.v2_47_1.TENCOR1.EAFLoggingUnitTesting; + CreateSelfDescription.Staging.v2_47_0.TENCOR1.ClassInitialize(testContext); + _TENCOR1 = CreateSelfDescription.Staging.v2_47_0.TENCOR1.EAFLoggingUnitTesting; } -#if true +#if DEBUG [Ignore] #endif [TestMethod] - public void Staging__v2_47_1__TENCOR1__pcl() => _TENCOR1.Staging__v2_47_1__TENCOR1__pcl(); + public void Staging__v2_47_0__TENCOR1__pcl() => _TENCOR1.Staging__v2_47_0__TENCOR1__pcl(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] [ExpectedException(typeof(MissingMethodException))] - public void Staging__v2_47_1__TENCOR1__pcl637955518212649513__Normal() + public void Staging__v2_47_0__TENCOR1__pcl637955518212649513__Normal() { string check = "*.pcl"; bool validatePDSF = false; - _TENCOR1.Staging__v2_47_1__TENCOR1__pcl(); + _TENCOR1.Staging__v2_47_0__TENCOR1__pcl(); MethodBase methodBase = new StackFrame().GetMethod(); string[] variables = _TENCOR1.AdaptationTesting.GetVariables(methodBase, check, validatePDSF); IFileRead fileRead = _TENCOR1.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); diff --git a/Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR2.cs b/Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR2.cs similarity index 70% rename from Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR2.cs rename to Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR2.cs index 7619049..a621b34 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR2.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR2.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Reflection; -namespace Adaptation._Tests.Extract.Staging.v2_47_1; +namespace Adaptation._Tests.Extract.Staging.v2_47_0; [TestClass] public class TENCOR2 @@ -14,31 +14,31 @@ public class TENCOR2 #pragma warning disable CA2254 #pragma warning disable IDE0060 - private static CreateSelfDescription.Staging.v2_47_1.TENCOR2 _TENCOR2; + private static CreateSelfDescription.Staging.v2_47_0.TENCOR2 _TENCOR2; [ClassInitialize] public static void ClassInitialize(TestContext testContext) { - CreateSelfDescription.Staging.v2_47_1.TENCOR2.ClassInitialize(testContext); - _TENCOR2 = CreateSelfDescription.Staging.v2_47_1.TENCOR2.EAFLoggingUnitTesting; + CreateSelfDescription.Staging.v2_47_0.TENCOR2.ClassInitialize(testContext); + _TENCOR2 = CreateSelfDescription.Staging.v2_47_0.TENCOR2.EAFLoggingUnitTesting; } -#if true +#if DEBUG [Ignore] #endif [TestMethod] - public void Staging__v2_47_1__TENCOR2__pcl() => _TENCOR2.Staging__v2_47_1__TENCOR2__pcl(); + public void Staging__v2_47_0__TENCOR2__pcl() => _TENCOR2.Staging__v2_47_0__TENCOR2__pcl(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] [ExpectedException(typeof(MissingMethodException))] - public void Staging__v2_47_1__TENCOR2__pcl637955534973701250__Normal() + public void Staging__v2_47_0__TENCOR2__pcl637955534973701250__Normal() { string check = "*.pcl"; bool validatePDSF = false; - _TENCOR2.Staging__v2_47_1__TENCOR2__pcl(); + _TENCOR2.Staging__v2_47_0__TENCOR2__pcl(); MethodBase methodBase = new StackFrame().GetMethod(); string[] variables = _TENCOR2.AdaptationTesting.GetVariables(methodBase, check, validatePDSF); IFileRead fileRead = _TENCOR2.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); diff --git a/Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR3.cs b/Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR3.cs similarity index 70% rename from Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR3.cs rename to Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR3.cs index 0820312..abb02c7 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.47.1/TENCOR3.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.47.0/TENCOR3.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Reflection; -namespace Adaptation._Tests.Extract.Staging.v2_47_1; +namespace Adaptation._Tests.Extract.Staging.v2_47_0; [TestClass] public class TENCOR3 @@ -14,31 +14,31 @@ public class TENCOR3 #pragma warning disable CA2254 #pragma warning disable IDE0060 - private static CreateSelfDescription.Staging.v2_47_1.TENCOR3 _TENCOR3; + private static CreateSelfDescription.Staging.v2_47_0.TENCOR3 _TENCOR3; [ClassInitialize] public static void ClassInitialize(TestContext testContext) { - CreateSelfDescription.Staging.v2_47_1.TENCOR3.ClassInitialize(testContext); - _TENCOR3 = CreateSelfDescription.Staging.v2_47_1.TENCOR3.EAFLoggingUnitTesting; + CreateSelfDescription.Staging.v2_47_0.TENCOR3.ClassInitialize(testContext); + _TENCOR3 = CreateSelfDescription.Staging.v2_47_0.TENCOR3.EAFLoggingUnitTesting; } -#if true +#if DEBUG [Ignore] #endif [TestMethod] - public void Staging__v2_47_1__TENCOR3__pcl() => _TENCOR3.Staging__v2_47_1__TENCOR3__pcl(); + public void Staging__v2_47_0__TENCOR3__pcl() => _TENCOR3.Staging__v2_47_0__TENCOR3__pcl(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] [ExpectedException(typeof(MissingMethodException))] - public void Staging__v2_47_1__TENCOR3__pcl637955520360305921__Normal() + public void Staging__v2_47_0__TENCOR3__pcl637955520360305921__Normal() { string check = "*.pcl"; bool validatePDSF = false; - _TENCOR3.Staging__v2_47_1__TENCOR3__pcl(); + _TENCOR3.Staging__v2_47_0__TENCOR3__pcl(); MethodBase methodBase = new StackFrame().GetMethod(); string[] variables = _TENCOR3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF); IFileRead fileRead = _TENCOR3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); diff --git a/Adaptation/_Tests/Extract/Staging/v2.47.1/MET08DDUPSFS6420.cs b/Adaptation/_Tests/Extract/Staging/v2.47.1/MET08DDUPSFS6420.cs index 9ead710..1b3d70d 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.47.1/MET08DDUPSFS6420.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.47.1/MET08DDUPSFS6420.cs @@ -22,46 +22,47 @@ public class MET08DDUPSFS6420 _MET08DDUPSFS6420 = CreateSelfDescription.Staging.v2_47_1.MET08DDUPSFS6420.EAFLoggingUnitTesting; } -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__MoveMatchingFiles() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__MoveMatchingFiles(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__OpenInsightMetrologyViewer() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__OpenInsightMetrologyViewer(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__OpenInsightMetrologyViewer637810124350899080__Normal() { - string check = "~IsXToOpenInsightMetrologyViewer"; + string check = "*.pdsf"; + bool validatePDSF = false; MethodBase methodBase = new StackFrame().GetMethod(); _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__OpenInsightMetrologyViewer(); - string[] variables = _MET08DDUPSFS6420.AdaptationTesting.GetVariables(methodBase, check); + string[] variables = _MET08DDUPSFS6420.AdaptationTesting.GetVariables(methodBase, check, validatePDSF); IFileRead fileRead = _MET08DDUPSFS6420.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); Logistics logistics = new(fileRead); - _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics); + _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__IQSSi() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__IQSSi(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__OpenInsight() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__OpenInsight(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] @@ -76,37 +77,37 @@ public class MET08DDUPSFS6420 _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics); } -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__OpenInsightMetrologyViewerAttachments() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__OpenInsightMetrologyViewerAttachments(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__APC() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__APC(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__SPaCe() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__SPaCe(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__Processed() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__Processed(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] public void Staging__v2_47_1__MET08DDUPSFS6420__Archive() => _MET08DDUPSFS6420.Staging__v2_47_1__MET08DDUPSFS6420__Archive(); -#if true +#if DEBUG [Ignore] #endif [TestMethod] diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs index c011f8e..5741fc3 100644 --- a/Adaptation/_Tests/Shared/AdaptationTesting.cs +++ b/Adaptation/_Tests/Shared/AdaptationTesting.cs @@ -343,7 +343,7 @@ public class AdaptationTesting : ISMTP return result as T; } - protected static CellInstanceVersion GetCellInstanceVersion(string url) + public static CellInstanceVersion GetCellInstanceVersion(string url) { CellInstanceVersion result; byte[] byteArray; @@ -874,7 +874,7 @@ public class AdaptationTesting : ISMTP return result; } - protected Dictionary GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, List> equipmentDictionaryIsAlwaysEnabledEvents) + 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() { @@ -883,6 +883,7 @@ public class AdaptationTesting : ISMTP { nameof(cellInstanceName), cellInstanceName }, { nameof(equipmentTypeName), equipmentTypeName }, { nameof(cellInstanceVersionName), cellInstanceVersionName }, + { nameof(edaConnectionPortNumber), edaConnectionPortNumber }, { nameof(equipmentDictionaryName), equipmentDictionaryName }, { nameof(cellInstanceConnectionName), cellInstanceConnectionName }, { nameof(FileConnectorConfiguration), fileConnectorConfiguration }, @@ -930,7 +931,7 @@ public class AdaptationTesting : ISMTP 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); + 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; 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/MET08DDUPSFS6420.cs b/Adaptation/_Tests/Static/MET08DDUPSFS6420.cs new file mode 100644 index 0000000..fad2f3b --- /dev/null +++ b/Adaptation/_Tests/Static/MET08DDUPSFS6420.cs @@ -0,0 +1,72 @@ +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 MET08DDUPSFS6420 : LoggingUnitTesting, IDisposable +{ + +#pragma warning disable CA2254 +#pragma warning disable IDE0060 + + internal static MET08DDUPSFS6420 LoggingUnitTesting { get; private set; } + + public MET08DDUPSFS6420() : base(testContext: null, declaringType: null) + { + if (LoggingUnitTesting is null) + throw new Exception(); + } + + public MET08DDUPSFS6420(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType) + { + } + + [ClassInitialize] + public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new MET08DDUPSFS6420(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 Staging() + { + MethodBase methodBase = new StackFrame().GetMethod(); + StringBuilder results = new(); + (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[] + { + new("MET08DDUPSFS6420", "v2.47.1"), + }; + 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/Adaptation/_Tests/Static/pcl.cs b/Adaptation/_Tests/Static/pcl.cs index 6dcae3a..88e850f 100644 --- a/Adaptation/_Tests/Static/pcl.cs +++ b/Adaptation/_Tests/Static/pcl.cs @@ -3,7 +3,9 @@ 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; @@ -32,7 +34,7 @@ public class PCL : LoggingUnitTesting, IDisposable [ClassCleanup()] public static void ClassCleanup() { - LoggingUnitTesting.Logger?.LogInformation("Cleanup"); + LoggingUnitTesting?.Logger?.LogInformation("Cleanup"); LoggingUnitTesting?.Dispose(); } @@ -126,6 +128,40 @@ public class PCL : LoggingUnitTesting, IDisposable Assert.IsTrue(descriptor.Reactor is "20"); Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); + descriptor = FileHandlers.pcl.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")); + } + +#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("TENCOR1", "v2.47.0"), + new("TENCOR2", "v2.47.0"), + new("TENCOR3", "v2.47.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")); } diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 442c4ef..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env groovy -/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */ -import groovy.transform.Field - -@Field String _DDrive = 'D:/' -@Field String _AssemblyName = '...' -@Field String _TargetLocation = '...' -@Field String _GitCommitSeven = '...' -@Field String _GitName = 'MET08DDUPSFS6420' -@Field String _TestProjectDirectory = 'Adaptation' -@Field String _AgentStaging = 'mestsa07ec-ecmeseaf' -@Field String _DDriveNet = "${_DDrive}Framework4.8" -@Field String _AgentProduction = 'messa08ec-ecmeseaf' -@Field String _AgentDevelopment = 'mestsa003-mesedasvc' -@Field String _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe' -@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe' - -pipeline { - agent { - label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else' - } - parameters { - string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server') - string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...') - } - stages { - // stage('Git') { - // steps { - // bat(returnStatus: true, script: 'git init') - // bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git') - // bat(returnStatus: true, script: 'git pull origin master') - // } - // } - stage('Setup') { - steps { - script { - _AssemblyName = "${env.JOB_NAME}" - // _GitCommitSeven = '1234567' - _GitCommitSeven = env.GIT_COMMIT.substring(0, 7) - def files = findFiles(glob: '*.csproj') - if (files.length != 1) { - error("Build failed because couldn't find a *.csproj file") - } - echo """ - ${files[0].name} - ${files[0].path} - ${files[0].directory} - ${files[0].length} - ${files[0].lastModified} - """ - _AssemblyName = files[0].name.split('[.]csproj')[0] - _TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}" - } - } - } - stage('Info') { - steps { - echo "_AssemblyName ${_AssemblyName}" // ... - echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11 - echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11 - echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master - echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41 - echo "GIT_SERVER ${params.GIT_SERVER}" // ... - echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git - echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11 - echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/ - echo "JOB_NAME ${env.JOB_NAME}" // ... - echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\... - } - } - // stage('Restore') { - // steps { - // bat(returnStatus: true, script: 'dotnet --info') - // } - // } - stage('Safe storage of app secrets') { - steps { - dir(_TestProjectDirectory) { - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets init') - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"') - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"') - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"') - } - } - } - stage('Core Build') { - steps { - echo "Build number is ${currentBuild.number}" - dir(_TestProjectDirectory) { - bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' + - 'build --runtime win-x64 --self-contained --verbosity quiet') - } - } - } - // stage('Test') { - // options { - // timeout(time: 10, unit: 'MINUTES') - // } - // steps { - // dir(_TestProjectDirectory) { - // bat('dotnet --info') - // } - // } - // } - stage('Framework Build') { - steps { - echo "Build number is ${currentBuild.number}" - bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' + - '/target:Restore ' + - '/detailedsummary ' + - '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' + - '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' + - _AssemblyName + '.csproj') - bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' + - '/target:Build ' + - '/detailedsummary ' + - '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' + - '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' + - _AssemblyName + '.csproj') - } - } - stage('Commit Id') { - steps { - dir('bin/Debug') { - writeFile file: "${_AssemblyName}.txt", text: "${env.GIT_COMMIT}-${env.BUILD_NUMBER}-${env.GIT_URL}" - } - } - } - stage('Package') { - steps { - fileOperations([fileZipOperation(folderPath: 'bin/Debug', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug")]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug", targetNameExpression: '')]) - } - } - // stage('Force Fail') { - // steps { - // error("Build failed because of this and that..") - // } - // } - stage('Copy Files to: file-share') { - steps { - dir('bin/Debug') { - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')]) - } - } - } - } - post { - always { - dir('bin') { - deleteDir() - } - dir('obj') { - deleteDir() - } - dir(_TestProjectDirectory + '/bin') { - deleteDir() - } - dir(_TestProjectDirectory + '/obj') { - deleteDir() - } - cleanWs() - } - } -} diff --git a/MET08DDUPSFS6420.csproj b/MET08DDUPSFS6420.csproj index b346b65..1ffee4f 100644 --- a/MET08DDUPSFS6420.csproj +++ b/MET08DDUPSFS6420.csproj @@ -11,7 +11,8 @@ MET08DDUPSFS6420 MET08DDUPSFS6420 v4.8 - win-x86 + win-x86 + win 512 @@ -109,7 +110,6 @@ - @@ -179,8 +179,5 @@ 6.0.3 - - - \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 8993376..f778481 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")]