1
- // This file is part of CycloneDX CLI Tool
1
+ // This file is part of CycloneDX CLI Tool
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the “License”);
4
4
// you may not use this file except in compliance with the License.
@@ -29,20 +29,23 @@ namespace CycloneDX.Cli.Tests
29
29
public class MergeTests
30
30
{
31
31
[ Theory ]
32
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . autodetect , true , null , "Thing" , "1" ) ]
33
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
34
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
35
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . json , "sbom.json" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
36
- [ InlineData ( new string [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
37
- [ InlineData ( new string [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
38
- [ InlineData ( new string [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . xml , "sbom.xml" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
39
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , false , null , null , null ) ]
40
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . json , false , null , null , null ) ]
41
- [ InlineData ( new string [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . xml , false , null , null , null ) ]
32
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . autodetect , null , true , null , "Thing" , "1" ) ]
33
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
34
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
35
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . json , "sbom.json" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
36
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . json , "sbom.json" , CycloneDXBomFormat . autodetect , SpecificationVersion . v1_4 , false , null , null , null ) ]
37
+ [ InlineData ( new [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
38
+ [ InlineData ( new [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , SpecificationVersion . v1_4 , false , null , null , null ) ]
39
+ [ InlineData ( new [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
40
+ [ InlineData ( new [ ] { "sbom1.xml" , "sbom2.xml" } , CycloneDXBomFormat . xml , "sbom.xml" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
41
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.xml" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . autodetect , null , false , null , null , null ) ]
42
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.json" , CycloneDXBomFormat . json , null , false , null , null , null ) ]
43
+ [ InlineData ( new [ ] { "sbom1.json" , "sbom2.json" } , CycloneDXBomFormat . autodetect , "sbom.xml" , CycloneDXBomFormat . xml , null , false , null , null , null ) ]
42
44
public async Task Merge (
43
45
string [ ] inputFilenames ,
44
46
CycloneDXBomFormat inputFormat ,
45
47
string outputFilename , CycloneDXBomFormat outputFormat ,
48
+ SpecificationVersion ? outputVersion ,
46
49
bool hierarchical ,
47
50
string group , string name , string version
48
51
)
@@ -57,6 +60,7 @@ public async Task Merge(
57
60
InputFormat = inputFormat ,
58
61
OutputFile = fullOutputPath ,
59
62
OutputFormat = outputFormat ,
63
+ OutputVersion = outputVersion ,
60
64
Hierarchical = hierarchical ,
61
65
Group = group ,
62
66
Name = name ,
@@ -73,7 +77,7 @@ public async Task Merge(
73
77
var bom = File . ReadAllText ( fullOutputPath ) ;
74
78
bom = Regex . Replace ( bom , @"\s*""serialNumber"": "".*?"",\r?\n" , "" ) ; // json
75
79
bom = Regex . Replace ( bom , @"\s+serialNumber="".*?""" , "" ) ; // xml
76
- Snapshot . Match ( bom , SnapshotNameExtension . Create ( hierarchical ? "Hierarchical" : "Flat" , snapshotInputFilenames , inputFormat , outputFilename , outputFormat ) ) ;
80
+ Snapshot . Match ( bom , SnapshotNameExtension . Create ( hierarchical ? "Hierarchical" : "Flat" , snapshotInputFilenames , inputFormat , outputFilename , outputFormat , outputVersion ) ) ;
77
81
}
78
82
}
79
83
}
0 commit comments