From 41986c1d4f0ccfdc91cfbf046b02d27ff2271806 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Thu, 9 May 2024 10:28:56 -0500 Subject: [PATCH] Add valid formulation files --- .../tests/spec/1.5/valid-formulation-1.5.json | 294 +++++++++++++++++ .../tests/spec/1.5/valid-formulation-1.5.xml | 251 ++++++++++++++ ...ifications@valid-formulation-1.5.json.snap | 310 ++++++++++++++++++ ...cifications@valid-formulation-1.5.xml.snap | 252 ++++++++++++++ 4 files changed, 1107 insertions(+) create mode 100644 cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.json create mode 100644 cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.xml create mode 100644 cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_json_specifications@valid-formulation-1.5.json.snap create mode 100644 cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_xml_specifications@valid-formulation-1.5.xml.snap diff --git a/cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.json b/cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.json new file mode 100644 index 00000000..9f9490a1 --- /dev/null +++ b/cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.json @@ -0,0 +1,294 @@ +{ + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79", + "version": 1, + "components": [ + { + "type": "library", + "publisher": "Acme Inc", + "group": "org.example", + "name": "mylibrary", + "version": "1.0.0" + } + ], + "formulation": [ + { + "bom-ref": "formula-1", + "components": [ + { + "bom-ref": "component-1", + "type": "platform", + "name": "Pipeline controller image", + "version": "v0.47.0" + } + ], + "workflows": [ + { + "bom-ref": "workflow-1", + "uid": "8edb2b08-e2c7-11ed-b5ea-0242ac120002", + "name": "My workflow", + "description": "Workflow description here", + "resourceReferences": [ + { + "ref": "component-a" + } + ], + "tasks": [ + { + "bom-ref": "task-1", + "uid": "task-uid-1", + "name": "fetch-repository", + "description": "Description here", + "resourceReferences": [ + { + "ref": "component-a" + } + ], + "taskTypes": [ "clone", "build" ], + "trigger": { + "bom-ref": "trigger-1", + "uid": "trigger-1", + "type": "api" + }, + "steps": [ + { + "name": "My step" + } + ], + "inputs": [ + { + "resource": { + "ref": "component-a" + } + } + ], + "outputs": [ + { + "resource": { + "ref": "component-b" + } + } + ], + "timeStart": "2023-01-01T00:00:00+00:00", + "timeEnd": "2023-01-01T00:00:00+00:00", + "workspaces": [ + { + "bom-ref": "workspace-1", + "uid": "workspace-uid-1", + "name": "workspace" + } + ], + "runtimeTopology": [ + { + "ref": "task-1", + "dependsOn": [ "task-2" ] + } + ] + } + ], + "taskDependencies": [ + { + "ref": "task-1", + "dependsOn": ["task-2"] + } + ], + "taskTypes": [ "clone", "build" ], + "trigger": { + "bom-ref": "trigger-2", + "uid": "trigger-uid-2", + "name": "My trigger", + "description": "Description here", + "resourceReferences": [ + { + "ref": "component-a" + } + ], + "type": "api", + "event": { + "uid": "event-1", + "description": "Description here", + "timeReceived": "2023-01-01T00:00:00+00:00", + "data": { + "contentType": "text/plain", + "content": "Foo/Bar" + }, + "source": { + "ref": "component-g" + }, + "target": { + "ref": "component-h" + }, + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + "conditions": [ + { + "description": "Description here", + "expression": "1 == 1", + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ], + "timeActivated": "2023-01-01T00:00:00+00:00", + "inputs": [ + { + "resource": { + "ref": "component-10" + }, + "source": { + "ref": "component-11" + }, + "target": { + "ref": "component-12" + } + } + ], + "outputs": [ + { + "resource": { + "ref": "component-14" + }, + "type": "artifact", + "source": { + "ref": "component-15" + }, + "target": { + "ref": "component-16" + } + } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + "steps": [ + { + "name": "My step", + "description": "Description here", + "commands": [ + { + "executed": "ls -las", + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ], + "inputs": [ + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + { + "environmentVars": [ + "FooBar" + ] + }, + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + }, + "FooBar" + ] + } + ], + "outputs": [ + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + { + "environmentVars": [ + "FooBar" + ] + }, + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + }, + "FooBar" + ] + } + ], + "timeStart": "2023-01-01T00:00:00+00:00", + "timeEnd": "2023-01-01T00:00:00+10:00", + "workspaces": [ + { + "bom-ref": "workspace-1", + "uid": "workspace-1", + "name": "My workspace", + "aliases": [ "default-workspace" ], + "description": "Description here", + "resourceReferences": [ + { + "ref": "component-t" + } + ], + "accessMode": "read-write", + "mountPath": "/tmp/workspace", + "managedDataType": "ConfigMap", + "volumeRequest": "requestedVolumeClaim", + "volume": { + "uid": "volume-1", + "name": "My volume", + "mode": "filesystem", + "path": "/", + "sizeAllocated": "10GB", + "persistent": true, + "remote": false + } + } + ], + "runtimeTopology": [ + { + "ref": "component-s", + "dependsOn": [ + "component-r" + ] + } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ] + } + ] +} diff --git a/cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.xml b/cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.xml new file mode 100644 index 00000000..8492e4b4 --- /dev/null +++ b/cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.xml @@ -0,0 +1,251 @@ + + + + + Acme Inc + org.example + mylibrary + 1.0.0 + + + + + + + Pipeline controller image + v0.47.0 + + + + + 8edb2b08-e2c7-11ed-b5ea-0242ac120002 + My workflow + Workflow description here + + + component-a + + + + + task-uid-1 + fetch-repository + Description here + + + component-a + + + + clone + build + + + trigger-1 + api + + + + My step + + + + + + component-a + + + + + + + component-b + + + + 2023-01-01T00:00:00+00:00 + 2023-01-01T00:00:00+00:00 + + + workspace-uid-1 + workspace + + + + + + + + + + + + + + + + clean + build + + + trigger-uid-1 + My trigger + Description here + + + component-a + + + api + + event-1 + Description here + 2023-01-01T00:00:00+00:00 + FooBar + + component-g + + + component-h + + + Bar + + + + + Description here + 1 == 1 + + Bar + + + + 2023-01-01T00:00:00+00:00 + + + + component-10 + + + component-11 + + + component-12 + + + + + + + component-14 + + artifact + + component-15 + + + component-16 + + + + + Bar + + + + + My step + Description here + + + ls -las + + Bar + + + + + Bar + + + + + + + Bar + + + + + FooBar + + + + + Bar + FooBar + + + + + + + Bar + + + + + FooBar + + + + + Bar + FooBar + + + + 2023-01-01T00:00:00+00:00 + 2023-01-01T00:00:00+00:00 + + + workspace-1 + My workspace + + default-workspace + + Description here + + + component-t + + + read-write + /tmp/workspace + ConfigMap + requestedVolumeClaim + + volume-1 + My volume + filesystem + / + 10GB + true + false + + + + + + + + + + Bar + + + + + + diff --git a/cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_json_specifications@valid-formulation-1.5.json.snap b/cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_json_specifications@valid-formulation-1.5.json.snap new file mode 100644 index 00000000..23d378f3 --- /dev/null +++ b/cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_json_specifications@valid-formulation-1.5.json.snap @@ -0,0 +1,310 @@ +--- +source: cyclonedx-bom/tests/specification_tests_v1_5.rs +expression: bom_output +input_file: cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.json +--- +{ + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "version": 1, + "serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79", + "components": [ + { + "type": "library", + "publisher": "Acme Inc", + "group": "org.example", + "name": "mylibrary", + "version": "1.0.0" + } + ], + "formulation": [ + { + "bom-ref": "formula-1", + "components": [ + { + "type": "platform", + "bom-ref": "component-1", + "name": "Pipeline controller image", + "version": "v0.47.0" + } + ], + "workflows": [ + { + "bom-ref": "workflow-1", + "uid": "8edb2b08-e2c7-11ed-b5ea-0242ac120002", + "name": "My workflow", + "description": "Workflow description here", + "resourceReferences": [ + { + "ref": "component-a" + } + ], + "tasks": [ + { + "bom-ref": "task-1", + "uid": "task-uid-1", + "name": "fetch-repository", + "description": "Description here", + "resourceReferences": [ + { + "ref": "component-a" + } + ], + "taskTypes": [ + "clone", + "build" + ], + "trigger": { + "bom-ref": "trigger-1", + "uid": "trigger-1", + "type": "api" + }, + "steps": [ + { + "name": "My step" + } + ], + "inputs": [ + { + "resource": { + "ref": "component-a" + } + } + ], + "outputs": [ + { + "resource": { + "ref": "component-b" + } + } + ], + "timeStart": "2023-01-01T00:00:00+00:00", + "timeEnd": "2023-01-01T00:00:00+00:00", + "workspaces": [ + { + "bom-ref": "workspace-1", + "uid": "workspace-uid-1", + "name": "workspace" + } + ], + "runtimeTopology": [ + { + "ref": "task-1", + "dependsOn": [ + "task-2" + ] + } + ] + } + ], + "taskDependencies": [ + { + "ref": "task-1", + "dependsOn": [ + "task-2" + ] + } + ], + "taskTypes": [ + "clone", + "build" + ], + "trigger": { + "bom-ref": "trigger-2", + "uid": "trigger-uid-2", + "name": "My trigger", + "description": "Description here", + "resourceReferences": [ + { + "ref": "component-a" + } + ], + "type": "api", + "event": { + "uid": "event-1", + "description": "Description here", + "timeReceived": "2023-01-01T00:00:00+00:00", + "data": { + "content": "Foo/Bar", + "contentType": "text/plain" + }, + "source": { + "ref": "component-g" + }, + "target": { + "ref": "component-h" + }, + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + "conditions": [ + { + "description": "Description here", + "expression": "1 == 1", + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ], + "timeActivated": "2023-01-01T00:00:00+00:00", + "inputs": [ + { + "resource": { + "ref": "component-10" + }, + "source": { + "ref": "component-11" + }, + "target": { + "ref": "component-12" + } + } + ], + "outputs": [ + { + "resource": { + "ref": "component-14" + }, + "type": "artifact", + "source": { + "ref": "component-15" + }, + "target": { + "ref": "component-16" + } + } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + "steps": [ + { + "commands": [ + { + "executed": "ls -las", + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ], + "description": "Description here", + "name": "My step", + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ], + "inputs": [ + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + { + "environmentVars": [ + "FooBar" + ] + }, + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + }, + "FooBar" + ] + } + ], + "outputs": [ + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + } + ] + }, + { + "environmentVars": [ + "FooBar" + ] + }, + { + "environmentVars": [ + { + "name": "Foo", + "value": "Bar" + }, + "FooBar" + ] + } + ], + "timeStart": "2023-01-01T00:00:00+00:00", + "timeEnd": "2023-01-01T00:00:00+10:00", + "workspaces": [ + { + "bom-ref": "workspace-1", + "uid": "workspace-1", + "name": "My workspace", + "aliases": [ + "default-workspace" + ], + "description": "Description here", + "resourceReferences": [ + { + "ref": "component-t" + } + ], + "accessMode": "read-write", + "mountPath": "/tmp/workspace", + "managedDataType": "ConfigMap", + "volumeRequest": "requestedVolumeClaim", + "volume": { + "uid": "volume-1", + "name": "My volume", + "mode": "filesystem", + "path": "/", + "persistent": true, + "remote": false + } + } + ], + "runtimeTopology": [ + { + "ref": "component-s", + "dependsOn": [ + "component-r" + ] + } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + } + ] + } + ] + } + ] +} diff --git a/cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_xml_specifications@valid-formulation-1.5.xml.snap b/cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_xml_specifications@valid-formulation-1.5.xml.snap new file mode 100644 index 00000000..6abf269f --- /dev/null +++ b/cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_xml_specifications@valid-formulation-1.5.xml.snap @@ -0,0 +1,252 @@ +--- +source: cyclonedx-bom/tests/specification_tests_v1_5.rs +expression: bom_output +input_file: cyclonedx-bom/tests/spec/1.5/valid-formulation-1.5.xml +--- + + + + + Acme Inc + org.example + mylibrary + 1.0.0 + + + + + + + Pipeline controller image + v0.47.0 + + + + + 8edb2b08-e2c7-11ed-b5ea-0242ac120002 + My workflow + Workflow description here + + + component-a + + + + + task-uid-1 + fetch-repository + Description here + + + component-a + + + + trigger-1 + api + + + + My step + + + + + + component-a + + + + + + + component-b + + + + 2023-01-01T00:00:00+00:00 + 2023-01-01T00:00:00+00:00 + + + workspace-uid-1 + workspace + + + + + + + + + + + + + + + + clean + build + + + trigger-uid-1 + My trigger + Description here + + + component-a + + + api + + event-1 + Description here + 2023-01-01T00:00:00+00:00 + FooBar + + component-g + + + component-h + + + Bar + + + + + Description here + 1 == 1 + + Bar + + + + 2023-01-01T00:00:00+00:00 + + + + component-10 + + + component-11 + + + component-12 + + + + + + + component-14 + + artifact + + component-15 + + + component-16 + + + + + Bar + + + + + + + ls -las + + Bar + + + + Description here + My step + + Bar + + + + + + + Bar + + + + + FooBar + + + + + Bar + FooBar + + + + + + + Bar + + + + + FooBar + + + + + Bar + FooBar + + + + 2023-01-01T00:00:00+00:00 + 2023-01-01T00:00:00+00:00 + + + workspace-1 + My workspace + + default-workspace + + Description here + + + component-t + + + read-write + /tmp/workspace + ConfigMap + requestedVolumeClaim + + volume-1 + My volume + filesystem + / + 10GB + true + false + + + + + + + + + + Bar + + + + + +