Skip to content

Commit 6ee1f23

Browse files
committed
Add test example for issue 941
Relates to #941. Signed-off-by: stefan6419846 <96178532+stefan6419846@users.noreply.github.com>
1 parent bf596c0 commit 6ee1f23

15 files changed

Lines changed: 523 additions & 0 deletions

tests/_data/models.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,45 @@ def get_bom_for_issue540_duplicate_components() -> Bom:
15611561
bom.register_dependency(component1, [component3])
15621562
return bom
15631563

1564+
1565+
def get_bom_for_issue941_nested_dependencies() -> Bom:
1566+
bom = _make_bom()
1567+
bom.metadata.component = root_component = Component(
1568+
name='myApp',
1569+
type=ComponentType.APPLICATION,
1570+
bom_ref='myApp'
1571+
)
1572+
1573+
component1 = Component(
1574+
type=ComponentType.LIBRARY,
1575+
name='some-library',
1576+
bom_ref='some-library1'
1577+
)
1578+
bom.components.add(component1)
1579+
1580+
component2 = Component(
1581+
type=ComponentType.LIBRARY,
1582+
name='some-library',
1583+
bom_ref='some-library2'
1584+
)
1585+
bom.components.add(component2)
1586+
1587+
bom.dependencies.add(
1588+
Dependency(
1589+
root_component.bom_ref,
1590+
dependencies=[
1591+
Dependency(
1592+
component1.bom_ref,
1593+
dependencies=[
1594+
Dependency(component2.bom_ref)
1595+
]
1596+
)
1597+
]
1598+
)
1599+
)
1600+
1601+
return bom
1602+
15641603
# ---
15651604

15661605

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.0" version="1">
3+
<components>
4+
<component type="library">
5+
<name>some-library</name>
6+
<version/>
7+
<modified>false</modified>
8+
</component>
9+
<component type="library">
10+
<name>some-library</name>
11+
<version/>
12+
<modified>false</modified>
13+
</component>
14+
</components>
15+
</bom>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.1" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<components>
4+
<component type="library" bom-ref="some-library1">
5+
<name>some-library</name>
6+
<version/>
7+
</component>
8+
<component type="library" bom-ref="some-library2">
9+
<name>some-library</name>
10+
<version/>
11+
</component>
12+
</components>
13+
</bom>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "some-library1",
5+
"name": "some-library",
6+
"type": "library",
7+
"version": ""
8+
},
9+
{
10+
"bom-ref": "some-library2",
11+
"name": "some-library",
12+
"type": "library",
13+
"version": ""
14+
}
15+
],
16+
"dependencies": [
17+
{
18+
"dependsOn": [
19+
"some-library1"
20+
],
21+
"ref": "myApp"
22+
},
23+
{
24+
"ref": "some-library1"
25+
},
26+
{
27+
"ref": "some-library2"
28+
}
29+
],
30+
"metadata": {
31+
"component": {
32+
"bom-ref": "myApp",
33+
"name": "myApp",
34+
"type": "application",
35+
"version": ""
36+
},
37+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
38+
},
39+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
40+
"version": 1,
41+
"$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json",
42+
"bomFormat": "CycloneDX",
43+
"specVersion": "1.2"
44+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
<component type="application" bom-ref="myApp">
6+
<name>myApp</name>
7+
<version/>
8+
</component>
9+
</metadata>
10+
<components>
11+
<component type="library" bom-ref="some-library1">
12+
<name>some-library</name>
13+
<version/>
14+
</component>
15+
<component type="library" bom-ref="some-library2">
16+
<name>some-library</name>
17+
<version/>
18+
</component>
19+
</components>
20+
<dependencies>
21+
<dependency ref="myApp">
22+
<dependency ref="some-library1">
23+
<dependency ref="some-library2"/>
24+
</dependency>
25+
</dependency>
26+
<dependency ref="some-library1"/>
27+
<dependency ref="some-library2"/>
28+
</dependencies>
29+
</bom>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "some-library1",
5+
"name": "some-library",
6+
"type": "library",
7+
"version": ""
8+
},
9+
{
10+
"bom-ref": "some-library2",
11+
"name": "some-library",
12+
"type": "library",
13+
"version": ""
14+
}
15+
],
16+
"dependencies": [
17+
{
18+
"dependsOn": [
19+
"some-library1"
20+
],
21+
"ref": "myApp"
22+
},
23+
{
24+
"ref": "some-library1"
25+
},
26+
{
27+
"ref": "some-library2"
28+
}
29+
],
30+
"metadata": {
31+
"component": {
32+
"bom-ref": "myApp",
33+
"name": "myApp",
34+
"type": "application",
35+
"version": ""
36+
},
37+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
38+
},
39+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
40+
"version": 1,
41+
"$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json",
42+
"bomFormat": "CycloneDX",
43+
"specVersion": "1.3"
44+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.3" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
<component type="application" bom-ref="myApp">
6+
<name>myApp</name>
7+
<version/>
8+
</component>
9+
</metadata>
10+
<components>
11+
<component type="library" bom-ref="some-library1">
12+
<name>some-library</name>
13+
<version/>
14+
</component>
15+
<component type="library" bom-ref="some-library2">
16+
<name>some-library</name>
17+
<version/>
18+
</component>
19+
</components>
20+
<dependencies>
21+
<dependency ref="myApp">
22+
<dependency ref="some-library1">
23+
<dependency ref="some-library2"/>
24+
</dependency>
25+
</dependency>
26+
<dependency ref="some-library1"/>
27+
<dependency ref="some-library2"/>
28+
</dependencies>
29+
</bom>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "some-library1",
5+
"name": "some-library",
6+
"type": "library"
7+
},
8+
{
9+
"bom-ref": "some-library2",
10+
"name": "some-library",
11+
"type": "library"
12+
}
13+
],
14+
"dependencies": [
15+
{
16+
"dependsOn": [
17+
"some-library1"
18+
],
19+
"ref": "myApp"
20+
},
21+
{
22+
"ref": "some-library1"
23+
},
24+
{
25+
"ref": "some-library2"
26+
}
27+
],
28+
"metadata": {
29+
"component": {
30+
"bom-ref": "myApp",
31+
"name": "myApp",
32+
"type": "application"
33+
},
34+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
35+
},
36+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
37+
"version": 1,
38+
"$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json",
39+
"bomFormat": "CycloneDX",
40+
"specVersion": "1.4"
41+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.4" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
<component type="application" bom-ref="myApp">
6+
<name>myApp</name>
7+
</component>
8+
</metadata>
9+
<components>
10+
<component type="library" bom-ref="some-library1">
11+
<name>some-library</name>
12+
</component>
13+
<component type="library" bom-ref="some-library2">
14+
<name>some-library</name>
15+
</component>
16+
</components>
17+
<dependencies>
18+
<dependency ref="myApp">
19+
<dependency ref="some-library1">
20+
<dependency ref="some-library2"/>
21+
</dependency>
22+
</dependency>
23+
<dependency ref="some-library1"/>
24+
<dependency ref="some-library2"/>
25+
</dependencies>
26+
</bom>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "some-library1",
5+
"name": "some-library",
6+
"type": "library"
7+
},
8+
{
9+
"bom-ref": "some-library2",
10+
"name": "some-library",
11+
"type": "library"
12+
}
13+
],
14+
"dependencies": [
15+
{
16+
"dependsOn": [
17+
"some-library1"
18+
],
19+
"ref": "myApp"
20+
},
21+
{
22+
"ref": "some-library1"
23+
},
24+
{
25+
"ref": "some-library2"
26+
}
27+
],
28+
"metadata": {
29+
"component": {
30+
"bom-ref": "myApp",
31+
"name": "myApp",
32+
"type": "application"
33+
},
34+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
35+
},
36+
"properties": [
37+
{
38+
"name": "key1",
39+
"value": "val1"
40+
},
41+
{
42+
"name": "key2",
43+
"value": "val2"
44+
}
45+
],
46+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
47+
"version": 1,
48+
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
49+
"bomFormat": "CycloneDX",
50+
"specVersion": "1.5"
51+
}

0 commit comments

Comments
 (0)