diff --git a/src/LCT.PackageIdentifier.UTest/CycloneBomProcessorTests.cs b/src/LCT.PackageIdentifier.UTest/CycloneBomProcessorTests.cs index 5c6455ab..ac4c2e73 100644 --- a/src/LCT.PackageIdentifier.UTest/CycloneBomProcessorTests.cs +++ b/src/LCT.PackageIdentifier.UTest/CycloneBomProcessorTests.cs @@ -37,7 +37,8 @@ public void SetMetadataInComparisonBOM_GivenBOMWithEmptyMetadata_FillsInMetadata }; CommonAppSettings appSettings = new CommonAppSettings() { - CaVersion = "1.2.3" + CaVersion = "1.2.3", + ProjectType="NPM", }; CatoolInfo caToolInformation = new CatoolInfo() { CatoolVersion = "6.0.0", CatoolRunningLocation="" }; //Act @@ -73,6 +74,7 @@ public void SetMetadataInComparisonBOM_GivenBOMWithMetadata_AddsNewMetadataInfoI { CaVersion = "1.2.3", SW360ProjectName = "Test", + ProjectType = "NPM", }; Tool tools = new Tool() diff --git a/src/LCT.PackageIdentifier/CycloneBomProcessor.cs b/src/LCT.PackageIdentifier/CycloneBomProcessor.cs index 16651214..11a7d1a5 100644 --- a/src/LCT.PackageIdentifier/CycloneBomProcessor.cs +++ b/src/LCT.PackageIdentifier/CycloneBomProcessor.cs @@ -11,6 +11,7 @@ using LCT.Common.Model; using log4net; using System.Collections.Generic; +using System.Linq; using System.Reflection; namespace LCT.PackageIdentifier @@ -25,7 +26,7 @@ public static Bom SetMetadataInComparisonBOM(Bom bom, ProjectReleases projectReleases, CatoolInfo caToolInformation) { - Logger.Debug("Starting to add metadata info into the BOM"); + Logger.Debug("Starting to add metadata info into the BOM"); Metadata metadata = new Metadata { Tools = new List(), @@ -38,7 +39,7 @@ public static Bom SetMetadataInComparisonBOM(Bom bom, { Name = appSettings.SW360ProjectName, Version = projectReleases.Version, - Type = Component.Classification.Application + Type = appSettings.ProjectType.ToUpperInvariant().Contains("DEBIAN",System.StringComparison.OrdinalIgnoreCase) || appSettings.ProjectType.ToUpperInvariant().Contains("ALPINE", System.StringComparison.OrdinalIgnoreCase) ? Component.Classification.Container : Component.Classification.Application }; metadata.Component = component; @@ -51,7 +52,7 @@ public static Bom SetMetadataInComparisonBOM(Bom bom, bom.Metadata = metadata; return bom; - } + } public static void SetMetaDataToolsValues(Metadata metadata, CatoolInfo caToolInformation) {