Skip to content

Commit

Permalink
tests: fetched schema 1.5 test data from spec (#536)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck authored Jan 24, 2024
1 parent 8f81322 commit 394cc87
Show file tree
Hide file tree
Showing 122 changed files with 6,078 additions and 3 deletions.
8 changes: 8 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-bomformat-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"bomFormat": "AnotherFormat",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
]
}
26 changes: 26 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-component-ref-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"bom-ref": "123",
"name": "acme-library",
"version": "1.0.0"
},
{
"type": "library",
"bom-ref": "123",
"name": "acme-library",
"version": "1.0.0"
},
{
"type": "library",
"bom-ref": "",
"name": "acme-library",
"version": "1.0.0"
}
]
}
21 changes: 21 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-component-ref-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="library" bom-ref="123">
<name>acme-library</name>
<version>1.0.0</version>
<components>
<component type="library" bom-ref="123">
<!-- duplicate value in attribute `bom-ref` -->
<name>acme-library</name>
<version>1.0.0</version>
</component>
<component type="library" bom-ref="">
<!-- empty value in attribute `bom-ref` -->
<name>acme-library</name>
<version>1.0.0</version>
</component>
</components>
</component>
</components>
</bom>
18 changes: 18 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-component-swid-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "application",
"author": "Acme Super Heros",
"name": "Acme Application",
"version": "9.1.1",
"swid": {
"name": "Acme Application",
"version": "9.1.1"
}
}
]
}
11 changes: 11 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-component-swid-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="application">
<author>Acme Super Heros</author>
<name>Acme Application</name>
<version>9.1.1</version>
<swid name="Acme Application" version="9.1.1" />
</component>
</components>
</bom>
13 changes: 13 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-component-type-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "foo",
"name": "acme-library",
"version": "1.0.0"
}
]
}
9 changes: 9 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-component-type-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="foo">
<name>acme-library</name>
<version>1.0.0</version>
</component>
</components>
</bom>
43 changes: 43 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-dependency-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"bom-ref": "library-a",
"type": "library",
"name": "library-a",
"version": "1.0.0"
},
{
"bom-ref": "library-b",
"type": "library",
"name": "library-b",
"version": "1.0.0"
},
{
"bom-ref": "library-c",
"type": "library",
"name": "library-c",
"version": "1.0.0"
}
],
"dependencies": [
{
"dependsOn": []
},
{
"ref": "",
"dependsOn": [
"library-a"
]
},
{
"ref": "library-b",
"dependsOn": [
"library-c"
]
}
]
}
31 changes: 31 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-dependency-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="library" bom-ref="library-a">
<name>acme-library-a</name>
<version>1.0.0</version>
</component>
<component type="library" bom-ref="library-b">
<name>acme-library-b</name>
<version>1.0.0</version>
</component>
<component type="library" bom-ref="library-c">
<name>acme-library-b</name>
<version>1.0.0</version>
</component>
</components>
<dependencies>
<dependency>
<!-- invalid: missing attribute `ref` -->
</dependency>
<dependency ref="">
<!-- invalid: attribute `ref` is empty -->
<dependency ref="library-a"/>
</dependency>
<dependency ref="library-b">
<dependency ref="library-c">
<!-- valid -->
</dependency>
</dependency>
</dependencies>
</bom>
11 changes: 11 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-empty-component-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="application">
</component>
</components>
</bom>
32 changes: 32 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-alg-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "acme-library",
"version": "1.0.0",
"scope": "required",
"hashes": [
{
"alg": "FOO",
"content": "3942447fac867ae5cdb3229b658f4d48"
},
{
"alg": "SHA-1",
"content": "e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a"
},
{
"alg": "SHA-256",
"content": "f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b"
},
{
"alg": "SHA-512",
"content": "e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282"
}
]
}
]
}
16 changes: 16 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-alg-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="library">
<name>acme-library</name>
<version>1.0.0</version>
<scope>required</scope>
<hashes>
<hash alg="FOO">3942447fac867ae5cdb3229b658f4d48</hash>
<hash alg="SHA-1">e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a</hash>
<hash alg="SHA-256">f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b</hash>
<hash alg="SHA-512">e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282</hash>
</hashes>
</component>
</components>
</bom>
32 changes: 32 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-md5-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "acme-library",
"version": "1.0.0",
"scope": "required",
"hashes": [
{
"alg": "MD5",
"content": "foo"
},
{
"alg": "SHA-1",
"content": "e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a"
},
{
"alg": "SHA-256",
"content": "f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b"
},
{
"alg": "SHA-512",
"content": "e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282"
}
]
}
]
}
16 changes: 16 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-md5-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="library">
<name>acme-library</name>
<version>1.0.0</version>
<scope>required</scope>
<hashes>
<hash alg="MD5">foo</hash>
<hash alg="SHA-1">e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a</hash>
<hash alg="SHA-256">f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b</hash>
<hash alg="SHA-512">e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282</hash>
</hashes>
</component>
</components>
</bom>
32 changes: 32 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-sha1-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "acme-library",
"version": "1.0.0",
"scope": "required",
"hashes": [
{
"alg": "MD5",
"content": "3942447fac867ae5cdb3229b658f4d48"
},
{
"alg": "SHA-1",
"content": "foo"
},
{
"alg": "SHA-256",
"content": "f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b"
},
{
"alg": "SHA-512",
"content": "e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282"
}
]
}
]
}
16 changes: 16 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-sha1-1.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="library">
<name>acme-library</name>
<version>1.0.0</version>
<scope>required</scope>
<hashes>
<hash alg="MD5">3942447fac867ae5cdb3229b658f4d48</hash>
<hash alg="SHA-1">foo</hash>
<hash alg="SHA-256">f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b</hash>
<hash alg="SHA-512">e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282</hash>
</hashes>
</component>
</components>
</bom>
32 changes: 32 additions & 0 deletions tests/_data/schemaTestData/1.5/invalid-hash-sha256-1.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "acme-library",
"version": "1.0.0",
"scope": "required",
"hashes": [
{
"alg": "MD5",
"content": "3942447fac867ae5cdb3229b658f4d48"
},
{
"alg": "SHA-1",
"content": "e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a"
},
{
"alg": "SHA-256",
"content": "foo"
},
{
"alg": "SHA-512",
"content": "e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282"
}
]
}
]
}
Loading

0 comments on commit 394cc87

Please sign in to comment.