From a970fb52b5cc68fef924ba5896ec55596c67b3c5 Mon Sep 17 00:00:00 2001 From: Gary O'Neall Date: Sun, 28 Jun 2026 11:20:44 -0700 Subject: [PATCH] Add test to verify case sensitive ObjectURIs work Related to issue #283 Signed-off-by: Gary O'Neall --- src/test/java/org/spdx/tools/VerifyTest.java | 6 ++ .../SPDXJsonLDExample-casesensitive.json | 98 +++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 testResources/SPDXJsonLDExample-casesensitive.json diff --git a/src/test/java/org/spdx/tools/VerifyTest.java b/src/test/java/org/spdx/tools/VerifyTest.java index f2d03fe..7c5507e 100644 --- a/src/test/java/org/spdx/tools/VerifyTest.java +++ b/src/test/java/org/spdx/tools/VerifyTest.java @@ -36,6 +36,7 @@ public class VerifyTest extends TestCase { static final String TEST_WARNING_FILE_PATH = TEST_DIR + File.separator + "SPDXTagExample-v2.2-warning.spdx"; static final String BAD_JSON_FILE_PATH = TEST_DIR + File.separator + "BadJSON.spdx.json"; static final String DOUBLE_JSON_LD_FILE_PATH = TEST_DIR + File.separator + "double.jsonld"; + static final String JSONLD_CASE_SENSITIVE_ID = TEST_DIR + File.separator + "SPDXJsonLDExample-casesensitive.json"; protected void setUp() throws Exception { super.setUp(); @@ -106,4 +107,9 @@ public void testVerifyDouble() throws SpdxVerificationException { List result = Verify.verify(DOUBLE_JSON_LD_FILE_PATH, SerFileType.JSONLD); assertEquals(0, result.size()); } + + public void testCaseSensitive() throws SpdxVerificationException { + List result = Verify.verify(JSONLD_CASE_SENSITIVE_ID, SerFileType.JSONLD); + assertTrue(result.isEmpty()); + } } diff --git a/testResources/SPDXJsonLDExample-casesensitive.json b/testResources/SPDXJsonLDExample-casesensitive.json new file mode 100644 index 0000000..c62bde5 --- /dev/null +++ b/testResources/SPDXJsonLDExample-casesensitive.json @@ -0,0 +1,98 @@ +{ + "@context": "https://spdx.org/rdf/3.0.1/spdx-context.jsonld", + "@graph": [ + { + "type": "CreationInfo", + "@id": "_:creationinfo", + "createdBy": [ + "http://spdx.example.com/Agent/JoshuaWatt" + ], + "specVersion": "3.0.1", + "created": "2024-03-06T00:00:00Z" + }, + { + "type": "Person", + "spdxId": "http://spdx.example.com/Agent/JoshuaWatt", + "name": "Joshua Watt", + "creationInfo": "_:creationinfo", + "externalIdentifier": [ + { + "type": "ExternalIdentifier", + "externalIdentifierType": "email", + "identifier": "JPEWhacker@gmail.com" + } + ] + }, + { + "type": "SpdxDocument", + "spdxId": "http://spdx.example.com/Document1", + "creationInfo": "_:creationinfo", + "rootElement": [ + "http://spdx.example.com/BOM1" + ], + "element": [ + "http://spdx.example.com/BOM1", + "http://spdx.example.com/Agent/JoshuaWatt", + "http://spdx.example.com/Package1/myprogram", + "http://spdx.example.com/Relationship/1" + ], + "profileConformance": [ + "core", + "software" + ] + }, + { + "type": "software_Sbom", + "spdxId": "http://spdx.example.com/BOM1", + "creationInfo": "_:creationinfo", + "rootElement": [ + "http://spdx.example.com/Package1" + ], + "element": [ + "http://spdx.example.com/Package1/myprogram", + "http://spdx.example.com/Package1" + ], + "software_sbomType": [ + "build" + ] + }, + { + "type": "software_Package", + "spdxId": "http://spdx.example.com/MyProgram", + "creationInfo": "_:creationinfo", + "name": "my-package", + "software_packageVersion": "1.0", + "software_downloadLocation": "http://dl.example.com/my-package_1.0.0.tar", + "builtTime": "2024-03-06T00:00:00Z", + "originatedBy": [ + "http://spdx.example.com/Agent/JoshuaWatt" + ] + }, + { + "type": "software_File", + "spdxId": "http://spdx.example.com/myprogram", + "creationInfo": "_:creationinfo", + "name": "myprogram", + "software_primaryPurpose": "executable", + "software_additionalPurpose": [ + "application" + ], + "software_copyrightText": "Copyright 2024, Joshua Watt", + "builtTime": "2024-03-06T00:00:00Z", + "originatedBy": [ + "http://spdx.example.com/Agent/JoshuaWatt" + ] + }, + { + "type": "Relationship", + "spdxId": "http://spdx.example.com/Relationship/1", + "creationInfo": "_:creationinfo", + "from": "http://spdx.example.com/Package1", + "relationshipType": "contains", + "to": [ + "http://spdx.example.com/Package1/myprogram" + ], + "completeness": "complete" + } + ] +}