Skip to content

Commit

Permalink
Unit Test modification for AQL (#57)
Browse files Browse the repository at this point in the history
* Update compile.yml

* Update compile.yml

* Update compile.yml

* hotfix 3.1.2 for artifactory repository name info for NuGet packages (#55)

* Update CA_UsageDocument.md

* Hotfix v3.1.2 - Bug fix for getting correct artifactory repo name from Jfrog for NuGet (#54)

* Update compile.yml

* Artifactory Repo identification bug fix

* Usage document update

* Unit test case update

* nuspec version change

* nuspec file change

* Warn message changed to info

---------

Co-authored-by: MadanReddyK <[email protected]>

---------

Co-authored-by: MadanReddyK <[email protected]>

* modified the UT for AQL

---------

Co-authored-by: MadanReddyK <[email protected]>
  • Loading branch information
karthika-g and MadanReddyK authored Jul 10, 2023
1 parent 11ae2d6 commit a109509
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
- cron: "30 0 * * 5"

jobs:

build:

runs-on: self-hosted

defaults:
Expand Down
30 changes: 15 additions & 15 deletions src/LCT.PackageIdentifier.UTest/MavenParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData_Succes
component1.Version = "1.0.0";
var components = new List<Component>() { component1 };
ComponentIdentification component = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -123,14 +123,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData2_Succe
component1.Version = "1.0.0";
var components = new List<Component>() { component1 };
ComponentIdentification component = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-common_license-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -161,14 +161,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData3_Succe
};
var components = new List<Component>() { component1 };
ComponentIdentification componentIdentification = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = {"internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -199,14 +199,14 @@ public async Task GetJfrogRepoDetailsOfAComponent_ReturnsWithData_SuccessFully()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Maven = new Common.Model.Config() { JfrogMavenRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -238,14 +238,14 @@ public async Task GetJfrogRepoDetailsOfAComponent_ReturnsWithData2_SuccessFully(
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Maven = new Common.Model.Config() { JfrogMavenRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down
30 changes: 15 additions & 15 deletions src/LCT.PackageIdentifier.UTest/NpmProcessorUTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData_Succes
component1.Version = "1.0.0";
var components = new List<Component>() { component1 };
ComponentIdentification component = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -67,14 +67,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData2_Succe
component1.Version = "1.0.0";
var components = new List<Component>() { component1 };
ComponentIdentification component = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-common_license-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -105,14 +105,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData3_Succe
};
var components = new List<Component>() { component1 };
ComponentIdentification componentIdentification = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo1" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -143,14 +143,14 @@ public async Task GetJfrogRepoDetailsOfAComponent_ReturnsWithData_SuccessFully()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = { "internalrepo1", "internalrepo1" };
CommonAppSettings appSettings = new();
appSettings.Npm = new Common.Model.Config() { JfrogNpmRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -182,14 +182,14 @@ public async Task GetJfrogRepoDetailsOfAComponent_ReturnsWithData2_SuccessFully(
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Npm = new Common.Model.Config() { JfrogNpmRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down
57 changes: 29 additions & 28 deletions src/LCT.PackageIdentifier.UTest/NugetParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ public async Task IdentificationOfInternalComponents_Nuget_ReturnsComponentData_
component1.Version = "1.0.0";
var components = new List<Component>() { component1 };
ComponentIdentification component = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo1" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -267,14 +267,14 @@ public async Task IdentificationOfInternalComponents_Nuget_ReturnsComponentData2
component1.Version = "1.0.0";
var components = new List<Component>() { component1 };
ComponentIdentification component = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-common_license-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -305,14 +305,14 @@ public async Task IdentificationOfInternalComponents_ReturnsComponentData3_Succe
};
var components = new List<Component>() { component1 };
ComponentIdentification componentIdentification = new() { comparisonBOMData = components };
string[] reooListArr = { "energy-dev-npm-egll", "energy-release-npm-egll" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new() { InternalRepoList = reooListArr };

AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "energy-dev-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -343,14 +343,14 @@ public async Task GetJfrogRepoDetailsOfAComponent_ReturnsWithData_SuccessFully()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Nuget = new LCT.Common.Model.Config() { JfrogNugetRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -382,14 +382,14 @@ public async Task GetJfrogRepoDetailsOfAComponent_Nuget_ReturnsWithData2_Success
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = {"internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Nuget = new Config() { JfrogNugetRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -421,14 +421,14 @@ public async Task GetArtifactoryRepoName_Nuget_ReturnsRepoName_SuccessFully()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = {"internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Nuget = new Config() { JfrogNugetRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new List<AqlResult>() { aqlResult };
Expand Down Expand Up @@ -460,14 +460,14 @@ public async Task GetArtifactoryRepoName_Nuget_ReturnsRepoName_ReturnsFailure()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = {"internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Nuget = new Config() { JfrogNugetRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animation-test-1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new () { aqlResult };
Expand Down Expand Up @@ -499,14 +499,14 @@ public async Task GetArtifactoryRepoName_Nuget_ReturnsRepoName_ReturnsSuccess()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = {"internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Nuget = new Config() { JfrogNugetRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animations-common.1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new() { aqlResult };
Expand All @@ -524,7 +524,8 @@ public async Task GetArtifactoryRepoName_Nuget_ReturnsRepoName_ReturnsSuccess()

var reponameActual = actual.First(x => x.Properties[0].Name == "internal:siemens:clearing:repo-url").Properties[0].Value;

Assert.That("siparty-release-npm-egll", Is.EqualTo(reponameActual));

Assert.That("internalrepo1", Is.EqualTo(reponameActual));
}
[Test]
public async Task GetArtifactoryRepoName_Nuget_ReturnsNotFound_ReturnsFailure()
Expand All @@ -538,14 +539,14 @@ public async Task GetArtifactoryRepoName_Nuget_ReturnsNotFound_ReturnsFailure()
Version = "1.0.0"
};
var components = new List<Component>() { component1 };
string[] reooListArr = { "siparty-release-npm-egll", "org1-npmjs-npm-remote-cache" };
string[] reooListArr = { "internalrepo1", "internalrepo2" };
CommonAppSettings appSettings = new();
appSettings.Nuget = new Config() { JfrogNugetRepoList = reooListArr };
AqlResult aqlResult = new()
{
Name = "animation-common.1.0.0.nupkg",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Repo = "siparty-release-npm-egll"
Path = "@testfolder/-/folder",
Repo = "internalrepo1"
};

List<AqlResult> results = new() { aqlResult };
Expand Down
4 changes: 2 additions & 2 deletions src/LCT.Services.UTest/JFrogServiceUTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public async Task GetInternalComponentDataByRepo_GetsRepoInfo_Successfully()

AqlResult aqlResult = new AqlResult()
{
Name = "saap-api-node-2.26.3-LicenseClearing.16.sha-058fada.tgz",
Path = "@siemens-gds/saap-api-node/-/@siemens-gds",
Name = "api-node-2.26.3-LicenseClearing.16.sha-058fada.tgz",
Path = "@testfolder/-/folder",
Repo = "energy-dev-npm-egll"
};

Expand Down

0 comments on commit a109509

Please sign in to comment.