Skip to content

Commit

Permalink
UT file changes for AQL (#58)
Browse files Browse the repository at this point in the history
* 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]>

* Unit Test modification for AQL (#57)

* 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]>

* Update appSettingsSW360IntegrationTest.json

---------

Co-authored-by: MadanReddyK <[email protected]>
  • Loading branch information
karthika-g and MadanReddyK committed Jul 11, 2023
1 parent 7751b1f commit dead0c6
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 62 deletions.
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
58 changes: 30 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,15 @@ 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 +344,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 +383,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 +422,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 +461,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 +500,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 +525,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 +540,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
4 changes: 2 additions & 2 deletions src/TestUtilities/appSettingsSW360IntegrationTest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"FossologyURL": "",
"RemoveDevDependency": true,
"SW360AuthTokenType": "Token",
"SW360ProjectID": "036ec371847b4b199dd21c3494ccb108",
"SW360ProjectID": "0d0e23f6bccb4072be91b5a3462414ad",
"SW360ProjectName": "Test",
"SW360URL": "",
"JfrogNugetDestRepoName": "nuget-test",
Expand All @@ -12,4 +12,4 @@
"ArtifactoryUploadApiKey": "",
"JfrogApi": "",
"SW360AuthTokenValue": ""
}
}

0 comments on commit dead0c6

Please sign in to comment.