diff --git a/Protocol/Error Messages/Protocol/QActions/QAction/CheckDataMinerDependency.cs b/Protocol/Error Messages/Protocol/QActions/QAction/CheckDataMinerDependency.cs new file mode 100644 index 00000000..2089fd3d --- /dev/null +++ b/Protocol/Error Messages/Protocol/QActions/QAction/CheckDataMinerDependency.cs @@ -0,0 +1,56 @@ +// This is auto-generated code by Validator Management Tool. Do not modify. +namespace Skyline.DataMiner.CICD.Validators.Protocol.Tests.Protocol.QActions.QAction.CheckDataMinerDependency +{ + using System; + using System.Collections.Generic; + + using Skyline.DataMiner.CICD.Models.Protocol.Read; + using Skyline.DataMiner.CICD.Validators.Common.Interfaces; + using Skyline.DataMiner.CICD.Validators.Common.Model; + using Skyline.DataMiner.CICD.Validators.Protocol.Common; + using Skyline.DataMiner.CICD.Validators.Protocol.Interfaces; + + internal static class Error + { + public static IValidationResult MismatchDevPack(IValidate test, IReadable referenceNode, IReadable positionNode, string packageName, string packageVersion, string minimumRequiredVersion, string qactionId) + { + return new ValidationResult + { + Test = test, + CheckId = CheckId.CheckDataMinerDependency, + ErrorId = ErrorIds.MismatchDevPack, + FullId = "3.42.1", + Category = Category.QAction, + Severity = Severity.Major, + Certainty = Certainty.Certain, + Source = Source.Validator, + FixImpact = FixImpact.NonBreaking, + GroupDescription = "", + Description = String.Format("Package '{0}' version '{1}' does not meet the minimum required version '{2}'. QAction ID '{3}'.", packageName, packageVersion, minimumRequiredVersion, qactionId), + HowToFix = "Either increase version in the MinimumRequiredVersion tag or downgrade the package so it matches with the minimum required version.", + ExampleCode = "", + Details = "Using a higher version of the DevPack may introduce new features that are not compatible with the specified version of DataMiner." + Environment.NewLine + "This can lead to unexpected behavior or errors. Make sure that the DevPack version used in the solution does not exceed the MinimumRequiredVersion.", + HasCodeFix = false, + + PositionNode = positionNode, + ReferenceNode = referenceNode, + }; + } + } + + internal static class ErrorIds + { + public const uint MismatchDevPack = 1; + } + + /// + /// Contains the identifiers of the checks. + /// + public static class CheckId + { + /// + /// The check identifier. + /// + public const uint CheckDataMinerDependency = 42; + } +} \ No newline at end of file diff --git a/Protocol/ErrorMessages.xml b/Protocol/ErrorMessages.xml index 61f40196..4431ef05 100644 --- a/Protocol/ErrorMessages.xml +++ b/Protocol/ErrorMessages.xml @@ -12313,6 +12313,32 @@ + + CheckDataMinerDependency + + + MismatchDevPack + + + Package '{0}' version '{1}' does not meet the minimum required version '{2}'. QAction ID '{3}'. + + packageName + packageVersion + minimumRequiredVersion + qactionId + + + Major + Certain + Validator + NonBreaking + False + + +
+
+
+
diff --git a/Protocol/Tests/Protocol/QActions/QAction/CheckDataMinerDependency.cs b/Protocol/Tests/Protocol/QActions/QAction/CheckDataMinerDependency.cs new file mode 100644 index 00000000..6bf2167f --- /dev/null +++ b/Protocol/Tests/Protocol/QActions/QAction/CheckDataMinerDependency.cs @@ -0,0 +1,127 @@ +namespace Skyline.DataMiner.CICD.Validators.Protocol.Tests.Protocol.QActions.QAction.CheckDataMinerDependency +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using Skyline.DataMiner.CICD.Common; + using Skyline.DataMiner.CICD.Models.Protocol; + using Skyline.DataMiner.CICD.Models.Protocol.Read; + using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects; + using Skyline.DataMiner.CICD.Validators.Common.Interfaces; + using Skyline.DataMiner.CICD.Validators.Common.Model; + using Skyline.DataMiner.CICD.Validators.Protocol.Common; + using Skyline.DataMiner.CICD.Validators.Protocol.Common.Attributes; + using Skyline.DataMiner.CICD.Validators.Protocol.Common.Extensions; + using Skyline.DataMiner.CICD.Validators.Protocol.Helpers; + using Skyline.DataMiner.CICD.Validators.Protocol.Interfaces; + + [Test(CheckId.CheckDataMinerDependency, Category.QAction)] + internal class CheckDataMinerDependency : IValidate/*, ICodeFix, ICompare*/ + { + public List Validate(ValidatorContext context) + { + List results = new List(); + + if (!context.HasQActionsAndIsSolution) + { + // Early skip when no QActions are present or when it is not solution based. + return results; + } + + ValidateHelper helper = new ValidateHelper(this, context, results); + foreach ((CompiledQActionProject projectData, IQActionsQAction qaction) in context.EachQActionProject(true)) + { + // Load csproj + var project = Project.Load(projectData.Project.FilePath, projectData.Project.Name); + if (!project.PackageReferences.Any()) + { + // No NuGet packages being used + // Should not happen, but is covered by the banner in DIS. + continue; + } + + helper.CheckDevPack(project.PackageReferences, qaction); + } + + return results; + } + + ////public ICodeFixResult Fix(CodeFixContext context) + ////{ + //// CodeFixResult result = new CodeFixResult(); + + //// switch (context.Result.ErrorId) + //// { + + //// default: + //// result.Message = $"This error ({context.Result.ErrorId}) isn't implemented."; + //// break; + //// } + + //// return result; + ////} + + ////public List Compare(MajorChangeCheckContext context) + ////{ + //// List results = new List(); + + //// return results; + ////} + } + + internal class ValidateHelper : ValidateHelperBase + { + private readonly string minReqVersionTag; + private readonly Version minVersion; + + public ValidateHelper(IValidate test, ValidatorContext context, List results) : base(test, context, results) + { + minReqVersionTag = context.ProtocolModel.Protocol?.Compliancies?.MinimumRequiredVersion?.Value; + if (!DataMinerVersion.TryParse(minReqVersionTag, out DataMinerVersion version)) + { + // Default in case tag is not present. + version = context.ValidatorSettings.MinimumSupportedDataMinerVersion; + } + + minVersion = new Version(version.Major, version.Minor, version.Build); + } + + public void CheckDevPack(IEnumerable packageReferences, IQActionsQAction qAction) + { + // Filter out DevPacks & the Files + var dmPacks = packageReferences.Where(IsDevPackOrPartOf).ToList(); + + foreach (PackageReference dmPack in dmPacks) + { + if (!Version.TryParse(dmPack.Version, out Version v)) + { + // Unable to parse the version of the DevPack. + continue; + } + + Version packageVersion = new Version(v.Major, v.Minor, v.Build); + + /* + * MinimumRequiredVersion = 10.2.0.0 - XXXXX + * minVersion == 10.2.0 + * + * Package Reference = 10.2.0.5 (CU or rerun of package creation) + * packageVersion == 10.2.0 + */ + + if (minVersion < packageVersion) + { + results.Add(Error.MismatchDevPack(test, qAction, qAction, dmPack.Name, dmPack.Version, minReqVersionTag, qAction.Id?.RawValue)); + } + } + + return; + bool IsDevPackOrPartOf(PackageReference packageReference) + { + return packageReference.Name.StartsWith("Skyline.DataMiner.Dev.") || + packageReference.Name.StartsWith("Skyline.DataMiner.Files"); + } + } + } +} \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/CheckDataMinerDependency.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/CheckDataMinerDependency.cs new file mode 100644 index 00000000..cafa559b --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/CheckDataMinerDependency.cs @@ -0,0 +1,129 @@ +namespace ProtocolTests.Protocol.QActions.QAction.CheckDataMinerDependency +{ + using System; + using System.Collections.Generic; + + using FluentAssertions; + + using Microsoft.VisualStudio.TestTools.UnitTesting; + + using Skyline.DataMiner.CICD.Validators.Common.Interfaces; + using Skyline.DataMiner.CICD.Validators.Common.Model; + using Skyline.DataMiner.CICD.Validators.Protocol.Common; + using Skyline.DataMiner.CICD.Validators.Protocol.Interfaces; + using Skyline.DataMiner.CICD.Validators.Protocol.Tests.Protocol.QActions.QAction.CheckDataMinerDependency; + + [TestClass] + public class Validate + { + private readonly IValidate check = new CheckDataMinerDependency(); + + #region Valid Checks + + [TestMethod] + [Ignore("Check can only be done on a solution")] + public void QAction_CheckDataMinerDependency_Valid_XmlBased() + { + Generic.ValidateData data = new Generic.ValidateData + { + TestType = Generic.TestType.Valid, + FileName = "Valid", + ExpectedResults = new List() + }; + + Generic.Validate(check, data); + } + + [TestMethod] + public void QAction_CheckDataMinerDependency_Valid() + { + Generic.ValidateData data = new Generic.ValidateData + { + TestType = Generic.TestType.Valid, + FileName = "Valid", + IsSolution = true, + ExpectedResults = new List() + }; + + Generic.Validate(check, data); + } + + #endregion + + #region Invalid Checks + + [TestMethod] + [Ignore("Check can only be done on a solution")] + public void QAction_CheckDataMinerDependency_MismatchDevPack_Xml() + { + Generic.ValidateData data = new Generic.ValidateData + { + TestType = Generic.TestType.Invalid, + FileName = "MismatchDevPack", + ExpectedResults = new List() + }; + + Generic.Validate(check, data); + } + + [TestMethod] + public void QAction_CheckDataMinerDependency_MismatchDevPack() + { + Generic.ValidateData data = new Generic.ValidateData + { + TestType = Generic.TestType.Invalid, + FileName = "MismatchDevPack", + IsSolution = true, + ExpectedResults = new List + { + Error.MismatchDevPack(null, null, null, "Skyline.DataMiner.Dev.Protocol", "10.4.7", "10.2.0.0 - 11517", "1"), + + Error.MismatchDevPack(null, null, null, "Skyline.DataMiner.Dev.Protocol", "10.4.7", "10.2.0.0 - 11517", "2"), + Error.MismatchDevPack(null, null, null, "Skyline.DataMiner.Files.SLMediationSnippets", "10.4.7", "10.2.0.0 - 11517", "2"), + } + }; + + Generic.Validate(check, data); + } + + #endregion + } + + [TestClass] + public class ErrorMessages + { + [TestMethod] + public void QAction_CheckDataMinerDependency_MismatchDevPack() + { + // Create ErrorMessage + var message = Error.MismatchDevPack(null, null, null, "packageName", "packageVersion", "minimumRequiredVersion", "qactionId"); + + var expected = new ValidationResult + { + Severity = Severity.Major, + Certainty = Certainty.Certain, + FixImpact = FixImpact.NonBreaking, + GroupDescription = "", + Description = "Package 'packageName' version 'packageVersion' does not meet the minimum required version 'minimumRequiredVersion'. QAction ID 'qactionId'.", + Details = "Using a higher version of the DevPack may introduce new features that are not compatible with the specified version of DataMiner." + Environment.NewLine + + "This can lead to unexpected behavior or errors. Make sure that the DevPack version used in the solution does not exceed the MinimumRequiredVersion.", + HasCodeFix = false, + }; + + // Assert + message.Should().BeEquivalentTo(expected, Generic.ExcludePropertiesForErrorMessages); + } + } + + [TestClass] + public class Attribute + { + private readonly IRoot check = new CheckDataMinerDependency(); + + [TestMethod] + public void QAction_CheckDataMinerDependency_CheckCategory() => Generic.CheckCategory(check, Category.QAction); + + [TestMethod] + public void QAction_CheckDataMinerDependency_CheckId() => Generic.CheckId(check, CheckId.CheckDataMinerDependency); + } +} \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack.xml b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack.xml new file mode 100644 index 00000000..ecc4abbf --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/Directory.Build.props b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/Directory.Build.props new file mode 100644 index 00000000..7c08a058 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/Directory.Build.props @@ -0,0 +1,9 @@ + + + x86 + true + + + $(DefineConstants);DCFv1;DBInfo;ALARM_SQUASHING + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/Internal/.editorconfig b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/Internal/.editorconfig new file mode 100644 index 00000000..a612a7a0 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/Internal/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +tab_width = 4 +end_of_line = crlf +trim_trailing_whitespace = true + +[*.cs] +dotnet_sort_system_directives_first = true \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/MismatchDevPack.sln b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/MismatchDevPack.sln new file mode 100644 index 00000000..01146865 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/MismatchDevPack.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33502.453 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Internal", "Internal", "{5FDED38C-902D-4C4E-B1E5-6553D226B172}" + ProjectSection(SolutionItems) = preProject + Internal\.editorconfig = Internal\.editorconfig + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QActions", "QActions", "{AC3D9A76-D651-4315-8089-E2F4D03C16EE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EBD5AC2-944D-4D63-B287-35C58321507F}" + ProjectSection(SolutionItems) = preProject + protocol.xml = protocol.xml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{04305366-A409-4B24-87F4-754FC9135DA1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QAction_Helper", "QAction_Helper\QAction_Helper.csproj", "{7587A42C-1C69-454F-B74A-1E791305FEFE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QAction_1", "QAction_1\QAction_1.csproj", "{9C642B48-58B3-4766-8EC3-47F60FFDF1A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QAction_2", "QAction_2\QAction_2.csproj", "{A6F83612-702E-4AAD-96EE-B90495C56516}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Release|Any CPU.Build.0 = Release|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Release|Any CPU.Build.0 = Release|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {7587A42C-1C69-454F-B74A-1E791305FEFE} = {5FDED38C-902D-4C4E-B1E5-6553D226B172} + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8} = {AC3D9A76-D651-4315-8089-E2F4D03C16EE} + {A6F83612-702E-4AAD-96EE-B90495C56516} = {AC3D9A76-D651-4315-8089-E2F4D03C16EE} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5992B01D-BB76-478F-B72B-91AB66E2FA29} + EndGlobalSection +EndGlobal diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_1/QAction_1.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_1/QAction_1.cs new file mode 100644 index 00000000..13ee4a7c --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_1/QAction_1.cs @@ -0,0 +1,14 @@ +namespace Skyline.Protocol +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Text; + + namespace MyExtension + { + public class MyClass + { + } + } +} \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_1/QAction_1.csproj b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_1/QAction_1.csproj new file mode 100644 index 00000000..658c384b --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_1/QAction_1.csproj @@ -0,0 +1,17 @@ + + + net48 + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_2/QAction_2.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_2/QAction_2.cs new file mode 100644 index 00000000..7fc1b5cd --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_2/QAction_2.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; + +using Skyline.DataMiner.Scripting; + +/// +/// DataMiner QAction Class: After Startup. +/// +public static class QAction +{ + /// + /// The QAction entry point. + /// + /// Link with SLProtocol process. + public static void Run(SLProtocol protocol) + { + try + { + + } + catch (Exception ex) + { + protocol.Log($"QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|Run|Exception thrown:{Environment.NewLine}{ex}", LogType.Error, LogLevel.NoLogging); + } + } +} diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_2/QAction_2.csproj b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_2/QAction_2.csproj new file mode 100644 index 00000000..e4db9f5c --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_2/QAction_2.csproj @@ -0,0 +1,18 @@ + + + net48 + True + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/Directory.Build.props b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/Directory.Build.props new file mode 100644 index 00000000..60bd6c14 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/Directory.Build.props @@ -0,0 +1,5 @@ + + + x86 + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/QAction_Helper.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/QAction_Helper.cs new file mode 100644 index 00000000..2d1e2ebc --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/QAction_Helper.cs @@ -0,0 +1,35 @@ +// This is auto-generated code by DIS. Do not modify. +using System.ComponentModel; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Skyline.DataMiner.Scripting +{ +public static class Parameter +{ + public class Write + { + } +} +public class WriteParameters +{ + public SLProtocolExt Protocol; + public WriteParameters(SLProtocolExt protocol) + { + Protocol = protocol; + } +} +public interface SLProtocolExt : SLProtocol +{ + WriteParameters Write { get; set; } +} +public class ConcreteSLProtocolExt : ConcreteSLProtocol, SLProtocolExt +{ + public WriteParameters Write { get; set; } + public ConcreteSLProtocolExt() + { + Write = new WriteParameters(this); + } +} +} diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/QAction_Helper.csproj b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/QAction_Helper.csproj new file mode 100644 index 00000000..a4089ca9 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/QAction_Helper/QAction_Helper.csproj @@ -0,0 +1,15 @@ + + + net48 + Skyline Communications + © Skyline Communications + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/protocol.xml b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/protocol.xml new file mode 100644 index 00000000..bb63cffb --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Invalid/MismatchDevPack/protocol.xml @@ -0,0 +1,13 @@ + + + Valid Connector + 1.0.0.1 + + 10.2.0.0 - 11517 + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid.xml b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid.xml new file mode 100644 index 00000000..ecc4abbf --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Directory.Build.props b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Directory.Build.props new file mode 100644 index 00000000..7c08a058 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Directory.Build.props @@ -0,0 +1,9 @@ + + + x86 + true + + + $(DefineConstants);DCFv1;DBInfo;ALARM_SQUASHING + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Internal/.editorconfig b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Internal/.editorconfig new file mode 100644 index 00000000..a612a7a0 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Internal/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +tab_width = 4 +end_of_line = crlf +trim_trailing_whitespace = true + +[*.cs] +dotnet_sort_system_directives_first = true \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_1/QAction_1.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_1/QAction_1.cs new file mode 100644 index 00000000..13ee4a7c --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_1/QAction_1.cs @@ -0,0 +1,14 @@ +namespace Skyline.Protocol +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Text; + + namespace MyExtension + { + public class MyClass + { + } + } +} \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_1/QAction_1.csproj b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_1/QAction_1.csproj new file mode 100644 index 00000000..7ccf4b11 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_1/QAction_1.csproj @@ -0,0 +1,17 @@ + + + net48 + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_2/QAction_2.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_2/QAction_2.cs new file mode 100644 index 00000000..7fc1b5cd --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_2/QAction_2.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; + +using Skyline.DataMiner.Scripting; + +/// +/// DataMiner QAction Class: After Startup. +/// +public static class QAction +{ + /// + /// The QAction entry point. + /// + /// Link with SLProtocol process. + public static void Run(SLProtocol protocol) + { + try + { + + } + catch (Exception ex) + { + protocol.Log($"QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|Run|Exception thrown:{Environment.NewLine}{ex}", LogType.Error, LogLevel.NoLogging); + } + } +} diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_2/QAction_2.csproj b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_2/QAction_2.csproj new file mode 100644 index 00000000..c7992689 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_2/QAction_2.csproj @@ -0,0 +1,17 @@ + + + net48 + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/Directory.Build.props b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/Directory.Build.props new file mode 100644 index 00000000..60bd6c14 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/Directory.Build.props @@ -0,0 +1,5 @@ + + + x86 + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/QAction_Helper.cs b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/QAction_Helper.cs new file mode 100644 index 00000000..2d1e2ebc --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/QAction_Helper.cs @@ -0,0 +1,35 @@ +// This is auto-generated code by DIS. Do not modify. +using System.ComponentModel; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Skyline.DataMiner.Scripting +{ +public static class Parameter +{ + public class Write + { + } +} +public class WriteParameters +{ + public SLProtocolExt Protocol; + public WriteParameters(SLProtocolExt protocol) + { + Protocol = protocol; + } +} +public interface SLProtocolExt : SLProtocol +{ + WriteParameters Write { get; set; } +} +public class ConcreteSLProtocolExt : ConcreteSLProtocol, SLProtocolExt +{ + public WriteParameters Write { get; set; } + public ConcreteSLProtocolExt() + { + Write = new WriteParameters(this); + } +} +} diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/QAction_Helper.csproj b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/QAction_Helper.csproj new file mode 100644 index 00000000..c1144e71 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/QAction_Helper/QAction_Helper.csproj @@ -0,0 +1,15 @@ + + + net48 + Skyline Communications + © Skyline Communications + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Valid.sln b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Valid.sln new file mode 100644 index 00000000..01146865 --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/Valid.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33502.453 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Internal", "Internal", "{5FDED38C-902D-4C4E-B1E5-6553D226B172}" + ProjectSection(SolutionItems) = preProject + Internal\.editorconfig = Internal\.editorconfig + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QActions", "QActions", "{AC3D9A76-D651-4315-8089-E2F4D03C16EE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EBD5AC2-944D-4D63-B287-35C58321507F}" + ProjectSection(SolutionItems) = preProject + protocol.xml = protocol.xml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{04305366-A409-4B24-87F4-754FC9135DA1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QAction_Helper", "QAction_Helper\QAction_Helper.csproj", "{7587A42C-1C69-454F-B74A-1E791305FEFE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QAction_1", "QAction_1\QAction_1.csproj", "{9C642B48-58B3-4766-8EC3-47F60FFDF1A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QAction_2", "QAction_2\QAction_2.csproj", "{A6F83612-702E-4AAD-96EE-B90495C56516}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7587A42C-1C69-454F-B74A-1E791305FEFE}.Release|Any CPU.Build.0 = Release|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8}.Release|Any CPU.Build.0 = Release|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6F83612-702E-4AAD-96EE-B90495C56516}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {7587A42C-1C69-454F-B74A-1E791305FEFE} = {5FDED38C-902D-4C4E-B1E5-6553D226B172} + {9C642B48-58B3-4766-8EC3-47F60FFDF1A8} = {AC3D9A76-D651-4315-8089-E2F4D03C16EE} + {A6F83612-702E-4AAD-96EE-B90495C56516} = {AC3D9A76-D651-4315-8089-E2F4D03C16EE} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5992B01D-BB76-478F-B72B-91AB66E2FA29} + EndGlobalSection +EndGlobal diff --git a/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/protocol.xml b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/protocol.xml new file mode 100644 index 00000000..bb63cffb --- /dev/null +++ b/ProtocolTests/Protocol/QActions/QAction/CheckDataMinerDependency/Samples/Validate/Valid/Valid/protocol.xml @@ -0,0 +1,13 @@ + + + Valid Connector + 1.0.0.1 + + 10.2.0.0 - 11517 + + + + + + + \ No newline at end of file diff --git a/Skyline.DataMiner.CICD.Validators.sln b/Skyline.DataMiner.CICD.Validators.sln index 3daec8c8..a1f9a840 100644 --- a/Skyline.DataMiner.CICD.Validators.sln +++ b/Skyline.DataMiner.CICD.Validators.sln @@ -28,7 +28,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExportErrorMessages", "ExportErrorMessages\ExportErrorMessages.csproj", "{3E7A31D2-489F-4D77-8F12-39593893CAE3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skyline.DataMiner.CICD.Tools.Validator", "Skyline.DataMiner.CICD.Tools.Validator\Skyline.DataMiner.CICD.Tools.Validator.csproj", "{168477A6-B3F0-4977-B333-B4D812DC21B8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skyline.DataMiner.CICD.Tools.Validator", "Skyline.DataMiner.CICD.Tools.Validator\Skyline.DataMiner.CICD.Tools.Validator.csproj", "{168477A6-B3F0-4977-B333-B4D812DC21B8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution