From 49d3576d9395fd4a5668d41315e7af42ec57520d Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 17:30:08 +0200 Subject: [PATCH 01/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- examples/1-load/example_load.go | 6 +- examples/10-jsonloader/example_json_loader.go | 4 +- examples/11-yamltotv/exampleyamltotv.go | 8 +- examples/12-tvtoyaml/exampletvtoyaml.go | 8 +- examples/13-yamlloader/exampleYAMLLoader.go | 4 +- examples/2-load-save/example_load_save.go | 8 +- examples/3-build/example_build.go | 6 +- examples/9-tvtojson/exampletvtojson.go | 8 +- .../sample-docs/tv/SPDXTagExample-v2.2.spdx | 20 +- .../sample-docs/tv/SPDXTagExample-v2.3.spdx | 24 +- .../xml/SPDXXMLExample-v2.2.spdx.xml | 32 +- .../yaml/SPDXYAMLExample-2.2.spdx.yaml | 18 +- .../yaml/SPDXYAMLExample-2.3.spdx.yaml | 20 +- json/json_v2_2_test.go | 22 +- json/json_v2_3_test.go | 26 +- licensediff/licensediff_test.go | 226 +++++------ rdfloader/parser2v2/constants.go | 12 +- rdfloader/parser2v2/license_utils.go | 4 +- rdfloader/parser2v2/license_utils_test.go | 32 +- rdfloader/parser2v2/parse_annotation_test.go | 60 +-- rdfloader/parser2v2/parse_file.go | 2 +- rdfloader/parser2v2/parse_file_test.go | 294 +++++++------- rdfloader/parser2v2/parse_license.go | 4 +- rdfloader/parser2v2/parse_license_test.go | 330 ++++++++-------- .../parse_other_license_info_test.go | 6 +- rdfloader/parser2v2/parse_package_test.go | 338 ++++++++--------- .../parser2v2/parse_relationship_test.go | 236 ++++++------ .../parser2v2/parse_snippet_info_test.go | 358 +++++++++--------- .../parser2v2/parse_spdx_document_test.go | 206 +++++----- rdfloader/parser2v2/parser.go | 6 +- rdfloader/parser2v2/parser_test.go | 44 +-- rdfloader/parser2v2/types.go | 4 +- rdfloader/parser2v2/utils.go | 6 +- rdfloader/parser2v2/utils_test.go | 20 +- rdfloader/parser2v3/constants.go | 10 +- rdfloader/parser2v3/license_utils.go | 4 +- rdfloader/parser2v3/parse_annotation_test.go | 60 +-- rdfloader/parser2v3/parse_file_test.go | 318 ++++++++-------- tvloader/parser2v1/parse_file_test.go | 38 +- tvloader/parser2v1/parse_package_test.go | 6 +- tvloader/parser2v1/parse_review_test.go | 10 +- tvloader/parser2v1/parse_snippet_test.go | 30 +- .../parser2v2/parse_creation_info_test.go | 14 +- tvsaver/saver2v2/save_annotation_test.go | 12 +- tvsaver/saver2v2/save_creation_info_test.go | 12 +- tvsaver/saver2v2/save_document.go | 2 +- tvsaver/saver2v2/save_document_test.go | 6 +- tvsaver/saver2v2/save_file_test.go | 88 ++--- tvsaver/saver2v2/save_other_license_test.go | 30 +- tvsaver/saver2v2/save_package_test.go | 286 +++++++------- tvsaver/saver2v2/save_relationship_test.go | 20 +- tvsaver/saver2v3/save_annotation_test.go | 12 +- tvsaver/saver2v3/save_creation_info_test.go | 12 +- tvsaver/saver2v3/save_document_test.go | 6 +- tvsaver/saver2v3/save_file_test.go | 20 +- tvsaver/saver2v3/save_other_license_test.go | 8 +- tvsaver/saver2v3/save_package_test.go | 44 +-- tvsaver/saver2v3/save_relationship_test.go | 20 +- tvsaver/saver2v3/save_review_test.go | 12 +- tvsaver/saver2v3/save_snippet_test.go | 12 +- tvsaver/saver2v3/util_test.go | 4 +- 61 files changed, 1749 insertions(+), 1749 deletions(-) diff --git a/examples/1-load/example_load.go b/examples/1-load/example_load.go index 328d349c..03447a83 100644 --- a/examples/1-load/example_load.go +++ b/examples/1-load/example_load.go @@ -31,7 +31,7 @@ func main() { filename := args[1] r, err := os.Open(filename) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", filename, err) + fmt.Printf("error while opening %v for reading: %v", filename, err) return } defer r.Close() @@ -39,7 +39,7 @@ func main() { // try to load the SPDX file's contents as a tag-value file, version 2.2 doc, err := tvloader.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", filename, err) + fmt.Printf("error while parsing %v: %v", filename, err) return } @@ -58,7 +58,7 @@ func main() { // check whether the SPDX file has at least one package that it describes pkgIDs, err := spdxlib.GetDescribedPackageIDs2_2(doc) if err != nil { - fmt.Printf("Unable to get describe packages from SPDX document: %v\n", err) + fmt.Printf("unable to get describe packages from SPDX document: %v\n", err) return } diff --git a/examples/10-jsonloader/example_json_loader.go b/examples/10-jsonloader/example_json_loader.go index 1ccf4d0f..6314fa32 100644 --- a/examples/10-jsonloader/example_json_loader.go +++ b/examples/10-jsonloader/example_json_loader.go @@ -30,7 +30,7 @@ func main() { fileIn := args[1] r, err := os.Open(fileIn) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + fmt.Printf("error while opening %v for reading: %v", fileIn, err) return } defer r.Close() @@ -38,7 +38,7 @@ func main() { // try to load the SPDX file's contents as a json file, version 2.2 doc, err := spdx_json.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", args[1], err) + fmt.Printf("error while parsing %v: %v", args[1], err) return } diff --git a/examples/11-yamltotv/exampleyamltotv.go b/examples/11-yamltotv/exampleyamltotv.go index d14201c3..9e88072b 100644 --- a/examples/11-yamltotv/exampleyamltotv.go +++ b/examples/11-yamltotv/exampleyamltotv.go @@ -31,7 +31,7 @@ func main() { fileIn := args[1] r, err := os.Open(fileIn) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + fmt.Printf("error while opening %v for reading: %v", fileIn, err) return } defer r.Close() @@ -39,7 +39,7 @@ func main() { // try to load the SPDX file's contents as a YAML file doc, err := spdx_yaml.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", fileIn, err) + fmt.Printf("error while parsing %v: %v", fileIn, err) return } @@ -52,7 +52,7 @@ func main() { fileOut := args[2] w, err := os.Create(fileOut) if err != nil { - fmt.Printf("Error while opening %v for writing: %v", fileOut, err) + fmt.Printf("error while opening %v for writing: %v", fileOut, err) return } defer w.Close() @@ -60,7 +60,7 @@ func main() { // try to save the document to disk as an SPDX tag-value file, version 2.2 err = tvsaver.Save2_2(doc, w) if err != nil { - fmt.Printf("Error while saving %v: %v", fileOut, err) + fmt.Printf("error while saving %v: %v", fileOut, err) return } diff --git a/examples/12-tvtoyaml/exampletvtoyaml.go b/examples/12-tvtoyaml/exampletvtoyaml.go index 19abde70..6ad04116 100644 --- a/examples/12-tvtoyaml/exampletvtoyaml.go +++ b/examples/12-tvtoyaml/exampletvtoyaml.go @@ -30,7 +30,7 @@ func main() { fileIn := args[1] r, err := os.Open(fileIn) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + fmt.Printf("error while opening %v for reading: %v", fileIn, err) return } defer r.Close() @@ -38,7 +38,7 @@ func main() { // try to load the SPDX file's contents as a tag-value file, version 2.2 doc, err := tvloader.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", args[1], err) + fmt.Printf("error while parsing %v: %v", args[1], err) return } @@ -51,7 +51,7 @@ func main() { fileOut := args[2] w, err := os.Create(fileOut) if err != nil { - fmt.Printf("Error while opening %v for writing: %v", fileOut, err) + fmt.Printf("error while opening %v for writing: %v", fileOut, err) return } defer w.Close() @@ -59,7 +59,7 @@ func main() { // try to save the document to disk as an YAML file err = spdx_yaml.Save2_2(doc, w) if err != nil { - fmt.Printf("Error while saving %v: %v", fileOut, err) + fmt.Printf("error while saving %v: %v", fileOut, err) return } diff --git a/examples/13-yamlloader/exampleYAMLLoader.go b/examples/13-yamlloader/exampleYAMLLoader.go index a032eceb..aebc18d7 100644 --- a/examples/13-yamlloader/exampleYAMLLoader.go +++ b/examples/13-yamlloader/exampleYAMLLoader.go @@ -30,7 +30,7 @@ func main() { fileIn := args[1] r, err := os.Open(fileIn) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + fmt.Printf("error while opening %v for reading: %v", fileIn, err) return } defer r.Close() @@ -38,7 +38,7 @@ func main() { // try to load the SPDX file's contents as a json file, version 2.2 doc, err := spdx_yaml.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", args[1], err) + fmt.Printf("error while parsing %v: %v", args[1], err) return } diff --git a/examples/2-load-save/example_load_save.go b/examples/2-load-save/example_load_save.go index 7d234031..c68d88c0 100644 --- a/examples/2-load-save/example_load_save.go +++ b/examples/2-load-save/example_load_save.go @@ -31,7 +31,7 @@ func main() { fileIn := args[1] r, err := os.Open(fileIn) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + fmt.Printf("error while opening %v for reading: %v", fileIn, err) return } defer r.Close() @@ -39,7 +39,7 @@ func main() { // try to load the SPDX file's contents as a tag-value file, version 2.2 doc, err := tvloader.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", fileIn, err) + fmt.Printf("error while parsing %v: %v", fileIn, err) return } @@ -52,7 +52,7 @@ func main() { fileOut := args[2] w, err := os.Create(fileOut) if err != nil { - fmt.Printf("Error while opening %v for writing: %v", fileOut, err) + fmt.Printf("error while opening %v for writing: %v", fileOut, err) return } defer w.Close() @@ -60,7 +60,7 @@ func main() { // try to save the document to disk as an SPDX tag-value file, version 2.2 err = tvsaver.Save2_2(doc, w) if err != nil { - fmt.Printf("Error while saving %v: %v", fileOut, err) + fmt.Printf("error while saving %v: %v", fileOut, err) return } diff --git a/examples/3-build/example_build.go b/examples/3-build/example_build.go index c6051cca..271bed87 100644 --- a/examples/3-build/example_build.go +++ b/examples/3-build/example_build.go @@ -89,7 +89,7 @@ func main() { // - the config object we just defined. doc, err := builder.Build2_2(packageName, packageRootDir, config) if err != nil { - fmt.Printf("Error while building document: %v\n", err) + fmt.Printf("error while building document: %v\n", err) return } @@ -103,14 +103,14 @@ func main() { // create a new file for writing w, err := os.Create(fileOut) if err != nil { - fmt.Printf("Error while opening %v for writing: %v\n", fileOut, err) + fmt.Printf("error while opening %v for writing: %v\n", fileOut, err) return } defer w.Close() err = tvsaver.Save2_2(doc, w) if err != nil { - fmt.Printf("Error while saving %v: %v", fileOut, err) + fmt.Printf("error while saving %v: %v", fileOut, err) return } diff --git a/examples/9-tvtojson/exampletvtojson.go b/examples/9-tvtojson/exampletvtojson.go index 909677ff..04b099a4 100644 --- a/examples/9-tvtojson/exampletvtojson.go +++ b/examples/9-tvtojson/exampletvtojson.go @@ -30,7 +30,7 @@ func main() { fileIn := args[1] r, err := os.Open(fileIn) if err != nil { - fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + fmt.Printf("error while opening %v for reading: %v", fileIn, err) return } defer r.Close() @@ -38,7 +38,7 @@ func main() { // try to load the SPDX file's contents as a tag-value file, version 2.2 doc, err := tvloader.Load2_2(r) if err != nil { - fmt.Printf("Error while parsing %v: %v", args[1], err) + fmt.Printf("error while parsing %v: %v", args[1], err) return } @@ -51,7 +51,7 @@ func main() { fileOut := args[2] w, err := os.Create(fileOut) if err != nil { - fmt.Printf("Error while opening %v for writing: %v", fileOut, err) + fmt.Printf("error while opening %v for writing: %v", fileOut, err) return } defer w.Close() @@ -59,7 +59,7 @@ func main() { // try to save the document to disk as JSON file err = spdx_json.Save2_2(doc, w) if err != nil { - fmt.Printf("Error while saving %v: %v", fileOut, err) + fmt.Printf("error while saving %v: %v", fileOut, err) return } diff --git a/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx b/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx index e8f32ebf..f78f5a6b 100644 --- a/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx +++ b/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx @@ -1,12 +1,12 @@ SPDXVersion: SPDX-2.2 DataLicense: CC0-1.0 -DocumentNamespace: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 +DocumentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 DocumentName: SPDX-Tools-v2.0 SPDXID: SPDXRef-DOCUMENT DocumentComment: This document was created using SPDX 2.0 using licenses from the web site. ## External Document References -ExternalDocumentRef: DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1: d6a770ba38583ed4bb4525bd96e50461655d2759 +ExternalDocumentRef: DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1: d6a770ba38583ed4bb4525bd96e50461655d2759 ## Creation Information Creator: Tool: LicenseFind-1.0 Creator: Organization: ExampleCodeInspect () @@ -74,12 +74,12 @@ PackageVersion: 2.11.1 PackageFileName: glibc-2.11.1.tar.gz PackageSupplier: Person: Jane Doe (jane.doe@example.com) PackageOriginator: Organization: ExampleCodeInspect (contact@example.com) -PackageDownloadLocation: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz +PackageDownloadLocation: https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz PackageVerificationCode: d6a770ba38583ed4bb4525bd96e50461655d2758(./package.spdx) PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageHomePage: http://ftp.gnu.org/gnu/glibc +PackageHomePage: https://ftp.gnu.org/gnu/glibc PackageSourceInfo: uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. PackageLicenseConcluded: (LGPL-2.0-only OR LicenseRef-3) ## License information from files @@ -118,7 +118,7 @@ FileNotice: Apache Commons Lang Copyright 2001-2011 The Apache Software Foundation This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). +The Apache Software Foundation (https://www.apache.org/). This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) @@ -157,7 +157,7 @@ FileContributor: Black Duck Software In.c PackageName: Apache Commons Lang SPDXID: SPDXRef-fromDoap-1 PackageDownloadLocation: NOASSERTION -PackageHomePage: http://commons.apache.org/proper/commons-lang/ +PackageHomePage: https://commons.apache.org/proper/commons-lang/ PackageLicenseConcluded: NOASSERTION PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -168,7 +168,7 @@ PackageName: Jena SPDXID: SPDXRef-fromDoap-0 PackageVersion: 3.12.0 PackageDownloadLocation: https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz -PackageHomePage: http://www.openjena.org/ +PackageHomePage: https://www.openjena.org/ PackageLicenseConcluded: NOASSERTION PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -182,7 +182,7 @@ PackageVersion: 8.8 PackageFileName: saxonB-8.8.zip PackageDownloadLocation: https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageHomePage: http://saxon.sourceforge.net/ +PackageHomePage: https://saxon.sourceforge.net/ PackageLicenseConcluded: MPL-1.0 PackageLicenseDeclared: MPL-1.0 PackageLicenseComments: Other versions available for a commercial license @@ -276,7 +276,7 @@ ExtractedText: "THE BEER-WARE LICENSE" (Revision 42): phk@FreeBSD.ORG wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp LicenseName: Beer-Ware License (Version 42) -LicenseCrossReference: http://people.freebsd.org/~phk/ +LicenseCrossReference: https://people.freebsd.org/~phk/ LicenseComment: The beerware license has a couple of other standard variants. LicenseID: LicenseRef-3 @@ -324,6 +324,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LicenseName: CyberNeko License -LicenseCrossReference: http://people.apache.org/~andyc/neko/LICENSE, http://justasample.url.com +LicenseCrossReference: https://people.apache.org/~andyc/neko/LICENSE, https://justasample.url.com LicenseComment: This is tye CyperNeko License diff --git a/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx b/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx index 7c5ae3d8..9057e09c 100644 --- a/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx +++ b/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx @@ -2,8 +2,8 @@ SPDXVersion: SPDX-2.3 DataLicense: CC0-1.0 SPDXID: SPDXRef-SPDXRef-DOCUMENT DocumentName: SPDX-Tools-v2.0 -DocumentNamespace: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 -ExternalDocumentRef: DocumentRef-DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759 +DocumentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 +ExternalDocumentRef: DocumentRef-DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759 DocumentComment: This document was created using SPDX 2.0 using licenses from the web site. LicenseListVersion: 3.9 Creator: Tool: LicenseFind-1.0 @@ -28,7 +28,7 @@ FileNotice: Apache Commons Lang Copyright 2001-2011 The Apache Software Foundation This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). +The Apache Software Foundation (https://www.apache.org/). This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) @@ -105,12 +105,12 @@ PackageVersion: 2.11.1 PackageFileName: glibc-2.11.1.tar.gz PackageSupplier: Person: Jane Doe (jane.doe@example.com) PackageOriginator: Organization: ExampleCodeInspect (contact@example.com) -PackageDownloadLocation: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz +PackageDownloadLocation: https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz PackageVerificationCode: d6a770ba38583ed4bb4525bd96e50461655d2758 (excludes: ./package.spdx) PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageHomePage: http://ftp.gnu.org/gnu/glibc +PackageHomePage: https://ftp.gnu.org/gnu/glibc PackageSourceInfo: uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. PackageLicenseConcluded: (LGPL-2.0-only OR LicenseRef-3) PackageLicenseInfoFromFiles: GPL-2.0-only @@ -122,7 +122,7 @@ PackageCopyrightText: Copyright 2008-2010 John Smith PackageSummary: GNU C library. PackageDescription: The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems. ExternalRef: SECURITY cpe23Type cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* -ExternalRef: OTHER http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge acmecorp/acmenator/4.1.3-alpha +ExternalRef: OTHER https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge acmecorp/acmenator/4.1.3-alpha ExternalRefComment: This is the external ref for Acme PackageAttributionText: The GNU C Library is free software. See the file COPYING.LIB for copying conditions, and LICENSES for notices about a few contributions that require these additional notices to be distributed. License copyright years may be listed using range notation, e.g., 1996-2015, indicating that every year in the range, inclusive, is a copyrightable year that would otherwise be listed individually. @@ -135,7 +135,7 @@ PackageFileName: saxonB-8.8.zip PackageDownloadLocation: https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download FilesAnalyzed: false PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageHomePage: http://saxon.sourceforge.net/ +PackageHomePage: https://saxon.sourceforge.net/ PackageLicenseConcluded: MPL-1.0 PackageLicenseDeclared: MPL-1.0 PackageLicenseComments: Other versions available for a commercial license @@ -149,7 +149,7 @@ SPDXID: SPDXRef-SPDXRef-fromDoap-0 PackageVersion: 3.12.0 PackageDownloadLocation: https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz FilesAnalyzed: false -PackageHomePage: http://www.openjena.org/ +PackageHomePage: https://www.openjena.org/ PackageLicenseConcluded: NOASSERTION PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -161,7 +161,7 @@ PackageName: Apache Commons Lang SPDXID: SPDXRef-SPDXRef-fromDoap-1 PackageDownloadLocation: NOASSERTION FilesAnalyzed: false -PackageHomePage: http://commons.apache.org/proper/commons-lang/ +PackageHomePage: https://commons.apache.org/proper/commons-lang/ PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -239,7 +239,7 @@ ExtractedText: "THE BEER-WARE LICENSE" (Revision 42): phk@FreeBSD.ORG wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp LicenseName: Beer-Ware License (Version 42) -LicenseCrossReference: http://people.freebsd.org/~phk/ +LicenseCrossReference: https://people.freebsd.org/~phk/ LicenseComment: The beerware license has a couple of other standard variants. LicenseID: LicenseRef-3 @@ -287,8 +287,8 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LicenseName: CyberNeko License -LicenseCrossReference: http://people.apache.org/~andyc/neko/LICENSE -LicenseCrossReference: http://justasample.url.com +LicenseCrossReference: https://people.apache.org/~andyc/neko/LICENSE +LicenseCrossReference: https://justasample.url.com LicenseComment: This is tye CyperNeko License ##### Relationships diff --git a/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml b/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml index 80e0527a..15d0dab2 100644 --- a/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml +++ b/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml @@ -21,7 +21,7 @@ compatible system run time libraries. SHA1 d6a770ba38583ed4bb4525bd96e50461655d2759 - http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 + https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 LicenseRef-1 @@ -100,7 +100,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WAR phk@FreeBSD.ORG wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp Beer-Ware License (Version 42) - http://people.freebsd.org/~phk/ + https://people.freebsd.org/~phk/ LicenseRef-3 @@ -149,8 +149,8 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. CyberNeko License - http://people.apache.org/~andyc/neko/LICENSE - http://justasample.url.com + https://people.apache.org/~andyc/neko/LICENSE + https://justasample.url.com 2010-01-29T18:30:22Z @@ -170,7 +170,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Person: Suzanne Reviewer Another example reviewer. - http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 + https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 SPDXRef-File SPDXRef-Package @@ -196,7 +196,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright 2008-2010 John Smith The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems. - http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz + https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz SECURITY cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* @@ -206,13 +206,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This is the external ref for Acme OTHER acmecorp/acmenator/4.1.3-alpha - http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge + https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge true SPDXRef-CommonsLangSrc SPDXRef-JenaLib SPDXRef-DoapSource - http://ftp.gnu.org/gnu/glibc + https://ftp.gnu.org/gnu/glibc The license for this project changed with the release of version x.y. The version of the project included here post-dates the license change. (LGPL-2.0-only OR LicenseRef-3) (LGPL-2.0-only AND LicenseRef-3) @@ -236,7 +236,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NOASSERTION NOASSERTION false - http://commons.apache.org/proper/commons-lang/ + https://commons.apache.org/proper/commons-lang/ NOASSERTION NOASSERTION Apache Commons Lang @@ -251,7 +251,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. purl false - http://www.openjena.org/ + https://www.openjena.org/ NOASSERTION NOASSERTION Jena @@ -267,7 +267,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The Saxon package is a collection of tools for processing XML documents. https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download false - http://saxon.sourceforge.net/ + https://saxon.sourceforge.net/ Other versions available for a commercial license MPL-1.0 MPL-1.0 @@ -306,13 +306,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Apache-2.0 Apache-2.0 Apache Commons Lang -Copyright 2001-2011 The Apache Software Foundation + Copyright 2001-2011 The Apache Software Foundation -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). + This product includes software developed by + The Apache Software Foundation (https://www.apache.org/). -This product includes software from the Spring Framework, -under the Apache License 2.0 (see: StringUtils.containsWhitespace()) + This product includes software from the Spring Framework, + under the Apache License 2.0 (see: StringUtils.containsWhitespace()) SPDXRef-JenaLib diff --git a/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml b/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml index d58cf229..7fca7c1b 100644 --- a/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml +++ b/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml @@ -19,7 +19,7 @@ externalDocumentRefs: checksum: algorithm: "SHA1" checksumValue: "d6a770ba38583ed4bb4525bd96e50461655d2759" - spdxDocument: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" + spdxDocument: "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" hasExtractedLicensingInfos: - licenseId: "LicenseRef-1" extractedText: "/*\n * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,\ @@ -92,7 +92,7 @@ hasExtractedLicensingInfos: \ buy me a beer in return Poul-Henning Kamp" name: "Beer-Ware License (Version 42)" seeAlsos: - - "http://people.freebsd.org/~phk/" + - "https://people.freebsd.org/~phk/" - licenseId: "LicenseRef-3" comment: "This is tye CyperNeko License" extractedText: "The CyberNeko Software License, Version 1.0\n\n \n(C) Copyright\ @@ -124,8 +124,8 @@ hasExtractedLicensingInfos: \ SUCH DAMAGE." name: "CyberNeko License" seeAlsos: - - "http://people.apache.org/~andyc/neko/LICENSE" - - "http://justasample.url.com" + - "https://people.apache.org/~andyc/neko/LICENSE" + - "https://justasample.url.com" annotations: - annotationDate: "2010-01-29T18:30:22Z" annotationType: "OTHER" @@ -140,7 +140,7 @@ annotations: annotationType: "REVIEW" annotator: "Person: Suzanne Reviewer" comment: "Another example reviewer." -documentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301" +documentNamespace: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301" documentDescribes: - "SPDXRef-File" - "SPDXRef-Package" @@ -168,7 +168,7 @@ packages: description: "The GNU C Library defines functions that are specified by the ISO\ \ C standard, as well as additional features specific to POSIX and other derivatives\ \ of the Unix operating system, and extensions specific to GNU systems." - downloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz" + downloadLocation: "https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz" externalRefs: - referenceCategory: "SECURITY" referenceLocator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*" @@ -176,13 +176,13 @@ packages: - comment: "This is the external ref for Acme" referenceCategory: "OTHER" referenceLocator: "acmecorp/acmenator/4.1.3-alpha" - referenceType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge" + referenceType: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge" filesAnalyzed: true hasFiles: - "SPDXRef-CommonsLangSrc" - "SPDXRef-JenaLib" - "SPDXRef-DoapSource" - homepage: "http://ftp.gnu.org/gnu/glibc" + homepage: "https://ftp.gnu.org/gnu/glibc" licenseComments: "The license for this project changed with the release of version\ \ x.y. The version of the project included here post-dates the license change." licenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)" @@ -231,7 +231,7 @@ packages: description: "The Saxon package is a collection of tools for processing XML documents." downloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download" filesAnalyzed: false - homepage: "http://saxon.sourceforge.net/" + homepage: "https://saxon.sourceforge.net/" licenseComments: "Other versions available for a commercial license" licenseConcluded: "MPL-1.0" licenseDeclared: "MPL-1.0" diff --git a/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml b/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml index 611b74cc..3baff85f 100644 --- a/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml +++ b/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml @@ -26,13 +26,13 @@ creationInfo: - 'Person: Jane Doe ()' licenseListVersion: "3.9" dataLicense: CC0-1.0 -documentNamespace: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 +documentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 externalDocumentRefs: - checksum: algorithm: SHA1 checksumValue: d6a770ba38583ed4bb4525bd96e50461655d2759 externalDocumentId: DocumentRef-spdx-tool-1.2 - spdxDocument: http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 + spdxDocument: https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 files: - SPDXID: SPDXRef-DoapSource checksums: @@ -70,7 +70,7 @@ files: Copyright 2001-2011 The Apache Software Foundation This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). + The Apache Software Foundation (https://www.apache.org/). This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) @@ -249,8 +249,8 @@ hasExtractedLicensingInfos: licenseId: LicenseRef-3 name: CyberNeko License seeAlsos: - - http://people.apache.org/~andyc/neko/LICENSE - - http://justasample.url.com + - https://people.apache.org/~andyc/neko/LICENSE + - https://justasample.url.com name: SPDX-Tools-v2.0 packages: - SPDXID: SPDXRef-Package @@ -276,7 +276,7 @@ packages: description: The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems. - downloadLocation: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz + downloadLocation: https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz externalRefs: - comment: "" referenceCategory: SECURITY @@ -285,9 +285,9 @@ packages: - comment: This is the external ref for Acme referenceCategory: OTHER referenceLocator: acmecorp/acmenator/4.1.3-alpha - referenceType: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge + referenceType: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge filesAnalyzed: true - homepage: http://ftp.gnu.org/gnu/glibc + homepage: https://ftp.gnu.org/gnu/glibc licenseComments: The license for this project changed with the release of version x.y. The version of the project included here post-dates the license change. licenseConcluded: (LGPL-2.0-only OR LicenseRef-3) @@ -322,7 +322,7 @@ packages: referenceCategory: PACKAGE_MANAGER referenceLocator: pkg:maven/org.apache.jena/apache-jena@3.12.0 referenceType: purl - homepage: http://www.openjena.org/ + homepage: https://www.openjena.org/ licenseConcluded: NOASSERTION licenseDeclared: NOASSERTION name: Jena @@ -334,7 +334,7 @@ packages: copyrightText: Copyright Saxonica Ltd description: The Saxon package is a collection of tools for processing XML documents. downloadLocation: https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download - homepage: http://saxon.sourceforge.net/ + homepage: https://saxon.sourceforge.net/ licenseComments: Other versions available for a commercial license licenseConcluded: MPL-1.0 licenseDeclared: MPL-1.0 diff --git a/json/json_v2_2_test.go b/json/json_v2_2_test.go index 01400ecd..d21b4183 100644 --- a/json/json_v2_2_test.go +++ b/json/json_v2_2_test.go @@ -30,7 +30,7 @@ func TestLoad2_2(t *testing.T) { handwrittenExample := want2_2 if cmp.Equal(handwrittenExample, got) { - t.Errorf("Got incorrect struct after parsing JSON example") + t.Errorf("got incorrect struct after parsing JSON example") return } } @@ -52,7 +52,7 @@ func TestWrite2_2(t *testing.T) { } if cmp.Equal(handwrittenExample, parsedDoc) { - t.Errorf("Got incorrect struct after writing and re-parsing JSON example") + t.Errorf("got incorrect struct after writing and re-parsing JSON example") return } } @@ -65,7 +65,7 @@ var want2_2 = v2_2.Document{ SPDXVersion: "SPDX-2.2", SPDXIdentifier: "SPDXRef-DOCUMENT", DocumentName: "SPDX-Tools-v2.0", - DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", + DocumentNamespace: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", CreationInfo: &v2_2.CreationInfo{ LicenseListVersion: "3.9", Creators: []common.Creator{ @@ -80,7 +80,7 @@ var want2_2 = v2_2.Document{ ExternalDocumentReferences: []v2_2.ExternalDocumentRef{ { DocumentRefID: "DocumentRef-spdx-tool-1.2", - URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + URI: "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", Checksum: common.Checksum{ Algorithm: common.SHA1, Value: "d6a770ba38583ed4bb4525bd96e50461655d2759", @@ -105,7 +105,7 @@ var want2_2 = v2_2.Document{ ExtractedText: "\"THE BEER-WARE LICENSE\" (Revision 42):\nphk@FreeBSD.ORG wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp", LicenseComment: "The beerware license has a couple of other standard variants.", LicenseName: "Beer-Ware License (Version 42)", - LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"}, + LicenseCrossReferences: []string{"https://people.freebsd.org/~phk/"}, }, { LicenseIdentifier: "LicenseRef-3", @@ -161,7 +161,7 @@ var want2_2 = v2_2.Document{ Originator: "ExampleCodeInspect (contact@example.com)", OriginatorType: "Organization", }, - PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", + PackageDownloadLocation: "https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", FilesAnalyzed: true, PackageVerificationCode: common.PackageVerificationCode{ Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", @@ -181,7 +181,7 @@ var want2_2 = v2_2.Document{ Value: "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd", }, }, - PackageHomePage: "http://ftp.gnu.org/gnu/glibc", + PackageHomePage: "https://ftp.gnu.org/gnu/glibc", PackageSourceInfo: "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.", PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)", PackageLicenseInfoFromFiles: []string{ @@ -203,7 +203,7 @@ var want2_2 = v2_2.Document{ }, { Category: "OTHER", - RefType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", + RefType: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", Locator: "acmecorp/acmenator/4.1.3-alpha", ExternalRefComment: "This is the external ref for Acme", }, @@ -229,7 +229,7 @@ var want2_2 = v2_2.Document{ PackageCopyrightText: "NOASSERTION", PackageDownloadLocation: "NOASSERTION", FilesAnalyzed: false, - PackageHomePage: "http://commons.apache.org/proper/commons-lang/", + PackageHomePage: "https://commons.apache.org/proper/commons-lang/", PackageLicenseConcluded: "NOASSERTION", PackageLicenseDeclared: "NOASSERTION", PackageName: "Apache Commons Lang", @@ -247,7 +247,7 @@ var want2_2 = v2_2.Document{ }, }, FilesAnalyzed: false, - PackageHomePage: "http://www.openjena.org/", + PackageHomePage: "https://www.openjena.org/", PackageLicenseConcluded: "NOASSERTION", PackageLicenseDeclared: "NOASSERTION", PackageVersion: "3.12.0", @@ -264,7 +264,7 @@ var want2_2 = v2_2.Document{ PackageDescription: "The Saxon package is a collection of tools for processing XML documents.", PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download", FilesAnalyzed: false, - PackageHomePage: "http://saxon.sourceforge.net/", + PackageHomePage: "https://saxon.sourceforge.net/", PackageLicenseComments: "Other versions available for a commercial license", PackageLicenseConcluded: "MPL-1.0", PackageLicenseDeclared: "MPL-1.0", diff --git a/json/json_v2_3_test.go b/json/json_v2_3_test.go index 2cefafcd..841343b4 100644 --- a/json/json_v2_3_test.go +++ b/json/json_v2_3_test.go @@ -47,7 +47,7 @@ func TestLoad2_3(t *testing.T) { handwrittenExample := want2_3 if cmp.Equal(handwrittenExample, got) { - t.Errorf("Got incorrect struct after parsing JSON example") + t.Errorf("got incorrect struct after parsing JSON example") return } } @@ -69,7 +69,7 @@ func TestWrite2_3(t *testing.T) { } if cmp.Equal(handwrittenExample, parsedDoc) { - t.Errorf("Got incorrect struct after writing and re-parsing JSON example") + t.Errorf("got incorrect struct after writing and re-parsing JSON example") return } } @@ -82,7 +82,7 @@ var want2_3 = v2_3.Document{ SPDXVersion: "SPDX-2.3", SPDXIdentifier: "SPDXRef-DOCUMENT", DocumentName: "SPDX-Tools-v2.0", - DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", + DocumentNamespace: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", CreationInfo: &v2_3.CreationInfo{ LicenseListVersion: "3.9", Creators: []common.Creator{ @@ -97,7 +97,7 @@ var want2_3 = v2_3.Document{ ExternalDocumentReferences: []v2_3.ExternalDocumentRef{ { DocumentRefID: "DocumentRef-spdx-tool-1.2", - URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + URI: "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", Checksum: common.Checksum{ Algorithm: common.SHA1, Value: "d6a770ba38583ed4bb4525bd96e50461655d2759", @@ -122,15 +122,15 @@ var want2_3 = v2_3.Document{ ExtractedText: "\"THE BEER-WARE LICENSE\" (Revision 42):\nphk@FreeBSD.ORG wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp", LicenseComment: "The beerware license has a couple of other standard variants.", LicenseName: "Beer-Ware License (Version 42)", - LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"}, + LicenseCrossReferences: []string{"https://people.freebsd.org/~phk/"}, }, { LicenseIdentifier: "LicenseRef-3", ExtractedText: "The CyberNeko Software License, Version 1.0\n\n \n(C) Copyright 2002-2005, Andy Clark. All rights reserved.\n \nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer. \n\n2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the\n distribution.\n\n3. The end-user documentation included with the redistribution,\n if any, must include the following acknowledgment: \n \"This product includes software developed by Andy Clark.\"\n Alternately, this acknowledgment may appear in the software itself,\n if and wherever such third-party acknowledgments normally appear.\n\n4. The names \"CyberNeko\" and \"NekoHTML\" must not be used to endorse\n or promote products derived from this software without prior \n written permission. For written permission, please contact \n andyc@cyberneko.net.\n\n5. Products derived from this software may not be called \"CyberNeko\",\n nor may \"CyberNeko\" appear in their name, without prior written\n permission of the author.\n\nTHIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED\nWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS\nBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, \nOR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR \nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE \nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, \nEVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", LicenseName: "CyberNeko License", LicenseCrossReferences: []string{ - "http://people.apache.org/~andyc/neko/LICENSE", - "http://justasample.url.com", + "https://people.apache.org/~andyc/neko/LICENSE", + "https://justasample.url.com", }, LicenseComment: "This is tye CyperNeko License", }, @@ -178,7 +178,7 @@ var want2_3 = v2_3.Document{ Originator: "ExampleCodeInspect (contact@example.com)", OriginatorType: "Organization", }, - PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", + PackageDownloadLocation: "https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", FilesAnalyzed: true, PackageVerificationCode: &common.PackageVerificationCode{ Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", @@ -198,7 +198,7 @@ var want2_3 = v2_3.Document{ Value: "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd", }, }, - PackageHomePage: "http://ftp.gnu.org/gnu/glibc", + PackageHomePage: "https://ftp.gnu.org/gnu/glibc", PackageSourceInfo: "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.", PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)", PackageLicenseInfoFromFiles: []string{ @@ -220,7 +220,7 @@ var want2_3 = v2_3.Document{ }, { Category: "OTHER", - RefType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", + RefType: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", Locator: "acmecorp/acmenator/4.1.3-alpha", ExternalRefComment: "This is the external ref for Acme", }, @@ -246,7 +246,7 @@ var want2_3 = v2_3.Document{ PackageCopyrightText: "NOASSERTION", PackageDownloadLocation: "NOASSERTION", FilesAnalyzed: false, - PackageHomePage: "http://commons.apache.org/proper/commons-lang/", + PackageHomePage: "https://commons.apache.org/proper/commons-lang/", PackageLicenseDeclared: "NOASSERTION", PackageName: "Apache Commons Lang", }, @@ -263,7 +263,7 @@ var want2_3 = v2_3.Document{ }, }, FilesAnalyzed: false, - PackageHomePage: "http://www.openjena.org/", + PackageHomePage: "https://www.openjena.org/", PackageLicenseConcluded: "NOASSERTION", PackageLicenseDeclared: "NOASSERTION", PackageVersion: "3.12.0", @@ -280,7 +280,7 @@ var want2_3 = v2_3.Document{ PackageDescription: "The Saxon package is a collection of tools for processing XML documents.", PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download", FilesAnalyzed: false, - PackageHomePage: "http://saxon.sourceforge.net/", + PackageHomePage: "https://saxon.sourceforge.net/", PackageLicenseComments: "Other versions available for a commercial license", PackageLicenseConcluded: "MPL-1.0", PackageLicenseDeclared: "MPL-1.0", diff --git a/licensediff/licensediff_test.go b/licensediff/licensediff_test.go index 226ad51d..cf60b75e 100644 --- a/licensediff/licensediff_test.go +++ b/licensediff/licensediff_test.go @@ -168,13 +168,13 @@ func Test2_1DifferCanCreateDiffPairs(t *testing.T) { // run the diff between the two packages diffMap, err := MakePairs2_1(p1, p2) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // check that the diff results are what we expect // there should be 6 entries, one for each unique filename if len(diffMap) != 6 { - t.Fatalf("Expected %d, got %d", 6, len(diffMap)) + t.Fatalf("expected %d, got %d", 6, len(diffMap)) } // check each filename is present, and check its pair @@ -184,10 +184,10 @@ func Test2_1DifferCanCreateDiffPairs(t *testing.T) { t.Fatalf("Couldn't get pair1") } if pair1.First != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f1.LicenseConcluded, pair1.First) + t.Errorf("expected %s, got %s", f1.LicenseConcluded, pair1.First) } if pair1.Second != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, pair1.Second) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, pair1.Second) } // pair 2 -- only in first @@ -196,10 +196,10 @@ func Test2_1DifferCanCreateDiffPairs(t *testing.T) { t.Fatalf("Couldn't get pair2") } if pair2.First != f2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, pair2.First) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, pair2.First) } if pair2.Second != "" { - t.Errorf("Expected %s, got %s", "", pair2.Second) + t.Errorf("expected %s, got %s", "", pair2.Second) } // pair 3 -- only in second @@ -220,34 +220,34 @@ func Test2_1DifferCanCreateDiffPairs(t *testing.T) { t.Fatalf("Couldn't get pair4") } if pair4.First != f4_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_1.LicenseConcluded, pair4.First) + t.Errorf("expected %s, got %s", f4_1.LicenseConcluded, pair4.First) } if pair4.Second != f4_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_2.LicenseConcluded, pair4.Second) + t.Errorf("expected %s, got %s", f4_2.LicenseConcluded, pair4.Second) } // pair 5 -- in both but different hash, same license pair5, ok := diffMap["/project/file5.txt"] if !ok { - t.Fatalf("Couldn't get pair5") + t.Fatalf("couldn't get pair5") } if pair5.First != f5_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_1.LicenseConcluded, pair5.First) + t.Errorf("expected %s, got %s", f5_1.LicenseConcluded, pair5.First) } if pair5.Second != f5_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_2.LicenseConcluded, pair5.Second) + t.Errorf("expected %s, got %s", f5_2.LicenseConcluded, pair5.Second) } // pair 6 -- in both but different hash, different license pair6, ok := diffMap["/project/file6.txt"] if !ok { - t.Fatalf("Couldn't get pair6") + t.Fatalf("couldn't get pair6") } if pair6.First != f6_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_1.LicenseConcluded, pair6.First) + t.Errorf("expected %s, got %s", f6_1.LicenseConcluded, pair6.First) } if pair6.Second != f6_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_2.LicenseConcluded, pair6.Second) + t.Errorf("expected %s, got %s", f6_2.LicenseConcluded, pair6.Second) } } @@ -407,27 +407,27 @@ func Test2_1DifferCanCreateDiffStructuredResults(t *testing.T) { // run the diff between the two packages diffMap, err := MakePairs2_1(p1, p2) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // now, create the LicenseDiff structured results from the pairs diffResults, err := MakeResults(diffMap) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // check that the diff results are the expected lengths if len(diffResults.InBothChanged) != 2 { - t.Fatalf("Expected %d, got %d", 2, len(diffResults.InBothChanged)) + t.Fatalf("expected %d, got %d", 2, len(diffResults.InBothChanged)) } if len(diffResults.InBothSame) != 2 { - t.Fatalf("Expected %d, got %d", 2, len(diffResults.InBothSame)) + t.Fatalf("expected %d, got %d", 2, len(diffResults.InBothSame)) } if len(diffResults.InFirstOnly) != 1 { - t.Fatalf("Expected %d, got %d", 1, len(diffResults.InFirstOnly)) + t.Fatalf("expected %d, got %d", 1, len(diffResults.InFirstOnly)) } if len(diffResults.InSecondOnly) != 1 { - t.Fatalf("Expected %d, got %d", 1, len(diffResults.InSecondOnly)) + t.Fatalf("expected %d, got %d", 1, len(diffResults.InSecondOnly)) } // check each filename is present where it belongs, and check license(s) @@ -436,63 +436,63 @@ func Test2_1DifferCanCreateDiffStructuredResults(t *testing.T) { // filename will map to a LicensePair check4, ok := diffResults.InBothChanged["/project/file4.txt"] if !ok { - t.Fatalf("Couldn't get check4") + t.Fatalf("couldn't get check4") } if check4.First != f4_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_1.LicenseConcluded, check4.First) + t.Errorf("expected %s, got %s", f4_1.LicenseConcluded, check4.First) } if check4.Second != f4_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_2.LicenseConcluded, check4.Second) + t.Errorf("expected %s, got %s", f4_2.LicenseConcluded, check4.Second) } check6, ok := diffResults.InBothChanged["/project/file6.txt"] if !ok { - t.Fatalf("Couldn't get check6") + t.Fatalf("couldn't get check6") } if check6.First != f6_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_1.LicenseConcluded, check6.First) + t.Errorf("expected %s, got %s", f6_1.LicenseConcluded, check6.First) } if check6.Second != f6_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_2.LicenseConcluded, check6.Second) + t.Errorf("expected %s, got %s", f6_2.LicenseConcluded, check6.Second) } // in both and same license: f1 and f5 // filename will map to a string check1, ok := diffResults.InBothSame["/project/file1.txt"] if !ok { - t.Fatalf("Couldn't get check1") + t.Fatalf("couldn't get check1") } if check1 != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f1.LicenseConcluded, check1) + t.Errorf("expected %s, got %s", f1.LicenseConcluded, check1) } check5, ok := diffResults.InBothSame["/project/file5.txt"] if !ok { - t.Fatalf("Couldn't get check5") + t.Fatalf("couldn't get check5") } if check5 != f5_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_1.LicenseConcluded, check5) + t.Errorf("expected %s, got %s", f5_1.LicenseConcluded, check5) } if check5 != f5_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_2.LicenseConcluded, check5) + t.Errorf("expected %s, got %s", f5_2.LicenseConcluded, check5) } // in first only: f2 // filename will map to a string check2, ok := diffResults.InFirstOnly["/project/file2.txt"] if !ok { - t.Fatalf("Couldn't get check2") + t.Fatalf("couldn't get check2") } if check2 != f2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, check2) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, check2) } // in second only: f3 // filename will map to a string check3, ok := diffResults.InSecondOnly["/project/file3.txt"] if !ok { - t.Fatalf("Couldn't get check3") + t.Fatalf("couldn't get check3") } if check3 != f3.LicenseConcluded { - t.Errorf("Expected %s, got %s", f3.LicenseConcluded, check2) + t.Errorf("expected %s, got %s", f3.LicenseConcluded, check2) } } @@ -690,86 +690,86 @@ func Test2_2DifferCanCreateDiffPairs(t *testing.T) { // run the diff between the two packages diffMap, err := MakePairs2_2(p1, p2) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // check that the diff results are what we expect // there should be 6 entries, one for each unique filename if len(diffMap) != 6 { - t.Fatalf("Expected %d, got %d", 6, len(diffMap)) + t.Fatalf("expected %d, got %d", 6, len(diffMap)) } // check each filename is present, and check its pair // pair 1 -- same in both pair1, ok := diffMap["/project/file1.txt"] if !ok { - t.Fatalf("Couldn't get pair1") + t.Fatalf("couldn't get pair1") } if pair1.First != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f1.LicenseConcluded, pair1.First) + t.Errorf("expected %s, got %s", f1.LicenseConcluded, pair1.First) } if pair1.Second != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, pair1.Second) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, pair1.Second) } // pair 2 -- only in first pair2, ok := diffMap["/project/file2.txt"] if !ok { - t.Fatalf("Couldn't get pair2") + t.Fatalf("couldn't get pair2") } if pair2.First != f2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, pair2.First) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, pair2.First) } if pair2.Second != "" { - t.Errorf("Expected %s, got %s", "", pair2.Second) + t.Errorf("expected %s, got %s", "", pair2.Second) } // pair 3 -- only in second pair3, ok := diffMap["/project/file3.txt"] if !ok { - t.Fatalf("Couldn't get pair3") + t.Fatalf("couldn't get pair3") } if pair3.First != "" { - t.Errorf("Expected %s, got %s", "", pair3.First) + t.Errorf("expected %s, got %s", "", pair3.First) } if pair3.Second != f3.LicenseConcluded { - t.Errorf("Expected %s, got %s", f3.LicenseConcluded, pair3.Second) + t.Errorf("expected %s, got %s", f3.LicenseConcluded, pair3.Second) } // pair 4 -- in both but different license pair4, ok := diffMap["/project/file4.txt"] if !ok { - t.Fatalf("Couldn't get pair4") + t.Fatalf("couldn't get pair4") } if pair4.First != f4_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_1.LicenseConcluded, pair4.First) + t.Errorf("expected %s, got %s", f4_1.LicenseConcluded, pair4.First) } if pair4.Second != f4_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_2.LicenseConcluded, pair4.Second) + t.Errorf("expected %s, got %s", f4_2.LicenseConcluded, pair4.Second) } // pair 5 -- in both but different hash, same license pair5, ok := diffMap["/project/file5.txt"] if !ok { - t.Fatalf("Couldn't get pair5") + t.Fatalf("couldn't get pair5") } if pair5.First != f5_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_1.LicenseConcluded, pair5.First) + t.Errorf("expected %s, got %s", f5_1.LicenseConcluded, pair5.First) } if pair5.Second != f5_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_2.LicenseConcluded, pair5.Second) + t.Errorf("expected %s, got %s", f5_2.LicenseConcluded, pair5.Second) } // pair 6 -- in both but different hash, different license pair6, ok := diffMap["/project/file6.txt"] if !ok { - t.Fatalf("Couldn't get pair6") + t.Fatalf("couldn't get pair6") } if pair6.First != f6_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_1.LicenseConcluded, pair6.First) + t.Errorf("expected %s, got %s", f6_1.LicenseConcluded, pair6.First) } if pair6.Second != f6_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_2.LicenseConcluded, pair6.Second) + t.Errorf("expected %s, got %s", f6_2.LicenseConcluded, pair6.Second) } } @@ -961,27 +961,27 @@ func Test2_2DifferCanCreateDiffStructuredResults(t *testing.T) { // run the diff between the two packages diffMap, err := MakePairs2_2(p1, p2) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // now, create the LicenseDiff structured results from the pairs diffResults, err := MakeResults(diffMap) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // check that the diff results are the expected lengths if len(diffResults.InBothChanged) != 2 { - t.Fatalf("Expected %d, got %d", 2, len(diffResults.InBothChanged)) + t.Fatalf("expected %d, got %d", 2, len(diffResults.InBothChanged)) } if len(diffResults.InBothSame) != 2 { - t.Fatalf("Expected %d, got %d", 2, len(diffResults.InBothSame)) + t.Fatalf("expected %d, got %d", 2, len(diffResults.InBothSame)) } if len(diffResults.InFirstOnly) != 1 { - t.Fatalf("Expected %d, got %d", 1, len(diffResults.InFirstOnly)) + t.Fatalf("expected %d, got %d", 1, len(diffResults.InFirstOnly)) } if len(diffResults.InSecondOnly) != 1 { - t.Fatalf("Expected %d, got %d", 1, len(diffResults.InSecondOnly)) + t.Fatalf("expected %d, got %d", 1, len(diffResults.InSecondOnly)) } // check each filename is present where it belongs, and check license(s) @@ -990,63 +990,63 @@ func Test2_2DifferCanCreateDiffStructuredResults(t *testing.T) { // filename will map to a LicensePair check4, ok := diffResults.InBothChanged["/project/file4.txt"] if !ok { - t.Fatalf("Couldn't get check4") + t.Fatalf("couldn't get check4") } if check4.First != f4_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_1.LicenseConcluded, check4.First) + t.Errorf("expected %s, got %s", f4_1.LicenseConcluded, check4.First) } if check4.Second != f4_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_2.LicenseConcluded, check4.Second) + t.Errorf("expected %s, got %s", f4_2.LicenseConcluded, check4.Second) } check6, ok := diffResults.InBothChanged["/project/file6.txt"] if !ok { - t.Fatalf("Couldn't get check6") + t.Fatalf("couldn't get check6") } if check6.First != f6_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_1.LicenseConcluded, check6.First) + t.Errorf("expected %s, got %s", f6_1.LicenseConcluded, check6.First) } if check6.Second != f6_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_2.LicenseConcluded, check6.Second) + t.Errorf("expected %s, got %s", f6_2.LicenseConcluded, check6.Second) } // in both and same license: f1 and f5 // filename will map to a string check1, ok := diffResults.InBothSame["/project/file1.txt"] if !ok { - t.Fatalf("Couldn't get check1") + t.Fatalf("couldn't get check1") } if check1 != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f1.LicenseConcluded, check1) + t.Errorf("expected %s, got %s", f1.LicenseConcluded, check1) } check5, ok := diffResults.InBothSame["/project/file5.txt"] if !ok { - t.Fatalf("Couldn't get check5") + t.Fatalf("couldn't get check5") } if check5 != f5_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_1.LicenseConcluded, check5) + t.Errorf("expected %s, got %s", f5_1.LicenseConcluded, check5) } if check5 != f5_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_2.LicenseConcluded, check5) + t.Errorf("expected %s, got %s", f5_2.LicenseConcluded, check5) } // in first only: f2 // filename will map to a string check2, ok := diffResults.InFirstOnly["/project/file2.txt"] if !ok { - t.Fatalf("Couldn't get check2") + t.Fatalf("couldn't get check2") } if check2 != f2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, check2) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, check2) } // in second only: f3 // filename will map to a string check3, ok := diffResults.InSecondOnly["/project/file3.txt"] if !ok { - t.Fatalf("Couldn't get check3") + t.Fatalf("couldn't get check3") } if check3 != f3.LicenseConcluded { - t.Errorf("Expected %s, got %s", f3.LicenseConcluded, check2) + t.Errorf("expected %s, got %s", f3.LicenseConcluded, check2) } } @@ -1244,38 +1244,38 @@ func Test2_3DifferCanCreateDiffPairs(t *testing.T) { // run the diff between the two packages diffMap, err := MakePairs2_3(p1, p2) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // check that the diff results are what we expect // there should be 6 entries, one for each unique filename if len(diffMap) != 6 { - t.Fatalf("Expected %d, got %d", 6, len(diffMap)) + t.Fatalf("expected %d, got %d", 6, len(diffMap)) } // check each filename is present, and check its pair // pair 1 -- same in both pair1, ok := diffMap["/project/file1.txt"] if !ok { - t.Fatalf("Couldn't get pair1") + t.Fatalf("couldn't get pair1") } if pair1.First != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f1.LicenseConcluded, pair1.First) + t.Errorf("expected %s, got %s", f1.LicenseConcluded, pair1.First) } if pair1.Second != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, pair1.Second) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, pair1.Second) } // pair 2 -- only in first pair2, ok := diffMap["/project/file2.txt"] if !ok { - t.Fatalf("Couldn't get pair2") + t.Fatalf("couldn't get pair2") } if pair2.First != f2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, pair2.First) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, pair2.First) } if pair2.Second != "" { - t.Errorf("Expected %s, got %s", "", pair2.Second) + t.Errorf("expected %s, got %s", "", pair2.Second) } // pair 3 -- only in second @@ -1284,10 +1284,10 @@ func Test2_3DifferCanCreateDiffPairs(t *testing.T) { t.Fatalf("Couldn't get pair3") } if pair3.First != "" { - t.Errorf("Expected %s, got %s", "", pair3.First) + t.Errorf("expected %s, got %s", "", pair3.First) } if pair3.Second != f3.LicenseConcluded { - t.Errorf("Expected %s, got %s", f3.LicenseConcluded, pair3.Second) + t.Errorf("expected %s, got %s", f3.LicenseConcluded, pair3.Second) } // pair 4 -- in both but different license @@ -1305,25 +1305,25 @@ func Test2_3DifferCanCreateDiffPairs(t *testing.T) { // pair 5 -- in both but different hash, same license pair5, ok := diffMap["/project/file5.txt"] if !ok { - t.Fatalf("Couldn't get pair5") + t.Fatalf("couldn't get pair5") } if pair5.First != f5_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_1.LicenseConcluded, pair5.First) + t.Errorf("expected %s, got %s", f5_1.LicenseConcluded, pair5.First) } if pair5.Second != f5_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_2.LicenseConcluded, pair5.Second) + t.Errorf("expected %s, got %s", f5_2.LicenseConcluded, pair5.Second) } // pair 6 -- in both but different hash, different license pair6, ok := diffMap["/project/file6.txt"] if !ok { - t.Fatalf("Couldn't get pair6") + t.Fatalf("couldn't get pair6") } if pair6.First != f6_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_1.LicenseConcluded, pair6.First) + t.Errorf("expected %s, got %s", f6_1.LicenseConcluded, pair6.First) } if pair6.Second != f6_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_2.LicenseConcluded, pair6.Second) + t.Errorf("expected %s, got %s", f6_2.LicenseConcluded, pair6.Second) } } @@ -1515,27 +1515,27 @@ func Test2_3DifferCanCreateDiffStructuredResults(t *testing.T) { // run the diff between the two packages diffMap, err := MakePairs2_3(p1, p2) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // now, create the LicenseDiff structured results from the pairs diffResults, err := MakeResults(diffMap) if err != nil { - t.Fatalf("Expected nil error, got %v", err) + t.Fatalf("expected nil error, got %v", err) } // check that the diff results are the expected lengths if len(diffResults.InBothChanged) != 2 { - t.Fatalf("Expected %d, got %d", 2, len(diffResults.InBothChanged)) + t.Fatalf("expected %d, got %d", 2, len(diffResults.InBothChanged)) } if len(diffResults.InBothSame) != 2 { - t.Fatalf("Expected %d, got %d", 2, len(diffResults.InBothSame)) + t.Fatalf("expected %d, got %d", 2, len(diffResults.InBothSame)) } if len(diffResults.InFirstOnly) != 1 { - t.Fatalf("Expected %d, got %d", 1, len(diffResults.InFirstOnly)) + t.Fatalf("expected %d, got %d", 1, len(diffResults.InFirstOnly)) } if len(diffResults.InSecondOnly) != 1 { - t.Fatalf("Expected %d, got %d", 1, len(diffResults.InSecondOnly)) + t.Fatalf("expected %d, got %d", 1, len(diffResults.InSecondOnly)) } // check each filename is present where it belongs, and check license(s) @@ -1544,63 +1544,63 @@ func Test2_3DifferCanCreateDiffStructuredResults(t *testing.T) { // filename will map to a LicensePair check4, ok := diffResults.InBothChanged["/project/file4.txt"] if !ok { - t.Fatalf("Couldn't get check4") + t.Fatalf("couldn't get check4") } if check4.First != f4_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_1.LicenseConcluded, check4.First) + t.Errorf("expected %s, got %s", f4_1.LicenseConcluded, check4.First) } if check4.Second != f4_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f4_2.LicenseConcluded, check4.Second) + t.Errorf("expected %s, got %s", f4_2.LicenseConcluded, check4.Second) } check6, ok := diffResults.InBothChanged["/project/file6.txt"] if !ok { - t.Fatalf("Couldn't get check6") + t.Fatalf("couldn't get check6") } if check6.First != f6_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_1.LicenseConcluded, check6.First) + t.Errorf("expected %s, got %s", f6_1.LicenseConcluded, check6.First) } if check6.Second != f6_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f6_2.LicenseConcluded, check6.Second) + t.Errorf("expected %s, got %s", f6_2.LicenseConcluded, check6.Second) } // in both and same license: f1 and f5 // filename will map to a string check1, ok := diffResults.InBothSame["/project/file1.txt"] if !ok { - t.Fatalf("Couldn't get check1") + t.Fatalf("couldn't get check1") } if check1 != f1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f1.LicenseConcluded, check1) + t.Errorf("expected %s, got %s", f1.LicenseConcluded, check1) } check5, ok := diffResults.InBothSame["/project/file5.txt"] if !ok { - t.Fatalf("Couldn't get check5") + t.Fatalf("couldn't get check5") } if check5 != f5_1.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_1.LicenseConcluded, check5) + t.Errorf("expected %s, got %s", f5_1.LicenseConcluded, check5) } if check5 != f5_2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f5_2.LicenseConcluded, check5) + t.Errorf("expected %s, got %s", f5_2.LicenseConcluded, check5) } // in first only: f2 // filename will map to a string check2, ok := diffResults.InFirstOnly["/project/file2.txt"] if !ok { - t.Fatalf("Couldn't get check2") + t.Fatalf("couldn't get check2") } if check2 != f2.LicenseConcluded { - t.Errorf("Expected %s, got %s", f2.LicenseConcluded, check2) + t.Errorf("expected %s, got %s", f2.LicenseConcluded, check2) } // in second only: f3 // filename will map to a string check3, ok := diffResults.InSecondOnly["/project/file3.txt"] if !ok { - t.Fatalf("Couldn't get check3") + t.Fatalf("couldn't get check3") } if check3 != f3.LicenseConcluded { - t.Errorf("Expected %s, got %s", f3.LicenseConcluded, check2) + t.Errorf("expected %s, got %s", f3.LicenseConcluded, check2) } } diff --git a/rdfloader/parser2v2/constants.go b/rdfloader/parser2v2/constants.go index 71a3e33a..eb09cab9 100644 --- a/rdfloader/parser2v2/constants.go +++ b/rdfloader/parser2v2/constants.go @@ -5,14 +5,14 @@ package parser2v2 import "github.com/spdx/gordf/rdfloader/parser" var ( - // NAMESPACES - NS_SPDX = "http://spdx.org/rdf/terms#" - NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#" + // NS_SPDX NAMESPACES + NS_SPDX = "https://spdx.org/rdf/terms#" + NS_RDFS = "https://www.w3.org/2000/01/rdf-schema#" NS_RDF = parser.RDFNS - NS_PTR = "http://www.w3.org/2009/pointers#" - NS_DOAP = "http://usefulinc.com/ns/doap#" + NS_PTR = "https://www.w3.org/2009/pointers#" + NS_DOAP = "https://usefulinc.com/ns/doap#" - // SPDX properties + // SPDX_SPEC_VERSION SPDX properties SPDX_SPEC_VERSION = NS_SPDX + "specVersion" SPDX_DATA_LICENSE = NS_SPDX + "dataLicense" SPDX_NAME = NS_SPDX + "name" diff --git a/rdfloader/parser2v2/license_utils.go b/rdfloader/parser2v2/license_utils.go index 41e8870d..b3485ad3 100644 --- a/rdfloader/parser2v2/license_utils.go +++ b/rdfloader/parser2v2/license_utils.go @@ -80,12 +80,12 @@ func mapLicensesToStrings(licences []AnyLicenseInfo) []string { /****** Type Functions ******/ -// TODO: should probably add brackets while linearizing a nested license. +// ToLicenseString TODO: should probably add brackets while linearizing a nested license. func (lic ConjunctiveLicenseSet) ToLicenseString() string { return strings.Join(mapLicensesToStrings(lic.members), " AND ") } -// TODO: should probably add brackets while linearizing a nested license. +// ToLicenseString TODO: should probably add brackets while linearizing a nested license. func (lic DisjunctiveLicenseSet) ToLicenseString() string { return strings.Join(mapLicensesToStrings(lic.members), " OR ") } diff --git a/rdfloader/parser2v2/license_utils_test.go b/rdfloader/parser2v2/license_utils_test.go index 7e20b5cd..9bc86ddd 100644 --- a/rdfloader/parser2v2/license_utils_test.go +++ b/rdfloader/parser2v2/license_utils_test.go @@ -38,11 +38,11 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { var err error // TestCase 1: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) checksumNode := parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -51,12 +51,12 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -65,11 +65,11 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { // TestCase 3: valid input parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject algorithm, value, err := parser.getChecksumFromNode(checksumNode) if err != nil { diff --git a/rdfloader/parser2v2/parse_annotation_test.go b/rdfloader/parser2v2/parse_annotation_test.go index 114fc5de..d372f41d 100644 --- a/rdfloader/parser2v2/parse_annotation_test.go +++ b/rdfloader/parser2v2/parse_annotation_test.go @@ -33,7 +33,7 @@ func Test_setAnnotatorFromString(t *testing.T) { t.Errorf("unexpected error for a valid annotator") } if ann.Annotator.AnnotatorType != "Person" { - t.Errorf("wrnog annotator type: expected: %s, found: %s", "Person", ann.Annotator) + t.Errorf("wrong annotator type: expected: %s, found: %s", "Person", ann.Annotator) } if ann.Annotator.Annotator != "Rishabh" { t.Errorf("wrong annotator: expected: %s, found: %s", "Rishabh", ann.Annotator) @@ -98,13 +98,13 @@ func Test_setAnnotationToParser(t *testing.T) { func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 1: invalid annotator must raise an error parser, _ := parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Company: some company - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Company: some company + + + `) node := parser.gordfParserObj.Triples[0].Subject err := parser.parseAnnotationFromNode(node) if err == nil { @@ -113,13 +113,13 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 2: wrong annotation type should raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -128,14 +128,14 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 3: unknown predicate should also raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -144,13 +144,13 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 4: completely valid annotation parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err != nil { diff --git a/rdfloader/parser2v2/parse_file.go b/rdfloader/parser2v2/parse_file.go index d5a19ef0..f909e4e5 100644 --- a/rdfloader/parser2v2/parse_file.go +++ b/rdfloader/parser2v2/parse_file.go @@ -176,7 +176,7 @@ func (parser *rdfParser2_2) getArtifactFromNode(node *gordfParser.Node) (*v2_2.A // TODO: check if the filetype is valid. func (parser *rdfParser2_2) getFileTypeFromUri(uri string) (string, error) { - // fileType is given as a uri. for example: http://spdx.org/rdf/terms#fileType_text + // fileType is given as a uri. for example: https://spdx.org/rdf/terms#fileType_text lastPart := getLastPartOfURI(uri) if !strings.HasPrefix(lastPart, "fileType_") { return "", fmt.Errorf("fileType Uri must begin with fileTYpe_. found: %s", lastPart) diff --git a/rdfloader/parser2v2/parse_file_test.go b/rdfloader/parser2v2/parse_file_test.go index 0383cd97..3877cb79 100644 --- a/rdfloader/parser2v2/parse_file_test.go +++ b/rdfloader/parser2v2/parse_file_test.go @@ -18,12 +18,12 @@ import ( // pads the content with the enclosing rdf:RDF tag func wrapIntoTemplate(content string) string { header := `` + xmlns:spdx="https://spdx.org/rdf/terms#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns="https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#" + xmlns:doap="https://usefulinc.com/ns/doap#" + xmlns:j.0="http://www.w3.org/2009/pointers#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">` footer := `` return header + content + footer } @@ -49,13 +49,13 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { // TestCase 1: artifactOf without project URI rdfParser, err := parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + https://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -78,13 +78,13 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { // TestCase 2: artifactOf with a Project URI rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + https://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -93,7 +93,7 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { if err != nil { t.Errorf("error parsing a valid artifactOf node: %v", err) } - expectedURI := "http://subversion.apache.org/doap.rdf" + expectedURI := "https://subversion.apache.org/doap.rdf" if artifact.URI != expectedURI { t.Errorf("wrong artifact URI. Expected: %s, found: %s", expectedURI, artifact.URI) } @@ -101,14 +101,14 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { // TestCase 3: artifactOf with unknown predicate rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - - `) + + + https://www.openjena.org/ + Jena + + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -133,7 +133,7 @@ func Test_rdfParser2_2_getFileTypeFromUri(t *testing.T) { } // TestCase 2: Invalid fileType URI format. - fileTypeURI = "http://spdx.org/rdf/terms#source" + fileTypeURI = "https://spdx.org/rdf/terms#source" fileType, err = rdfParser.getFileTypeFromUri(fileTypeURI) if err == nil { t.Error("should've raised an error for invalid fileType") @@ -178,7 +178,7 @@ func Test_setFileIdentifier(t *testing.T) { file := &v2_2.File{} // TestCase 1: valid example - err := setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) + err := setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -187,7 +187,7 @@ func Test_setFileIdentifier(t *testing.T) { } // TestCase 2: invalid example - err = setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) + err = setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) if err == nil { t.Errorf("should've raised an error for an invalid example") } @@ -196,11 +196,11 @@ func Test_setFileIdentifier(t *testing.T) { func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 1: md5 checksum parser, _ := parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file := &v2_2.File{} err := parser.setFileChecksumFromNode(file, checksumNode) @@ -227,11 +227,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 2: valid sha1 checksum parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -257,11 +257,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 3: valid sha256 checksum parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -300,11 +300,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 5: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -314,11 +314,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 6: valid checksum algorithm which is invalid for file (like md4, md6, sha384, etc.) parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -330,7 +330,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 1: file with invalid id parser, _ := parserFromBodyContent(` - + `) fileNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err := parser.getFileFromNode(fileNode) @@ -340,10 +340,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 2: invalid fileType parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -352,10 +352,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 3: invalid file checksum parser, _ = parserFromBodyContent(` - + - + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd @@ -370,7 +370,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 4: invalid license concluded parser, _ = parserFromBodyContent(` - + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -381,7 +381,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 5: invalid artifactOf attribute parser, _ = parserFromBodyContent(` - + @@ -398,10 +398,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 6: invalid file dependency parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -410,7 +410,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 7: invalid annotation with unknown predicate parser, _ = parserFromBodyContent(` - + @@ -426,10 +426,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 8: invalid relationship parser, _ = parserFromBodyContent(` - + - + @@ -442,7 +442,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 8: unknown predicate parser, _ = parserFromBodyContent(` - + `) @@ -454,10 +454,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 9: invalid licenseInfoInFile. parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -467,21 +467,21 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 10: Splitting of File definition into parents of different tags mustn't create new file objects. fileDefinitions := []string{ ` - - - time-1.9/ChangeLog - - - - `, + + + time-1.9/ChangeLog + + + + `, ` - - - - - - - `, + + + + + + + `, } parser, _ = parserFromBodyContent(strings.Join(fileDefinitions, "")) @@ -519,65 +519,65 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 12: checking if recursive dependencies are resolved. parser, _ = parserFromBodyContent(` - - - - - - - ParentFile - - - - - - `) + + + + + + + ParentFile + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) // TestCase 11: all valid attribute and it's values. parser, _ = parserFromBodyContent(` - - time-1.9/ChangeLog - - - - - - 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - - - - no comments - from spdx file - - - http://www.openjena.org/ - Jena - - - no comments - - Some Organization - - attribution text - - - 2011-01-29T18:30:22Z - File level annotation copied from a spdx document - Person: File Commenter - - - - - - - - - - - `) + + time-1.9/ChangeLog + + + + + + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd + + + + + no comments + from spdx file + + + https://www.openjena.org/ + Jena + + + no comments + + Some Organization + + attribution text + + + 2011-01-29T18:30:22Z + File level annotation copied from a spdx document + Person: File Commenter + + + + + + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) if err != nil { @@ -637,7 +637,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { t.Errorf("given file should have 1 artifactOfProjects attribute. found %d", n) } artifactOf := file.ArtifactOfProjects[0] - expectedHomePage := "http://www.openjena.org/" + expectedHomePage := "https://www.openjena.org/" if artifactOf.HomePage != expectedHomePage { t.Errorf("expected %s, found %s", expectedHomePage, artifactOf.HomePage) } diff --git a/rdfloader/parser2v2/parse_license.go b/rdfloader/parser2v2/parse_license.go index 71a1e4a2..5d5ade03 100644 --- a/rdfloader/parser2v2/parse_license.go +++ b/rdfloader/parser2v2/parse_license.go @@ -30,7 +30,7 @@ func (parser *rdfParser2_2) getAnyLicenseFromNode(node *gordfParser.Node) (AnyLi } else if currState.Color == GREY { // we have already started parsing this license node. // We have a cyclic dependency! - return nil, errors.New("Couldn't parse license: found a cyclic dependency on " + node.ID) + return nil, errors.New("couldn't parse license: found a cyclic dependency on " + node.ID) } // setting color of the state to grey to indicate that we've started to @@ -67,7 +67,7 @@ func (parser *rdfParser2_2) getAnyLicenseFromNode(node *gordfParser.Node) (AnyLi case SPDX_SIMPLE_LICENSING_INFO: return parser.getSimpleLicensingInfoFromNode(node) } - return nil, fmt.Errorf("Unknown subTag (%s) found while parsing AnyLicense", nodeType) + return nil, fmt.Errorf("unknown subTag (%s) found while parsing AnyLicense", nodeType) } func (parser *rdfParser2_2) getLicenseExceptionFromNode(node *gordfParser.Node) (exception LicenseException, err error) { diff --git a/rdfloader/parser2v2/parse_license_test.go b/rdfloader/parser2v2/parse_license_test.go index e2c684dc..202f7711 100644 --- a/rdfloader/parser2v2/parse_license_test.go +++ b/rdfloader/parser2v2/parse_license_test.go @@ -36,11 +36,11 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 2: DisjunctiveLicenseSet: parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -55,11 +55,11 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 3: ConjunctiveLicenseSet: parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -74,12 +74,12 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 4: ExtractedLicensingInfo parser, _ = parserFromBodyContent(` - - LicenseRef-Freeware - freeware - - - `) + + LicenseRef-Freeware + freeware + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -94,12 +94,12 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 4: ExtractedLicensingInfo parser, _ = parserFromBodyContent(` - - LicenseRef-Freeware - freeware - - - `) + + LicenseRef-Freeware + freeware + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -114,17 +114,17 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 5: License parser, _ = parserFromBodyContent(` - - <> Apache License Version 2.0, January 2004 http://www.apache.org/licenses/<><> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<> <> Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. <> Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. <> Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. <> Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: <> You must give any other recipients of the Work or Derivative Works a copy of this License; and <> You must cause any modified files to carry prominent notices stating that You changed the files; and <> You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and <> If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. <> Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. <> Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. <> Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. <> Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. <> Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<> END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright <> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.<> - http://www.apache.org/licenses/LICENSE-2.0 - Apache License 2.0 - Apache-2.0 - true - http://www.opensource.org/licenses/Apache-2.0 - ... - ... - - `) + + <> Apache License Version 2.0, January 2004 https://www.apache.org/licenses/<><> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<> <> Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. <> Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. <> Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. <> Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: <> You must give any other recipients of the Work or Derivative Works a copy of this License; and <> You must cause any modified files to carry prominent notices stating that You changed the files; and <> You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and <> If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. <> Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. <> Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. <> Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. <> Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. <> Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<> END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright <> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.<> + https://www.apache.org/licenses/LICENSE-2.0 + Apache License 2.0 + Apache-2.0 + true + https://www.opensource.org/licenses/Apache-2.0 + ... + ... + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -139,17 +139,17 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 5: WithExceptionOperator parser, _ = parserFromBodyContent(` - - - - - Libtool-exception - - - - - - `) + + + + + Libtool-exception + + + + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -200,16 +200,16 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 8: cyclic dependent license must raise an error. parser, _ = parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getAnyLicenseFromNode(node) if err == nil { @@ -225,11 +225,11 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 1: invalid license member parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getConjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -238,12 +238,12 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 2: invalid predicate in the licenseSet. parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getConjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -252,11 +252,11 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 3: valid example. parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject license, err = parser.getConjunctiveLicenseSetFromNode(licenseNode) if err != nil { @@ -282,11 +282,11 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 1: invalid license member parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getDisjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -295,12 +295,12 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 2: invalid predicate in the licenseSet. parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getDisjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -309,11 +309,11 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 3: valid example. parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject license, err = parser.getDisjunctiveLicenseSetFromNode(licenseNode) if err != nil { @@ -370,21 +370,21 @@ func Test_rdfParser2_2_getLicenseExceptionFromNode(t *testing.T) { // TestCase 3: everything valid // TestCase 1: invalid value for rdf:seeAlso parser, _ = parserFromBodyContent(` - - - no example - Libtool-exception - no comments - text - name - - `) + + + no example + Libtool-exception + no comments + text + name + + `) node = parser.gordfParserObj.Triples[0].Subject licenseException, err = parser.getLicenseExceptionFromNode(node) if err != nil { t.Fatalf("unexpected error while parsing a valid licenseException") } - expectedCrossReference := "http://www.opensource.org/licenses/GPL-3.0" + expectedCrossReference := "https://www.opensource.org/licenses/GPL-3.0" if licenseException.seeAlso != expectedCrossReference { t.Errorf("expected: %s, found: %s", expectedCrossReference, licenseException.seeAlso) } @@ -474,25 +474,25 @@ func Test_rdfParser2_2_getLicenseFromNode(t *testing.T) { // TestCase 5: everything valid: parser, _ = parserFromBodyContent(` - - http://www.opensource.org/licenses/GPL-3.0 - true - GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - GNU General Public License v3.0 or later - ... - GPL-3.0-or-later - This license was released: 29 June 2007 - true - ... - .... - - `) + + https://www.opensource.org/licenses/GPL-3.0 + true + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 + GNU General Public License v3.0 or later + ... + GPL-3.0-or-later + This license was released: 29 June 2007 + true + ... + .... + + `) node = parser.gordfParserObj.Triples[0].Subject license, err = parser.getLicenseFromNode(node) if err != nil { t.Errorf("error parsing a valid input: %v", err) } - expectedSeeAlso := "http://www.opensource.org/licenses/GPL-3.0" + expectedSeeAlso := "https://www.opensource.org/licenses/GPL-3.0" if len(license.seeAlso) != 1 { t.Fatalf("expected seeAlso to have 1 element, got %d", len(license.seeAlso)) } @@ -542,16 +542,16 @@ func Test_rdfParser2_2_getOrLaterOperatorFromNode(t *testing.T) { // TestCase 1: more than one member in the OrLaterOperator tag must raise an error parser, _ = parserFromBodyContent(` - - - - LicenseRef-Freeware - freeware - - - - - `) + + + + LicenseRef-Freeware + freeware + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getOrLaterOperatorFromNode(node) if err == nil { @@ -759,16 +759,16 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 1: more than one member in the OrLaterOperator tag must raise an error parser, _ = parserFromBodyContent(` - - - - LicenseRef-Freeware - freeware - - - - - `) + + + + LicenseRef-Freeware + freeware + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err == nil { @@ -794,14 +794,14 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 3: Invalid member parser, _ = parserFromBodyContent(` - - - - - - - - `) + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err == nil { @@ -810,20 +810,20 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 4: Invalid licenseException parser, _ = parserFromBodyContent(` - - - - - - - - example - Libtool-exception - comment - - - - `) + + + + + + + + example + Libtool-exception + comment + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err == nil { @@ -832,19 +832,19 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 5: valid input parser, _ = parserFromBodyContent(` - - - - - - - example - Libtool-exception - comment - - - - `) + + + + + + + example + Libtool-exception + comment + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err != nil { diff --git a/rdfloader/parser2v2/parse_other_license_info_test.go b/rdfloader/parser2v2/parse_other_license_info_test.go index cd7ad321..e212b4e1 100644 --- a/rdfloader/parser2v2/parse_other_license_info_test.go +++ b/rdfloader/parser2v2/parse_other_license_info_test.go @@ -16,7 +16,7 @@ func Test_rdfParser2_2_getExtractedLicensingInfoFromNode(t *testing.T) { // TestCase 1: invalid predicate must raise an error parser, _ = parserFromBodyContent(` - + LicenseRef-Freeware freeware @@ -30,7 +30,7 @@ func Test_rdfParser2_2_getExtractedLicensingInfoFromNode(t *testing.T) { // TestCase 2: valid input parser, _ = parserFromBodyContent(` - + LicenseRef-Freeware freeware @@ -46,7 +46,7 @@ func Test_rdfParser2_2_getExtractedLicensingInfoFromNode(t *testing.T) { func Test_rdfParser2_2_extractedLicenseToOtherLicense(t *testing.T) { // nothing to test for this function. parser, _ := parserFromBodyContent(` - + LicenseRef-Freeware freeware diff --git a/rdfloader/parser2v2/parse_package_test.go b/rdfloader/parser2v2/parse_package_test.go index f458984d..5293b6ef 100644 --- a/rdfloader/parser2v2/parse_package_test.go +++ b/rdfloader/parser2v2/parse_package_test.go @@ -193,14 +193,14 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 1: invalid reference category parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err == nil { @@ -209,15 +209,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - `) + + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err == nil { @@ -226,15 +226,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 3: valid example (referenceCategory_security) parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - comment - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + comment + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err != nil { @@ -242,7 +242,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { } expectedExtRef := &v2_2.PackageExternalReference{ Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", - RefType: "http://spdx.org/rdf/references/cpe23Type", + RefType: "https://spdx.org/rdf/references/cpe23Type", Category: "SECURITY", ExternalRefComment: "comment", } @@ -252,15 +252,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 4: valid example (referenceCategory_packageManager) parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - comment - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + comment + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err != nil { @@ -268,7 +268,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { } expectedExtRef = &v2_2.PackageExternalReference{ Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", - RefType: "http://spdx.org/rdf/references/cpe23Type", + RefType: "https://spdx.org/rdf/references/cpe23Type", Category: "PACKAGE-MANAGER", ExternalRefComment: "comment", } @@ -278,15 +278,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 5: valid example (referenceCategory_other) parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - comment - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + comment + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err != nil { @@ -294,7 +294,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { } expectedExtRef = &v2_2.PackageExternalReference{ Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", - RefType: "http://spdx.org/rdf/references/cpe23Type", + RefType: "https://spdx.org/rdf/references/cpe23Type", Category: "OTHER", ExternalRefComment: "comment", } @@ -310,7 +310,7 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 1: invalid elementId parser, _ = parserFromBodyContent(` - + time-1.9.tar.gz `) @@ -322,10 +322,10 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 2: Invalid License Concluded must raise an error: parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err == nil { @@ -334,10 +334,10 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 2: Invalid License Declared must raise an error: parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err == nil { @@ -346,18 +346,18 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 3: Invalid ExternalRef parser, _ = parserFromBodyContent(` - - - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - - - `) + + + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err == nil { @@ -464,20 +464,20 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 8: Checking if packages can handle cyclic dependencies: // Simulating a smallest possible cycle: package related to itself. parser, _ = parserFromBodyContent(` - - Test Package - - - - - - 1.1.1 - - - - - - `) + + Test Package + + + + + + 1.1.1 + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject pkg, err = parser.getPackageFromNode(node) if err != nil { @@ -495,68 +495,68 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 9: everything valid parser, _ = parserFromBodyContent(` - - Test Package - 1.1.1 - time-1.9.tar.gz - Person: Jane Doe (jane.doe@example.com) - Organization: SPDX - - true - - - cbceb8b5689b75a584efe35587b5d41bd48820ce - ./package.spdx - - - - - - 75068c26abbed3ad3980685bae21d7202d288317 - - - http://www.openjena.org/ - uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. - - - - - - - - - Other versions available for a commercial license - - Package for Testing - Some tags are taken from other spdx autogenerated files - no comments - - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - - - - - - - - - attribution text - - - 2011-01-29T18:30:22Z - Package level annotation - Person: Package Commenter - - - - - `) + + Test Package + 1.1.1 + time-1.9.tar.gz + Person: Jane Doe (jane.doe@example.com) + Organization: SPDX + + true + + + cbceb8b5689b75a584efe35587b5d41bd48820ce + ./package.spdx + + + + + + 75068c26abbed3ad3980685bae21d7202d288317 + + + https://www.openjena.org/ + uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. + + + + + + + + + Other versions available for a commercial license + + Package for Testing + Some tags are taken from other spdx autogenerated files + no comments + + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + + + + + + + + + attribution text + + + 2011-01-29T18:30:22Z + Package level annotation + Person: Package Commenter + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err != nil { @@ -591,11 +591,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 1: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -605,11 +605,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 1: valid checksum algorithm which is invalid for package parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -619,11 +619,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 2: valid checksum (sha1) parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -643,11 +643,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 3: valid checksum (sha256) parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -666,11 +666,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 4: valid checksum (md5) parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) diff --git a/rdfloader/parser2v2/parse_relationship_test.go b/rdfloader/parser2v2/parse_relationship_test.go index fd66d148..36a6ba3d 100644 --- a/rdfloader/parser2v2/parse_relationship_test.go +++ b/rdfloader/parser2v2/parse_relationship_test.go @@ -77,12 +77,12 @@ func Test_getRelationshipTypeFromURI(t *testing.T) { func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 1: Package as a related element parser, _ := parserFromBodyContent(` - - - - - - `) + + + + + + `) reln := &v2_2.Relationship{} triple := rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_PACKAGE)[0] err := parser.parseRelatedElementFromTriple(reln, triple) @@ -106,12 +106,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 3: invalid package as a relatedElement parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_PACKAGE)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -121,12 +121,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 4: valid File as a related element parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -150,12 +150,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 5: invalid File as a relatedElement parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -165,12 +165,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 6: valid SpdxElement as a related element parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_SPDX_ELEMENT)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -194,12 +194,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 7: invalid SpdxElement as a related element parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_SPDX_ELEMENT)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -211,16 +211,16 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 1: invalid RefA parser, _ := parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) triple := rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err := parser.parseRelationship(triple) if err == nil { @@ -229,16 +229,16 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 3: invalid RefB parser, _ = parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -268,16 +268,16 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 4: undefined relatedSpdxElement parser, _ = parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -286,17 +286,17 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 6: relatedElement associated with more than one type parser, _ = parserFromBodyContent(` - - - - - - - - - - - `) + + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -305,17 +305,17 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 5: unknown predicate inside a relationship parser, _ = parserFromBodyContent(` - - - - - - - - - - - `) + + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -324,24 +324,24 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 8: Recursive relationships mustn't raise any error: parser, _ = parserFromBodyContent(` - - - - - - - - - - - - - - - - - - `) + + + + + + + + + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err != nil { @@ -350,18 +350,18 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 7: completely valid example: parser, _ = parserFromBodyContent(` - - - - - - - - comment - - - - `) + + + + + + + + comment + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err != nil { diff --git a/rdfloader/parser2v2/parse_snippet_info_test.go b/rdfloader/parser2v2/parse_snippet_info_test.go index df0bb70e..fe71c02c 100644 --- a/rdfloader/parser2v2/parse_snippet_info_test.go +++ b/rdfloader/parser2v2/parse_snippet_info_test.go @@ -28,10 +28,10 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 2: Invalid LicenseInfoInSnippet parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getSnippetInformationFromNode2_2(node) if err == nil { @@ -58,7 +58,7 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) @@ -82,10 +82,10 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 5: invalid license concluded: parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getSnippetInformationFromNode2_2(node) if err == nil { @@ -94,34 +94,34 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 6: everything valid: parser, _ = parserFromBodyContent(` - - - - - - - - - - 420 - - - - - - 310 - - - - - - snippet test - test - comments - comments - - - `) + + + + + + + + + + 420 + + + + + + 310 + + + + + + snippet test + test + comments + comments + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getSnippetInformationFromNode2_2(node) if err != nil { @@ -138,7 +138,7 @@ func Test_setSnippetID(t *testing.T) { // TestCase 2: valid input si := &v2_2.Snippet{} - err = setSnippetID("http://spdx.org/spdxdocs/spdx-example#SPDXRef-Snippet", si) + err = setSnippetID("https://spdx.org/spdxdocs/spdx-example#SPDXRef-Snippet", si) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -158,7 +158,7 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { parser, _ = parserFromBodyContent(``) node = &gordfParser.Node{ NodeType: gordfParser.RESOURCELITERAL, - ID: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#SPDXRef-DoapSource", + ID: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#SPDXRef-DoapSource", } err = parser.parseRangeReference(node, si) if err != nil { @@ -168,10 +168,10 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { // TestCase 2: invalid file in the reference should raise an error si = &v2_2.Snippet{} parser, _ = parserFromBodyContent(` - - test file - - `) + + test file + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseRangeReference(node, si) if err == nil { @@ -181,10 +181,10 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { // TestCase 3: A valid reference must set the file to the files map of the parser. si = &v2_2.Snippet{} parser, _ = parserFromBodyContent(` - - test file - - `) + + test file + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseRangeReference(node, si) if err != nil { @@ -286,16 +286,16 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 1: range with less one pointer less must raise an error // (end-pointer missing in the range) parser, _ = parserFromBodyContent(` - - - - - 310 - - - - - `) + + + + + 310 + + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -305,23 +305,23 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 2: triples with 0 or more than one type-triple parser, _ = parserFromBodyContent(` - - - - - - 420 - - - - - - 310 - - - - - `) + + + + + + 420 + + + + + + 310 + + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject dummyTriple := parser.gordfParserObj.Triples[0] @@ -337,21 +337,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 3: triples with 0 startPointer parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -361,21 +361,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 4: triples with 0 endPointer parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -385,21 +385,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 5: error parsing start pointer must be propagated to the range parser, _ = parserFromBodyContent(` - - - - - 42.0 - - - - - - 310 - - - - `) + + + + + 42.0 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -409,21 +409,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 6: error parsing end pointer must be propagated to the range parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 31+0 - - - - `) + + + + + 420 + + + + + + 31+0 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -433,21 +433,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 7: mismatching start and end pointer must also raise an error. parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -457,21 +457,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 8: everything valid(byte_range): parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -481,21 +481,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 9: everything valid(line_range): parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index 9d22faad..5efa9847 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -15,17 +15,17 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { // TestCase 1: invalid checksum parser, _ = parserFromBodyContent(` - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - `) + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getExternalDocumentRefFromNode(node) if err == nil { @@ -46,17 +46,17 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { // TestCase 3: valid example parser, _ = parserFromBodyContent(` - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - `) + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getExternalDocumentRefFromNode(node) if err != nil { @@ -71,8 +71,8 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 1: invalid spdx id of the document parser, _ = parserFromBodyContent(` - - `) + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -81,10 +81,10 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 2: erroneous dataLicense parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -93,21 +93,21 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 3: invalid external document ref parser, _ = parserFromBodyContent(` - - - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - - - `) + + + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -116,12 +116,12 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 4: invalid package parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -179,60 +179,60 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 7: everything valid parser, _ = parserFromBodyContent(` - - SPDX-2.1 - - /test/example - - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - - - - 2.6 - Person: spdx (y) - Organization: - Tool: spdx2 - 2018-08-24T19:55:34Z - - - test - - - Another example reviewer. - 2011-03-13T00:00:00Z - Person: Suzanne Reviewer - - - - - - - - - - - - - - - - 2011-01-29T18:30:22Z - test annotation - Person: Rishabh Bhatnagar - - - - - `) + + SPDX-2.1 + + /test/example + + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + + + + 2.6 + Person: spdx (y) + Organization: + Tool: spdx2 + 2018-08-24T19:55:34Z + + + test + + + Another example reviewer. + 2011-03-13T00:00:00Z + Person: Suzanne Reviewer + + + + + + + + + + + + + + + + 2011-01-29T18:30:22Z + test annotation + Person: Rishabh Bhatnagar + + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err != nil { diff --git a/rdfloader/parser2v2/parser.go b/rdfloader/parser2v2/parser.go index 4b3b62c1..b4fff559 100644 --- a/rdfloader/parser2v2/parser.go +++ b/rdfloader/parser2v2/parser.go @@ -12,7 +12,7 @@ import ( "github.com/spdx/tools-golang/spdx/v2_2" ) -// returns a new instance of rdfParser2_2 given the gordf object and nodeToTriples mapping +// NewParser2_2 returns a new instance of rdfParser2_2 given the gordf object and nodeToTriples mapping func NewParser2_2(gordfParserObj *gordfParser.Parser, nodeToTriples map[string][]*gordfParser.Triple) *rdfParser2_2 { parser := rdfParser2_2{ gordfParserObj: gordfParserObj, @@ -34,7 +34,7 @@ func NewParser2_2(gordfParserObj *gordfParser.Parser, nodeToTriples map[string][ return &parser } -// main function which takes in a gordfParser and returns +// LoadFromGoRDFParser main function which takes in a gordfParser and returns // a spdxDocument model or the error encountered while parsing it func LoadFromGoRDFParser(gordfParserObj *gordfParser.Parser) (*v2_2.Document, error) { // nodeToTriples is a mapping from a node to list of triples. @@ -75,7 +75,7 @@ func LoadFromGoRDFParser(gordfParserObj *gordfParser.Parser) (*v2_2.Document, er default: continue // because in rdf it is quite possible that the root node is an - // element that has been used in the some other element as a child + // element that has been used in some other element as a child } } diff --git a/rdfloader/parser2v2/parser_test.go b/rdfloader/parser2v2/parser_test.go index 11b2da6b..efc8c02e 100644 --- a/rdfloader/parser2v2/parser_test.go +++ b/rdfloader/parser2v2/parser_test.go @@ -8,7 +8,7 @@ import ( func TestNewParser2_2(t *testing.T) { // testing if the attributes are initialised well and no top-level is left uninitialized. - // primarily, checking if all the maps are initialized because + // primarily, checking if all the maps are initialised because // uninitialized slices are by default slices of length 0 p, _ := parserFromBodyContent(``) parser := NewParser2_2(p.gordfParserObj, p.nodeStringToTriples) @@ -42,10 +42,10 @@ func TestLoadFromGoRDFParser(t *testing.T) { // TestCase 2: invalid SpdxDocumentNode parser, _ = parserFromBodyContent(` - - - - `) + + + + `) _, err = LoadFromGoRDFParser(parser.gordfParserObj) if err == nil { t.Errorf("expected an error because of absence of SpdxDocument node, got %v", err) @@ -94,23 +94,23 @@ func TestLoadFromGoRDFParser(t *testing.T) { // TestCase 5: everything valid: parser, _ = parserFromBodyContent(` - - - from linux kernel - Copyright 2008-2010 John Smith - The concluded license was taken from package xyz, from which the snippet was copied into the current file. The concluded license information was found in the COPYING.txt file in package xyz. - - - Copyright 2010, 2011 Source Auditor Inc. - Open Logic Inc. - ./src/org/spdx/parser/DOAPProject.java - Black Duck Software In.c - - - - - - `) + + + from linux kernel + Copyright 2008-2010 John Smith + The concluded license was taken from package xyz, from which the snippet was copied into the current file. The concluded license information was found in the COPYING.txt file in package xyz. + + + Copyright 2010, 2011 Source Auditor Inc. + Open Logic Inc. + ./src/org/spdx/parser/DOAPProject.java + Black Duck Software In.c + + + + + + `) _, err = LoadFromGoRDFParser(parser.gordfParserObj) if err != nil { t.Errorf("error parsing a valid example: %v", err) diff --git a/rdfloader/parser2v2/types.go b/rdfloader/parser2v2/types.go index dbb50d5d..03f24a22 100644 --- a/rdfloader/parser2v2/types.go +++ b/rdfloader/parser2v2/types.go @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +// Package parser2v2 SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later // copied from tvloader/parser2v2/types.go package parser2v2 @@ -105,7 +105,7 @@ type WithExceptionOperator struct { licenseException LicenseException } -// custom LicenseType to provide support for licences of +// SpecialLicense custom LicenseType to provide support for licences of // type Noassertion, None and customLicenses type SpecialLicense struct { AnyLicenseInfo diff --git a/rdfloader/parser2v2/utils.go b/rdfloader/parser2v2/utils.go index 9f51a3c6..295e8c5d 100644 --- a/rdfloader/parser2v2/utils.go +++ b/rdfloader/parser2v2/utils.go @@ -66,7 +66,7 @@ func boolFromString(boolString string) (bool, error) { /* Function Below this line is taken from the tvloader/parser2v2/utils.go */ -// used to extract DocumentRef and SPDXRef values from an SPDX Identifier +// ExtractDocElementID used to extract DocumentRef and SPDXRef values from an SPDX Identifier // which can point either to this document or to a different one func ExtractDocElementID(value string) (common.DocElementID, error) { docRefID := "" @@ -115,7 +115,7 @@ func ExtractDocElementID(value string) (common.DocElementID, error) { return common.DocElementID{DocumentRefID: docRefID, ElementRefID: common.ElementID(eltRefID)}, nil } -// used to extract SPDXRef values only from an SPDX Identifier which can point +// ExtractElementID used to extract SPDXRef values only from an SPDX Identifier which can point // to this document only. Use extractDocElementID for parsing IDs that can // refer either to this document or a different one. func ExtractElementID(value string) (common.ElementID, error) { @@ -139,7 +139,7 @@ func ExtractElementID(value string) (common.ElementID, error) { return common.ElementID(eltRefID), nil } -// used to extract key / value from embedded substrings +// ExtractSubs used to extract key / value from embedded substrings // returns subkey, subvalue, nil if no error, or "", "", error otherwise func ExtractSubs(value string, sep string) (string, string, error) { // parse the value to see if it's a valid subvalue format diff --git a/rdfloader/parser2v2/utils_test.go b/rdfloader/parser2v2/utils_test.go index c0cc5746..a21fa976 100644 --- a/rdfloader/parser2v2/utils_test.go +++ b/rdfloader/parser2v2/utils_test.go @@ -70,20 +70,20 @@ func Test_rdfParser2_2_nodeToTriples(t *testing.T) { // TestCase 2: node should be addressable based on the node content and not the pointer. // It should allow new nodes same as the older ones to retrieve the associated triples. parser, _ = parserFromBodyContent(` - - - 75068c26abbed3ad3980685bae21d7202d288317 - - `) + + + 75068c26abbed3ad3980685bae21d7202d288317 + + `) newNode := &gordfParser.Node{ NodeType: gordfParser.IRI, - ID: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#checksum", + ID: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#checksum", } output = parser.nodeToTriples(newNode) // The output must have 3 triples: // 1. newNode rdf:type Checksum - // 2. newNode spdx:algorithm http://spdx.org/rdf/terms#checksumAlgorithm_sha1 + // 2. newNode spdx:algorithm https://spdx.org/rdf/terms#checksumAlgorithm_sha1 // 3. newNode spdx:checksumValue 75068c26abbed3ad3980685bae21d7202d288317 if len(output) != 3 { t.Errorf("expected output to have 3 triples, got %d", len(output)) @@ -154,11 +154,11 @@ func Test_getNodeTypeFromTriples(t *testing.T) { }, Object: &gordfParser.Node{ NodeType: gordfParser.IRI, - ID: "http://spdx.org/rdf/terms#Checksum", + ID: "https://spdx.org/rdf/terms#Checksum", }, } triples = append(triples, typeTriple) - expectedNodeType = "http://spdx.org/rdf/terms#Checksum" + expectedNodeType = "https://spdx.org/rdf/terms#Checksum" nodeType, err = getNodeTypeFromTriples(triples, node) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -176,7 +176,7 @@ func Test_getNodeTypeFromTriples(t *testing.T) { }, Object: &gordfParser.Node{ NodeType: gordfParser.IRI, - ID: "http://spdx.org/rdf/terms#Snippet", + ID: "https://spdx.org/rdf/terms#Snippet", }, } triples = append(triples, typeTriple) diff --git a/rdfloader/parser2v3/constants.go b/rdfloader/parser2v3/constants.go index 44ca0d4c..93cb859c 100644 --- a/rdfloader/parser2v3/constants.go +++ b/rdfloader/parser2v3/constants.go @@ -6,13 +6,13 @@ import "github.com/spdx/gordf/rdfloader/parser" var ( // NAMESPACES - NS_SPDX = "http://spdx.org/rdf/terms#" - NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#" + NS_SPDX = "https://spdx.org/rdf/terms#" + NS_RDFS = "https://www.w3.org/2000/01/rdf-schema#" NS_RDF = parser.RDFNS - NS_PTR = "http://www.w3.org/2009/pointers#" - NS_DOAP = "http://usefulinc.com/ns/doap#" + NS_PTR = "https://www.w3.org/2009/pointers#" + NS_DOAP = "https://usefulinc.com/ns/doap#" - // SPDX properties + // SPDX_SPEC_VERSION SPDX properties SPDX_SPEC_VERSION = NS_SPDX + "specVersion" SPDX_DATA_LICENSE = NS_SPDX + "dataLicense" SPDX_NAME = NS_SPDX + "name" diff --git a/rdfloader/parser2v3/license_utils.go b/rdfloader/parser2v3/license_utils.go index 11bb3c80..74a512ec 100644 --- a/rdfloader/parser2v3/license_utils.go +++ b/rdfloader/parser2v3/license_utils.go @@ -80,12 +80,12 @@ func mapLicensesToStrings(licences []AnyLicenseInfo) []string { /****** Type Functions ******/ -// TODO: should probably add brackets while linearizing a nested license. +// ToLicenseString TODO: should probably add brackets while linearizing a nested license. func (lic ConjunctiveLicenseSet) ToLicenseString() string { return strings.Join(mapLicensesToStrings(lic.members), " AND ") } -// TODO: should probably add brackets while linearizing a nested license. +// ToLicenseString TODO: should probably add brackets while linearizing a nested license. func (lic DisjunctiveLicenseSet) ToLicenseString() string { return strings.Join(mapLicensesToStrings(lic.members), " OR ") } diff --git a/rdfloader/parser2v3/parse_annotation_test.go b/rdfloader/parser2v3/parse_annotation_test.go index 1ce0bd73..205bc7fc 100644 --- a/rdfloader/parser2v3/parse_annotation_test.go +++ b/rdfloader/parser2v3/parse_annotation_test.go @@ -33,7 +33,7 @@ func Test_setAnnotatorFromString(t *testing.T) { t.Errorf("unexpected error for a valid annotator") } if ann.Annotator.AnnotatorType != "Person" { - t.Errorf("wrnog annotator type: expected: %s, found: %s", "Person", ann.Annotator) + t.Errorf("wrong annotator type: expected: %s, found: %s", "Person", ann.Annotator) } if ann.Annotator.Annotator != "Rishabh" { t.Errorf("wrong annotator: expected: %s, found: %s", "Rishabh", ann.Annotator) @@ -98,13 +98,13 @@ func Test_setAnnotationToParser(t *testing.T) { func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 1: invalid annotator must raise an error parser, _ := parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Company: some company - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Company: some company + + + `) node := parser.gordfParserObj.Triples[0].Subject err := parser.parseAnnotationFromNode(node) if err == nil { @@ -113,13 +113,13 @@ func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 2: wrong annotation type should raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -128,14 +128,14 @@ func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 3: unknown predicate should also raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -144,13 +144,13 @@ func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 4: completely valid annotation parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err != nil { diff --git a/rdfloader/parser2v3/parse_file_test.go b/rdfloader/parser2v3/parse_file_test.go index f7348ef6..023cc1dd 100644 --- a/rdfloader/parser2v3/parse_file_test.go +++ b/rdfloader/parser2v3/parse_file_test.go @@ -18,12 +18,12 @@ import ( // pads the content with the enclosing rdf:RDF tag func wrapIntoTemplate(content string) string { header := `` + xmlns:spdx="https://spdx.org/rdf/terms#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns="https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#" + xmlns:doap="https://usefulinc.com/ns/doap#" + xmlns:j.0="http://www.w3.org/2009/pointers#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">` footer := `` return header + content + footer } @@ -49,13 +49,13 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { // TestCase 1: artifactOf without project URI rdfParser, err := parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + https://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -67,7 +67,7 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { if artifact.Name != "Jena" { t.Errorf("expected name of artifact: %s, found: %s", "Jena", artifact.Name) } - expectedHomePage := "http://www.openjena.org/" + expectedHomePage := "https://www.openjena.org/" if artifact.HomePage != expectedHomePage { t.Errorf("wrong artifact homepage. Expected: %s, found: %s", expectedHomePage, artifact.HomePage) } @@ -78,13 +78,13 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { // TestCase 2: artifactOf with a Project URI rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + https://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -93,7 +93,7 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { if err != nil { t.Errorf("error parsing a valid artifactOf node: %v", err) } - expectedURI := "http://subversion.apache.org/doap.rdf" + expectedURI := "https://subversion.apache.org/doap.rdf" if artifact.URI != expectedURI { t.Errorf("wrong artifact URI. Expected: %s, found: %s", expectedURI, artifact.URI) } @@ -101,14 +101,14 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { // TestCase 3: artifactOf with unknown predicate rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - - `) + + + https://www.openjena.org/ + Jena + + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -123,7 +123,7 @@ func Test_rdfParser2_3_getFileTypeFromUri(t *testing.T) { rdfParser, _ := parserFromBodyContent(``) // TestCase 1: Valid fileType URI: - fileTypeURI := "http://spdx.org/rdf/terms#fileType_source" + fileTypeURI := "https://spdx.org/rdf/terms#fileType_source" fileType, err := rdfParser.getFileTypeFromUri(fileTypeURI) if err != nil { t.Errorf("error in a valid example: %v", err) @@ -133,7 +133,7 @@ func Test_rdfParser2_3_getFileTypeFromUri(t *testing.T) { } // TestCase 2: Invalid fileType URI format. - fileTypeURI = "http://spdx.org/rdf/terms#source" + fileTypeURI = "https://spdx.org/rdf/terms#source" fileType, err = rdfParser.getFileTypeFromUri(fileTypeURI) if err == nil { t.Error("should've raised an error for invalid fileType") @@ -178,7 +178,7 @@ func Test_setFileIdentifier(t *testing.T) { file := &v2_3.File{} // TestCase 1: valid example - err := setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) + err := setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -187,7 +187,7 @@ func Test_setFileIdentifier(t *testing.T) { } // TestCase 2: invalid example - err = setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) + err = setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) if err == nil { t.Errorf("should've raised an error for an invalid example") } @@ -196,11 +196,11 @@ func Test_setFileIdentifier(t *testing.T) { func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 1: md5 checksum parser, _ := parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file := &v2_3.File{} err := parser.setFileChecksumFromNode(file, checksumNode) @@ -257,11 +257,11 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 3: valid sha256 checksum parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_3.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -300,11 +300,11 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 5: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_3.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -314,11 +314,11 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 6: valid checksum algorithm which is invalid for file (like md4, md6, sha384, etc.) parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_3.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -330,7 +330,7 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 1: file with invalid id parser, _ := parserFromBodyContent(` - + `) fileNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err := parser.getFileFromNode(fileNode) @@ -340,10 +340,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 2: invalid fileType parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -352,15 +352,15 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 3: invalid file checksum parser, _ = parserFromBodyContent(` - - - - - 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - - - `) + + + + + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -369,10 +369,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 4: invalid license concluded parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -398,10 +398,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 6: invalid file dependency parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -410,7 +410,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 7: invalid annotation with unknown predicate parser, _ = parserFromBodyContent(` - + @@ -426,14 +426,14 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 8: invalid relationship parser, _ = parserFromBodyContent(` - - - - - - - - `) + + + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -442,7 +442,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 8: unknown predicate parser, _ = parserFromBodyContent(` - + `) @@ -454,10 +454,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 9: invalid licenseInfoInFile. parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -467,21 +467,21 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 10: Splitting of File definition into parents of different tags mustn't create new file objects. fileDefinitions := []string{ ` - - - time-1.9/ChangeLog - - - - `, + + + time-1.9/ChangeLog + + + + `, ` - - - - - - - `, + + + + + + + `, } parser, _ = parserFromBodyContent(strings.Join(fileDefinitions, "")) @@ -519,65 +519,65 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 12: checking if recursive dependencies are resolved. parser, _ = parserFromBodyContent(` - - - - - - - ParentFile - - - - - - `) + + + + + + + ParentFile + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) // TestCase 11: all valid attribute and it's values. parser, _ = parserFromBodyContent(` - - time-1.9/ChangeLog - - - - - - 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - - - - no comments - from spdx file - - - http://www.openjena.org/ - Jena - - - no comments - - Some Organization - - attribution text - - - 2011-01-29T18:30:22Z - File level annotation copied from a spdx document - Person: File Commenter - - - - - - - - - - - `) + + time-1.9/ChangeLog + + + + + + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd + + + + + no comments + from spdx file + + + https://www.openjena.org/ + Jena + + + no comments + + Some Organization + + attribution text + + + 2011-01-29T18:30:22Z + File level annotation copied from a spdx document + Person: File Commenter + + + + + + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) if err != nil { @@ -637,7 +637,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { t.Errorf("given file should have 1 artifactOfProjects attribute. found %d", n) } artifactOf := file.ArtifactOfProjects[0] - expectedHomePage := "http://www.openjena.org/" + expectedHomePage := "https://www.openjena.org/" if artifactOf.HomePage != expectedHomePage { t.Errorf("expected %s, found %s", expectedHomePage, artifactOf.HomePage) } diff --git a/tvloader/parser2v1/parse_file_test.go b/tvloader/parser2v1/parse_file_test.go index 33f4ef22..c12b05ed 100644 --- a/tvloader/parser2v1/parse_file_test.go +++ b/tvloader/parser2v1/parse_file_test.go @@ -187,7 +187,7 @@ func TestParser2_1FileStartsNewPackageAfterParsingPackageNameTag(t *testing.T) { } // and the new Package should have no files if len(parser.pkg.Files) != 0 { - t.Errorf("Expected no files in pkg.Files, got %d", len(parser.pkg.Files)) + t.Errorf("expected no files in pkg.Files, got %d", len(parser.pkg.Files)) } // and the Document's Packages should still be of size 1 and not have this // new one, because no SPDX identifier has been seen yet @@ -195,24 +195,24 @@ func TestParser2_1FileStartsNewPackageAfterParsingPackageNameTag(t *testing.T) { t.Fatalf("expected 1 package, got %d", len(parser.doc.Packages)) } if parser.doc.Packages[0] != p1 { - t.Errorf("Expected package %v in Packages[package1], got %v", p1, parser.doc.Packages[0]) + t.Errorf("expected package %v in Packages[package1], got %v", p1, parser.doc.Packages[0]) } if parser.doc.Packages[0].PackageName != p1Name { t.Errorf("expected package name %s in Packages[package1], got %s", p1Name, parser.doc.Packages[0].PackageName) } // and the first Package's Files should be of size 1 and have f1 only if len(parser.doc.Packages[0].Files) != 1 { - t.Errorf("Expected 1 file in Packages[package1].Files, got %d", len(parser.doc.Packages[0].Files)) + t.Errorf("expected 1 file in Packages[package1].Files, got %d", len(parser.doc.Packages[0].Files)) } if parser.doc.Packages[0].Files[0] != f1 { - t.Errorf("Expected file %v in Files[f1], got %v", f1, parser.doc.Packages[0].Files[0]) + t.Errorf("expected file %v in Files[f1], got %v", f1, parser.doc.Packages[0].Files[0]) } if parser.doc.Packages[0].Files[0].FileName != f1Name { t.Errorf("expected file name %s in Files[f1], got %s", f1Name, parser.doc.Packages[0].Files[0].FileName) } // and the current file should be nil if parser.file != nil { - t.Errorf("Expected nil for parser.file, got %v", parser.file) + t.Errorf("expected nil for parser.file, got %v", parser.file) } } @@ -521,11 +521,11 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "http://example.com/1/") + err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "https://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -539,7 +539,7 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "http://example.com/3/") + err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "https://example.com/3/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -548,7 +548,7 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "http://example.com/4/uri.whatever") + err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "https://example.com/4/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -561,11 +561,11 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if aop.Name != "project1" { t.Errorf("expected %v, got %v", "project1", aop.Name) } - if aop.HomePage != "http://example.com/1/" { - t.Errorf("expected %v, got %v", "http://example.com/1/", aop.HomePage) + if aop.HomePage != "https://example.com/1/" { + t.Errorf("expected %v, got %v", "https://example.com/1/", aop.HomePage) } - if aop.URI != "http://example.com/1/uri.whatever" { - t.Errorf("expected %v, got %v", "http://example.com/1/uri.whatever", aop.URI) + if aop.URI != "https://example.com/1/uri.whatever" { + t.Errorf("expected %v, got %v", "https://example.com/1/uri.whatever", aop.URI) } aop = parser.file.ArtifactOfProjects[1] @@ -583,8 +583,8 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if aop.Name != "project3" { t.Errorf("expected %v, got %v", "project3", aop.Name) } - if aop.HomePage != "http://example.com/3/" { - t.Errorf("expected %v, got %v", "http://example.com/3/", aop.HomePage) + if aop.HomePage != "https://example.com/3/" { + t.Errorf("expected %v, got %v", "https://example.com/3/", aop.HomePage) } if aop.URI != "" { t.Errorf("expected %v, got %v", "", aop.URI) @@ -597,8 +597,8 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if aop.HomePage != "" { t.Errorf("expected %v, got %v", "", aop.HomePage) } - if aop.URI != "http://example.com/4/uri.whatever" { - t.Errorf("expected %v, got %v", "http://example.com/4/uri.whatever", aop.URI) + if aop.URI != "https://example.com/4/uri.whatever" { + t.Errorf("expected %v, got %v", "https://example.com/4/uri.whatever", aop.URI) } // File Comment @@ -755,7 +755,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { curPtr := parser.fileAOP // now, a home page; pointer should stay - err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "http://example.com/1/") + err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "https://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -764,7 +764,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { } // a URI; pointer should stay - err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } diff --git a/tvloader/parser2v1/parse_package_test.go b/tvloader/parser2v1/parse_package_test.go index 052f5355..9e1217a9 100644 --- a/tvloader/parser2v1/parse_package_test.go +++ b/tvloader/parser2v1/parse_package_test.go @@ -52,7 +52,7 @@ func TestParser2_1PackageStartsNewPackageAfterParsingPackageNameTag(t *testing.T } // and the Document's Packages should still be of size 1 and have pkgOld only if parser.doc.Packages[0] != pkgOld { - t.Errorf("Expected package %v, got %v", pkgOld, parser.doc.Packages[0]) + t.Errorf("expected package %v, got %v", pkgOld, parser.doc.Packages[0]) } if len(parser.doc.Packages) != 1 { t.Errorf("expected 1 package, got %d", len(parser.doc.Packages)) @@ -69,7 +69,7 @@ func TestParser2_1PackageStartsNewPackageAfterParsingPackageNameTagWhileInUnpack } // the Document's Packages should be empty if len(parser.doc.Packages) != 0 { - t.Errorf("Expected zero packages, got %d", len(parser.doc.Packages)) + t.Errorf("expected zero packages, got %d", len(parser.doc.Packages)) } // now add a new package @@ -100,7 +100,7 @@ func TestParser2_1PackageStartsNewPackageAfterParsingPackageNameTagWhileInUnpack // and the Document's Packages should be of size 0, because the prior was // unpackaged files and this one won't be added until an SPDXID is seen if len(parser.doc.Packages) != 0 { - t.Errorf("Expected %v packages in doc, got %v", 0, len(parser.doc.Packages)) + t.Errorf("expected %v packages in doc, got %v", 0, len(parser.doc.Packages)) } } diff --git a/tvloader/parser2v1/parse_review_test.go b/tvloader/parser2v1/parse_review_test.go index c3cea2dd..f96c6000 100644 --- a/tvloader/parser2v1/parse_review_test.go +++ b/tvloader/parser2v1/parse_review_test.go @@ -33,10 +33,10 @@ func TestParser2_1ReviewStartsNewReviewAfterParsingReviewerTag(t *testing.T) { // the Document's Reviews should have this one only if len(parser.doc.Reviews) != 1 { - t.Errorf("Expected only one review, got %d", len(parser.doc.Reviews)) + t.Errorf("expected only one review, got %d", len(parser.doc.Reviews)) } if parser.doc.Reviews[0] != r1 { - t.Errorf("Expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) + t.Errorf("expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) } if parser.doc.Reviews[0].Reviewer != rev1 { t.Errorf("expected review name %s in Reviews[0], got %s", rev1, parser.doc.Reviews[0].Reviewer) @@ -63,16 +63,16 @@ func TestParser2_1ReviewStartsNewReviewAfterParsingReviewerTag(t *testing.T) { } // and the Document's reviews should be of size 2 and have these two if len(parser.doc.Reviews) != 2 { - t.Fatalf("Expected Reviews to have len 2, got %d", len(parser.doc.Reviews)) + t.Fatalf("expected Reviews to have len 2, got %d", len(parser.doc.Reviews)) } if parser.doc.Reviews[0] != r1 { - t.Errorf("Expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) + t.Errorf("expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) } if parser.doc.Reviews[0].Reviewer != rev1 { t.Errorf("expected reviewer name %s in Reviews[0], got %s", rev1, parser.doc.Reviews[0].Reviewer) } if parser.doc.Reviews[1] != parser.rev { - t.Errorf("Expected review %v in Reviews[1], got %v", parser.rev, parser.doc.Reviews[1]) + t.Errorf("expected review %v in Reviews[1], got %v", parser.rev, parser.doc.Reviews[1]) } if parser.doc.Reviews[1].Reviewer != rev2 { t.Errorf("expected reviewer name %s in Reviews[1], got %s", rev2, parser.doc.Reviews[1].Reviewer) diff --git a/tvloader/parser2v1/parse_snippet_test.go b/tvloader/parser2v1/parse_snippet_test.go index aa42c3c3..e44d6400 100644 --- a/tvloader/parser2v1/parse_snippet_test.go +++ b/tvloader/parser2v1/parse_snippet_test.go @@ -26,10 +26,10 @@ func TestParser2_1SnippetStartsNewSnippetAfterParsingSnippetSPDXIDTag(t *testing // the File's Snippets should have this one only if len(parser.file.Snippets) != 1 { - t.Errorf("Expected len(Snippets) to be 1, got %d", len(parser.file.Snippets)) + t.Errorf("expected len(Snippets) to be 1, got %d", len(parser.file.Snippets)) } if parser.file.Snippets["s1"] != s1 { - t.Errorf("Expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) + t.Errorf("expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) } if parser.file.Snippets["s1"].SnippetSPDXIdentifier != sid1 { t.Errorf("expected snippet ID %s in Snippets[s1], got %s", sid1, parser.file.Snippets["s1"].SnippetSPDXIdentifier) @@ -54,16 +54,16 @@ func TestParser2_1SnippetStartsNewSnippetAfterParsingSnippetSPDXIDTag(t *testing } // and the File's Snippets should be of size 2 and have these two if len(parser.file.Snippets) != 2 { - t.Errorf("Expected len(Snippets) to be 2, got %d", len(parser.file.Snippets)) + t.Errorf("expected len(Snippets) to be 2, got %d", len(parser.file.Snippets)) } if parser.file.Snippets["s1"] != s1 { - t.Errorf("Expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) + t.Errorf("expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) } if parser.file.Snippets["s1"].SnippetSPDXIdentifier != sid1 { t.Errorf("expected snippet ID %s in Snippets[s1], got %s", sid1, parser.file.Snippets["s1"].SnippetSPDXIdentifier) } if parser.file.Snippets["s2"] != parser.snippet { - t.Errorf("Expected snippet %v in Snippets[s2], got %v", parser.snippet, parser.file.Snippets["s2"]) + t.Errorf("expected snippet %v in Snippets[s2], got %v", parser.snippet, parser.file.Snippets["s2"]) } if parser.file.Snippets["s2"].SnippetSPDXIdentifier != "s2" { t.Errorf("expected snippet ID %s in Snippets[s2], got %s", "s2", parser.file.Snippets["s2"].SnippetSPDXIdentifier) @@ -112,35 +112,35 @@ func TestParser2_1SnippetStartsNewPackageAfterParsingPackageNameTag(t *testing.T // and the Document's Packages should still be of size 1 b/c no SPDX // identifier has been seen yet if len(parser.doc.Packages) != 1 { - t.Errorf("Expected len(Packages) to be 1, got %d", len(parser.doc.Packages)) + t.Errorf("expected len(Packages) to be 1, got %d", len(parser.doc.Packages)) } if parser.doc.Packages[0] != p1 { - t.Errorf("Expected package %v in Packages[package1], got %v", p1, parser.doc.Packages[0]) + t.Errorf("expected package %v in Packages[package1], got %v", p1, parser.doc.Packages[0]) } if parser.doc.Packages[0].PackageName != "package1" { t.Errorf("expected package name %s in Packages[package1], got %s", "package1", parser.doc.Packages[0].PackageName) } // and the first Package's Files should be of size 1 and have f1 only if len(parser.doc.Packages[0].Files) != 1 { - t.Errorf("Expected 1 file in Packages[package1].Files, got %d", len(parser.doc.Packages[0].Files)) + t.Errorf("expected 1 file in Packages[package1].Files, got %d", len(parser.doc.Packages[0].Files)) } if parser.doc.Packages[0].Files[0] != f1 { - t.Errorf("Expected file %v in Files[f1], got %v", f1, parser.doc.Packages[0].Files[0]) + t.Errorf("expected file %v in Files[f1], got %v", f1, parser.doc.Packages[0].Files[0]) } if parser.doc.Packages[0].Files[0].FileName != "f1.txt" { t.Errorf("expected file name %s in Files[f1], got %s", "f1.txt", parser.doc.Packages[0].Files[0].FileName) } // and the new Package should have no files if len(parser.pkg.Files) != 0 { - t.Errorf("Expected no files in Packages[1].Files, got %d", len(parser.pkg.Files)) + t.Errorf("expected no files in Packages[1].Files, got %d", len(parser.pkg.Files)) } // and the current file should be nil if parser.file != nil { - t.Errorf("Expected nil for parser.file, got %v", parser.file) + t.Errorf("expected nil for parser.file, got %v", parser.file) } // and the current snippet should be nil if parser.snippet != nil { - t.Errorf("Expected nil for parser.snippet, got %v", parser.snippet) + t.Errorf("expected nil for parser.snippet, got %v", parser.snippet) } } @@ -183,17 +183,17 @@ func TestParser2_1SnippetMovesToFileAfterParsingFileNameTag(t *testing.T) { // and the Package's Files should still be of size 1 since we haven't seen // an SPDX identifier yet for this new file if len(parser.pkg.Files) != 1 { - t.Errorf("Expected len(Files) to be 1, got %d", len(parser.pkg.Files)) + t.Errorf("expected len(Files) to be 1, got %d", len(parser.pkg.Files)) } if parser.pkg.Files[0] != f1 { - t.Errorf("Expected file %v in Files[f1], got %v", f1, parser.pkg.Files[0]) + t.Errorf("expected file %v in Files[f1], got %v", f1, parser.pkg.Files[0]) } if parser.pkg.Files[0].FileName != f1Name { t.Errorf("expected file name %s in Files[f1], got %s", f1Name, parser.pkg.Files[0].FileName) } // and the current snippet should be nil if parser.snippet != nil { - t.Errorf("Expected nil for parser.snippet, got %v", parser.snippet) + t.Errorf("expected nil for parser.snippet, got %v", parser.snippet) } } diff --git a/tvloader/parser2v2/parse_creation_info_test.go b/tvloader/parser2v2/parse_creation_info_test.go index dcf60986..42e0e642 100644 --- a/tvloader/parser2v2/parse_creation_info_test.go +++ b/tvloader/parser2v2/parse_creation_info_test.go @@ -359,9 +359,9 @@ func TestParser2_2CICreatesAnnotation(t *testing.T) { // ===== Helper function tests ===== func TestCanExtractExternalDocumentReference(t *testing.T) { - refstring := "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759" + refstring := "DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759" wantDocumentRefID := "spdx-tool-1.2" - wantURI := "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" + wantURI := "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" wantAlg := "SHA1" wantChecksum := "d6a770ba38583ed4bb4525bd96e50461655d2759" @@ -384,9 +384,9 @@ func TestCanExtractExternalDocumentReference(t *testing.T) { } func TestCanExtractExternalDocumentReferenceWithExtraWhitespace(t *testing.T) { - refstring := " DocumentRef-spdx-tool-1.2 \t http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 \t SHA1: \t d6a770ba38583ed4bb4525bd96e50461655d2759" + refstring := " DocumentRef-spdx-tool-1.2 \t https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 \t SHA1: \t d6a770ba38583ed4bb4525bd96e50461655d2759" wantDocumentRefID := "spdx-tool-1.2" - wantURI := "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" + wantURI := "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" wantAlg := "SHA1" wantChecksum := "d6a770ba38583ed4bb4525bd96e50461655d2759" @@ -413,10 +413,10 @@ func TestFailsExternalDocumentReferenceWithInvalidFormats(t *testing.T) { "whoops", "DocumentRef-", "DocumentRef- ", - "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", - "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 d6a770ba38583ed4bb4525bd96e50461655d2759", + "DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + "DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 d6a770ba38583ed4bb4525bd96e50461655d2759", "DocumentRef-spdx-tool-1.2", - "spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759", + "spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759", } for _, refstring := range invalidRefs { _, _, _, _, err := extractExternalDocumentReference(refstring) diff --git a/tvsaver/saver2v2/save_annotation_test.go b/tvsaver/saver2v2/save_annotation_test.go index e8d1741a..3b47501b 100644 --- a/tvsaver/saver2v2/save_annotation_test.go +++ b/tvsaver/saver2v2/save_annotation_test.go @@ -33,13 +33,13 @@ AnnotationComment: This is an annotation about the SPDX document var got bytes.Buffer err := renderAnnotation2_2(ann, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -65,13 +65,13 @@ AnnotationComment: This is an annotation about the SPDX document var got bytes.Buffer err := renderAnnotation2_2(ann, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -97,13 +97,13 @@ AnnotationComment: This is an annotation about the SPDX document var got bytes.Buffer err := renderAnnotation2_2(ann, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v2/save_creation_info_test.go b/tvsaver/saver2v2/save_creation_info_test.go index bb10aa37..20263fff 100644 --- a/tvsaver/saver2v2/save_creation_info_test.go +++ b/tvsaver/saver2v2/save_creation_info_test.go @@ -45,13 +45,13 @@ CreatorComment: this is a creator comment var got bytes.Buffer err := renderCreationInfo2_2(ci, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -74,13 +74,13 @@ Created: 2018-10-10T06:20:00Z var got1 bytes.Buffer err := renderCreationInfo2_2(ci1, &got1) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c1 := bytes.Compare(want1.Bytes(), got1.Bytes()) if c1 != 0 { - t.Errorf("Expected %v, got %v", want1.String(), got1.String()) + t.Errorf("expected %v, got %v", want1.String(), got1.String()) } // --- need at least one creator; now switch to organization --- @@ -101,12 +101,12 @@ Created: 2018-10-10T06:20:00Z var got2 bytes.Buffer err = renderCreationInfo2_2(ci2, &got2) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c2 := bytes.Compare(want2.Bytes(), got2.Bytes()) if c2 != 0 { - t.Errorf("Expected %v, got %v", want2.String(), got2.String()) + t.Errorf("expected %v, got %v", want2.String(), got2.String()) } } diff --git a/tvsaver/saver2v2/save_document.go b/tvsaver/saver2v2/save_document.go index efec2a1e..52f922f6 100644 --- a/tvsaver/saver2v2/save_document.go +++ b/tvsaver/saver2v2/save_document.go @@ -19,7 +19,7 @@ import ( // and typically does not need to be called by client code. func RenderDocument2_2(doc *v2_2.Document, w io.Writer) error { if doc.CreationInfo == nil { - return fmt.Errorf("Document had nil CreationInfo section") + return fmt.Errorf("document had nil CreationInfo section") } if doc.SPDXVersion != "" { diff --git a/tvsaver/saver2v2/save_document_test.go b/tvsaver/saver2v2/save_document_test.go index 39146dd0..9964967c 100644 --- a/tvsaver/saver2v2/save_document_test.go +++ b/tvsaver/saver2v2/save_document_test.go @@ -321,13 +321,13 @@ ReviewComment: I have reviewed this SPDX document and it is awesome var got bytes.Buffer err := RenderDocument2_2(doc, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected {{{%v}}}, got {{{%v}}}", want.String(), got.String()) + t.Errorf("expected {{{%v}}}, got {{{%v}}}", want.String(), got.String()) } } @@ -338,6 +338,6 @@ func TestSaver2_2DocumentReturnsErrorIfNilCreationInfo(t *testing.T) { var got bytes.Buffer err := RenderDocument2_2(doc, &got) if err == nil { - t.Errorf("Expected error, got nil") + t.Errorf("expected error, got nil") } } diff --git a/tvsaver/saver2v2/save_file_test.go b/tvsaver/saver2v2/save_file_test.go index f8a8f324..01b45640 100644 --- a/tvsaver/saver2v2/save_file_test.go +++ b/tvsaver/saver2v2/save_file_test.go @@ -34,19 +34,19 @@ func TestSaver2_2FileSavesText(t *testing.T) { ArtifactOfProjects: []*v2_2.ArtifactOfProject{ &v2_2.ArtifactOfProject{ Name: "project1", - HomePage: "http://example.com/1/", - URI: "http://example.com/1/uri.whatever", + HomePage: "https://example.com/1/", + URI: "https://example.com/1/uri.whatever", }, &v2_2.ArtifactOfProject{ Name: "project2", }, &v2_2.ArtifactOfProject{ Name: "project3", - HomePage: "http://example.com/3/", + HomePage: "https://example.com/3/", }, &v2_2.ArtifactOfProject{ Name: "project4", - URI: "http://example.com/4/uri.whatever", + URI: "https://example.com/4/uri.whatever", }, }, FileComment: "this is a file comment", @@ -68,48 +68,48 @@ attribution`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`FileName: /tmp/whatever.txt -SPDXID: SPDXRef-File123 -FileType: TEXT -FileType: DOCUMENTATION -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -FileChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -FileChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 -LicenseConcluded: Apache-2.0 -LicenseInfoInFile: Apache-2.0 -LicenseInfoInFile: Apache-1.1 -LicenseComments: this is a license comment(s) -FileCopyrightText: Copyright (c) Jane Doe -ArtifactOfProjectName: project1 -ArtifactOfProjectHomePage: http://example.com/1/ -ArtifactOfProjectURI: http://example.com/1/uri.whatever -ArtifactOfProjectName: project2 -ArtifactOfProjectName: project3 -ArtifactOfProjectHomePage: http://example.com/3/ -ArtifactOfProjectName: project4 -ArtifactOfProjectURI: http://example.com/4/uri.whatever -FileComment: this is a file comment -FileNotice: This file may be used under either Apache-2.0 or Apache-1.1. -FileContributor: John Doe jdoe@example.com -FileContributor: EvilCorp -FileAttributionText: attributions -FileAttributionText: multi-line -attribution -FileDependency: f-1.txt -FileDependency: g.txt - -`) + SPDXID: SPDXRef-File123 + FileType: TEXT + FileType: DOCUMENTATION + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c + FileChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd + FileChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 + LicenseConcluded: Apache-2.0 + LicenseInfoInFile: Apache-2.0 + LicenseInfoInFile: Apache-1.1 + LicenseComments: this is a license comment(s) + FileCopyrightText: Copyright (c) Jane Doe + ArtifactOfProjectName: project1 + ArtifactOfProjectHomePage: https://example.com/1/ + ArtifactOfProjectURI: https://example.com/1/uri.whatever + ArtifactOfProjectName: project2 + ArtifactOfProjectName: project3 + ArtifactOfProjectHomePage: https://example.com/3/ + ArtifactOfProjectName: project4 + ArtifactOfProjectURI: https://example.com/4/uri.whatever + FileComment: this is a file comment + FileNotice: This file may be used under either Apache-2.0 or Apache-1.1. + FileContributor: John Doe jdoe@example.com + FileContributor: EvilCorp + FileAttributionText: attributions + FileAttributionText: multi-line + attribution + FileDependency: f-1.txt + FileDependency: g.txt + + `) // render as buffer of bytes var got bytes.Buffer err := renderFile2_2(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -175,13 +175,13 @@ SnippetCopyrightText: NOASSERTION var got bytes.Buffer err := renderFile2_2(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -213,13 +213,13 @@ FileCopyrightText: Copyright (c) Jane Doe var got bytes.Buffer err := renderFile2_2(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -253,13 +253,13 @@ Copyright (c) John Doe var got bytes.Buffer err := renderFile2_2(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -303,12 +303,12 @@ under either Apache-2.0 or Apache-1.1. var got bytes.Buffer err := renderFile2_2(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v2/save_other_license_test.go b/tvsaver/saver2v2/save_other_license_test.go index 6b715220..4635e8e2 100644 --- a/tvsaver/saver2v2/save_other_license_test.go +++ b/tvsaver/saver2v2/save_other_license_test.go @@ -18,35 +18,35 @@ blah blah blah blah blah blah blah`, LicenseName: "License 1", LicenseCrossReferences: []string{ - "http://example.com/License1/", - "http://example.com/License1AnotherURL/", + "https://example.com/License1/", + "https://example.com/License1AnotherURL/", }, LicenseComment: "this is a license comment", } // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`LicenseID: LicenseRef-1 -ExtractedText: License 1 text -blah blah blah -blah blah blah blah -LicenseName: License 1 -LicenseCrossReference: http://example.com/License1/ -LicenseCrossReference: http://example.com/License1AnotherURL/ -LicenseComment: this is a license comment - -`) + ExtractedText: License 1 text + blah blah blah + blah blah blah blah + LicenseName: License 1 + LicenseCrossReference: https://example.com/License1/ + LicenseCrossReference: https://example.com/License1AnotherURL/ + LicenseComment: this is a license comment + + `) // render as buffer of bytes var got bytes.Buffer err := renderOtherLicense2_2(ol, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -72,12 +72,12 @@ LicenseName: License 1 var got bytes.Buffer err := renderOtherLicense2_2(ol, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v2/save_package_test.go b/tvsaver/saver2v2/save_package_test.go index 45f9851e..308fab5e 100644 --- a/tvsaver/saver2v2/save_package_test.go +++ b/tvsaver/saver2v2/save_package_test.go @@ -56,7 +56,7 @@ multi-line external ref comment`, PackageFileName: "p1-0.1.0-master.tar.gz", PackageSupplier: &common.Supplier{SupplierType: "Organization", Supplier: "John Doe, Inc."}, PackageOriginator: &common.Originator{Originator: "John Doe", OriginatorType: "Person"}, - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: true, IsFilesAnalyzedTagPresent: true, PackageVerificationCode: common.PackageVerificationCode{ @@ -77,7 +77,7 @@ multi-line external ref comment`, Value: "624c1abb3664f4b35547e7c73864ad24", }, }, - PackageHomePage: "http://example.com/p1", + PackageHomePage: "https://example.com/p1", PackageSourceInfo: "this is a source comment", PackageLicenseConcluded: "GPL-2.0-or-later", PackageLicenseInfoFromFiles: []string{ @@ -102,51 +102,51 @@ multi-line external ref comment`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageVersion: 0.1.0 -PackageFileName: p1-0.1.0-master.tar.gz -PackageSupplier: Organization: John Doe, Inc. -PackageOriginator: Person: John Doe -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: true -PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 (excludes: p1-0.1.0.spdx) -PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 -PackageHomePage: http://example.com/p1 -PackageSourceInfo: this is a source comment -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseInfoFromFiles: Apache-1.1 -PackageLicenseInfoFromFiles: Apache-2.0 -PackageLicenseInfoFromFiles: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageLicenseComments: this is a license comment(s) -PackageCopyrightText: Copyright (c) John Doe, Inc. -PackageSummary: this is a summary comment -PackageDescription: this is a description comment -PackageComment: this is a comment comment -ExternalRef: SECURITY cpe22Type cpe:/a:john_doe_inc:p1:0.1.0 -ExternalRefComment: this is an external ref comment #1 -ExternalRef: PACKAGE-MANAGER npm p1@0.1.0 -ExternalRefComment: this is a -multi-line external ref comment -ExternalRef: PERSISTENT-ID swh swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 -ExternalRef: OTHER anything anything-without-spaces-can-go-here -PackageAttributionText: Include this notice in all advertising materials - -`) + SPDXID: SPDXRef-p1 + PackageVersion: 0.1.0 + PackageFileName: p1-0.1.0-master.tar.gz + PackageSupplier: Organization: John Doe, Inc. + PackageOriginator: Person: John Doe + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: true + PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 (excludes: p1-0.1.0.spdx) + PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c + PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd + PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 + PackageHomePage: https://example.com/p1 + PackageSourceInfo: this is a source comment + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseInfoFromFiles: Apache-1.1 + PackageLicenseInfoFromFiles: Apache-2.0 + PackageLicenseInfoFromFiles: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageLicenseComments: this is a license comment(s) + PackageCopyrightText: Copyright (c) John Doe, Inc. + PackageSummary: this is a summary comment + PackageDescription: this is a description comment + PackageComment: this is a comment comment + ExternalRef: SECURITY cpe22Type cpe:/a:john_doe_inc:p1:0.1.0 + ExternalRefComment: this is an external ref comment #1 + ExternalRef: PACKAGE-MANAGER npm p1@0.1.0 + ExternalRefComment: this is a + multi-line external ref comment + ExternalRef: PERSISTENT-ID swh swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 + ExternalRef: OTHER anything anything-without-spaces-can-go-here + PackageAttributionText: Include this notice in all advertising materials + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_2(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -163,7 +163,7 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { PackageFileName: "p1-0.1.0-master.tar.gz", PackageSupplier: &common.Supplier{Supplier: "NOASSERTION"}, PackageOriginator: &common.Originator{OriginatorType: "Organization", Originator: "John Doe, Inc."}, - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: true, IsFilesAnalyzedTagPresent: false, PackageVerificationCode: common.PackageVerificationCode{Value: "0123456789abcdef0123456789abcdef01234567"}, @@ -181,7 +181,7 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { Value: "624c1abb3664f4b35547e7c73864ad24", }, }, - PackageHomePage: "http://example.com/p1", + PackageHomePage: "https://example.com/p1", PackageSourceInfo: "this is a source comment", PackageLicenseConcluded: "GPL-2.0-or-later", PackageLicenseInfoFromFiles: []string{ @@ -200,43 +200,43 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageVersion: 0.1.0 -PackageFileName: p1-0.1.0-master.tar.gz -PackageSupplier: NOASSERTION -PackageOriginator: Organization: John Doe, Inc. -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 -PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 -PackageHomePage: http://example.com/p1 -PackageSourceInfo: this is a source comment -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseInfoFromFiles: Apache-1.1 -PackageLicenseInfoFromFiles: Apache-2.0 -PackageLicenseInfoFromFiles: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageLicenseComments: this is a license comment(s) -PackageCopyrightText: Copyright (c) John Doe, Inc. -PackageSummary: this is a summary comment -PackageDescription: this is a description comment -PackageComment: this is a comment comment -PackageAttributionText: Include this notice in all advertising materials - -`) + SPDXID: SPDXRef-p1 + PackageVersion: 0.1.0 + PackageFileName: p1-0.1.0-master.tar.gz + PackageSupplier: NOASSERTION + PackageOriginator: Organization: John Doe, Inc. + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 + PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c + PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd + PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 + PackageHomePage: https://example.com/p1 + PackageSourceInfo: this is a source comment + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseInfoFromFiles: Apache-1.1 + PackageLicenseInfoFromFiles: Apache-2.0 + PackageLicenseInfoFromFiles: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageLicenseComments: this is a license comment(s) + PackageCopyrightText: Copyright (c) John Doe, Inc. + PackageSummary: this is a summary comment + PackageDescription: this is a description comment + PackageComment: this is a comment comment + PackageAttributionText: Include this notice in all advertising materials + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_2(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -254,7 +254,7 @@ func TestSaver2_2PackageSavesTextCombo3(t *testing.T) { PackageFileName: "p1-0.1.0-master.tar.gz", PackageSupplier: &common.Supplier{Supplier: "John Doe", SupplierType: "Person"}, PackageOriginator: &common.Originator{Originator: "NOASSERTION"}, - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, // NOTE that verification code MUST be omitted from output @@ -274,7 +274,7 @@ func TestSaver2_2PackageSavesTextCombo3(t *testing.T) { Value: "624c1abb3664f4b35547e7c73864ad24", }, }, - PackageHomePage: "http://example.com/p1", + PackageHomePage: "https://example.com/p1", PackageSourceInfo: "this is a source comment", PackageLicenseConcluded: "GPL-2.0-or-later", // NOTE that license info from files MUST be omitted from output @@ -300,43 +300,43 @@ which goes across two lines`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageVersion: 0.1.0 -PackageFileName: p1-0.1.0-master.tar.gz -PackageSupplier: Person: John Doe -PackageOriginator: NOASSERTION -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: false -PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 -PackageHomePage: http://example.com/p1 -PackageSourceInfo: this is a source comment -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageLicenseComments: this is a license comment(s) -PackageCopyrightText: Copyright (c) John Doe, Inc. -PackageSummary: this is a summary comment -PackageDescription: this is a description comment -PackageComment: this is a comment comment -PackageAttributionText: Include this notice in all advertising materials -PackageAttributionText: and also this notice -PackageAttributionText: and this multi-line notice -which goes across two lines - -`) + SPDXID: SPDXRef-p1 + PackageVersion: 0.1.0 + PackageFileName: p1-0.1.0-master.tar.gz + PackageSupplier: Person: John Doe + PackageOriginator: NOASSERTION + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: false + PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c + PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd + PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 + PackageHomePage: https://example.com/p1 + PackageSourceInfo: this is a source comment + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageLicenseComments: this is a license comment(s) + PackageCopyrightText: Copyright (c) John Doe, Inc. + PackageSummary: this is a summary comment + PackageDescription: this is a description comment + PackageComment: this is a comment comment + PackageAttributionText: Include this notice in all advertising materials + PackageAttributionText: and also this notice + PackageAttributionText: and this multi-line notice + which goes across two lines + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_2(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -344,7 +344,7 @@ func TestSaver2_2PackageSaveOmitsOptionalFieldsIfEmpty(t *testing.T) { pkg := &v2_2.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, // NOTE that verification code MUST be omitted from output, @@ -363,26 +363,26 @@ func TestSaver2_2PackageSaveOmitsOptionalFieldsIfEmpty(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: false -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageCopyrightText: Copyright (c) John Doe, Inc. - -`) + SPDXID: SPDXRef-p1 + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: false + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageCopyrightText: Copyright (c) John Doe, Inc. + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_2(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -418,7 +418,7 @@ func TestSaver2_2PackageSavesFilesIfPresent(t *testing.T) { pkg := &v2_2.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, // NOTE that verification code MUST be omitted from output, @@ -441,40 +441,40 @@ func TestSaver2_2PackageSavesFilesIfPresent(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: false -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageCopyrightText: Copyright (c) John Doe, Inc. - -FileName: /tmp/whatever1.txt -SPDXID: SPDXRef-File1231 -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -LicenseConcluded: Apache-2.0 -LicenseInfoInFile: Apache-2.0 -FileCopyrightText: Copyright (c) Jane Doe - -FileName: /tmp/whatever2.txt -SPDXID: SPDXRef-File1232 -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d -LicenseConcluded: MIT -LicenseInfoInFile: MIT -FileCopyrightText: Copyright (c) John Doe - -`) + SPDXID: SPDXRef-p1 + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: false + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageCopyrightText: Copyright (c) John Doe, Inc. + + FileName: /tmp/whatever1.txt + SPDXID: SPDXRef-File1231 + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c + LicenseConcluded: Apache-2.0 + LicenseInfoInFile: Apache-2.0 + FileCopyrightText: Copyright (c) Jane Doe + + FileName: /tmp/whatever2.txt + SPDXID: SPDXRef-File1232 + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d + LicenseConcluded: MIT + LicenseInfoInFile: MIT + FileCopyrightText: Copyright (c) John Doe + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_2(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -482,7 +482,7 @@ func TestSaver2_2PackageWrapsMultiLine(t *testing.T) { pkg := &v2_2.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, PackageLicenseConcluded: "GPL-2.0-or-later", @@ -498,26 +498,26 @@ Copyright Jane Doe`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: false -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageCopyrightText: Copyright (c) John Doe, Inc. -Copyright Jane Doe - -`) + SPDXID: SPDXRef-p1 + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: false + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageCopyrightText: Copyright (c) John Doe, Inc. + Copyright Jane Doe + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_2(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v2/save_relationship_test.go b/tvsaver/saver2v2/save_relationship_test.go index 927164c3..620c43ae 100644 --- a/tvsaver/saver2v2/save_relationship_test.go +++ b/tvsaver/saver2v2/save_relationship_test.go @@ -29,13 +29,13 @@ RelationshipComment: this is a comment var got bytes.Buffer err := renderRelationship2_2(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -54,13 +54,13 @@ func TestSaver2_2RelationshipOmitsOptionalFieldsIfEmpty(t *testing.T) { var got bytes.Buffer err := renderRelationship2_2(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -79,13 +79,13 @@ func TestSaver2_2RelationshipCanHaveNONEOnRight(t *testing.T) { var got bytes.Buffer err := renderRelationship2_2(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -104,13 +104,13 @@ func TestSaver2_2RelationshipCanHaveNOASSERTIONOnRight(t *testing.T) { var got bytes.Buffer err := renderRelationship2_2(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -134,12 +134,12 @@ multi-line comment var got bytes.Buffer err := renderRelationship2_2(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_annotation_test.go b/tvsaver/saver2v3/save_annotation_test.go index 7471260a..e5392790 100644 --- a/tvsaver/saver2v3/save_annotation_test.go +++ b/tvsaver/saver2v3/save_annotation_test.go @@ -33,13 +33,13 @@ AnnotationComment: This is an annotation about the SPDX document var got bytes.Buffer err := renderAnnotation2_3(ann, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -65,13 +65,13 @@ AnnotationComment: This is an annotation about the SPDX document var got bytes.Buffer err := renderAnnotation2_3(ann, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -97,13 +97,13 @@ AnnotationComment: This is an annotation about the SPDX document var got bytes.Buffer err := renderAnnotation2_3(ann, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_creation_info_test.go b/tvsaver/saver2v3/save_creation_info_test.go index a433dc5a..ababeaa5 100644 --- a/tvsaver/saver2v3/save_creation_info_test.go +++ b/tvsaver/saver2v3/save_creation_info_test.go @@ -45,13 +45,13 @@ CreatorComment: this is a creator comment var got bytes.Buffer err := renderCreationInfo2_3(ci, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -74,13 +74,13 @@ Created: 2018-10-10T06:20:00Z var got1 bytes.Buffer err := renderCreationInfo2_3(ci1, &got1) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c1 := bytes.Compare(want1.Bytes(), got1.Bytes()) if c1 != 0 { - t.Errorf("Expected %v, got %v", want1.String(), got1.String()) + t.Errorf("expected %v, got %v", want1.String(), got1.String()) } // --- need at least one creator; now switch to organization --- @@ -101,12 +101,12 @@ Created: 2018-10-10T06:20:00Z var got2 bytes.Buffer err = renderCreationInfo2_3(ci2, &got2) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c2 := bytes.Compare(want2.Bytes(), got2.Bytes()) if c2 != 0 { - t.Errorf("Expected %v, got %v", want2.String(), got2.String()) + t.Errorf("expected %v, got %v", want2.String(), got2.String()) } } diff --git a/tvsaver/saver2v3/save_document_test.go b/tvsaver/saver2v3/save_document_test.go index 10aa3115..e856f230 100644 --- a/tvsaver/saver2v3/save_document_test.go +++ b/tvsaver/saver2v3/save_document_test.go @@ -321,13 +321,13 @@ ReviewComment: I have reviewed this SPDX document and it is awesome var got bytes.Buffer err := RenderDocument2_3(doc, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected {{{%v}}}, got {{{%v}}}", want.String(), got.String()) + t.Errorf("expected {{{%v}}}, got {{{%v}}}", want.String(), got.String()) } } @@ -338,6 +338,6 @@ func TestSaver2_3DocumentReturnsErrorIfNilCreationInfo(t *testing.T) { var got bytes.Buffer err := RenderDocument2_3(doc, &got) if err == nil { - t.Errorf("Expected error, got nil") + t.Errorf("expected error, got nil") } } diff --git a/tvsaver/saver2v3/save_file_test.go b/tvsaver/saver2v3/save_file_test.go index 05fc2cf4..e2d4ff26 100644 --- a/tvsaver/saver2v3/save_file_test.go +++ b/tvsaver/saver2v3/save_file_test.go @@ -103,13 +103,13 @@ FileDependency: g.txt var got bytes.Buffer err := renderFile2_3(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -175,13 +175,13 @@ SnippetCopyrightText: NOASSERTION var got bytes.Buffer err := renderFile2_3(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -213,13 +213,13 @@ FileCopyrightText: Copyright (c) Jane Doe var got bytes.Buffer err := renderFile2_3(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -253,13 +253,13 @@ Copyright (c) John Doe var got bytes.Buffer err := renderFile2_3(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -303,12 +303,12 @@ under either Apache-2.0 or Apache-1.1. var got bytes.Buffer err := renderFile2_3(f, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_other_license_test.go b/tvsaver/saver2v3/save_other_license_test.go index 00134dd5..45105c99 100644 --- a/tvsaver/saver2v3/save_other_license_test.go +++ b/tvsaver/saver2v3/save_other_license_test.go @@ -40,13 +40,13 @@ LicenseComment: this is a license comment var got bytes.Buffer err := renderOtherLicense2_3(ol, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -72,12 +72,12 @@ LicenseName: License 1 var got bytes.Buffer err := renderOtherLicense2_3(ol, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_package_test.go b/tvsaver/saver2v3/save_package_test.go index 435b5b59..bf7d2e6f 100644 --- a/tvsaver/saver2v3/save_package_test.go +++ b/tvsaver/saver2v3/save_package_test.go @@ -148,13 +148,13 @@ PackageAttributionText: Include this notice in all advertising materials var got bytes.Buffer err := renderPackage2_3(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -238,13 +238,13 @@ PackageAttributionText: Include this notice in all advertising materials var got bytes.Buffer err := renderPackage2_3(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -338,13 +338,13 @@ which goes across two lines var got bytes.Buffer err := renderPackage2_3(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -384,13 +384,13 @@ PackageCopyrightText: Copyright (c) John Doe, Inc. var got bytes.Buffer err := renderPackage2_3(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -476,13 +476,13 @@ FileCopyrightText: Copyright (c) John Doe var got bytes.Buffer err := renderPackage2_3(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -490,7 +490,7 @@ func TestSaver2_3PackageWrapsMultiLine(t *testing.T) { pkg := &v2_3.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, PackageLicenseConcluded: "GPL-2.0-or-later", @@ -506,26 +506,26 @@ Copyright Jane Doe`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 -SPDXID: SPDXRef-p1 -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: false -PackageLicenseConcluded: GPL-2.0-or-later -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageCopyrightText: Copyright (c) John Doe, Inc. -Copyright Jane Doe - -`) + SPDXID: SPDXRef-p1 + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: false + PackageLicenseConcluded: GPL-2.0-or-later + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageCopyrightText: Copyright (c) John Doe, Inc. + Copyright Jane Doe + + `) // render as buffer of bytes var got bytes.Buffer err := renderPackage2_3(pkg, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_relationship_test.go b/tvsaver/saver2v3/save_relationship_test.go index 26ce0c3e..d8f692a2 100644 --- a/tvsaver/saver2v3/save_relationship_test.go +++ b/tvsaver/saver2v3/save_relationship_test.go @@ -29,13 +29,13 @@ RelationshipComment: this is a comment var got bytes.Buffer err := renderRelationship2_3(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -54,13 +54,13 @@ func TestSaver2_3RelationshipOmitsOptionalFieldsIfEmpty(t *testing.T) { var got bytes.Buffer err := renderRelationship2_3(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -79,13 +79,13 @@ func TestSaver2_3RelationshipCanHaveNONEOnRight(t *testing.T) { var got bytes.Buffer err := renderRelationship2_3(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -104,13 +104,13 @@ func TestSaver2_3RelationshipCanHaveNOASSERTIONOnRight(t *testing.T) { var got bytes.Buffer err := renderRelationship2_3(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -134,12 +134,12 @@ multi-line comment var got bytes.Buffer err := renderRelationship2_3(rln, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_review_test.go b/tvsaver/saver2v3/save_review_test.go index 5eec3bc7..a5ef506d 100644 --- a/tvsaver/saver2v3/save_review_test.go +++ b/tvsaver/saver2v3/save_review_test.go @@ -29,13 +29,13 @@ ReviewComment: this is a review comment var got bytes.Buffer err := renderReview2_3(rev, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -56,13 +56,13 @@ ReviewDate: 2018-10-14T10:28:00Z var got bytes.Buffer err := renderReview2_3(rev, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -87,12 +87,12 @@ multi-line review comment var got bytes.Buffer err := renderReview2_3(rev, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/save_snippet_test.go b/tvsaver/saver2v3/save_snippet_test.go index ef101942..01603656 100644 --- a/tvsaver/saver2v3/save_snippet_test.go +++ b/tvsaver/saver2v3/save_snippet_test.go @@ -57,13 +57,13 @@ SnippetAttributionText: some attributions var got bytes.Buffer err := renderSnippet2_3(sn, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -94,13 +94,13 @@ SnippetCopyrightText: Copyright (c) John Doe 20x6 var got bytes.Buffer err := renderSnippet2_3(sn, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } @@ -133,12 +133,12 @@ Copyright (c) John Doe 20x6 var got bytes.Buffer err := renderSnippet2_3(sn, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected %v, got %v", want.String(), got.String()) + t.Errorf("expected %v, got %v", want.String(), got.String()) } } diff --git a/tvsaver/saver2v3/util_test.go b/tvsaver/saver2v3/util_test.go index b4b7553b..15f8bf92 100644 --- a/tvsaver/saver2v3/util_test.go +++ b/tvsaver/saver2v3/util_test.go @@ -16,7 +16,7 @@ a newline in it` got := textify(s) if want != got { - t.Errorf("Expected %s, got %s", want, got) + t.Errorf("expected %s, got %s", want, got) } } @@ -27,6 +27,6 @@ func TestTextifyDoesNotWrapsStringWithNoNewline(t *testing.T) { got := textify(s) if want != got { - t.Errorf("Expected %s, got %s", want, got) + t.Errorf("expected %s, got %s", want, got) } } From 7d9314e292af78f885bc94b327dde86a7991b5e5 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 18:05:07 +0200 Subject: [PATCH 02/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- tvloader/parser2v2/parse_file_test.go | 28 +-- .../parser2v2/parse_other_license_test.go | 8 +- tvloader/parser2v2/parse_package_test.go | 6 +- tvloader/parser2v2/parse_review_test.go | 10 +- tvloader/parser2v2/parse_snippet_test.go | 28 +-- tvsaver/saver2v1/save_document_test.go | 218 +++++++++--------- 6 files changed, 149 insertions(+), 149 deletions(-) diff --git a/tvloader/parser2v2/parse_file_test.go b/tvloader/parser2v2/parse_file_test.go index 0bcea7d7..975547ec 100644 --- a/tvloader/parser2v2/parse_file_test.go +++ b/tvloader/parser2v2/parse_file_test.go @@ -510,11 +510,11 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "http://example.com/1/") + err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "https://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -528,7 +528,7 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "http://example.com/3/") + err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "https://example.com/3/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -537,7 +537,7 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "http://example.com/4/uri.whatever") + err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "https://example.com/4/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -550,11 +550,11 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if aop.Name != "project1" { t.Errorf("expected %v, got %v", "project1", aop.Name) } - if aop.HomePage != "http://example.com/1/" { - t.Errorf("expected %v, got %v", "http://example.com/1/", aop.HomePage) + if aop.HomePage != "https://example.com/1/" { + t.Errorf("expected %v, got %v", "https://example.com/1/", aop.HomePage) } - if aop.URI != "http://example.com/1/uri.whatever" { - t.Errorf("expected %v, got %v", "http://example.com/1/uri.whatever", aop.URI) + if aop.URI != "https://example.com/1/uri.whatever" { + t.Errorf("expected %v, got %v", "https://example.com/1/uri.whatever", aop.URI) } aop = parser.file.ArtifactOfProjects[1] @@ -572,8 +572,8 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if aop.Name != "project3" { t.Errorf("expected %v, got %v", "project3", aop.Name) } - if aop.HomePage != "http://example.com/3/" { - t.Errorf("expected %v, got %v", "http://example.com/3/", aop.HomePage) + if aop.HomePage != "https://example.com/3/" { + t.Errorf("expected %v, got %v", "https://example.com/3/", aop.HomePage) } if aop.URI != "" { t.Errorf("expected %v, got %v", "", aop.URI) @@ -586,8 +586,8 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if aop.HomePage != "" { t.Errorf("expected %v, got %v", "", aop.HomePage) } - if aop.URI != "http://example.com/4/uri.whatever" { - t.Errorf("expected %v, got %v", "http://example.com/4/uri.whatever", aop.URI) + if aop.URI != "https://example.com/4/uri.whatever" { + t.Errorf("expected %v, got %v", "https://example.com/4/uri.whatever", aop.URI) } // File Comment @@ -771,7 +771,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { curPtr := parser.fileAOP // now, a home page; pointer should stay - err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "http://example.com/1/") + err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "https://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -780,7 +780,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { } // a URI; pointer should stay - err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } diff --git a/tvloader/parser2v2/parse_other_license_test.go b/tvloader/parser2v2/parse_other_license_test.go index cdba8401..97c45254 100644 --- a/tvloader/parser2v2/parse_other_license_test.go +++ b/tvloader/parser2v2/parse_other_license_test.go @@ -30,7 +30,7 @@ func TestParser2_2OLStartsNewOtherLicenseAfterParsingLicenseIDTag(t *testing.T) // the Document's OtherLicenses should have this one only if parser.doc.OtherLicenses[0] != olic1 { - t.Errorf("Expected other license %v in OtherLicenses[0], got %v", olic1, parser.doc.OtherLicenses[0]) + t.Errorf("expected other license %v in OtherLicenses[0], got %v", olic1, parser.doc.OtherLicenses[0]) } if parser.doc.OtherLicenses[0].LicenseName != olname1 { t.Errorf("expected other license name %s in OtherLicenses[0], got %s", olname1, parser.doc.OtherLicenses[0].LicenseName) @@ -66,10 +66,10 @@ func TestParser2_2OLStartsNewOtherLicenseAfterParsingLicenseIDTag(t *testing.T) } // and the Document's Other Licenses should be of size 2 and have these two if len(parser.doc.OtherLicenses) != 2 { - t.Fatalf("Expected OtherLicenses to have len 2, got %d", len(parser.doc.OtherLicenses)) + t.Fatalf("expected OtherLicenses to have len 2, got %d", len(parser.doc.OtherLicenses)) } if parser.doc.OtherLicenses[0] != olic1 { - t.Errorf("Expected other license %v in OtherLicenses[0], got %v", olic1, parser.doc.OtherLicenses[0]) + t.Errorf("expected other license %v in OtherLicenses[0], got %v", olic1, parser.doc.OtherLicenses[0]) } if parser.doc.OtherLicenses[0].LicenseIdentifier != olid1 { t.Errorf("expected other license ID %s in OtherLicenses[0], got %s", olid1, parser.doc.OtherLicenses[0].LicenseIdentifier) @@ -78,7 +78,7 @@ func TestParser2_2OLStartsNewOtherLicenseAfterParsingLicenseIDTag(t *testing.T) t.Errorf("expected other license name %s in OtherLicenses[0], got %s", olname1, parser.doc.OtherLicenses[0].LicenseName) } if parser.doc.OtherLicenses[1] != parser.otherLic { - t.Errorf("Expected other license %v in OtherLicenses[1], got %v", parser.otherLic, parser.doc.OtherLicenses[1]) + t.Errorf("expected other license %v in OtherLicenses[1], got %v", parser.otherLic, parser.doc.OtherLicenses[1]) } if parser.doc.OtherLicenses[1].LicenseIdentifier != olid2 { t.Errorf("expected other license ID %s in OtherLicenses[1], got %s", olid2, parser.doc.OtherLicenses[1].LicenseIdentifier) diff --git a/tvloader/parser2v2/parse_package_test.go b/tvloader/parser2v2/parse_package_test.go index e07cf5ad..f65fad2b 100644 --- a/tvloader/parser2v2/parse_package_test.go +++ b/tvloader/parser2v2/parse_package_test.go @@ -60,7 +60,7 @@ func TestParser2_2PackageStartsNewPackageAfterParsingPackageNameTag(t *testing.T } // and the Document's Packages should still be of size 1 and have pkgOld only if parser.doc.Packages[0] != pkgOld { - t.Errorf("Expected package %v, got %v", pkgOld, parser.doc.Packages[0]) + t.Errorf("expected package %v, got %v", pkgOld, parser.doc.Packages[0]) } if len(parser.doc.Packages) != 1 { t.Errorf("expected 1 package, got %d", len(parser.doc.Packages)) @@ -77,7 +77,7 @@ func TestParser2_2PackageStartsNewPackageAfterParsingPackageNameTagWhileInUnpack } // the Document's Packages should be empty if len(parser.doc.Packages) != 0 { - t.Errorf("Expected zero packages, got %d", len(parser.doc.Packages)) + t.Errorf("expected zero packages, got %d", len(parser.doc.Packages)) } // now add a new package @@ -108,7 +108,7 @@ func TestParser2_2PackageStartsNewPackageAfterParsingPackageNameTagWhileInUnpack // and the Document's Packages should be of size 0, because the prior was // unpackaged files and this one won't be added until an SPDXID is seen if len(parser.doc.Packages) != 0 { - t.Errorf("Expected %v packages in doc, got %v", 0, len(parser.doc.Packages)) + t.Errorf("expected %v packages in doc, got %v", 0, len(parser.doc.Packages)) } } diff --git a/tvloader/parser2v2/parse_review_test.go b/tvloader/parser2v2/parse_review_test.go index f93afbf8..64db597f 100644 --- a/tvloader/parser2v2/parse_review_test.go +++ b/tvloader/parser2v2/parse_review_test.go @@ -33,10 +33,10 @@ func TestParser2_2ReviewStartsNewReviewAfterParsingReviewerTag(t *testing.T) { // the Document's Reviews should have this one only if len(parser.doc.Reviews) != 1 { - t.Errorf("Expected only one review, got %d", len(parser.doc.Reviews)) + t.Errorf("expected only one review, got %d", len(parser.doc.Reviews)) } if parser.doc.Reviews[0] != r1 { - t.Errorf("Expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) + t.Errorf("expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) } if parser.doc.Reviews[0].Reviewer != rev1 { t.Errorf("expected review name %s in Reviews[0], got %s", rev1, parser.doc.Reviews[0].Reviewer) @@ -63,16 +63,16 @@ func TestParser2_2ReviewStartsNewReviewAfterParsingReviewerTag(t *testing.T) { } // and the Document's reviews should be of size 2 and have these two if len(parser.doc.Reviews) != 2 { - t.Fatalf("Expected Reviews to have len 2, got %d", len(parser.doc.Reviews)) + t.Fatalf("expected Reviews to have len 2, got %d", len(parser.doc.Reviews)) } if parser.doc.Reviews[0] != r1 { - t.Errorf("Expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) + t.Errorf("expected review %v in Reviews[0], got %v", r1, parser.doc.Reviews[0]) } if parser.doc.Reviews[0].Reviewer != rev1 { t.Errorf("expected reviewer name %s in Reviews[0], got %s", rev1, parser.doc.Reviews[0].Reviewer) } if parser.doc.Reviews[1] != parser.rev { - t.Errorf("Expected review %v in Reviews[1], got %v", parser.rev, parser.doc.Reviews[1]) + t.Errorf("expected review %v in Reviews[1], got %v", parser.rev, parser.doc.Reviews[1]) } if parser.doc.Reviews[1].Reviewer != rev2 { t.Errorf("expected reviewer name %s in Reviews[1], got %s", rev2, parser.doc.Reviews[1].Reviewer) diff --git a/tvloader/parser2v2/parse_snippet_test.go b/tvloader/parser2v2/parse_snippet_test.go index 1d6ddb2b..886617a5 100644 --- a/tvloader/parser2v2/parse_snippet_test.go +++ b/tvloader/parser2v2/parse_snippet_test.go @@ -26,10 +26,10 @@ func TestParser2_2SnippetStartsNewSnippetAfterParsingSnippetSPDXIDTag(t *testing // the File's Snippets should have this one only if len(parser.file.Snippets) != 1 { - t.Errorf("Expected len(Snippets) to be 1, got %d", len(parser.file.Snippets)) + t.Errorf("expected len(Snippets) to be 1, got %d", len(parser.file.Snippets)) } if parser.file.Snippets["s1"] != s1 { - t.Errorf("Expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) + t.Errorf("expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) } if parser.file.Snippets["s1"].SnippetSPDXIdentifier != sid1 { t.Errorf("expected snippet ID %s in Snippets[s1], got %s", sid1, parser.file.Snippets["s1"].SnippetSPDXIdentifier) @@ -54,10 +54,10 @@ func TestParser2_2SnippetStartsNewSnippetAfterParsingSnippetSPDXIDTag(t *testing } // and the File's Snippets should be of size 2 and have these two if len(parser.file.Snippets) != 2 { - t.Errorf("Expected len(Snippets) to be 2, got %d", len(parser.file.Snippets)) + t.Errorf("expected len(Snippets) to be 2, got %d", len(parser.file.Snippets)) } if parser.file.Snippets["s1"] != s1 { - t.Errorf("Expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) + t.Errorf("expected snippet %v in Snippets[s1], got %v", s1, parser.file.Snippets["s1"]) } if parser.file.Snippets["s1"].SnippetSPDXIdentifier != sid1 { t.Errorf("expected snippet ID %s in Snippets[s1], got %s", sid1, parser.file.Snippets["s1"].SnippetSPDXIdentifier) @@ -112,35 +112,35 @@ func TestParser2_2SnippetStartsNewPackageAfterParsingPackageNameTag(t *testing.T // and the Document's Packages should still be of size 1 b/c no SPDX // identifier has been seen yet if len(parser.doc.Packages) != 1 { - t.Errorf("Expected len(Packages) to be 1, got %d", len(parser.doc.Packages)) + t.Errorf("expected len(Packages) to be 1, got %d", len(parser.doc.Packages)) } if parser.doc.Packages[0] != p1 { - t.Errorf("Expected package %v in Packages[package1], got %v", p1, parser.doc.Packages[0]) + t.Errorf("expected package %v in Packages[package1], got %v", p1, parser.doc.Packages[0]) } if parser.doc.Packages[0].PackageName != "package1" { t.Errorf("expected package name %s in Packages[package1], got %s", "package1", parser.doc.Packages[0].PackageName) } // and the first Package's Files should be of size 1 and have f1 only if len(parser.doc.Packages[0].Files) != 1 { - t.Errorf("Expected 1 file in Packages[package1].Files, got %d", len(parser.doc.Packages[0].Files)) + t.Errorf("expected 1 file in Packages[package1].Files, got %d", len(parser.doc.Packages[0].Files)) } if parser.doc.Packages[0].Files[0] != f1 { - t.Errorf("Expected file %v in Files[f1], got %v", f1, parser.doc.Packages[0].Files[0]) + t.Errorf("expected file %v in Files[f1], got %v", f1, parser.doc.Packages[0].Files[0]) } if parser.doc.Packages[0].Files[0].FileName != "f1.txt" { t.Errorf("expected file name %s in Files[f1], got %s", "f1.txt", parser.doc.Packages[0].Files[0].FileName) } // and the new Package should have no files if len(parser.pkg.Files) != 0 { - t.Errorf("Expected no files in Packages[1].Files, got %d", len(parser.pkg.Files)) + t.Errorf("expected no files in Packages[1].Files, got %d", len(parser.pkg.Files)) } // and the current file should be nil if parser.file != nil { - t.Errorf("Expected nil for parser.file, got %v", parser.file) + t.Errorf("expected nil for parser.file, got %v", parser.file) } // and the current snippet should be nil if parser.snippet != nil { - t.Errorf("Expected nil for parser.snippet, got %v", parser.snippet) + t.Errorf("expected nil for parser.snippet, got %v", parser.snippet) } } @@ -183,17 +183,17 @@ func TestParser2_2SnippetMovesToFileAfterParsingFileNameTag(t *testing.T) { // and the Package's Files should still be of size 1 since we haven't seen // an SPDX identifier yet for this new file if len(parser.pkg.Files) != 1 { - t.Errorf("Expected len(Files) to be 1, got %d", len(parser.pkg.Files)) + t.Errorf("expected len(Files) to be 1, got %d", len(parser.pkg.Files)) } if parser.pkg.Files[0] != f1 { - t.Errorf("Expected file %v in Files[f1], got %v", f1, parser.pkg.Files[0]) + t.Errorf("expected file %v in Files[f1], got %v", f1, parser.pkg.Files[0]) } if parser.pkg.Files[0].FileName != f1Name { t.Errorf("expected file name %s in Files[f1], got %s", f1Name, parser.pkg.Files[0].FileName) } // and the current snippet should be nil if parser.snippet != nil { - t.Errorf("Expected nil for parser.snippet, got %v", parser.snippet) + t.Errorf("expected nil for parser.snippet, got %v", parser.snippet) } } diff --git a/tvsaver/saver2v1/save_document_test.go b/tvsaver/saver2v1/save_document_test.go index 1447c07a..e290c887 100644 --- a/tvsaver/saver2v1/save_document_test.go +++ b/tvsaver/saver2v1/save_document_test.go @@ -91,7 +91,7 @@ func TestSaver2_1DocumentSavesText(t *testing.T) { pkgWith := &v2_1.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: true, IsFilesAnalyzedTagPresent: true, PackageVerificationCode: common.PackageVerificationCode{Value: "0123456789abcdef0123456789abcdef01234567"}, @@ -208,114 +208,114 @@ blah blah blah blah`, } want := bytes.NewBufferString(`SPDXVersion: SPDX-2.1 -DataLicense: CC0-1.0 -SPDXID: SPDXRef-DOCUMENT -DocumentName: spdx-go-0.0.1.abcdef -DocumentNamespace: https://github.com/swinslow/spdx-docs/spdx-go/spdx-go-0.0.1.abcdef.whatever -Creator: Person: John Doe -Created: 2018-10-10T06:20:00Z - -##### Unpackaged files - -FileName: /tmp/whatever1.txt -SPDXID: SPDXRef-File1231 -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -LicenseConcluded: Apache-2.0 -LicenseInfoInFile: Apache-2.0 -FileCopyrightText: Copyright (c) Jane Doe - -FileName: /tmp/whatever2.txt -SPDXID: SPDXRef-File1232 -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d -LicenseConcluded: MIT -LicenseInfoInFile: MIT -FileCopyrightText: Copyright (c) John Doe - -##### Package: p1 - -PackageName: p1 -SPDXID: SPDXRef-p1 -PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz -FilesAnalyzed: true -PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 -PackageLicenseConcluded: GPL-2.0-or-later AND BSD-3-Clause AND WTFPL -PackageLicenseInfoFromFiles: Apache-2.0 -PackageLicenseInfoFromFiles: GPL-2.0-or-later -PackageLicenseInfoFromFiles: WTFPL -PackageLicenseInfoFromFiles: BSD-3-Clause -PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later -PackageCopyrightText: Copyright (c) John Doe, Inc. - -FileName: /tmp/another-file.txt -SPDXID: SPDXRef-FileAnother -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983f -LicenseConcluded: BSD-3-Clause -LicenseInfoInFile: BSD-3-Clause -FileCopyrightText: Copyright (c) Jane Doe LLC - -FileName: /tmp/file-with-snippets.txt -SPDXID: SPDXRef-FileHasSnippets -FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983e -LicenseConcluded: GPL-2.0-or-later AND WTFPL -LicenseInfoInFile: Apache-2.0 -LicenseInfoInFile: GPL-2.0-or-later -LicenseInfoInFile: WTFPL -FileCopyrightText: Copyright (c) Jane Doe - -SnippetSPDXID: SPDXRef-Snippet19 -SnippetFromFileSPDXID: SPDXRef-FileHasSnippets -SnippetByteRange: 17:209 -SnippetLicenseConcluded: GPL-2.0-or-later -SnippetCopyrightText: Copyright (c) John Doe 20x6 - -SnippetSPDXID: SPDXRef-Snippet20 -SnippetFromFileSPDXID: SPDXRef-FileHasSnippets -SnippetByteRange: 268:309 -SnippetLicenseConcluded: WTFPL -SnippetCopyrightText: NOASSERTION - -##### Other Licenses - -LicenseID: LicenseRef-1 -ExtractedText: License 1 text -blah blah blah -blah blah blah blah -LicenseName: License 1 - -LicenseID: LicenseRef-2 -ExtractedText: License 2 text - this is a license that does some stuff -LicenseName: License 2 - -##### Relationships - -Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-p1 -Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1231 -Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1232 - -##### Annotations - -Annotator: Person: John Doe -AnnotationDate: 2018-10-10T17:52:00Z -AnnotationType: REVIEW -SPDXREF: SPDXRef-DOCUMENT -AnnotationComment: This is an annotation about the SPDX document - -Annotator: Organization: John Doe, Inc. -AnnotationDate: 2018-10-10T17:52:00Z -AnnotationType: REVIEW -SPDXREF: SPDXRef-p1 -AnnotationComment: This is an annotation about Package p1 - -##### Reviews - -Reviewer: Person: John Doe -ReviewDate: 2018-10-14T10:28:00Z - -Reviewer: Organization: Jane Doe LLC -ReviewDate: 2018-10-14T10:28:00Z -ReviewComment: I have reviewed this SPDX document and it is awesome - -`) + DataLicense: CC0-1.0 + SPDXID: SPDXRef-DOCUMENT + DocumentName: spdx-go-0.0.1.abcdef + DocumentNamespace: https://github.com/swinslow/spdx-docs/spdx-go/spdx-go-0.0.1.abcdef.whatever + Creator: Person: John Doe + Created: 2018-10-10T06:20:00Z + + ##### Unpackaged files + + FileName: /tmp/whatever1.txt + SPDXID: SPDXRef-File1231 + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c + LicenseConcluded: Apache-2.0 + LicenseInfoInFile: Apache-2.0 + FileCopyrightText: Copyright (c) Jane Doe + + FileName: /tmp/whatever2.txt + SPDXID: SPDXRef-File1232 + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d + LicenseConcluded: MIT + LicenseInfoInFile: MIT + FileCopyrightText: Copyright (c) John Doe + + ##### Package: p1 + + PackageName: p1 + SPDXID: SPDXRef-p1 + PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + FilesAnalyzed: true + PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 + PackageLicenseConcluded: GPL-2.0-or-later AND BSD-3-Clause AND WTFPL + PackageLicenseInfoFromFiles: Apache-2.0 + PackageLicenseInfoFromFiles: GPL-2.0-or-later + PackageLicenseInfoFromFiles: WTFPL + PackageLicenseInfoFromFiles: BSD-3-Clause + PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later + PackageCopyrightText: Copyright (c) John Doe, Inc. + + FileName: /tmp/another-file.txt + SPDXID: SPDXRef-FileAnother + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983f + LicenseConcluded: BSD-3-Clause + LicenseInfoInFile: BSD-3-Clause + FileCopyrightText: Copyright (c) Jane Doe LLC + + FileName: /tmp/file-with-snippets.txt + SPDXID: SPDXRef-FileHasSnippets + FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983e + LicenseConcluded: GPL-2.0-or-later AND WTFPL + LicenseInfoInFile: Apache-2.0 + LicenseInfoInFile: GPL-2.0-or-later + LicenseInfoInFile: WTFPL + FileCopyrightText: Copyright (c) Jane Doe + + SnippetSPDXID: SPDXRef-Snippet19 + SnippetFromFileSPDXID: SPDXRef-FileHasSnippets + SnippetByteRange: 17:209 + SnippetLicenseConcluded: GPL-2.0-or-later + SnippetCopyrightText: Copyright (c) John Doe 20x6 + + SnippetSPDXID: SPDXRef-Snippet20 + SnippetFromFileSPDXID: SPDXRef-FileHasSnippets + SnippetByteRange: 268:309 + SnippetLicenseConcluded: WTFPL + SnippetCopyrightText: NOASSERTION + + ##### Other Licenses + + LicenseID: LicenseRef-1 + ExtractedText: License 1 text + blah blah blah + blah blah blah blah + LicenseName: License 1 + + LicenseID: LicenseRef-2 + ExtractedText: License 2 text - this is a license that does some stuff + LicenseName: License 2 + + ##### Relationships + + Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-p1 + Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1231 + Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1232 + + ##### Annotations + + Annotator: Person: John Doe + AnnotationDate: 2018-10-10T17:52:00Z + AnnotationType: REVIEW + SPDXREF: SPDXRef-DOCUMENT + AnnotationComment: This is an annotation about the SPDX document + + Annotator: Organization: John Doe, Inc. + AnnotationDate: 2018-10-10T17:52:00Z + AnnotationType: REVIEW + SPDXREF: SPDXRef-p1 + AnnotationComment: This is an annotation about Package p1 + + ##### Reviews + + Reviewer: Person: John Doe + ReviewDate: 2018-10-14T10:28:00Z + + Reviewer: Organization: Jane Doe LLC + ReviewDate: 2018-10-14T10:28:00Z + ReviewComment: I have reviewed this SPDX document and it is awesome + + `) // render as buffer of bytes var got bytes.Buffer From c0fd445669c87ee48965f1ca6e0adec1d13470ae Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 19:12:44 +0200 Subject: [PATCH 03/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- rdfloader/parser2v2/constants.go | 8 +- rdfloader/parser2v2/license_utils_test.go | 6 +- rdfloader/parser2v2/parse_annotation_test.go | 8 +- rdfloader/parser2v2/parse_file_test.go | 72 +++--- rdfloader/parser2v2/parse_package_test.go | 205 +++++++++--------- .../parser2v2/parse_snippet_info_test.go | 4 +- .../parser2v2/parse_spdx_document_test.go | 2 +- rdfloader/parser2v3/constants.go | 8 +- rdfloader/parser2v3/license_utils_test.go | 22 +- rdfloader/parser2v3/parse_annotation_test.go | 58 ++--- rdfloader/parser2v3/parse_file_test.go | 74 +++---- rdfloader/rdfloader.go | 4 +- tvsaver/saver2v2/save_package_test.go | 19 +- 13 files changed, 244 insertions(+), 246 deletions(-) diff --git a/rdfloader/parser2v2/constants.go b/rdfloader/parser2v2/constants.go index eb09cab9..0a29e14c 100644 --- a/rdfloader/parser2v2/constants.go +++ b/rdfloader/parser2v2/constants.go @@ -6,11 +6,11 @@ import "github.com/spdx/gordf/rdfloader/parser" var ( // NS_SPDX NAMESPACES - NS_SPDX = "https://spdx.org/rdf/terms#" - NS_RDFS = "https://www.w3.org/2000/01/rdf-schema#" + NS_SPDX = "http://spdx.org/rdf/terms#" + NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#" NS_RDF = parser.RDFNS - NS_PTR = "https://www.w3.org/2009/pointers#" - NS_DOAP = "https://usefulinc.com/ns/doap#" + NS_PTR = "http://www.w3.org/2009/pointers#" + NS_DOAP = "http://usefulinc.com/ns/doap#" // SPDX_SPEC_VERSION SPDX properties SPDX_SPEC_VERSION = NS_SPDX + "specVersion" diff --git a/rdfloader/parser2v2/license_utils_test.go b/rdfloader/parser2v2/license_utils_test.go index 9bc86ddd..b308851b 100644 --- a/rdfloader/parser2v2/license_utils_test.go +++ b/rdfloader/parser2v2/license_utils_test.go @@ -40,7 +40,7 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) checksumNode := parser.gordfParserObj.Triples[0].Subject @@ -53,7 +53,7 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) @@ -67,7 +67,7 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) checksumNode = parser.gordfParserObj.Triples[0].Subject diff --git a/rdfloader/parser2v2/parse_annotation_test.go b/rdfloader/parser2v2/parse_annotation_test.go index d372f41d..a6cdf807 100644 --- a/rdfloader/parser2v2/parse_annotation_test.go +++ b/rdfloader/parser2v2/parse_annotation_test.go @@ -102,7 +102,7 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { 2010-01-29T18:30:22Z Document level annotation Company: some company - + `) node := parser.gordfParserObj.Triples[0].Subject @@ -117,7 +117,7 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { 2010-01-29T18:30:22Z Document level annotation Person: Jane Doe - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -132,7 +132,7 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { 2010-01-29T18:30:22Z Document level annotation Person: Jane Doe - + `) @@ -148,7 +148,7 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { 2010-01-29T18:30:22Z Document level annotation Person: Jane Doe - + `) node = parser.gordfParserObj.Triples[0].Subject diff --git a/rdfloader/parser2v2/parse_file_test.go b/rdfloader/parser2v2/parse_file_test.go index 3877cb79..cdfa540b 100644 --- a/rdfloader/parser2v2/parse_file_test.go +++ b/rdfloader/parser2v2/parse_file_test.go @@ -18,10 +18,10 @@ import ( // pads the content with the enclosing rdf:RDF tag func wrapIntoTemplate(content string) string { header := `` footer := `` @@ -51,7 +51,7 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { ` - https://www.openjena.org/ + http://www.openjena.org/ Jena @@ -79,8 +79,8 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { rdfParser, err = parserFromBodyContent( ` - - https://www.openjena.org/ + + http://www.openjena.org/ Jena @@ -93,7 +93,7 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { if err != nil { t.Errorf("error parsing a valid artifactOf node: %v", err) } - expectedURI := "https://subversion.apache.org/doap.rdf" + expectedURI := "http://subversion.apache.org/doap.rdf" if artifact.URI != expectedURI { t.Errorf("wrong artifact URI. Expected: %s, found: %s", expectedURI, artifact.URI) } @@ -103,7 +103,7 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { ` - https://www.openjena.org/ + http://www.openjena.org/ Jena @@ -330,7 +330,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 1: file with invalid id parser, _ := parserFromBodyContent(` - + `) fileNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err := parser.getFileFromNode(fileNode) @@ -340,8 +340,8 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 2: invalid fileType parser, _ = parserFromBodyContent(` - - + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -352,10 +352,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 3: invalid file checksum parser, _ = parserFromBodyContent(` - + - + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd @@ -370,7 +370,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 4: invalid license concluded parser, _ = parserFromBodyContent(` - + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -381,7 +381,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 5: invalid artifactOf attribute parser, _ = parserFromBodyContent(` - + @@ -399,7 +399,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 6: invalid file dependency parser, _ = parserFromBodyContent(` - + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -410,7 +410,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 7: invalid annotation with unknown predicate parser, _ = parserFromBodyContent(` - + @@ -426,10 +426,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 8: invalid relationship parser, _ = parserFromBodyContent(` - + - + @@ -442,7 +442,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 8: unknown predicate parser, _ = parserFromBodyContent(` - + `) @@ -454,8 +454,8 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 9: invalid licenseInfoInFile. parser, _ = parserFromBodyContent(` - - + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -468,17 +468,17 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { fileDefinitions := []string{ ` - + time-1.9/ChangeLog - + `, ` - - + + `, @@ -520,7 +520,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 12: checking if recursive dependencies are resolved. parser, _ = parserFromBodyContent(` - + @@ -537,37 +537,37 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 11: all valid attribute and it's values. parser, _ = parserFromBodyContent(` - + time-1.9/ChangeLog - + - + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - + + no comments from spdx file - https://www.openjena.org/ + http://www.openjena.org/ Jena no comments - + Some Organization - + attribution text 2011-01-29T18:30:22Z File level annotation copied from a spdx document Person: File Commenter - + @@ -637,7 +637,7 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { t.Errorf("given file should have 1 artifactOfProjects attribute. found %d", n) } artifactOf := file.ArtifactOfProjects[0] - expectedHomePage := "https://www.openjena.org/" + expectedHomePage := "http://www.openjena.org/" if artifactOf.HomePage != expectedHomePage { t.Errorf("expected %s, found %s", expectedHomePage, artifactOf.HomePage) } diff --git a/rdfloader/parser2v2/parse_package_test.go b/rdfloader/parser2v2/parse_package_test.go index 5293b6ef..08f71d17 100644 --- a/rdfloader/parser2v2/parse_package_test.go +++ b/rdfloader/parser2v2/parse_package_test.go @@ -198,7 +198,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -215,7 +215,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -231,7 +231,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { - + comment `) @@ -257,7 +257,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { - + comment `) @@ -283,7 +283,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { - + comment `) @@ -310,7 +310,7 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 1: invalid elementId parser, _ = parserFromBodyContent(` - + time-1.9.tar.gz `) @@ -322,10 +322,10 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 2: Invalid License Concluded must raise an error: parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err == nil { @@ -334,10 +334,10 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 2: Invalid License Declared must raise an error: parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err == nil { @@ -346,18 +346,18 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 3: Invalid ExternalRef parser, _ = parserFromBodyContent(` - - - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - - - `) + + + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err == nil { @@ -464,20 +464,20 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 8: Checking if packages can handle cyclic dependencies: // Simulating a smallest possible cycle: package related to itself. parser, _ = parserFromBodyContent(` - - Test Package - - - - - - 1.1.1 - - - - - - `) + + Test Package + + + + + + 1.1.1 + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject pkg, err = parser.getPackageFromNode(node) if err != nil { @@ -495,75 +495,74 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { // TestCase 9: everything valid parser, _ = parserFromBodyContent(` - - Test Package - 1.1.1 - time-1.9.tar.gz - Person: Jane Doe (jane.doe@example.com) - Organization: SPDX - - true - - - cbceb8b5689b75a584efe35587b5d41bd48820ce - ./package.spdx - - - - - - 75068c26abbed3ad3980685bae21d7202d288317 - - - https://www.openjena.org/ - uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. - - - - - - - - - Other versions available for a commercial license - - Package for Testing - Some tags are taken from other spdx autogenerated files - no comments - - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - - - - - - - - - attribution text - - - 2011-01-29T18:30:22Z - Package level annotation - Person: Package Commenter - - - - - `) + + Test Package + 1.1.1 + time-1.9.tar.gz + Person: Jane Doe (jane.doe@example.com) + Organization: SPDX + + true + + + cbceb8b5689b75a584efe35587b5d41bd48820ce + ./package.spdx + + + + + + 75068c26abbed3ad3980685bae21d7202d288317 + + + http://www.openjena.org/ + uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. + + + + + + + + + Other versions available for a commercial license + + Package for Testing + Some tags are taken from other spdx autogenerated files + no comments + + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + + + + + + + + + attribution text + + + 2011-01-29T18:30:22Z + Package level annotation + Person: Package Commenter + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getPackageFromNode(node) if err != nil { t.Errorf("error parsing a valid package: %v", err) } } - func Test_rdfParser2_2_setFileToPackage(t *testing.T) { var pkg *v2_2.Package var file *v2_2.File diff --git a/rdfloader/parser2v2/parse_snippet_info_test.go b/rdfloader/parser2v2/parse_snippet_info_test.go index fe71c02c..f9f71b94 100644 --- a/rdfloader/parser2v2/parse_snippet_info_test.go +++ b/rdfloader/parser2v2/parse_snippet_info_test.go @@ -114,12 +114,12 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { - + snippet test test comments comments - + `) node = parser.gordfParserObj.Triples[0].Subject diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index 5efa9847..4a3a8c39 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -228,7 +228,7 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { 2011-01-29T18:30:22Z test annotation Person: Rishabh Bhatnagar - + diff --git a/rdfloader/parser2v3/constants.go b/rdfloader/parser2v3/constants.go index 93cb859c..48f870fb 100644 --- a/rdfloader/parser2v3/constants.go +++ b/rdfloader/parser2v3/constants.go @@ -6,11 +6,11 @@ import "github.com/spdx/gordf/rdfloader/parser" var ( // NAMESPACES - NS_SPDX = "https://spdx.org/rdf/terms#" - NS_RDFS = "https://www.w3.org/2000/01/rdf-schema#" + NS_SPDX = "http://spdx.org/rdf/terms#" + NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#" NS_RDF = parser.RDFNS - NS_PTR = "https://www.w3.org/2009/pointers#" - NS_DOAP = "https://usefulinc.com/ns/doap#" + NS_PTR = "http://www.w3.org/2009/pointers#" + NS_DOAP = "http://usefulinc.com/ns/doap#" // SPDX_SPEC_VERSION SPDX properties SPDX_SPEC_VERSION = NS_SPDX + "specVersion" diff --git a/rdfloader/parser2v3/license_utils_test.go b/rdfloader/parser2v3/license_utils_test.go index 0156b993..5f592255 100644 --- a/rdfloader/parser2v3/license_utils_test.go +++ b/rdfloader/parser2v3/license_utils_test.go @@ -51,12 +51,12 @@ func Test_rdfParser2_3_getChecksumFromNode(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -65,11 +65,11 @@ func Test_rdfParser2_3_getChecksumFromNode(t *testing.T) { // TestCase 3: valid input parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject algorithm, value, err := parser.getChecksumFromNode(checksumNode) if err != nil { diff --git a/rdfloader/parser2v3/parse_annotation_test.go b/rdfloader/parser2v3/parse_annotation_test.go index 205bc7fc..1b90a110 100644 --- a/rdfloader/parser2v3/parse_annotation_test.go +++ b/rdfloader/parser2v3/parse_annotation_test.go @@ -98,13 +98,13 @@ func Test_setAnnotationToParser(t *testing.T) { func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 1: invalid annotator must raise an error parser, _ := parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Company: some company - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Company: some company + + + `) node := parser.gordfParserObj.Triples[0].Subject err := parser.parseAnnotationFromNode(node) if err == nil { @@ -113,13 +113,13 @@ func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 2: wrong annotation type should raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -128,14 +128,14 @@ func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 3: unknown predicate should also raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -144,13 +144,13 @@ func Test_rdfParser2_3_parseAnnotationFromNode(t *testing.T) { // TestCase 4: completely valid annotation parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err != nil { diff --git a/rdfloader/parser2v3/parse_file_test.go b/rdfloader/parser2v3/parse_file_test.go index 023cc1dd..424ddfbf 100644 --- a/rdfloader/parser2v3/parse_file_test.go +++ b/rdfloader/parser2v3/parse_file_test.go @@ -18,10 +18,10 @@ import ( // pads the content with the enclosing rdf:RDF tag func wrapIntoTemplate(content string) string { header := `` footer := `` @@ -301,7 +301,7 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 5: invalid checksum algorithm parser, _ = parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -315,7 +315,7 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 6: valid checksum algorithm which is invalid for file (like md4, md6, sha384, etc.) parser, _ = parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -330,7 +330,7 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 1: file with invalid id parser, _ := parserFromBodyContent(` - + `) fileNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err := parser.getFileFromNode(fileNode) @@ -340,8 +340,8 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 2: invalid fileType parser, _ = parserFromBodyContent(` - - + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -352,10 +352,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 3: invalid file checksum parser, _ = parserFromBodyContent(` - + - + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd @@ -370,7 +370,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 4: invalid license concluded parser, _ = parserFromBodyContent(` - + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -398,8 +398,8 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 6: invalid file dependency parser, _ = parserFromBodyContent(` - - + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -410,7 +410,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 7: invalid annotation with unknown predicate parser, _ = parserFromBodyContent(` - + @@ -426,10 +426,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 8: invalid relationship parser, _ = parserFromBodyContent(` - + - + @@ -442,7 +442,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 8: unknown predicate parser, _ = parserFromBodyContent(` - + `) @@ -454,8 +454,8 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 9: invalid licenseInfoInFile. parser, _ = parserFromBodyContent(` - - + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject @@ -468,17 +468,17 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { fileDefinitions := []string{ ` - + time-1.9/ChangeLog - + `, ` - - - + + + `, @@ -520,7 +520,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 12: checking if recursive dependencies are resolved. parser, _ = parserFromBodyContent(` - + @@ -537,43 +537,43 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 11: all valid attribute and it's values. parser, _ = parserFromBodyContent(` - + time-1.9/ChangeLog - + - + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - + + no comments from spdx file - https://www.openjena.org/ + http://www.openjena.org/ Jena no comments - + Some Organization - + attribution text 2011-01-29T18:30:22Z File level annotation copied from a spdx document Person: File Commenter - + - - + + @@ -637,7 +637,7 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { t.Errorf("given file should have 1 artifactOfProjects attribute. found %d", n) } artifactOf := file.ArtifactOfProjects[0] - expectedHomePage := "https://www.openjena.org/" + expectedHomePage := "http://www.openjena.org/" if artifactOf.HomePage != expectedHomePage { t.Errorf("expected %s, found %s", expectedHomePage, artifactOf.HomePage) } diff --git a/rdfloader/rdfloader.go b/rdfloader/rdfloader.go index 4575799a..e680a1f3 100644 --- a/rdfloader/rdfloader.go +++ b/rdfloader/rdfloader.go @@ -12,7 +12,7 @@ import ( "github.com/spdx/tools-golang/spdx/v2_3" ) -// Takes in a file Reader and returns the pertaining spdx document +// Load2_2 Takes in a file Reader and returns the pertaining spdx document // or the error if any is encountered while setting the doc. func Load2_2(content io.Reader) (*v2_2.Document, error) { var rdfParserObj, err = rdfloader.LoadFromReaderObject(content) @@ -24,7 +24,7 @@ func Load2_2(content io.Reader) (*v2_2.Document, error) { return doc, err } -// Takes in a file Reader and returns the pertaining spdx document +// Load2_3 Takes in a file Reader and returns the pertaining spdx document // or the error if any is encountered while setting the doc. func Load2_3(content io.Reader) (*v2_3.Document, error) { var rdfParserObj, err = rdfloader.LoadFromReaderObject(content) diff --git a/tvsaver/saver2v2/save_package_test.go b/tvsaver/saver2v2/save_package_test.go index 308fab5e..cc798ea2 100644 --- a/tvsaver/saver2v2/save_package_test.go +++ b/tvsaver/saver2v2/save_package_test.go @@ -482,7 +482,7 @@ func TestSaver2_2PackageWrapsMultiLine(t *testing.T) { pkg := &v2_2.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, PackageLicenseConcluded: "GPL-2.0-or-later", @@ -498,15 +498,14 @@ Copyright Jane Doe`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: false - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageCopyrightText: Copyright (c) John Doe, Inc. - Copyright Jane Doe - - `) +SPDXID: SPDXRef-p1 +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: false +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageCopyrightText: Copyright (c) John Doe, Inc. +Copyright Jane Doe +`) // render as buffer of bytes var got bytes.Buffer From fcc9894bee1e96949566ebe0373b35b656ffc31e Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 19:33:55 +0200 Subject: [PATCH 04/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- .../sample-docs/tv/SPDXTagExample-v2.2.spdx | 20 ++++++------ .../sample-docs/tv/SPDXTagExample-v2.3.spdx | 24 +++++++------- .../xml/SPDXXMLExample-v2.2.spdx.xml | 32 +++++++++---------- .../yaml/SPDXYAMLExample-2.2.spdx.yaml | 18 +++++------ .../yaml/SPDXYAMLExample-2.3.spdx.yaml | 20 ++++++------ 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx b/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx index f78f5a6b..e8f32ebf 100644 --- a/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx +++ b/examples/sample-docs/tv/SPDXTagExample-v2.2.spdx @@ -1,12 +1,12 @@ SPDXVersion: SPDX-2.2 DataLicense: CC0-1.0 -DocumentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 +DocumentNamespace: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 DocumentName: SPDX-Tools-v2.0 SPDXID: SPDXRef-DOCUMENT DocumentComment: This document was created using SPDX 2.0 using licenses from the web site. ## External Document References -ExternalDocumentRef: DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1: d6a770ba38583ed4bb4525bd96e50461655d2759 +ExternalDocumentRef: DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1: d6a770ba38583ed4bb4525bd96e50461655d2759 ## Creation Information Creator: Tool: LicenseFind-1.0 Creator: Organization: ExampleCodeInspect () @@ -74,12 +74,12 @@ PackageVersion: 2.11.1 PackageFileName: glibc-2.11.1.tar.gz PackageSupplier: Person: Jane Doe (jane.doe@example.com) PackageOriginator: Organization: ExampleCodeInspect (contact@example.com) -PackageDownloadLocation: https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz +PackageDownloadLocation: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz PackageVerificationCode: d6a770ba38583ed4bb4525bd96e50461655d2758(./package.spdx) PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageHomePage: https://ftp.gnu.org/gnu/glibc +PackageHomePage: http://ftp.gnu.org/gnu/glibc PackageSourceInfo: uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. PackageLicenseConcluded: (LGPL-2.0-only OR LicenseRef-3) ## License information from files @@ -118,7 +118,7 @@ FileNotice: Apache Commons Lang Copyright 2001-2011 The Apache Software Foundation This product includes software developed by -The Apache Software Foundation (https://www.apache.org/). +The Apache Software Foundation (http://www.apache.org/). This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) @@ -157,7 +157,7 @@ FileContributor: Black Duck Software In.c PackageName: Apache Commons Lang SPDXID: SPDXRef-fromDoap-1 PackageDownloadLocation: NOASSERTION -PackageHomePage: https://commons.apache.org/proper/commons-lang/ +PackageHomePage: http://commons.apache.org/proper/commons-lang/ PackageLicenseConcluded: NOASSERTION PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -168,7 +168,7 @@ PackageName: Jena SPDXID: SPDXRef-fromDoap-0 PackageVersion: 3.12.0 PackageDownloadLocation: https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz -PackageHomePage: https://www.openjena.org/ +PackageHomePage: http://www.openjena.org/ PackageLicenseConcluded: NOASSERTION PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -182,7 +182,7 @@ PackageVersion: 8.8 PackageFileName: saxonB-8.8.zip PackageDownloadLocation: https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageHomePage: https://saxon.sourceforge.net/ +PackageHomePage: http://saxon.sourceforge.net/ PackageLicenseConcluded: MPL-1.0 PackageLicenseDeclared: MPL-1.0 PackageLicenseComments: Other versions available for a commercial license @@ -276,7 +276,7 @@ ExtractedText: "THE BEER-WARE LICENSE" (Revision 42): phk@FreeBSD.ORG wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp LicenseName: Beer-Ware License (Version 42) -LicenseCrossReference: https://people.freebsd.org/~phk/ +LicenseCrossReference: http://people.freebsd.org/~phk/ LicenseComment: The beerware license has a couple of other standard variants. LicenseID: LicenseRef-3 @@ -324,6 +324,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LicenseName: CyberNeko License -LicenseCrossReference: https://people.apache.org/~andyc/neko/LICENSE, https://justasample.url.com +LicenseCrossReference: http://people.apache.org/~andyc/neko/LICENSE, http://justasample.url.com LicenseComment: This is tye CyperNeko License diff --git a/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx b/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx index 9057e09c..7c5ae3d8 100644 --- a/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx +++ b/examples/sample-docs/tv/SPDXTagExample-v2.3.spdx @@ -2,8 +2,8 @@ SPDXVersion: SPDX-2.3 DataLicense: CC0-1.0 SPDXID: SPDXRef-SPDXRef-DOCUMENT DocumentName: SPDX-Tools-v2.0 -DocumentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 -ExternalDocumentRef: DocumentRef-DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759 +DocumentNamespace: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 +ExternalDocumentRef: DocumentRef-DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759 DocumentComment: This document was created using SPDX 2.0 using licenses from the web site. LicenseListVersion: 3.9 Creator: Tool: LicenseFind-1.0 @@ -28,7 +28,7 @@ FileNotice: Apache Commons Lang Copyright 2001-2011 The Apache Software Foundation This product includes software developed by -The Apache Software Foundation (https://www.apache.org/). +The Apache Software Foundation (http://www.apache.org/). This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) @@ -105,12 +105,12 @@ PackageVersion: 2.11.1 PackageFileName: glibc-2.11.1.tar.gz PackageSupplier: Person: Jane Doe (jane.doe@example.com) PackageOriginator: Organization: ExampleCodeInspect (contact@example.com) -PackageDownloadLocation: https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz +PackageDownloadLocation: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz PackageVerificationCode: d6a770ba38583ed4bb4525bd96e50461655d2758 (excludes: ./package.spdx) PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd -PackageHomePage: https://ftp.gnu.org/gnu/glibc +PackageHomePage: http://ftp.gnu.org/gnu/glibc PackageSourceInfo: uses glibc-2_11-branch from git://sourceware.org/git/glibc.git. PackageLicenseConcluded: (LGPL-2.0-only OR LicenseRef-3) PackageLicenseInfoFromFiles: GPL-2.0-only @@ -122,7 +122,7 @@ PackageCopyrightText: Copyright 2008-2010 John Smith PackageSummary: GNU C library. PackageDescription: The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems. ExternalRef: SECURITY cpe23Type cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* -ExternalRef: OTHER https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge acmecorp/acmenator/4.1.3-alpha +ExternalRef: OTHER http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge acmecorp/acmenator/4.1.3-alpha ExternalRefComment: This is the external ref for Acme PackageAttributionText: The GNU C Library is free software. See the file COPYING.LIB for copying conditions, and LICENSES for notices about a few contributions that require these additional notices to be distributed. License copyright years may be listed using range notation, e.g., 1996-2015, indicating that every year in the range, inclusive, is a copyrightable year that would otherwise be listed individually. @@ -135,7 +135,7 @@ PackageFileName: saxonB-8.8.zip PackageDownloadLocation: https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download FilesAnalyzed: false PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c -PackageHomePage: https://saxon.sourceforge.net/ +PackageHomePage: http://saxon.sourceforge.net/ PackageLicenseConcluded: MPL-1.0 PackageLicenseDeclared: MPL-1.0 PackageLicenseComments: Other versions available for a commercial license @@ -149,7 +149,7 @@ SPDXID: SPDXRef-SPDXRef-fromDoap-0 PackageVersion: 3.12.0 PackageDownloadLocation: https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz FilesAnalyzed: false -PackageHomePage: https://www.openjena.org/ +PackageHomePage: http://www.openjena.org/ PackageLicenseConcluded: NOASSERTION PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -161,7 +161,7 @@ PackageName: Apache Commons Lang SPDXID: SPDXRef-SPDXRef-fromDoap-1 PackageDownloadLocation: NOASSERTION FilesAnalyzed: false -PackageHomePage: https://commons.apache.org/proper/commons-lang/ +PackageHomePage: http://commons.apache.org/proper/commons-lang/ PackageLicenseDeclared: NOASSERTION PackageCopyrightText: NOASSERTION @@ -239,7 +239,7 @@ ExtractedText: "THE BEER-WARE LICENSE" (Revision 42): phk@FreeBSD.ORG wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp LicenseName: Beer-Ware License (Version 42) -LicenseCrossReference: https://people.freebsd.org/~phk/ +LicenseCrossReference: http://people.freebsd.org/~phk/ LicenseComment: The beerware license has a couple of other standard variants. LicenseID: LicenseRef-3 @@ -287,8 +287,8 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LicenseName: CyberNeko License -LicenseCrossReference: https://people.apache.org/~andyc/neko/LICENSE -LicenseCrossReference: https://justasample.url.com +LicenseCrossReference: http://people.apache.org/~andyc/neko/LICENSE +LicenseCrossReference: http://justasample.url.com LicenseComment: This is tye CyperNeko License ##### Relationships diff --git a/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml b/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml index 15d0dab2..80e0527a 100644 --- a/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml +++ b/examples/sample-docs/xml/SPDXXMLExample-v2.2.spdx.xml @@ -21,7 +21,7 @@ compatible system run time libraries. SHA1 d6a770ba38583ed4bb4525bd96e50461655d2759 - https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 + http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 LicenseRef-1 @@ -100,7 +100,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WAR phk@FreeBSD.ORG wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp Beer-Ware License (Version 42) - https://people.freebsd.org/~phk/ + http://people.freebsd.org/~phk/ LicenseRef-3 @@ -149,8 +149,8 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. CyberNeko License - https://people.apache.org/~andyc/neko/LICENSE - https://justasample.url.com + http://people.apache.org/~andyc/neko/LICENSE + http://justasample.url.com 2010-01-29T18:30:22Z @@ -170,7 +170,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Person: Suzanne Reviewer Another example reviewer. - https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 + http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 SPDXRef-File SPDXRef-Package @@ -196,7 +196,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright 2008-2010 John Smith The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems. - https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz + http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz SECURITY cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* @@ -206,13 +206,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This is the external ref for Acme OTHER acmecorp/acmenator/4.1.3-alpha - https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge + http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge true SPDXRef-CommonsLangSrc SPDXRef-JenaLib SPDXRef-DoapSource - https://ftp.gnu.org/gnu/glibc + http://ftp.gnu.org/gnu/glibc The license for this project changed with the release of version x.y. The version of the project included here post-dates the license change. (LGPL-2.0-only OR LicenseRef-3) (LGPL-2.0-only AND LicenseRef-3) @@ -236,7 +236,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NOASSERTION NOASSERTION false - https://commons.apache.org/proper/commons-lang/ + http://commons.apache.org/proper/commons-lang/ NOASSERTION NOASSERTION Apache Commons Lang @@ -251,7 +251,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. purl false - https://www.openjena.org/ + http://www.openjena.org/ NOASSERTION NOASSERTION Jena @@ -267,7 +267,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The Saxon package is a collection of tools for processing XML documents. https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download false - https://saxon.sourceforge.net/ + http://saxon.sourceforge.net/ Other versions available for a commercial license MPL-1.0 MPL-1.0 @@ -306,13 +306,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Apache-2.0 Apache-2.0 Apache Commons Lang - Copyright 2001-2011 The Apache Software Foundation +Copyright 2001-2011 The Apache Software Foundation - This product includes software developed by - The Apache Software Foundation (https://www.apache.org/). +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). - This product includes software from the Spring Framework, - under the Apache License 2.0 (see: StringUtils.containsWhitespace()) +This product includes software from the Spring Framework, +under the Apache License 2.0 (see: StringUtils.containsWhitespace()) SPDXRef-JenaLib diff --git a/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml b/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml index 7fca7c1b..d58cf229 100644 --- a/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml +++ b/examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml @@ -19,7 +19,7 @@ externalDocumentRefs: checksum: algorithm: "SHA1" checksumValue: "d6a770ba38583ed4bb4525bd96e50461655d2759" - spdxDocument: "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" + spdxDocument: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" hasExtractedLicensingInfos: - licenseId: "LicenseRef-1" extractedText: "/*\n * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,\ @@ -92,7 +92,7 @@ hasExtractedLicensingInfos: \ buy me a beer in return Poul-Henning Kamp" name: "Beer-Ware License (Version 42)" seeAlsos: - - "https://people.freebsd.org/~phk/" + - "http://people.freebsd.org/~phk/" - licenseId: "LicenseRef-3" comment: "This is tye CyperNeko License" extractedText: "The CyberNeko Software License, Version 1.0\n\n \n(C) Copyright\ @@ -124,8 +124,8 @@ hasExtractedLicensingInfos: \ SUCH DAMAGE." name: "CyberNeko License" seeAlsos: - - "https://people.apache.org/~andyc/neko/LICENSE" - - "https://justasample.url.com" + - "http://people.apache.org/~andyc/neko/LICENSE" + - "http://justasample.url.com" annotations: - annotationDate: "2010-01-29T18:30:22Z" annotationType: "OTHER" @@ -140,7 +140,7 @@ annotations: annotationType: "REVIEW" annotator: "Person: Suzanne Reviewer" comment: "Another example reviewer." -documentNamespace: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301" +documentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301" documentDescribes: - "SPDXRef-File" - "SPDXRef-Package" @@ -168,7 +168,7 @@ packages: description: "The GNU C Library defines functions that are specified by the ISO\ \ C standard, as well as additional features specific to POSIX and other derivatives\ \ of the Unix operating system, and extensions specific to GNU systems." - downloadLocation: "https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz" + downloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz" externalRefs: - referenceCategory: "SECURITY" referenceLocator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*" @@ -176,13 +176,13 @@ packages: - comment: "This is the external ref for Acme" referenceCategory: "OTHER" referenceLocator: "acmecorp/acmenator/4.1.3-alpha" - referenceType: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge" + referenceType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge" filesAnalyzed: true hasFiles: - "SPDXRef-CommonsLangSrc" - "SPDXRef-JenaLib" - "SPDXRef-DoapSource" - homepage: "https://ftp.gnu.org/gnu/glibc" + homepage: "http://ftp.gnu.org/gnu/glibc" licenseComments: "The license for this project changed with the release of version\ \ x.y. The version of the project included here post-dates the license change." licenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)" @@ -231,7 +231,7 @@ packages: description: "The Saxon package is a collection of tools for processing XML documents." downloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download" filesAnalyzed: false - homepage: "https://saxon.sourceforge.net/" + homepage: "http://saxon.sourceforge.net/" licenseComments: "Other versions available for a commercial license" licenseConcluded: "MPL-1.0" licenseDeclared: "MPL-1.0" diff --git a/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml b/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml index 3baff85f..611b74cc 100644 --- a/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml +++ b/examples/sample-docs/yaml/SPDXYAMLExample-2.3.spdx.yaml @@ -26,13 +26,13 @@ creationInfo: - 'Person: Jane Doe ()' licenseListVersion: "3.9" dataLicense: CC0-1.0 -documentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 +documentNamespace: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301 externalDocumentRefs: - checksum: algorithm: SHA1 checksumValue: d6a770ba38583ed4bb4525bd96e50461655d2759 externalDocumentId: DocumentRef-spdx-tool-1.2 - spdxDocument: https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 + spdxDocument: http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 files: - SPDXID: SPDXRef-DoapSource checksums: @@ -70,7 +70,7 @@ files: Copyright 2001-2011 The Apache Software Foundation This product includes software developed by - The Apache Software Foundation (https://www.apache.org/). + The Apache Software Foundation (http://www.apache.org/). This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) @@ -249,8 +249,8 @@ hasExtractedLicensingInfos: licenseId: LicenseRef-3 name: CyberNeko License seeAlsos: - - https://people.apache.org/~andyc/neko/LICENSE - - https://justasample.url.com + - http://people.apache.org/~andyc/neko/LICENSE + - http://justasample.url.com name: SPDX-Tools-v2.0 packages: - SPDXID: SPDXRef-Package @@ -276,7 +276,7 @@ packages: description: The GNU C Library defines functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems. - downloadLocation: https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz + downloadLocation: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz externalRefs: - comment: "" referenceCategory: SECURITY @@ -285,9 +285,9 @@ packages: - comment: This is the external ref for Acme referenceCategory: OTHER referenceLocator: acmecorp/acmenator/4.1.3-alpha - referenceType: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge + referenceType: http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge filesAnalyzed: true - homepage: https://ftp.gnu.org/gnu/glibc + homepage: http://ftp.gnu.org/gnu/glibc licenseComments: The license for this project changed with the release of version x.y. The version of the project included here post-dates the license change. licenseConcluded: (LGPL-2.0-only OR LicenseRef-3) @@ -322,7 +322,7 @@ packages: referenceCategory: PACKAGE_MANAGER referenceLocator: pkg:maven/org.apache.jena/apache-jena@3.12.0 referenceType: purl - homepage: https://www.openjena.org/ + homepage: http://www.openjena.org/ licenseConcluded: NOASSERTION licenseDeclared: NOASSERTION name: Jena @@ -334,7 +334,7 @@ packages: copyrightText: Copyright Saxonica Ltd description: The Saxon package is a collection of tools for processing XML documents. downloadLocation: https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download - homepage: https://saxon.sourceforge.net/ + homepage: http://saxon.sourceforge.net/ licenseComments: Other versions available for a commercial license licenseConcluded: MPL-1.0 licenseDeclared: MPL-1.0 From acf3f0e8d0274302ee7f5e8635f930b318bcedb0 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 19:51:12 +0200 Subject: [PATCH 05/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- tvloader/parser2v2/parse_file_test.go | 28 ++++++++++----------- tvsaver/saver2v1/save_document_test.go | 4 +-- tvsaver/saver2v2/save_file_test.go | 20 +++++++-------- tvsaver/saver2v2/save_other_license_test.go | 20 +++++++-------- tvsaver/saver2v2/save_package_test.go | 4 +-- tvsaver/saver2v3/save_package_test.go | 16 ++++++------ 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/tvloader/parser2v2/parse_file_test.go b/tvloader/parser2v2/parse_file_test.go index 975547ec..0bcea7d7 100644 --- a/tvloader/parser2v2/parse_file_test.go +++ b/tvloader/parser2v2/parse_file_test.go @@ -510,11 +510,11 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "https://example.com/1/") + err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "http://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -528,7 +528,7 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "https://example.com/3/") + err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "http://example.com/3/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -537,7 +537,7 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "https://example.com/4/uri.whatever") + err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "http://example.com/4/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -550,11 +550,11 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if aop.Name != "project1" { t.Errorf("expected %v, got %v", "project1", aop.Name) } - if aop.HomePage != "https://example.com/1/" { - t.Errorf("expected %v, got %v", "https://example.com/1/", aop.HomePage) + if aop.HomePage != "http://example.com/1/" { + t.Errorf("expected %v, got %v", "http://example.com/1/", aop.HomePage) } - if aop.URI != "https://example.com/1/uri.whatever" { - t.Errorf("expected %v, got %v", "https://example.com/1/uri.whatever", aop.URI) + if aop.URI != "http://example.com/1/uri.whatever" { + t.Errorf("expected %v, got %v", "http://example.com/1/uri.whatever", aop.URI) } aop = parser.file.ArtifactOfProjects[1] @@ -572,8 +572,8 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if aop.Name != "project3" { t.Errorf("expected %v, got %v", "project3", aop.Name) } - if aop.HomePage != "https://example.com/3/" { - t.Errorf("expected %v, got %v", "https://example.com/3/", aop.HomePage) + if aop.HomePage != "http://example.com/3/" { + t.Errorf("expected %v, got %v", "http://example.com/3/", aop.HomePage) } if aop.URI != "" { t.Errorf("expected %v, got %v", "", aop.URI) @@ -586,8 +586,8 @@ func TestParser2_2CanParseFileTags(t *testing.T) { if aop.HomePage != "" { t.Errorf("expected %v, got %v", "", aop.HomePage) } - if aop.URI != "https://example.com/4/uri.whatever" { - t.Errorf("expected %v, got %v", "https://example.com/4/uri.whatever", aop.URI) + if aop.URI != "http://example.com/4/uri.whatever" { + t.Errorf("expected %v, got %v", "http://example.com/4/uri.whatever", aop.URI) } // File Comment @@ -771,7 +771,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { curPtr := parser.fileAOP // now, a home page; pointer should stay - err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "https://example.com/1/") + err = parser.parsePairFromFile2_2("ArtifactOfProjectHomePage", "http://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -780,7 +780,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { } // a URI; pointer should stay - err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_2("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } diff --git a/tvsaver/saver2v1/save_document_test.go b/tvsaver/saver2v1/save_document_test.go index e290c887..997af865 100644 --- a/tvsaver/saver2v1/save_document_test.go +++ b/tvsaver/saver2v1/save_document_test.go @@ -91,7 +91,7 @@ func TestSaver2_1DocumentSavesText(t *testing.T) { pkgWith := &v2_1.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: true, IsFilesAnalyzedTagPresent: true, PackageVerificationCode: common.PackageVerificationCode{Value: "0123456789abcdef0123456789abcdef01234567"}, @@ -235,7 +235,7 @@ blah blah blah blah`, PackageName: p1 SPDXID: SPDXRef-p1 - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz FilesAnalyzed: true PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 PackageLicenseConcluded: GPL-2.0-or-later AND BSD-3-Clause AND WTFPL diff --git a/tvsaver/saver2v2/save_file_test.go b/tvsaver/saver2v2/save_file_test.go index 01b45640..1bf64534 100644 --- a/tvsaver/saver2v2/save_file_test.go +++ b/tvsaver/saver2v2/save_file_test.go @@ -34,19 +34,19 @@ func TestSaver2_2FileSavesText(t *testing.T) { ArtifactOfProjects: []*v2_2.ArtifactOfProject{ &v2_2.ArtifactOfProject{ Name: "project1", - HomePage: "https://example.com/1/", - URI: "https://example.com/1/uri.whatever", + HomePage: "http://example.com/1/", + URI: "http://example.com/1/uri.whatever", }, &v2_2.ArtifactOfProject{ Name: "project2", }, &v2_2.ArtifactOfProject{ Name: "project3", - HomePage: "https://example.com/3/", + HomePage: "http://example.com/3/", }, &v2_2.ArtifactOfProject{ Name: "project4", - URI: "https://example.com/4/uri.whatever", + URI: "http://example.com/4/uri.whatever", }, }, FileComment: "this is a file comment", @@ -80,13 +80,13 @@ attribution`, LicenseComments: this is a license comment(s) FileCopyrightText: Copyright (c) Jane Doe ArtifactOfProjectName: project1 - ArtifactOfProjectHomePage: https://example.com/1/ - ArtifactOfProjectURI: https://example.com/1/uri.whatever + ArtifactOfProjectHomePage: http://example.com/1/ + ArtifactOfProjectURI: http://example.com/1/uri.whatever ArtifactOfProjectName: project2 ArtifactOfProjectName: project3 - ArtifactOfProjectHomePage: https://example.com/3/ + ArtifactOfProjectHomePage: http://example.com/3/ ArtifactOfProjectName: project4 - ArtifactOfProjectURI: https://example.com/4/uri.whatever + ArtifactOfProjectURI: http://example.com/4/uri.whatever FileComment: this is a file comment FileNotice: This file may be used under either Apache-2.0 or Apache-1.1. FileContributor: John Doe jdoe@example.com @@ -95,9 +95,9 @@ attribution`, FileAttributionText: multi-line attribution FileDependency: f-1.txt - FileDependency: g.txt +FileDependency: g.txt - `) +`) // render as buffer of bytes var got bytes.Buffer diff --git a/tvsaver/saver2v2/save_other_license_test.go b/tvsaver/saver2v2/save_other_license_test.go index 4635e8e2..235abb96 100644 --- a/tvsaver/saver2v2/save_other_license_test.go +++ b/tvsaver/saver2v2/save_other_license_test.go @@ -18,23 +18,23 @@ blah blah blah blah blah blah blah`, LicenseName: "License 1", LicenseCrossReferences: []string{ - "https://example.com/License1/", - "https://example.com/License1AnotherURL/", + "http://example.com/License1/", + "http://example.com/License1AnotherURL/", }, LicenseComment: "this is a license comment", } // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`LicenseID: LicenseRef-1 - ExtractedText: License 1 text - blah blah blah - blah blah blah blah - LicenseName: License 1 - LicenseCrossReference: https://example.com/License1/ - LicenseCrossReference: https://example.com/License1AnotherURL/ - LicenseComment: this is a license comment +ExtractedText: License 1 text +blah blah blah +blah blah blah blah +LicenseName: License 1 +LicenseCrossReference: http://example.com/License1/ +LicenseCrossReference: http://example.com/License1AnotherURL/ +LicenseComment: this is a license comment - `) +`) // render as buffer of bytes var got bytes.Buffer diff --git a/tvsaver/saver2v2/save_package_test.go b/tvsaver/saver2v2/save_package_test.go index cc798ea2..45f2c827 100644 --- a/tvsaver/saver2v2/save_package_test.go +++ b/tvsaver/saver2v2/save_package_test.go @@ -56,7 +56,7 @@ multi-line external ref comment`, PackageFileName: "p1-0.1.0-master.tar.gz", PackageSupplier: &common.Supplier{SupplierType: "Organization", Supplier: "John Doe, Inc."}, PackageOriginator: &common.Originator{Originator: "John Doe", OriginatorType: "Person"}, - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: true, IsFilesAnalyzedTagPresent: true, PackageVerificationCode: common.PackageVerificationCode{ @@ -77,7 +77,7 @@ multi-line external ref comment`, Value: "624c1abb3664f4b35547e7c73864ad24", }, }, - PackageHomePage: "https://example.com/p1", + PackageHomePage: "http://example.com/p1", PackageSourceInfo: "this is a source comment", PackageLicenseConcluded: "GPL-2.0-or-later", PackageLicenseInfoFromFiles: []string{ diff --git a/tvsaver/saver2v3/save_package_test.go b/tvsaver/saver2v3/save_package_test.go index bf7d2e6f..e2bddb4c 100644 --- a/tvsaver/saver2v3/save_package_test.go +++ b/tvsaver/saver2v3/save_package_test.go @@ -490,7 +490,7 @@ func TestSaver2_3PackageWrapsMultiLine(t *testing.T) { pkg := &v2_3.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, PackageLicenseConcluded: "GPL-2.0-or-later", @@ -506,13 +506,13 @@ Copyright Jane Doe`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: false - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageCopyrightText: Copyright (c) John Doe, Inc. - Copyright Jane Doe +SPDXID: SPDXRef-p1 +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: false +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageCopyrightText: Copyright (c) John Doe, Inc. +Copyright Jane Doe `) From 57d940a4fd716bdf3e78015d01bc5658e41d4509 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 19:53:56 +0200 Subject: [PATCH 06/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- json/json_v2_2_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/json/json_v2_2_test.go b/json/json_v2_2_test.go index d21b4183..702d2a9a 100644 --- a/json/json_v2_2_test.go +++ b/json/json_v2_2_test.go @@ -65,7 +65,7 @@ var want2_2 = v2_2.Document{ SPDXVersion: "SPDX-2.2", SPDXIdentifier: "SPDXRef-DOCUMENT", DocumentName: "SPDX-Tools-v2.0", - DocumentNamespace: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", + DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", CreationInfo: &v2_2.CreationInfo{ LicenseListVersion: "3.9", Creators: []common.Creator{ @@ -80,7 +80,7 @@ var want2_2 = v2_2.Document{ ExternalDocumentReferences: []v2_2.ExternalDocumentRef{ { DocumentRefID: "DocumentRef-spdx-tool-1.2", - URI: "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", Checksum: common.Checksum{ Algorithm: common.SHA1, Value: "d6a770ba38583ed4bb4525bd96e50461655d2759", @@ -105,7 +105,7 @@ var want2_2 = v2_2.Document{ ExtractedText: "\"THE BEER-WARE LICENSE\" (Revision 42):\nphk@FreeBSD.ORG wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp", LicenseComment: "The beerware license has a couple of other standard variants.", LicenseName: "Beer-Ware License (Version 42)", - LicenseCrossReferences: []string{"https://people.freebsd.org/~phk/"}, + LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"}, }, { LicenseIdentifier: "LicenseRef-3", @@ -161,7 +161,7 @@ var want2_2 = v2_2.Document{ Originator: "ExampleCodeInspect (contact@example.com)", OriginatorType: "Organization", }, - PackageDownloadLocation: "https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", + PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", FilesAnalyzed: true, PackageVerificationCode: common.PackageVerificationCode{ Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", @@ -181,7 +181,7 @@ var want2_2 = v2_2.Document{ Value: "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd", }, }, - PackageHomePage: "https://ftp.gnu.org/gnu/glibc", + PackageHomePage: "http://ftp.gnu.org/gnu/glibc", PackageSourceInfo: "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.", PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)", PackageLicenseInfoFromFiles: []string{ @@ -203,7 +203,7 @@ var want2_2 = v2_2.Document{ }, { Category: "OTHER", - RefType: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", + RefType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", Locator: "acmecorp/acmenator/4.1.3-alpha", ExternalRefComment: "This is the external ref for Acme", }, @@ -229,7 +229,7 @@ var want2_2 = v2_2.Document{ PackageCopyrightText: "NOASSERTION", PackageDownloadLocation: "NOASSERTION", FilesAnalyzed: false, - PackageHomePage: "https://commons.apache.org/proper/commons-lang/", + PackageHomePage: "http://commons.apache.org/proper/commons-lang/", PackageLicenseConcluded: "NOASSERTION", PackageLicenseDeclared: "NOASSERTION", PackageName: "Apache Commons Lang", @@ -247,7 +247,7 @@ var want2_2 = v2_2.Document{ }, }, FilesAnalyzed: false, - PackageHomePage: "https://www.openjena.org/", + PackageHomePage: "http://www.openjena.org/", PackageLicenseConcluded: "NOASSERTION", PackageLicenseDeclared: "NOASSERTION", PackageVersion: "3.12.0", @@ -264,7 +264,7 @@ var want2_2 = v2_2.Document{ PackageDescription: "The Saxon package is a collection of tools for processing XML documents.", PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download", FilesAnalyzed: false, - PackageHomePage: "https://saxon.sourceforge.net/", + PackageHomePage: "http://saxon.sourceforge.net/", PackageLicenseComments: "Other versions available for a commercial license", PackageLicenseConcluded: "MPL-1.0", PackageLicenseDeclared: "MPL-1.0", From c1e3ef339c58d7d126331be764a4f9e5b3ebb20e Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:02:10 +0200 Subject: [PATCH 07/29] Pipeline fix Signed-off-by: CatalinStratu --- json/json_v2_3_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/json/json_v2_3_test.go b/json/json_v2_3_test.go index 841343b4..f85f2287 100644 --- a/json/json_v2_3_test.go +++ b/json/json_v2_3_test.go @@ -82,7 +82,7 @@ var want2_3 = v2_3.Document{ SPDXVersion: "SPDX-2.3", SPDXIdentifier: "SPDXRef-DOCUMENT", DocumentName: "SPDX-Tools-v2.0", - DocumentNamespace: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", + DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", CreationInfo: &v2_3.CreationInfo{ LicenseListVersion: "3.9", Creators: []common.Creator{ @@ -97,7 +97,7 @@ var want2_3 = v2_3.Document{ ExternalDocumentReferences: []v2_3.ExternalDocumentRef{ { DocumentRefID: "DocumentRef-spdx-tool-1.2", - URI: "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", Checksum: common.Checksum{ Algorithm: common.SHA1, Value: "d6a770ba38583ed4bb4525bd96e50461655d2759", @@ -122,7 +122,7 @@ var want2_3 = v2_3.Document{ ExtractedText: "\"THE BEER-WARE LICENSE\" (Revision 42):\nphk@FreeBSD.ORG wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp", LicenseComment: "The beerware license has a couple of other standard variants.", LicenseName: "Beer-Ware License (Version 42)", - LicenseCrossReferences: []string{"https://people.freebsd.org/~phk/"}, + LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"}, }, { LicenseIdentifier: "LicenseRef-3", From 8fe102436905a023caa1eda27ca552cccf9d8a47 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:05:30 +0200 Subject: [PATCH 08/29] Pipeline fix Signed-off-by: CatalinStratu --- .../parser2v2/parse_other_license_info_test.go | 6 +++--- rdfloader/parser2v2/parse_package_test.go | 18 +++++++++--------- .../parser2v2/parse_spdx_document_test.go | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/rdfloader/parser2v2/parse_other_license_info_test.go b/rdfloader/parser2v2/parse_other_license_info_test.go index e212b4e1..cd7ad321 100644 --- a/rdfloader/parser2v2/parse_other_license_info_test.go +++ b/rdfloader/parser2v2/parse_other_license_info_test.go @@ -16,7 +16,7 @@ func Test_rdfParser2_2_getExtractedLicensingInfoFromNode(t *testing.T) { // TestCase 1: invalid predicate must raise an error parser, _ = parserFromBodyContent(` - + LicenseRef-Freeware freeware @@ -30,7 +30,7 @@ func Test_rdfParser2_2_getExtractedLicensingInfoFromNode(t *testing.T) { // TestCase 2: valid input parser, _ = parserFromBodyContent(` - + LicenseRef-Freeware freeware @@ -46,7 +46,7 @@ func Test_rdfParser2_2_getExtractedLicensingInfoFromNode(t *testing.T) { func Test_rdfParser2_2_extractedLicenseToOtherLicense(t *testing.T) { // nothing to test for this function. parser, _ := parserFromBodyContent(` - + LicenseRef-Freeware freeware diff --git a/rdfloader/parser2v2/parse_package_test.go b/rdfloader/parser2v2/parse_package_test.go index 08f71d17..7b8c2429 100644 --- a/rdfloader/parser2v2/parse_package_test.go +++ b/rdfloader/parser2v2/parse_package_test.go @@ -196,7 +196,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - + @@ -213,7 +213,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - + @@ -229,7 +229,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - + comment @@ -242,7 +242,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { } expectedExtRef := &v2_2.PackageExternalReference{ Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", - RefType: "https://spdx.org/rdf/references/cpe23Type", + RefType: "http://spdx.org/rdf/references/cpe23Type", Category: "SECURITY", ExternalRefComment: "comment", } @@ -255,7 +255,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - + comment @@ -268,7 +268,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { } expectedExtRef = &v2_2.PackageExternalReference{ Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", - RefType: "https://spdx.org/rdf/references/cpe23Type", + RefType: "http://spdx.org/rdf/references/cpe23Type", Category: "PACKAGE-MANAGER", ExternalRefComment: "comment", } @@ -281,7 +281,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - + comment @@ -294,7 +294,7 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { } expectedExtRef = &v2_2.PackageExternalReference{ Locator: "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*", - RefType: "https://spdx.org/rdf/references/cpe23Type", + RefType: "http://spdx.org/rdf/references/cpe23Type", Category: "OTHER", ExternalRefComment: "comment", } @@ -592,7 +592,7 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) pkg = &v2_2.Package{} diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index 4a3a8c39..3840c061 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -20,7 +20,7 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { d6a770ba38583ed4bb4525bd96e50461655d2759 - + @@ -100,7 +100,7 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { d6a770ba38583ed4bb4525bd96e50461655d2759 - + From 1397c60ef92ae24a09172299fc21cbe4549fcf72 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:10:58 +0200 Subject: [PATCH 09/29] Pipeline fix Signed-off-by: CatalinStratu --- tvloader/parser2v1/parse_file_test.go | 4 ++-- tvloader/parser2v2/parse_creation_info_test.go | 8 ++++---- tvsaver/saver2v2/save_other_license_test.go | 2 +- tvsaver/saver2v2/save_package_test.go | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tvloader/parser2v1/parse_file_test.go b/tvloader/parser2v1/parse_file_test.go index c12b05ed..0b2aee1c 100644 --- a/tvloader/parser2v1/parse_file_test.go +++ b/tvloader/parser2v1/parse_file_test.go @@ -525,7 +525,7 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -764,7 +764,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { } // a URI; pointer should stay - err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "https://example.com/1/uri.whatever") + err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "http://example.com/1/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } diff --git a/tvloader/parser2v2/parse_creation_info_test.go b/tvloader/parser2v2/parse_creation_info_test.go index 42e0e642..339f5738 100644 --- a/tvloader/parser2v2/parse_creation_info_test.go +++ b/tvloader/parser2v2/parse_creation_info_test.go @@ -359,9 +359,9 @@ func TestParser2_2CICreatesAnnotation(t *testing.T) { // ===== Helper function tests ===== func TestCanExtractExternalDocumentReference(t *testing.T) { - refstring := "DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759" + refstring := "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759" wantDocumentRefID := "spdx-tool-1.2" - wantURI := "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" + wantURI := "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" wantAlg := "SHA1" wantChecksum := "d6a770ba38583ed4bb4525bd96e50461655d2759" @@ -384,9 +384,9 @@ func TestCanExtractExternalDocumentReference(t *testing.T) { } func TestCanExtractExternalDocumentReferenceWithExtraWhitespace(t *testing.T) { - refstring := " DocumentRef-spdx-tool-1.2 \t https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 \t SHA1: \t d6a770ba38583ed4bb4525bd96e50461655d2759" + refstring := " DocumentRef-spdx-tool-1.2 \t http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 \t SHA1: \t d6a770ba38583ed4bb4525bd96e50461655d2759" wantDocumentRefID := "spdx-tool-1.2" - wantURI := "https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" + wantURI := "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301" wantAlg := "SHA1" wantChecksum := "d6a770ba38583ed4bb4525bd96e50461655d2759" diff --git a/tvsaver/saver2v2/save_other_license_test.go b/tvsaver/saver2v2/save_other_license_test.go index 235abb96..87b0c1b3 100644 --- a/tvsaver/saver2v2/save_other_license_test.go +++ b/tvsaver/saver2v2/save_other_license_test.go @@ -26,7 +26,7 @@ blah blah blah blah`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`LicenseID: LicenseRef-1 -ExtractedText: License 1 text +ExtractedText: License 1 text blah blah blah blah blah blah blah LicenseName: License 1 diff --git a/tvsaver/saver2v2/save_package_test.go b/tvsaver/saver2v2/save_package_test.go index 45f2c827..e921743d 100644 --- a/tvsaver/saver2v2/save_package_test.go +++ b/tvsaver/saver2v2/save_package_test.go @@ -107,13 +107,13 @@ multi-line external ref comment`, PackageFileName: p1-0.1.0-master.tar.gz PackageSupplier: Organization: John Doe, Inc. PackageOriginator: Person: John Doe - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz FilesAnalyzed: true PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 (excludes: p1-0.1.0.spdx) PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - PackageHomePage: https://example.com/p1 + PackageHomePage: http://example.com/p1 PackageSourceInfo: this is a source comment PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseInfoFromFiles: Apache-1.1 @@ -205,12 +205,12 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { PackageFileName: p1-0.1.0-master.tar.gz PackageSupplier: NOASSERTION PackageOriginator: Organization: John Doe, Inc. - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - PackageHomePage: https://example.com/p1 + PackageHomePage: http://example.com/p1 PackageSourceInfo: this is a source comment PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseInfoFromFiles: Apache-1.1 @@ -305,12 +305,12 @@ which goes across two lines`, PackageFileName: p1-0.1.0-master.tar.gz PackageSupplier: Person: John Doe PackageOriginator: NOASSERTION - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz FilesAnalyzed: false PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - PackageHomePage: https://example.com/p1 + PackageHomePage: http://example.com/p1 PackageSourceInfo: this is a source comment PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later @@ -364,7 +364,7 @@ func TestSaver2_2PackageSaveOmitsOptionalFieldsIfEmpty(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 SPDXID: SPDXRef-p1 - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz FilesAnalyzed: false PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later @@ -442,7 +442,7 @@ func TestSaver2_2PackageSavesFilesIfPresent(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 SPDXID: SPDXRef-p1 - PackageDownloadLocation: https://example.com/p1/p1-0.1.0-master.tar.gz + PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz FilesAnalyzed: false PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later From ba43e8408f788cdf4bdeeb37f03addc6ef46e5c1 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:21:28 +0200 Subject: [PATCH 10/29] Pipeline fix Signed-off-by: CatalinStratu --- json/json_v2_3_test.go | 16 +++++----- rdfloader/parser2v2/constants.go | 4 +-- rdfloader/parser2v2/parse_file_test.go | 24 +++++++-------- rdfloader/parser2v2/parse_license_test.go | 36 +++++++++++------------ 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/json/json_v2_3_test.go b/json/json_v2_3_test.go index f85f2287..ee72017e 100644 --- a/json/json_v2_3_test.go +++ b/json/json_v2_3_test.go @@ -129,8 +129,8 @@ var want2_3 = v2_3.Document{ ExtractedText: "The CyberNeko Software License, Version 1.0\n\n \n(C) Copyright 2002-2005, Andy Clark. All rights reserved.\n \nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer. \n\n2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the\n distribution.\n\n3. The end-user documentation included with the redistribution,\n if any, must include the following acknowledgment: \n \"This product includes software developed by Andy Clark.\"\n Alternately, this acknowledgment may appear in the software itself,\n if and wherever such third-party acknowledgments normally appear.\n\n4. The names \"CyberNeko\" and \"NekoHTML\" must not be used to endorse\n or promote products derived from this software without prior \n written permission. For written permission, please contact \n andyc@cyberneko.net.\n\n5. Products derived from this software may not be called \"CyberNeko\",\n nor may \"CyberNeko\" appear in their name, without prior written\n permission of the author.\n\nTHIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED\nWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS\nBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, \nOR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR \nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE \nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, \nEVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", LicenseName: "CyberNeko License", LicenseCrossReferences: []string{ - "https://people.apache.org/~andyc/neko/LICENSE", - "https://justasample.url.com", + "http://people.apache.org/~andyc/neko/LICENSE", + "http://justasample.url.com", }, LicenseComment: "This is tye CyperNeko License", }, @@ -178,7 +178,7 @@ var want2_3 = v2_3.Document{ Originator: "ExampleCodeInspect (contact@example.com)", OriginatorType: "Organization", }, - PackageDownloadLocation: "https://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", + PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz", FilesAnalyzed: true, PackageVerificationCode: &common.PackageVerificationCode{ Value: "d6a770ba38583ed4bb4525bd96e50461655d2758", @@ -198,7 +198,7 @@ var want2_3 = v2_3.Document{ Value: "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd", }, }, - PackageHomePage: "https://ftp.gnu.org/gnu/glibc", + PackageHomePage: "http://ftp.gnu.org/gnu/glibc", PackageSourceInfo: "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.", PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)", PackageLicenseInfoFromFiles: []string{ @@ -220,7 +220,7 @@ var want2_3 = v2_3.Document{ }, { Category: "OTHER", - RefType: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", + RefType: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge", Locator: "acmecorp/acmenator/4.1.3-alpha", ExternalRefComment: "This is the external ref for Acme", }, @@ -246,7 +246,7 @@ var want2_3 = v2_3.Document{ PackageCopyrightText: "NOASSERTION", PackageDownloadLocation: "NOASSERTION", FilesAnalyzed: false, - PackageHomePage: "https://commons.apache.org/proper/commons-lang/", + PackageHomePage: "http://commons.apache.org/proper/commons-lang/", PackageLicenseDeclared: "NOASSERTION", PackageName: "Apache Commons Lang", }, @@ -263,7 +263,7 @@ var want2_3 = v2_3.Document{ }, }, FilesAnalyzed: false, - PackageHomePage: "https://www.openjena.org/", + PackageHomePage: "http://www.openjena.org/", PackageLicenseConcluded: "NOASSERTION", PackageLicenseDeclared: "NOASSERTION", PackageVersion: "3.12.0", @@ -280,7 +280,7 @@ var want2_3 = v2_3.Document{ PackageDescription: "The Saxon package is a collection of tools for processing XML documents.", PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download", FilesAnalyzed: false, - PackageHomePage: "https://saxon.sourceforge.net/", + PackageHomePage: "http://saxon.sourceforge.net/", PackageLicenseComments: "Other versions available for a commercial license", PackageLicenseConcluded: "MPL-1.0", PackageLicenseDeclared: "MPL-1.0", diff --git a/rdfloader/parser2v2/constants.go b/rdfloader/parser2v2/constants.go index 0a29e14c..71a3e33a 100644 --- a/rdfloader/parser2v2/constants.go +++ b/rdfloader/parser2v2/constants.go @@ -5,14 +5,14 @@ package parser2v2 import "github.com/spdx/gordf/rdfloader/parser" var ( - // NS_SPDX NAMESPACES + // NAMESPACES NS_SPDX = "http://spdx.org/rdf/terms#" NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#" NS_RDF = parser.RDFNS NS_PTR = "http://www.w3.org/2009/pointers#" NS_DOAP = "http://usefulinc.com/ns/doap#" - // SPDX_SPEC_VERSION SPDX properties + // SPDX properties SPDX_SPEC_VERSION = NS_SPDX + "specVersion" SPDX_DATA_LICENSE = NS_SPDX + "dataLicense" SPDX_NAME = NS_SPDX + "name" diff --git a/rdfloader/parser2v2/parse_file_test.go b/rdfloader/parser2v2/parse_file_test.go index cdfa540b..dc7bf478 100644 --- a/rdfloader/parser2v2/parse_file_test.go +++ b/rdfloader/parser2v2/parse_file_test.go @@ -20,7 +20,7 @@ func wrapIntoTemplate(content string) string { header := `` @@ -102,7 +102,7 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { rdfParser, err = parserFromBodyContent( ` - + http://www.openjena.org/ Jena @@ -133,7 +133,7 @@ func Test_rdfParser2_2_getFileTypeFromUri(t *testing.T) { } // TestCase 2: Invalid fileType URI format. - fileTypeURI = "https://spdx.org/rdf/terms#source" + fileTypeURI = "http://spdx.org/rdf/terms#source" fileType, err = rdfParser.getFileTypeFromUri(fileTypeURI) if err == nil { t.Error("should've raised an error for invalid fileType") @@ -178,7 +178,7 @@ func Test_setFileIdentifier(t *testing.T) { file := &v2_2.File{} // TestCase 1: valid example - err := setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) + err := setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -187,7 +187,7 @@ func Test_setFileIdentifier(t *testing.T) { } // TestCase 2: invalid example - err = setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) + err = setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) if err == nil { t.Errorf("should've raised an error for an invalid example") } @@ -197,7 +197,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 1: md5 checksum parser, _ := parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -228,7 +228,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 2: valid sha1 checksum parser, _ = parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -258,7 +258,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 3: valid sha256 checksum parser, _ = parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -301,7 +301,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 5: invalid checksum algorithm parser, _ = parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -315,7 +315,7 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 6: valid checksum algorithm which is invalid for file (like md4, md6, sha384, etc.) parser, _ = parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) @@ -572,8 +572,8 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { - - + + diff --git a/rdfloader/parser2v2/parse_license_test.go b/rdfloader/parser2v2/parse_license_test.go index 202f7711..927661a0 100644 --- a/rdfloader/parser2v2/parse_license_test.go +++ b/rdfloader/parser2v2/parse_license_test.go @@ -37,8 +37,8 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 2: DisjunctiveLicenseSet: parser, _ = parserFromBodyContent(` - - + + `) inputNode = parser.gordfParserObj.Triples[0].Subject @@ -56,8 +56,8 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 3: ConjunctiveLicenseSet: parser, _ = parserFromBodyContent(` - - + + `) inputNode = parser.gordfParserObj.Triples[0].Subject @@ -74,7 +74,7 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 4: ExtractedLicensingInfo parser, _ = parserFromBodyContent(` - + LicenseRef-Freeware freeware @@ -94,7 +94,7 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 4: ExtractedLicensingInfo parser, _ = parserFromBodyContent(` - + LicenseRef-Freeware freeware @@ -114,9 +114,9 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 5: License parser, _ = parserFromBodyContent(` - + <> Apache License Version 2.0, January 2004 https://www.apache.org/licenses/<><> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<> <> Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. <> Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. <> Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. <> Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: <> You must give any other recipients of the Work or Derivative Works a copy of this License; and <> You must cause any modified files to carry prominent notices stating that You changed the files; and <> You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and <> If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. <> Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. <> Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. <> Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. <> Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. <> Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<> END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright <> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.<> - https://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 Apache-2.0 true @@ -147,7 +147,7 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { - + `) inputNode = parser.gordfParserObj.Triples[0].Subject @@ -201,11 +201,11 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 8: cyclic dependent license must raise an error. parser, _ = parserFromBodyContent(` - + - - + + @@ -253,8 +253,8 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 3: valid example. parser, _ = parserFromBodyContent(` - - + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject @@ -310,8 +310,8 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 3: valid example. parser, _ = parserFromBodyContent(` - - + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject @@ -549,7 +549,7 @@ func Test_rdfParser2_2_getOrLaterOperatorFromNode(t *testing.T) { freeware - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -766,7 +766,7 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { freeware - + `) node = parser.gordfParserObj.Triples[0].Subject From 87d1e712570efc9fea21987fa563a5339bc2710e Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:35:07 +0200 Subject: [PATCH 11/29] Pipeline fix Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_license_test.go | 30 +++++++++---------- rdfloader/parser2v2/parse_package_test.go | 8 ++--- .../parser2v2/parse_spdx_document_test.go | 8 ++--- rdfloader/parser2v3/license_utils_test.go | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/rdfloader/parser2v2/parse_license_test.go b/rdfloader/parser2v2/parse_license_test.go index 927661a0..d68f1261 100644 --- a/rdfloader/parser2v2/parse_license_test.go +++ b/rdfloader/parser2v2/parse_license_test.go @@ -226,8 +226,8 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 1: invalid license member parser, _ = parserFromBodyContent(` - - + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject @@ -239,8 +239,8 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 2: invalid predicate in the licenseSet. parser, _ = parserFromBodyContent(` - - + + `) @@ -283,8 +283,8 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 1: invalid license member parser, _ = parserFromBodyContent(` - - + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject @@ -296,8 +296,8 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 2: invalid predicate in the licenseSet. parser, _ = parserFromBodyContent(` - - + + `) @@ -371,7 +371,7 @@ func Test_rdfParser2_2_getLicenseExceptionFromNode(t *testing.T) { // TestCase 1: invalid value for rdf:seeAlso parser, _ = parserFromBodyContent(` - + no example Libtool-exception no comments @@ -384,7 +384,7 @@ func Test_rdfParser2_2_getLicenseExceptionFromNode(t *testing.T) { if err != nil { t.Fatalf("unexpected error while parsing a valid licenseException") } - expectedCrossReference := "https://www.opensource.org/licenses/GPL-3.0" + expectedCrossReference := "http://www.opensource.org/licenses/GPL-3.0" if licenseException.seeAlso != expectedCrossReference { t.Errorf("expected: %s, found: %s", expectedCrossReference, licenseException.seeAlso) } @@ -474,7 +474,7 @@ func Test_rdfParser2_2_getLicenseFromNode(t *testing.T) { // TestCase 5: everything valid: parser, _ = parserFromBodyContent(` - + https://www.opensource.org/licenses/GPL-3.0 true GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -492,7 +492,7 @@ func Test_rdfParser2_2_getLicenseFromNode(t *testing.T) { if err != nil { t.Errorf("error parsing a valid input: %v", err) } - expectedSeeAlso := "https://www.opensource.org/licenses/GPL-3.0" + expectedSeeAlso := "http://www.opensource.org/licenses/GPL-3.0" if len(license.seeAlso) != 1 { t.Fatalf("expected seeAlso to have 1 element, got %d", len(license.seeAlso)) } @@ -796,7 +796,7 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` - + @@ -812,7 +812,7 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` - + @@ -834,7 +834,7 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` - + diff --git a/rdfloader/parser2v2/parse_package_test.go b/rdfloader/parser2v2/parse_package_test.go index 7b8c2429..23646db4 100644 --- a/rdfloader/parser2v2/parse_package_test.go +++ b/rdfloader/parser2v2/parse_package_test.go @@ -606,7 +606,7 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) pkg = &v2_2.Package{} @@ -620,7 +620,7 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) pkg = &v2_2.Package{} @@ -644,7 +644,7 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) pkg = &v2_2.Package{} @@ -667,7 +667,7 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) pkg = &v2_2.Package{} diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index 3840c061..1dce9342 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -51,10 +51,10 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { d6a770ba38583ed4bb4525bd96e50461655d2759 - + - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -189,10 +189,10 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { d6a770ba38583ed4bb4525bd96e50461655d2759 - + - + diff --git a/rdfloader/parser2v3/license_utils_test.go b/rdfloader/parser2v3/license_utils_test.go index 5f592255..da4af5dc 100644 --- a/rdfloader/parser2v3/license_utils_test.go +++ b/rdfloader/parser2v3/license_utils_test.go @@ -53,7 +53,7 @@ func Test_rdfParser2_3_getChecksumFromNode(t *testing.T) { parser, _ = parserFromBodyContent(` 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - + `) From e4072b10b4fbc20669574c19e746ad7d8cd883b2 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:39:26 +0200 Subject: [PATCH 12/29] Pipeline fix Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_license_test.go | 4 ++-- rdfloader/parser2v2/parse_relationship_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rdfloader/parser2v2/parse_license_test.go b/rdfloader/parser2v2/parse_license_test.go index d68f1261..3854e5bb 100644 --- a/rdfloader/parser2v2/parse_license_test.go +++ b/rdfloader/parser2v2/parse_license_test.go @@ -120,7 +120,7 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { Apache License 2.0 Apache-2.0 true - https://www.opensource.org/licenses/Apache-2.0 + http://www.opensource.org/licenses/Apache-2.0 ... ... @@ -475,7 +475,7 @@ func Test_rdfParser2_2_getLicenseFromNode(t *testing.T) { // TestCase 5: everything valid: parser, _ = parserFromBodyContent(` - https://www.opensource.org/licenses/GPL-3.0 + http://www.opensource.org/licenses/GPL-3.0 true GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 GNU General Public License v3.0 or later diff --git a/rdfloader/parser2v2/parse_relationship_test.go b/rdfloader/parser2v2/parse_relationship_test.go index 36a6ba3d..1853e4b8 100644 --- a/rdfloader/parser2v2/parse_relationship_test.go +++ b/rdfloader/parser2v2/parse_relationship_test.go @@ -79,7 +79,7 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { parser, _ := parserFromBodyContent(` - + `) @@ -215,7 +215,7 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { - + @@ -290,7 +290,7 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { - + @@ -327,13 +327,13 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { - + - + - - + + @@ -353,9 +353,9 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { - + - + comment From 100743e19c73ed30ad9a11b09a90fba1fa099b56 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Fri, 30 Dec 2022 22:43:36 +0200 Subject: [PATCH 13/29] Pipeline fix Signed-off-by: CatalinStratu --- .../parser2v2/parse_relationship_test.go | 30 +++++++++---------- .../parser2v2/parse_snippet_info_test.go | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/rdfloader/parser2v2/parse_relationship_test.go b/rdfloader/parser2v2/parse_relationship_test.go index 1853e4b8..0e1aa3e8 100644 --- a/rdfloader/parser2v2/parse_relationship_test.go +++ b/rdfloader/parser2v2/parse_relationship_test.go @@ -108,7 +108,7 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) @@ -123,7 +123,7 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) @@ -152,7 +152,7 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) @@ -167,7 +167,7 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) @@ -196,7 +196,7 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) @@ -229,11 +229,11 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 3: invalid RefB parser, _ = parserFromBodyContent(` - + - + @@ -268,11 +268,11 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 4: undefined relatedSpdxElement parser, _ = parserFromBodyContent(` - + - + @@ -286,7 +286,7 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 6: relatedElement associated with more than one type parser, _ = parserFromBodyContent(` - + @@ -295,7 +295,7 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { - + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) @@ -305,11 +305,11 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 5: unknown predicate inside a relationship parser, _ = parserFromBodyContent(` - + - + @@ -324,7 +324,7 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 8: Recursive relationships mustn't raise any error: parser, _ = parserFromBodyContent(` - + @@ -350,7 +350,7 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 7: completely valid example: parser, _ = parserFromBodyContent(` - + diff --git a/rdfloader/parser2v2/parse_snippet_info_test.go b/rdfloader/parser2v2/parse_snippet_info_test.go index f9f71b94..ff4494dd 100644 --- a/rdfloader/parser2v2/parse_snippet_info_test.go +++ b/rdfloader/parser2v2/parse_snippet_info_test.go @@ -168,7 +168,7 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { // TestCase 2: invalid file in the reference should raise an error si = &v2_2.Snippet{} parser, _ = parserFromBodyContent(` - + test file `) @@ -181,7 +181,7 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { // TestCase 3: A valid reference must set the file to the files map of the parser. si = &v2_2.Snippet{} parser, _ = parserFromBodyContent(` - + test file `) From 0d64ef3b8a62da8208456afea37d4c0aca063ea3 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 00:21:28 +0200 Subject: [PATCH 14/29] Pipeline fix Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_spdx_document_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index 1dce9342..f3ec203c 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -23,7 +23,7 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -103,7 +103,7 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { - + From aa5dffe7972e920494803cb24e6189479eca860d Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 00:41:01 +0200 Subject: [PATCH 15/29] Error string should not be capitalized or end with the punctuation mark Signed-off-by: CatalinStratu --- tvsaver/saver2v1/save_document.go | 2 +- tvsaver/saver2v2/save_file_test.go | 55 +++++++++++------------ tvsaver/saver2v2/save_package_test.go | 64 +++++++++++++-------------- tvsaver/saver2v3/save_document.go | 2 +- tvsaver/saver2v3/save_package_test.go | 3 +- 5 files changed, 62 insertions(+), 64 deletions(-) diff --git a/tvsaver/saver2v1/save_document.go b/tvsaver/saver2v1/save_document.go index 1db4bf6d..951fe092 100644 --- a/tvsaver/saver2v1/save_document.go +++ b/tvsaver/saver2v1/save_document.go @@ -19,7 +19,7 @@ import ( // and typically does not need to be called by client code. func RenderDocument2_1(doc *v2_1.Document, w io.Writer) error { if doc.CreationInfo == nil { - return fmt.Errorf("Document had nil CreationInfo section") + return fmt.Errorf("document had nil CreationInfo section") } if doc.SPDXVersion != "" { diff --git a/tvsaver/saver2v2/save_file_test.go b/tvsaver/saver2v2/save_file_test.go index 1bf64534..a7bd16fc 100644 --- a/tvsaver/saver2v2/save_file_test.go +++ b/tvsaver/saver2v2/save_file_test.go @@ -68,35 +68,34 @@ attribution`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`FileName: /tmp/whatever.txt - SPDXID: SPDXRef-File123 - FileType: TEXT - FileType: DOCUMENTATION - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c - FileChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd - FileChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - LicenseConcluded: Apache-2.0 - LicenseInfoInFile: Apache-2.0 - LicenseInfoInFile: Apache-1.1 - LicenseComments: this is a license comment(s) - FileCopyrightText: Copyright (c) Jane Doe - ArtifactOfProjectName: project1 - ArtifactOfProjectHomePage: http://example.com/1/ - ArtifactOfProjectURI: http://example.com/1/uri.whatever - ArtifactOfProjectName: project2 - ArtifactOfProjectName: project3 - ArtifactOfProjectHomePage: http://example.com/3/ - ArtifactOfProjectName: project4 - ArtifactOfProjectURI: http://example.com/4/uri.whatever - FileComment: this is a file comment - FileNotice: This file may be used under either Apache-2.0 or Apache-1.1. - FileContributor: John Doe jdoe@example.com - FileContributor: EvilCorp - FileAttributionText: attributions - FileAttributionText: multi-line - attribution - FileDependency: f-1.txt +SPDXID: SPDXRef-File123 +FileType: TEXT +FileType: DOCUMENTATION +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c +FileChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd +FileChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 +LicenseConcluded: Apache-2.0 +LicenseInfoInFile: Apache-2.0 +LicenseInfoInFile: Apache-1.1 +LicenseComments: this is a license comment(s) +FileCopyrightText: Copyright (c) Jane Doe +ArtifactOfProjectName: project1 +ArtifactOfProjectHomePage: http://example.com/1/ +ArtifactOfProjectURI: http://example.com/1/uri.whatever +ArtifactOfProjectName: project2 +ArtifactOfProjectName: project3 +ArtifactOfProjectHomePage: http://example.com/3/ +ArtifactOfProjectName: project4 +ArtifactOfProjectURI: http://example.com/4/uri.whatever +FileComment: this is a file comment +FileNotice: This file may be used under either Apache-2.0 or Apache-1.1. +FileContributor: John Doe jdoe@example.com +FileContributor: EvilCorp +FileAttributionText: attributions +FileAttributionText: multi-line +attribution +FileDependency: f-1.txt FileDependency: g.txt - `) // render as buffer of bytes diff --git a/tvsaver/saver2v2/save_package_test.go b/tvsaver/saver2v2/save_package_test.go index e921743d..7ddddd83 100644 --- a/tvsaver/saver2v2/save_package_test.go +++ b/tvsaver/saver2v2/save_package_test.go @@ -102,39 +102,39 @@ multi-line external ref comment`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageVersion: 0.1.0 - PackageFileName: p1-0.1.0-master.tar.gz - PackageSupplier: Organization: John Doe, Inc. - PackageOriginator: Person: John Doe - PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: true - PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 (excludes: p1-0.1.0.spdx) - PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c - PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd - PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - PackageHomePage: http://example.com/p1 - PackageSourceInfo: this is a source comment - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseInfoFromFiles: Apache-1.1 - PackageLicenseInfoFromFiles: Apache-2.0 - PackageLicenseInfoFromFiles: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageLicenseComments: this is a license comment(s) - PackageCopyrightText: Copyright (c) John Doe, Inc. - PackageSummary: this is a summary comment - PackageDescription: this is a description comment - PackageComment: this is a comment comment - ExternalRef: SECURITY cpe22Type cpe:/a:john_doe_inc:p1:0.1.0 - ExternalRefComment: this is an external ref comment #1 - ExternalRef: PACKAGE-MANAGER npm p1@0.1.0 - ExternalRefComment: this is a - multi-line external ref comment - ExternalRef: PERSISTENT-ID swh swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 - ExternalRef: OTHER anything anything-without-spaces-can-go-here - PackageAttributionText: Include this notice in all advertising materials +SPDXID: SPDXRef-p1 +PackageVersion: 0.1.0 +PackageFileName: p1-0.1.0-master.tar.gz +PackageSupplier: Organization: John Doe, Inc. +PackageOriginator: Person: John Doe +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: true +PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 (excludes: p1-0.1.0.spdx) +PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c +PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd +PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 +PackageHomePage: http://example.com/p1 +PackageSourceInfo: this is a source comment +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseInfoFromFiles: Apache-1.1 +PackageLicenseInfoFromFiles: Apache-2.0 +PackageLicenseInfoFromFiles: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageLicenseComments: this is a license comment(s) +PackageCopyrightText: Copyright (c) John Doe, Inc. +PackageSummary: this is a summary comment +PackageDescription: this is a description comment +PackageComment: this is a comment comment +ExternalRef: SECURITY cpe22Type cpe:/a:john_doe_inc:p1:0.1.0 +ExternalRefComment: this is an external ref comment #1 +ExternalRef: PACKAGE-MANAGER npm p1@0.1.0 +ExternalRefComment: this is a +multi-line external ref comment +ExternalRef: PERSISTENT-ID swh swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 +ExternalRef: OTHER anything anything-without-spaces-can-go-here +PackageAttributionText: Include this notice in all advertising materials - `) +`) // render as buffer of bytes var got bytes.Buffer diff --git a/tvsaver/saver2v3/save_document.go b/tvsaver/saver2v3/save_document.go index e8c25359..6c0e4e9b 100644 --- a/tvsaver/saver2v3/save_document.go +++ b/tvsaver/saver2v3/save_document.go @@ -19,7 +19,7 @@ import ( // and typically does not need to be called by client code. func RenderDocument2_3(doc *v2_3.Document, w io.Writer) error { if doc.CreationInfo == nil { - return fmt.Errorf("Document had nil CreationInfo section") + return fmt.Errorf("document had nil CreationInfo section") } if doc.SPDXVersion != "" { diff --git a/tvsaver/saver2v3/save_package_test.go b/tvsaver/saver2v3/save_package_test.go index e2bddb4c..6d0a3956 100644 --- a/tvsaver/saver2v3/save_package_test.go +++ b/tvsaver/saver2v3/save_package_test.go @@ -513,8 +513,7 @@ PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later PackageCopyrightText: Copyright (c) John Doe, Inc. Copyright Jane Doe - - `) +`) // render as buffer of bytes var got bytes.Buffer From 709905cd24c3d1ffe8377efbfa059d7e03ab8b89 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 00:44:59 +0200 Subject: [PATCH 16/29] Pipeline fix Signed-off-by: CatalinStratu --- tvsaver/saver2v1/save_document_test.go | 222 ++++++++++++------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/tvsaver/saver2v1/save_document_test.go b/tvsaver/saver2v1/save_document_test.go index 997af865..307af568 100644 --- a/tvsaver/saver2v1/save_document_test.go +++ b/tvsaver/saver2v1/save_document_test.go @@ -208,126 +208,126 @@ blah blah blah blah`, } want := bytes.NewBufferString(`SPDXVersion: SPDX-2.1 - DataLicense: CC0-1.0 - SPDXID: SPDXRef-DOCUMENT - DocumentName: spdx-go-0.0.1.abcdef - DocumentNamespace: https://github.com/swinslow/spdx-docs/spdx-go/spdx-go-0.0.1.abcdef.whatever - Creator: Person: John Doe - Created: 2018-10-10T06:20:00Z - - ##### Unpackaged files - - FileName: /tmp/whatever1.txt - SPDXID: SPDXRef-File1231 - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c - LicenseConcluded: Apache-2.0 - LicenseInfoInFile: Apache-2.0 - FileCopyrightText: Copyright (c) Jane Doe - - FileName: /tmp/whatever2.txt - SPDXID: SPDXRef-File1232 - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d - LicenseConcluded: MIT - LicenseInfoInFile: MIT - FileCopyrightText: Copyright (c) John Doe - - ##### Package: p1 - - PackageName: p1 - SPDXID: SPDXRef-p1 - PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: true - PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 - PackageLicenseConcluded: GPL-2.0-or-later AND BSD-3-Clause AND WTFPL - PackageLicenseInfoFromFiles: Apache-2.0 - PackageLicenseInfoFromFiles: GPL-2.0-or-later - PackageLicenseInfoFromFiles: WTFPL - PackageLicenseInfoFromFiles: BSD-3-Clause - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageCopyrightText: Copyright (c) John Doe, Inc. - - FileName: /tmp/another-file.txt - SPDXID: SPDXRef-FileAnother - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983f - LicenseConcluded: BSD-3-Clause - LicenseInfoInFile: BSD-3-Clause - FileCopyrightText: Copyright (c) Jane Doe LLC - - FileName: /tmp/file-with-snippets.txt - SPDXID: SPDXRef-FileHasSnippets - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983e - LicenseConcluded: GPL-2.0-or-later AND WTFPL - LicenseInfoInFile: Apache-2.0 - LicenseInfoInFile: GPL-2.0-or-later - LicenseInfoInFile: WTFPL - FileCopyrightText: Copyright (c) Jane Doe - - SnippetSPDXID: SPDXRef-Snippet19 - SnippetFromFileSPDXID: SPDXRef-FileHasSnippets - SnippetByteRange: 17:209 - SnippetLicenseConcluded: GPL-2.0-or-later - SnippetCopyrightText: Copyright (c) John Doe 20x6 - - SnippetSPDXID: SPDXRef-Snippet20 - SnippetFromFileSPDXID: SPDXRef-FileHasSnippets - SnippetByteRange: 268:309 - SnippetLicenseConcluded: WTFPL - SnippetCopyrightText: NOASSERTION - - ##### Other Licenses - - LicenseID: LicenseRef-1 - ExtractedText: License 1 text - blah blah blah - blah blah blah blah - LicenseName: License 1 - - LicenseID: LicenseRef-2 - ExtractedText: License 2 text - this is a license that does some stuff - LicenseName: License 2 - - ##### Relationships - - Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-p1 - Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1231 - Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1232 - - ##### Annotations - - Annotator: Person: John Doe - AnnotationDate: 2018-10-10T17:52:00Z - AnnotationType: REVIEW - SPDXREF: SPDXRef-DOCUMENT - AnnotationComment: This is an annotation about the SPDX document - - Annotator: Organization: John Doe, Inc. - AnnotationDate: 2018-10-10T17:52:00Z - AnnotationType: REVIEW - SPDXREF: SPDXRef-p1 - AnnotationComment: This is an annotation about Package p1 - - ##### Reviews - - Reviewer: Person: John Doe - ReviewDate: 2018-10-14T10:28:00Z - - Reviewer: Organization: Jane Doe LLC - ReviewDate: 2018-10-14T10:28:00Z - ReviewComment: I have reviewed this SPDX document and it is awesome - - `) +DataLicense: CC0-1.0 +SPDXID: SPDXRef-DOCUMENT +DocumentName: spdx-go-0.0.1.abcdef +DocumentNamespace: https://github.com/swinslow/spdx-docs/spdx-go/spdx-go-0.0.1.abcdef.whatever +Creator: Person: John Doe +Created: 2018-10-10T06:20:00Z + +##### Unpackaged files + +FileName: /tmp/whatever1.txt +SPDXID: SPDXRef-File1231 +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c +LicenseConcluded: Apache-2.0 +LicenseInfoInFile: Apache-2.0 +FileCopyrightText: Copyright (c) Jane Doe + +FileName: /tmp/whatever2.txt +SPDXID: SPDXRef-File1232 +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d +LicenseConcluded: MIT +LicenseInfoInFile: MIT +FileCopyrightText: Copyright (c) John Doe + +##### Package: p1 + +PackageName: p1 +SPDXID: SPDXRef-p1 +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: true +PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 +PackageLicenseConcluded: GPL-2.0-or-later AND BSD-3-Clause AND WTFPL +PackageLicenseInfoFromFiles: Apache-2.0 +PackageLicenseInfoFromFiles: GPL-2.0-or-later +PackageLicenseInfoFromFiles: WTFPL +PackageLicenseInfoFromFiles: BSD-3-Clause +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageCopyrightText: Copyright (c) John Doe, Inc. + +FileName: /tmp/another-file.txt +SPDXID: SPDXRef-FileAnother +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983f +LicenseConcluded: BSD-3-Clause +LicenseInfoInFile: BSD-3-Clause +FileCopyrightText: Copyright (c) Jane Doe LLC + +FileName: /tmp/file-with-snippets.txt +SPDXID: SPDXRef-FileHasSnippets +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983e +LicenseConcluded: GPL-2.0-or-later AND WTFPL +LicenseInfoInFile: Apache-2.0 +LicenseInfoInFile: GPL-2.0-or-later +LicenseInfoInFile: WTFPL +FileCopyrightText: Copyright (c) Jane Doe + +SnippetSPDXID: SPDXRef-Snippet19 +SnippetFromFileSPDXID: SPDXRef-FileHasSnippets +SnippetByteRange: 17:209 +SnippetLicenseConcluded: GPL-2.0-or-later +SnippetCopyrightText: Copyright (c) John Doe 20x6 + +SnippetSPDXID: SPDXRef-Snippet20 +SnippetFromFileSPDXID: SPDXRef-FileHasSnippets +SnippetByteRange: 268:309 +SnippetLicenseConcluded: WTFPL +SnippetCopyrightText: NOASSERTION + +##### Other Licenses + +LicenseID: LicenseRef-1 +ExtractedText: License 1 text +blah blah blah +blah blah blah blah +LicenseName: License 1 + +LicenseID: LicenseRef-2 +ExtractedText: License 2 text - this is a license that does some stuff +LicenseName: License 2 + +##### Relationships + +Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-p1 +Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1231 +Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-File1232 + +##### Annotations + +Annotator: Person: John Doe +AnnotationDate: 2018-10-10T17:52:00Z +AnnotationType: REVIEW +SPDXREF: SPDXRef-DOCUMENT +AnnotationComment: This is an annotation about the SPDX document + +Annotator: Organization: John Doe, Inc. +AnnotationDate: 2018-10-10T17:52:00Z +AnnotationType: REVIEW +SPDXREF: SPDXRef-p1 +AnnotationComment: This is an annotation about Package p1 + +##### Reviews + +Reviewer: Person: John Doe +ReviewDate: 2018-10-14T10:28:00Z + +Reviewer: Organization: Jane Doe LLC +ReviewDate: 2018-10-14T10:28:00Z +ReviewComment: I have reviewed this SPDX document and it is awesome + +`) // render as buffer of bytes var got bytes.Buffer err := RenderDocument2_1(doc, &got) if err != nil { - t.Errorf("Expected nil error, got %v", err) + t.Errorf("expected nil error, got %v", err) } // check that they match c := bytes.Compare(want.Bytes(), got.Bytes()) if c != 0 { - t.Errorf("Expected {{{%v}}}, got {{{%v}}}", want.String(), got.String()) + t.Errorf("expected {{{%v}}}, got {{{%v}}}", want.String(), got.String()) } } @@ -338,6 +338,6 @@ func TestSaver2_1DocumentReturnsErrorIfNilCreationInfo(t *testing.T) { var got bytes.Buffer err := RenderDocument2_1(doc, &got) if err == nil { - t.Errorf("Expected error, got nil") + t.Errorf("expected error, got nil") } } From e6c48e05b61e9c4f4cd7bdf91d4d0c68c1a71142 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 00:47:08 +0200 Subject: [PATCH 17/29] Pipeline fix Signed-off-by: CatalinStratu --- tvloader/parser2v1/parse_file_test.go | 4 ++-- tvloader/parser2v2/parse_creation_info_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tvloader/parser2v1/parse_file_test.go b/tvloader/parser2v1/parse_file_test.go index 0b2aee1c..0da60570 100644 --- a/tvloader/parser2v1/parse_file_test.go +++ b/tvloader/parser2v1/parse_file_test.go @@ -521,7 +521,7 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "https://example.com/1/") + err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "http://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -755,7 +755,7 @@ func TestFileAOPPointerChangesAfterTags(t *testing.T) { curPtr := parser.fileAOP // now, a home page; pointer should stay - err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "https://example.com/1/") + err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "http://example.com/1/") if err != nil { t.Errorf("expected nil error, got %v", err) } diff --git a/tvloader/parser2v2/parse_creation_info_test.go b/tvloader/parser2v2/parse_creation_info_test.go index 339f5738..06c064f2 100644 --- a/tvloader/parser2v2/parse_creation_info_test.go +++ b/tvloader/parser2v2/parse_creation_info_test.go @@ -413,10 +413,10 @@ func TestFailsExternalDocumentReferenceWithInvalidFormats(t *testing.T) { "whoops", "DocumentRef-", "DocumentRef- ", - "DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", - "DocumentRef-spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 d6a770ba38583ed4bb4525bd96e50461655d2759", + "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 d6a770ba38583ed4bb4525bd96e50461655d2759", "DocumentRef-spdx-tool-1.2", - "spdx-tool-1.2 https://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759", + "spdx-tool-1.2 htt://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759", } for _, refstring := range invalidRefs { _, _, _, _, err := extractExternalDocumentReference(refstring) From 1b2d2415b8c25f57ff8c59115ca5a3d26f168496 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 01:08:11 +0200 Subject: [PATCH 18/29] Pipeline fix Signed-off-by: CatalinStratu --- rdfloader/parser2v2/license_utils_test.go | 32 +++++----- rdfloader/parser2v2/parse_annotation_test.go | 58 +++++++++---------- .../parser2v2/parse_snippet_info_test.go | 46 +++++++-------- .../parser2v2/parse_spdx_document_test.go | 6 +- rdfloader/parser2v2/parser_test.go | 6 +- rdfloader/parser2v2/utils_test.go | 4 +- tvloader/parser2v1/parse_file_test.go | 8 +-- 7 files changed, 80 insertions(+), 80 deletions(-) diff --git a/rdfloader/parser2v2/license_utils_test.go b/rdfloader/parser2v2/license_utils_test.go index b308851b..467ad730 100644 --- a/rdfloader/parser2v2/license_utils_test.go +++ b/rdfloader/parser2v2/license_utils_test.go @@ -38,11 +38,11 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { var err error // TestCase 1: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + +`) checksumNode := parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -51,12 +51,12 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + +`) checksumNode = parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -65,11 +65,11 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { // TestCase 3: valid input parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + +`) checksumNode = parser.gordfParserObj.Triples[0].Subject algorithm, value, err := parser.getChecksumFromNode(checksumNode) if err != nil { diff --git a/rdfloader/parser2v2/parse_annotation_test.go b/rdfloader/parser2v2/parse_annotation_test.go index a6cdf807..cee4c6eb 100644 --- a/rdfloader/parser2v2/parse_annotation_test.go +++ b/rdfloader/parser2v2/parse_annotation_test.go @@ -98,13 +98,13 @@ func Test_setAnnotationToParser(t *testing.T) { func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 1: invalid annotator must raise an error parser, _ := parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Company: some company - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Company: some company + + +`) node := parser.gordfParserObj.Triples[0].Subject err := parser.parseAnnotationFromNode(node) if err == nil { @@ -113,13 +113,13 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 2: wrong annotation type should raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + +`) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -128,14 +128,14 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 3: unknown predicate should also raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + +`) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -144,13 +144,13 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 4: completely valid annotation parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - `) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + +`) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err != nil { diff --git a/rdfloader/parser2v2/parse_snippet_info_test.go b/rdfloader/parser2v2/parse_snippet_info_test.go index ff4494dd..83c212d4 100644 --- a/rdfloader/parser2v2/parse_snippet_info_test.go +++ b/rdfloader/parser2v2/parse_snippet_info_test.go @@ -29,7 +29,7 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 2: Invalid LicenseInfoInSnippet parser, _ = parserFromBodyContent(` - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -83,7 +83,7 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 5: invalid license concluded: parser, _ = parserFromBodyContent(` - + `) node = parser.gordfParserObj.Triples[0].Subject @@ -102,13 +102,13 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { - + 420 - + 310 @@ -138,7 +138,7 @@ func Test_setSnippetID(t *testing.T) { // TestCase 2: valid input si := &v2_2.Snippet{} - err = setSnippetID("https://spdx.org/spdxdocs/spdx-example#SPDXRef-Snippet", si) + err = setSnippetID("http://spdx.org/spdxdocs/spdx-example#SPDXRef-Snippet", si) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -158,7 +158,7 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { parser, _ = parserFromBodyContent(``) node = &gordfParser.Node{ NodeType: gordfParser.RESOURCELITERAL, - ID: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#SPDXRef-DoapSource", + ID: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#SPDXRef-DoapSource", } err = parser.parseRangeReference(node, si) if err != nil { @@ -289,7 +289,7 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 310 @@ -309,13 +309,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 310 @@ -340,13 +340,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 310 @@ -364,13 +364,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 310 @@ -388,13 +388,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 42.0 - + 310 @@ -412,13 +412,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 31+0 @@ -436,13 +436,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 310 @@ -460,13 +460,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 310 @@ -484,13 +484,13 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { - + 420 - + 310 diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index f3ec203c..c4e98db5 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -181,7 +181,7 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { parser, _ = parserFromBodyContent(` SPDX-2.1 - + /test/example @@ -218,8 +218,8 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { - - + + diff --git a/rdfloader/parser2v2/parser_test.go b/rdfloader/parser2v2/parser_test.go index efc8c02e..8bfafeb0 100644 --- a/rdfloader/parser2v2/parser_test.go +++ b/rdfloader/parser2v2/parser_test.go @@ -42,7 +42,7 @@ func TestLoadFromGoRDFParser(t *testing.T) { // TestCase 2: invalid SpdxDocumentNode parser, _ = parserFromBodyContent(` - + `) @@ -105,8 +105,8 @@ func TestLoadFromGoRDFParser(t *testing.T) { Open Logic Inc. ./src/org/spdx/parser/DOAPProject.java Black Duck Software In.c - - + + diff --git a/rdfloader/parser2v2/utils_test.go b/rdfloader/parser2v2/utils_test.go index a21fa976..311fb4c1 100644 --- a/rdfloader/parser2v2/utils_test.go +++ b/rdfloader/parser2v2/utils_test.go @@ -71,13 +71,13 @@ func Test_rdfParser2_2_nodeToTriples(t *testing.T) { // It should allow new nodes same as the older ones to retrieve the associated triples. parser, _ = parserFromBodyContent(` - + 75068c26abbed3ad3980685bae21d7202d288317 `) newNode := &gordfParser.Node{ NodeType: gordfParser.IRI, - ID: "https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#checksum", + ID: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#checksum", } output = parser.nodeToTriples(newNode) diff --git a/tvloader/parser2v1/parse_file_test.go b/tvloader/parser2v1/parse_file_test.go index 0da60570..1f975050 100644 --- a/tvloader/parser2v1/parse_file_test.go +++ b/tvloader/parser2v1/parse_file_test.go @@ -539,7 +539,7 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "https://example.com/3/") + err = parser.parsePairFromFile2_1("ArtifactOfProjectHomePage", "http://example.com/3/") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -548,7 +548,7 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if err != nil { t.Errorf("expected nil error, got %v", err) } - err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "https://example.com/4/uri.whatever") + err = parser.parsePairFromFile2_1("ArtifactOfProjectURI", "http://example.com/4/uri.whatever") if err != nil { t.Errorf("expected nil error, got %v", err) } @@ -597,8 +597,8 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if aop.HomePage != "" { t.Errorf("expected %v, got %v", "", aop.HomePage) } - if aop.URI != "https://example.com/4/uri.whatever" { - t.Errorf("expected %v, got %v", "https://example.com/4/uri.whatever", aop.URI) + if aop.URI != "http://example.com/4/uri.whatever" { + t.Errorf("expected %v, got %v", "http://example.com/4/uri.whatever", aop.URI) } // File Comment From f3ee56b8f9a021b80ec1f215b1a86a2353b96644 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 01:32:05 +0200 Subject: [PATCH 19/29] Pipeline fix Signed-off-by: CatalinStratu --- rdfloader/parser2v3/constants.go | 2 +- rdfloader/parser2v3/parse_file_test.go | 20 +- tvloader/parser2v1/parse_file_test.go | 12 +- .../parser2v2/parse_creation_info_test.go | 2 +- tvsaver/saver2v2/save_package_test.go | 175 +++++++++--------- 5 files changed, 106 insertions(+), 105 deletions(-) diff --git a/rdfloader/parser2v3/constants.go b/rdfloader/parser2v3/constants.go index 48f870fb..44ca0d4c 100644 --- a/rdfloader/parser2v3/constants.go +++ b/rdfloader/parser2v3/constants.go @@ -12,7 +12,7 @@ var ( NS_PTR = "http://www.w3.org/2009/pointers#" NS_DOAP = "http://usefulinc.com/ns/doap#" - // SPDX_SPEC_VERSION SPDX properties + // SPDX properties SPDX_SPEC_VERSION = NS_SPDX + "specVersion" SPDX_DATA_LICENSE = NS_SPDX + "dataLicense" SPDX_NAME = NS_SPDX + "name" diff --git a/rdfloader/parser2v3/parse_file_test.go b/rdfloader/parser2v3/parse_file_test.go index 424ddfbf..0828163a 100644 --- a/rdfloader/parser2v3/parse_file_test.go +++ b/rdfloader/parser2v3/parse_file_test.go @@ -51,7 +51,7 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { ` - https://www.openjena.org/ + http://www.openjena.org/ Jena @@ -67,7 +67,7 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { if artifact.Name != "Jena" { t.Errorf("expected name of artifact: %s, found: %s", "Jena", artifact.Name) } - expectedHomePage := "https://www.openjena.org/" + expectedHomePage := "http://www.openjena.org/" if artifact.HomePage != expectedHomePage { t.Errorf("wrong artifact homepage. Expected: %s, found: %s", expectedHomePage, artifact.HomePage) } @@ -79,8 +79,8 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { rdfParser, err = parserFromBodyContent( ` - - https://www.openjena.org/ + + http://www.openjena.org/ Jena @@ -103,7 +103,7 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { ` - https://www.openjena.org/ + http://www.openjena.org/ Jena @@ -123,7 +123,7 @@ func Test_rdfParser2_3_getFileTypeFromUri(t *testing.T) { rdfParser, _ := parserFromBodyContent(``) // TestCase 1: Valid fileType URI: - fileTypeURI := "https://spdx.org/rdf/terms#fileType_source" + fileTypeURI := "http://spdx.org/rdf/terms#fileType_source" fileType, err := rdfParser.getFileTypeFromUri(fileTypeURI) if err != nil { t.Errorf("error in a valid example: %v", err) @@ -133,7 +133,7 @@ func Test_rdfParser2_3_getFileTypeFromUri(t *testing.T) { } // TestCase 2: Invalid fileType URI format. - fileTypeURI = "https://spdx.org/rdf/terms#source" + fileTypeURI = "http://spdx.org/rdf/terms#source" fileType, err = rdfParser.getFileTypeFromUri(fileTypeURI) if err == nil { t.Error("should've raised an error for invalid fileType") @@ -178,7 +178,7 @@ func Test_setFileIdentifier(t *testing.T) { file := &v2_3.File{} // TestCase 1: valid example - err := setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) + err := setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#SPDXRef-129", file) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -187,7 +187,7 @@ func Test_setFileIdentifier(t *testing.T) { } // TestCase 2: invalid example - err = setFileIdentifier("https://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) + err = setFileIdentifier("http://spdx.org/documents/spdx-toolsv2.1.7-SNAPSHOT#129", file) if err == nil { t.Errorf("should've raised an error for an invalid example") } @@ -197,7 +197,7 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 1: md5 checksum parser, _ := parserFromBodyContent(` - + d2356e0fe1c0b85285d83c6b2ad51b5f `) diff --git a/tvloader/parser2v1/parse_file_test.go b/tvloader/parser2v1/parse_file_test.go index 1f975050..77cf63a1 100644 --- a/tvloader/parser2v1/parse_file_test.go +++ b/tvloader/parser2v1/parse_file_test.go @@ -561,11 +561,11 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if aop.Name != "project1" { t.Errorf("expected %v, got %v", "project1", aop.Name) } - if aop.HomePage != "https://example.com/1/" { - t.Errorf("expected %v, got %v", "https://example.com/1/", aop.HomePage) + if aop.HomePage != "http://example.com/1/" { + t.Errorf("expected %v, got %v", "http://example.com/1/", aop.HomePage) } - if aop.URI != "https://example.com/1/uri.whatever" { - t.Errorf("expected %v, got %v", "https://example.com/1/uri.whatever", aop.URI) + if aop.URI != "http://example.com/1/uri.whatever" { + t.Errorf("expected %v, got %v", "http://example.com/1/uri.whatever", aop.URI) } aop = parser.file.ArtifactOfProjects[1] @@ -583,8 +583,8 @@ func TestParser2_1CanParseFileTags(t *testing.T) { if aop.Name != "project3" { t.Errorf("expected %v, got %v", "project3", aop.Name) } - if aop.HomePage != "https://example.com/3/" { - t.Errorf("expected %v, got %v", "https://example.com/3/", aop.HomePage) + if aop.HomePage != "http://example.com/3/" { + t.Errorf("expected %v, got %v", "http://example.com/3/", aop.HomePage) } if aop.URI != "" { t.Errorf("expected %v, got %v", "", aop.URI) diff --git a/tvloader/parser2v2/parse_creation_info_test.go b/tvloader/parser2v2/parse_creation_info_test.go index 06c064f2..dcf60986 100644 --- a/tvloader/parser2v2/parse_creation_info_test.go +++ b/tvloader/parser2v2/parse_creation_info_test.go @@ -416,7 +416,7 @@ func TestFailsExternalDocumentReferenceWithInvalidFormats(t *testing.T) { "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", "DocumentRef-spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 d6a770ba38583ed4bb4525bd96e50461655d2759", "DocumentRef-spdx-tool-1.2", - "spdx-tool-1.2 htt://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759", + "spdx-tool-1.2 http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301 SHA1:d6a770ba38583ed4bb4525bd96e50461655d2759", } for _, refstring := range invalidRefs { _, _, _, _, err := extractExternalDocumentReference(refstring) diff --git a/tvsaver/saver2v2/save_package_test.go b/tvsaver/saver2v2/save_package_test.go index 7ddddd83..5c2a1749 100644 --- a/tvsaver/saver2v2/save_package_test.go +++ b/tvsaver/saver2v2/save_package_test.go @@ -133,7 +133,7 @@ multi-line external ref comment ExternalRef: PERSISTENT-ID swh swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 ExternalRef: OTHER anything anything-without-spaces-can-go-here PackageAttributionText: Include this notice in all advertising materials - + `) // render as buffer of bytes @@ -163,7 +163,7 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { PackageFileName: "p1-0.1.0-master.tar.gz", PackageSupplier: &common.Supplier{Supplier: "NOASSERTION"}, PackageOriginator: &common.Originator{OriginatorType: "Organization", Originator: "John Doe, Inc."}, - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: true, IsFilesAnalyzedTagPresent: false, PackageVerificationCode: common.PackageVerificationCode{Value: "0123456789abcdef0123456789abcdef01234567"}, @@ -181,7 +181,7 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { Value: "624c1abb3664f4b35547e7c73864ad24", }, }, - PackageHomePage: "https://example.com/p1", + PackageHomePage: "http://example.com/p1", PackageSourceInfo: "this is a source comment", PackageLicenseConcluded: "GPL-2.0-or-later", PackageLicenseInfoFromFiles: []string{ @@ -200,31 +200,31 @@ func TestSaver2_2PackageSavesTextCombo2(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageVersion: 0.1.0 - PackageFileName: p1-0.1.0-master.tar.gz - PackageSupplier: NOASSERTION - PackageOriginator: Organization: John Doe, Inc. - PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz - PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 - PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c - PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd - PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - PackageHomePage: http://example.com/p1 - PackageSourceInfo: this is a source comment - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseInfoFromFiles: Apache-1.1 - PackageLicenseInfoFromFiles: Apache-2.0 - PackageLicenseInfoFromFiles: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageLicenseComments: this is a license comment(s) - PackageCopyrightText: Copyright (c) John Doe, Inc. - PackageSummary: this is a summary comment - PackageDescription: this is a description comment - PackageComment: this is a comment comment - PackageAttributionText: Include this notice in all advertising materials - - `) +SPDXID: SPDXRef-p1 +PackageVersion: 0.1.0 +PackageFileName: p1-0.1.0-master.tar.gz +PackageSupplier: NOASSERTION +PackageOriginator: Organization: John Doe, Inc. +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +PackageVerificationCode: 0123456789abcdef0123456789abcdef01234567 +PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c +PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd +PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 +PackageHomePage: http://example.com/p1 +PackageSourceInfo: this is a source comment +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseInfoFromFiles: Apache-1.1 +PackageLicenseInfoFromFiles: Apache-2.0 +PackageLicenseInfoFromFiles: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageLicenseComments: this is a license comment(s) +PackageCopyrightText: Copyright (c) John Doe, Inc. +PackageSummary: this is a summary comment +PackageDescription: this is a description comment +PackageComment: this is a comment comment +PackageAttributionText: Include this notice in all advertising materials + +`) // render as buffer of bytes var got bytes.Buffer @@ -254,7 +254,7 @@ func TestSaver2_2PackageSavesTextCombo3(t *testing.T) { PackageFileName: "p1-0.1.0-master.tar.gz", PackageSupplier: &common.Supplier{Supplier: "John Doe", SupplierType: "Person"}, PackageOriginator: &common.Originator{Originator: "NOASSERTION"}, - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, // NOTE that verification code MUST be omitted from output @@ -274,7 +274,7 @@ func TestSaver2_2PackageSavesTextCombo3(t *testing.T) { Value: "624c1abb3664f4b35547e7c73864ad24", }, }, - PackageHomePage: "https://example.com/p1", + PackageHomePage: "http://example.com/p1", PackageSourceInfo: "this is a source comment", PackageLicenseConcluded: "GPL-2.0-or-later", // NOTE that license info from files MUST be omitted from output @@ -300,31 +300,31 @@ which goes across two lines`, // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageVersion: 0.1.0 - PackageFileName: p1-0.1.0-master.tar.gz - PackageSupplier: Person: John Doe - PackageOriginator: NOASSERTION - PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: false - PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c - PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd - PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 - PackageHomePage: http://example.com/p1 - PackageSourceInfo: this is a source comment - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageLicenseComments: this is a license comment(s) - PackageCopyrightText: Copyright (c) John Doe, Inc. - PackageSummary: this is a summary comment - PackageDescription: this is a description comment - PackageComment: this is a comment comment - PackageAttributionText: Include this notice in all advertising materials - PackageAttributionText: and also this notice - PackageAttributionText: and this multi-line notice - which goes across two lines - - `) +SPDXID: SPDXRef-p1 +PackageVersion: 0.1.0 +PackageFileName: p1-0.1.0-master.tar.gz +PackageSupplier: Person: John Doe +PackageOriginator: NOASSERTION +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: false +PackageChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c +PackageChecksum: SHA256: 11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd +PackageChecksum: MD5: 624c1abb3664f4b35547e7c73864ad24 +PackageHomePage: http://example.com/p1 +PackageSourceInfo: this is a source comment +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageLicenseComments: this is a license comment(s) +PackageCopyrightText: Copyright (c) John Doe, Inc. +PackageSummary: this is a summary comment +PackageDescription: this is a description comment +PackageComment: this is a comment comment +PackageAttributionText: Include this notice in all advertising materials +PackageAttributionText: and also this notice +PackageAttributionText: and this multi-line notice +which goes across two lines + +`) // render as buffer of bytes var got bytes.Buffer @@ -344,7 +344,7 @@ func TestSaver2_2PackageSaveOmitsOptionalFieldsIfEmpty(t *testing.T) { pkg := &v2_2.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, // NOTE that verification code MUST be omitted from output, @@ -363,14 +363,14 @@ func TestSaver2_2PackageSaveOmitsOptionalFieldsIfEmpty(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: false - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageCopyrightText: Copyright (c) John Doe, Inc. - - `) +SPDXID: SPDXRef-p1 +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: false +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageCopyrightText: Copyright (c) John Doe, Inc. + +`) // render as buffer of bytes var got bytes.Buffer @@ -418,7 +418,7 @@ func TestSaver2_2PackageSavesFilesIfPresent(t *testing.T) { pkg := &v2_2.Package{ PackageName: "p1", PackageSPDXIdentifier: common.ElementID("p1"), - PackageDownloadLocation: "https://example.com/p1/p1-0.1.0-master.tar.gz", + PackageDownloadLocation: "http://example.com/p1/p1-0.1.0-master.tar.gz", FilesAnalyzed: false, IsFilesAnalyzedTagPresent: true, // NOTE that verification code MUST be omitted from output, @@ -441,28 +441,28 @@ func TestSaver2_2PackageSavesFilesIfPresent(t *testing.T) { // what we want to get, as a buffer of bytes want := bytes.NewBufferString(`PackageName: p1 - SPDXID: SPDXRef-p1 - PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz - FilesAnalyzed: false - PackageLicenseConcluded: GPL-2.0-or-later - PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later - PackageCopyrightText: Copyright (c) John Doe, Inc. - - FileName: /tmp/whatever1.txt - SPDXID: SPDXRef-File1231 - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c - LicenseConcluded: Apache-2.0 - LicenseInfoInFile: Apache-2.0 - FileCopyrightText: Copyright (c) Jane Doe - - FileName: /tmp/whatever2.txt - SPDXID: SPDXRef-File1232 - FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d - LicenseConcluded: MIT - LicenseInfoInFile: MIT - FileCopyrightText: Copyright (c) John Doe - - `) +SPDXID: SPDXRef-p1 +PackageDownloadLocation: http://example.com/p1/p1-0.1.0-master.tar.gz +FilesAnalyzed: false +PackageLicenseConcluded: GPL-2.0-or-later +PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later +PackageCopyrightText: Copyright (c) John Doe, Inc. + +FileName: /tmp/whatever1.txt +SPDXID: SPDXRef-File1231 +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983c +LicenseConcluded: Apache-2.0 +LicenseInfoInFile: Apache-2.0 +FileCopyrightText: Copyright (c) Jane Doe + +FileName: /tmp/whatever2.txt +SPDXID: SPDXRef-File1232 +FileChecksum: SHA1: 85ed0817af83a24ad8da68c2b5094de69833983d +LicenseConcluded: MIT +LicenseInfoInFile: MIT +FileCopyrightText: Copyright (c) John Doe + +`) // render as buffer of bytes var got bytes.Buffer @@ -505,6 +505,7 @@ PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later PackageCopyrightText: Copyright (c) John Doe, Inc. Copyright Jane Doe + `) // render as buffer of bytes From 79a90335985a3cfc02d3b9a85ef52f35284c3012 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 01:37:16 +0200 Subject: [PATCH 20/29] Pipeline fix Signed-off-by: CatalinStratu --- tvsaver/saver2v2/save_file_test.go | 1 + tvsaver/saver2v2/save_other_license_test.go | 2 +- tvsaver/saver2v3/save_package_test.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tvsaver/saver2v2/save_file_test.go b/tvsaver/saver2v2/save_file_test.go index a7bd16fc..2b90acf6 100644 --- a/tvsaver/saver2v2/save_file_test.go +++ b/tvsaver/saver2v2/save_file_test.go @@ -96,6 +96,7 @@ FileAttributionText: multi-line attribution FileDependency: f-1.txt FileDependency: g.txt + `) // render as buffer of bytes diff --git a/tvsaver/saver2v2/save_other_license_test.go b/tvsaver/saver2v2/save_other_license_test.go index 87b0c1b3..8d31e48d 100644 --- a/tvsaver/saver2v2/save_other_license_test.go +++ b/tvsaver/saver2v2/save_other_license_test.go @@ -33,7 +33,7 @@ LicenseName: License 1 LicenseCrossReference: http://example.com/License1/ LicenseCrossReference: http://example.com/License1AnotherURL/ LicenseComment: this is a license comment - + `) // render as buffer of bytes diff --git a/tvsaver/saver2v3/save_package_test.go b/tvsaver/saver2v3/save_package_test.go index 6d0a3956..11d042a0 100644 --- a/tvsaver/saver2v3/save_package_test.go +++ b/tvsaver/saver2v3/save_package_test.go @@ -513,6 +513,7 @@ PackageLicenseConcluded: GPL-2.0-or-later PackageLicenseDeclared: Apache-2.0 OR GPL-2.0-or-later PackageCopyrightText: Copyright (c) John Doe, Inc. Copyright Jane Doe + `) // render as buffer of bytes From 4964e3e3df05dcc06ac3a99c13b0de2f7514f723 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 01:41:14 +0200 Subject: [PATCH 21/29] Pipeline fix Signed-off-by: CatalinStratu --- rdfloader/parser2v3/parse_file_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdfloader/parser2v3/parse_file_test.go b/rdfloader/parser2v3/parse_file_test.go index 0828163a..abcc2d92 100644 --- a/rdfloader/parser2v3/parse_file_test.go +++ b/rdfloader/parser2v3/parse_file_test.go @@ -93,7 +93,7 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { if err != nil { t.Errorf("error parsing a valid artifactOf node: %v", err) } - expectedURI := "https://subversion.apache.org/doap.rdf" + expectedURI := "http://subversion.apache.org/doap.rdf" if artifact.URI != expectedURI { t.Errorf("wrong artifact URI. Expected: %s, found: %s", expectedURI, artifact.URI) } From e28d997292bda66e55d75b14378b5bb3c7f131e0 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Sat, 31 Dec 2022 01:59:22 +0200 Subject: [PATCH 22/29] small fix Signed-off-by: CatalinStratu --- rdfloader/parser2v3/parse_license.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdfloader/parser2v3/parse_license.go b/rdfloader/parser2v3/parse_license.go index b75ca05c..008a8a8a 100644 --- a/rdfloader/parser2v3/parse_license.go +++ b/rdfloader/parser2v3/parse_license.go @@ -67,7 +67,7 @@ func (parser *rdfParser2_3) getAnyLicenseFromNode(node *gordfParser.Node) (AnyLi case SPDX_SIMPLE_LICENSING_INFO: return parser.getSimpleLicensingInfoFromNode(node) } - return nil, fmt.Errorf("Unknown subTag (%s) found while parsing AnyLicense", nodeType) + return nil, fmt.Errorf("unknown subTag (%s) found while parsing AnyLicense", nodeType) } func (parser *rdfParser2_3) getLicenseExceptionFromNode(node *gordfParser.Node) (exception LicenseException, err error) { From fe8c286ba2255b64055c2373fd06f8ec5e2a7e8f Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 14:57:10 +0200 Subject: [PATCH 23/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v3/parse_file_test.go | 298 ++++++++++++------------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/rdfloader/parser2v3/parse_file_test.go b/rdfloader/parser2v3/parse_file_test.go index abcc2d92..f7348ef6 100644 --- a/rdfloader/parser2v3/parse_file_test.go +++ b/rdfloader/parser2v3/parse_file_test.go @@ -18,12 +18,12 @@ import ( // pads the content with the enclosing rdf:RDF tag func wrapIntoTemplate(content string) string { header := `` + xmlns:spdx="http://spdx.org/rdf/terms#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns="http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#" + xmlns:doap="http://usefulinc.com/ns/doap#" + xmlns:j.0="http://www.w3.org/2009/pointers#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">` footer := `` return header + content + footer } @@ -49,13 +49,13 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { // TestCase 1: artifactOf without project URI rdfParser, err := parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + http://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -78,13 +78,13 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { // TestCase 2: artifactOf with a Project URI rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + http://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -101,14 +101,14 @@ func Test_rdfParser2_3_getArtifactFromNode(t *testing.T) { // TestCase 3: artifactOf with unknown predicate rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - - `) + + + http://www.openjena.org/ + Jena + + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -196,11 +196,11 @@ func Test_setFileIdentifier(t *testing.T) { func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 1: md5 checksum parser, _ := parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file := &v2_3.File{} err := parser.setFileChecksumFromNode(file, checksumNode) @@ -257,11 +257,11 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 3: valid sha256 checksum parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_3.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -300,11 +300,11 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 5: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_3.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -314,11 +314,11 @@ func Test_rdfParser2_3_setFileChecksumFromNode(t *testing.T) { // TestCase 6: valid checksum algorithm which is invalid for file (like md4, md6, sha384, etc.) parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_3.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -340,10 +340,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 2: invalid fileType parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -352,15 +352,15 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 3: invalid file checksum parser, _ = parserFromBodyContent(` - - - - - 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - - - `) + + + + + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -369,10 +369,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 4: invalid license concluded parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -398,10 +398,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 6: invalid file dependency parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -426,14 +426,14 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 8: invalid relationship parser, _ = parserFromBodyContent(` - - - - - - - - `) + + + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -454,10 +454,10 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 9: invalid licenseInfoInFile. parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -467,21 +467,21 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 10: Splitting of File definition into parents of different tags mustn't create new file objects. fileDefinitions := []string{ ` - - - time-1.9/ChangeLog - - - - `, + + + time-1.9/ChangeLog + + + + `, ` - - - - - - - `, + + + + + + + `, } parser, _ = parserFromBodyContent(strings.Join(fileDefinitions, "")) @@ -519,65 +519,65 @@ func Test_rdfParser2_3_getFileFromNode(t *testing.T) { // TestCase 12: checking if recursive dependencies are resolved. parser, _ = parserFromBodyContent(` - - - - - - - ParentFile - - - - - - `) + + + + + + + ParentFile + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) // TestCase 11: all valid attribute and it's values. parser, _ = parserFromBodyContent(` - - time-1.9/ChangeLog - - - - - - 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - - - - no comments - from spdx file - - - http://www.openjena.org/ - Jena - - - no comments - - Some Organization - - attribution text - - - 2011-01-29T18:30:22Z - File level annotation copied from a spdx document - Person: File Commenter - - - - - - - - - - - `) + + time-1.9/ChangeLog + + + + + + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd + + + + + no comments + from spdx file + + + http://www.openjena.org/ + Jena + + + no comments + + Some Organization + + attribution text + + + 2011-01-29T18:30:22Z + File level annotation copied from a spdx document + Person: File Commenter + + + + + + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) if err != nil { From b6d74b332adb5fa6b01703544a1991ee43f7ea66 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 16:53:05 +0200 Subject: [PATCH 24/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_package_test.go | 138 +++---- .../parser2v2/parse_relationship_test.go | 236 ++++++------ .../parser2v2/parse_snippet_info_test.go | 352 +++++++++--------- .../parser2v2/parse_spdx_document_test.go | 206 +++++----- rdfloader/parser2v2/parser_test.go | 42 +-- rdfloader/parser2v2/utils_test.go | 18 +- rdfloader/parser2v3/license_utils_test.go | 22 +- 7 files changed, 507 insertions(+), 507 deletions(-) diff --git a/rdfloader/parser2v2/parse_package_test.go b/rdfloader/parser2v2/parse_package_test.go index 23646db4..db3e6731 100644 --- a/rdfloader/parser2v2/parse_package_test.go +++ b/rdfloader/parser2v2/parse_package_test.go @@ -193,14 +193,14 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 1: invalid reference category parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err == nil { @@ -209,15 +209,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - - `) + + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err == nil { @@ -226,15 +226,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 3: valid example (referenceCategory_security) parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - comment - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + comment + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err != nil { @@ -252,15 +252,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 4: valid example (referenceCategory_packageManager) parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - comment - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + comment + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err != nil { @@ -278,15 +278,15 @@ func Test_rdfParser2_2_getPackageExternalRef(t *testing.T) { // TestCase 5: valid example (referenceCategory_other) parser, _ = parserFromBodyContent(` - - cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* - - - - - comment - - `) + + cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:* + + + + + comment + + `) node = parser.gordfParserObj.Triples[0].Subject extRef, err = parser.getPackageExternalRef(node) if err != nil { @@ -590,11 +590,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 1: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -604,11 +604,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 1: valid checksum algorithm which is invalid for package parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -618,11 +618,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 2: valid checksum (sha1) parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -642,11 +642,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 3: valid checksum (sha256) parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) @@ -665,11 +665,11 @@ func Test_rdfParser2_2_setPackageChecksum(t *testing.T) { // TestCase 4: valid checksum (md5) parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) pkg = &v2_2.Package{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setPackageChecksum(pkg, node) diff --git a/rdfloader/parser2v2/parse_relationship_test.go b/rdfloader/parser2v2/parse_relationship_test.go index 0e1aa3e8..fd66d148 100644 --- a/rdfloader/parser2v2/parse_relationship_test.go +++ b/rdfloader/parser2v2/parse_relationship_test.go @@ -77,12 +77,12 @@ func Test_getRelationshipTypeFromURI(t *testing.T) { func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 1: Package as a related element parser, _ := parserFromBodyContent(` - - - - - - `) + + + + + + `) reln := &v2_2.Relationship{} triple := rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_PACKAGE)[0] err := parser.parseRelatedElementFromTriple(reln, triple) @@ -106,12 +106,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 3: invalid package as a relatedElement parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_PACKAGE)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -121,12 +121,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 4: valid File as a related element parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -150,12 +150,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 5: invalid File as a relatedElement parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -165,12 +165,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 6: valid SpdxElement as a related element parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_SPDX_ELEMENT)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -194,12 +194,12 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { // TestCase 7: invalid SpdxElement as a related element parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) reln = &v2_2.Relationship{} triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_SPDX_ELEMENT)[0] err = parser.parseRelatedElementFromTriple(reln, triple) @@ -211,16 +211,16 @@ func Test_rdfParser2_2_parseRelatedElementFromTriple(t *testing.T) { func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 1: invalid RefA parser, _ := parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) triple := rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err := parser.parseRelationship(triple) if err == nil { @@ -229,16 +229,16 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 3: invalid RefB parser, _ = parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -268,16 +268,16 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 4: undefined relatedSpdxElement parser, _ = parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -286,17 +286,17 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 6: relatedElement associated with more than one type parser, _ = parserFromBodyContent(` - - - - - - - - - - - `) + + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -305,17 +305,17 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 5: unknown predicate inside a relationship parser, _ = parserFromBodyContent(` - - - - - - - - - - - `) + + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err == nil { @@ -324,24 +324,24 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 8: Recursive relationships mustn't raise any error: parser, _ = parserFromBodyContent(` - - - - - - - - - - - - - - - - - - `) + + + + + + + + + + + + + + + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err != nil { @@ -350,18 +350,18 @@ func Test_rdfParser2_2_parseRelationship(t *testing.T) { // TestCase 7: completely valid example: parser, _ = parserFromBodyContent(` - - - - - - - - comment - - - - `) + + + + + + + + comment + + + + `) triple = rdfwriter.FilterTriples(parser.gordfParserObj.Triples, nil, &SPDX_RELATIONSHIP, nil)[0] err = parser.parseRelationship(triple) if err != nil { diff --git a/rdfloader/parser2v2/parse_snippet_info_test.go b/rdfloader/parser2v2/parse_snippet_info_test.go index 83c212d4..175b749f 100644 --- a/rdfloader/parser2v2/parse_snippet_info_test.go +++ b/rdfloader/parser2v2/parse_snippet_info_test.go @@ -28,10 +28,10 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 2: Invalid LicenseInfoInSnippet parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getSnippetInformationFromNode2_2(node) if err == nil { @@ -82,10 +82,10 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 5: invalid license concluded: parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getSnippetInformationFromNode2_2(node) if err == nil { @@ -94,34 +94,34 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { // TestCase 6: everything valid: parser, _ = parserFromBodyContent(` - - - - - - - - - - 420 - - - - - - 310 - - - - - - snippet test - test - comments - comments - - - `) + + + + + + + + + + 420 + + + + + + 310 + + + + + + snippet test + test + comments + comments + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getSnippetInformationFromNode2_2(node) if err != nil { @@ -168,10 +168,10 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { // TestCase 2: invalid file in the reference should raise an error si = &v2_2.Snippet{} parser, _ = parserFromBodyContent(` - - test file - - `) + + test file + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseRangeReference(node, si) if err == nil { @@ -181,10 +181,10 @@ func Test_rdfParser2_2_parseRangeReference(t *testing.T) { // TestCase 3: A valid reference must set the file to the files map of the parser. si = &v2_2.Snippet{} parser, _ = parserFromBodyContent(` - - test file - - `) + + test file + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseRangeReference(node, si) if err != nil { @@ -286,16 +286,16 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 1: range with less one pointer less must raise an error // (end-pointer missing in the range) parser, _ = parserFromBodyContent(` - - - - - 310 - - - - - `) + + + + + 310 + + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -305,23 +305,23 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 2: triples with 0 or more than one type-triple parser, _ = parserFromBodyContent(` - - - - - - 420 - - - - - - 310 - - - - - `) + + + + + + 420 + + + + + + 310 + + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject dummyTriple := parser.gordfParserObj.Triples[0] @@ -337,21 +337,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 3: triples with 0 startPointer parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -361,21 +361,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 4: triples with 0 endPointer parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -385,21 +385,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 5: error parsing start pointer must be propagated to the range parser, _ = parserFromBodyContent(` - - - - - 42.0 - - - - - - 310 - - - - `) + + + + + 42.0 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -409,21 +409,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 6: error parsing end pointer must be propagated to the range parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 31+0 - - - - `) + + + + + 420 + + + + + + 31+0 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -433,21 +433,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 7: mismatching start and end pointer must also raise an error. parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -457,21 +457,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 8: everything valid(byte_range): parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) @@ -481,21 +481,21 @@ func Test_rdfParser2_2_setSnippetRangeFromNode(t *testing.T) { // TestCase 9: everything valid(line_range): parser, _ = parserFromBodyContent(` - - - - - 420 - - - - - - 310 - - - - `) + + + + + 420 + + + + + + 310 + + + + `) si = &v2_2.Snippet{} node = parser.gordfParserObj.Triples[0].Subject err = parser.setSnippetRangeFromNode(node, si) diff --git a/rdfloader/parser2v2/parse_spdx_document_test.go b/rdfloader/parser2v2/parse_spdx_document_test.go index c4e98db5..9d22faad 100644 --- a/rdfloader/parser2v2/parse_spdx_document_test.go +++ b/rdfloader/parser2v2/parse_spdx_document_test.go @@ -15,17 +15,17 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { // TestCase 1: invalid checksum parser, _ = parserFromBodyContent(` - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - `) + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getExternalDocumentRefFromNode(node) if err == nil { @@ -46,17 +46,17 @@ func Test_rdfParser2_2_getExternalDocumentRefFromNode(t *testing.T) { // TestCase 3: valid example parser, _ = parserFromBodyContent(` - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - `) + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getExternalDocumentRefFromNode(node) if err != nil { @@ -71,8 +71,8 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 1: invalid spdx id of the document parser, _ = parserFromBodyContent(` - - `) + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -81,10 +81,10 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 2: erroneous dataLicense parser, _ = parserFromBodyContent(` - - - - `) + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -93,21 +93,21 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 3: invalid external document ref parser, _ = parserFromBodyContent(` - - - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - - - `) + + + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -116,12 +116,12 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 4: invalid package parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err == nil { @@ -179,60 +179,60 @@ func Test_rdfParser2_2_parseSpdxDocumentNode(t *testing.T) { // TestCase 7: everything valid parser, _ = parserFromBodyContent(` - - SPDX-2.1 - - /test/example - - - DocumentRef-spdx-tool-1.2 - - - d6a770ba38583ed4bb4525bd96e50461655d2759 - - - - - - - - - 2.6 - Person: spdx (y) - Organization: - Tool: spdx2 - 2018-08-24T19:55:34Z - - - test - - - Another example reviewer. - 2011-03-13T00:00:00Z - Person: Suzanne Reviewer - - - - - - - - - - - - - - - - 2011-01-29T18:30:22Z - test annotation - Person: Rishabh Bhatnagar - - - - - `) + + SPDX-2.1 + + /test/example + + + DocumentRef-spdx-tool-1.2 + + + d6a770ba38583ed4bb4525bd96e50461655d2759 + + + + + + + + + 2.6 + Person: spdx (y) + Organization: + Tool: spdx2 + 2018-08-24T19:55:34Z + + + test + + + Another example reviewer. + 2011-03-13T00:00:00Z + Person: Suzanne Reviewer + + + + + + + + + + + + + + + + 2011-01-29T18:30:22Z + test annotation + Person: Rishabh Bhatnagar + + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseSpdxDocumentNode(node) if err != nil { diff --git a/rdfloader/parser2v2/parser_test.go b/rdfloader/parser2v2/parser_test.go index 8bfafeb0..bed6c749 100644 --- a/rdfloader/parser2v2/parser_test.go +++ b/rdfloader/parser2v2/parser_test.go @@ -42,10 +42,10 @@ func TestLoadFromGoRDFParser(t *testing.T) { // TestCase 2: invalid SpdxDocumentNode parser, _ = parserFromBodyContent(` - - - - `) + + + + `) _, err = LoadFromGoRDFParser(parser.gordfParserObj) if err == nil { t.Errorf("expected an error because of absence of SpdxDocument node, got %v", err) @@ -94,23 +94,23 @@ func TestLoadFromGoRDFParser(t *testing.T) { // TestCase 5: everything valid: parser, _ = parserFromBodyContent(` - - - from linux kernel - Copyright 2008-2010 John Smith - The concluded license was taken from package xyz, from which the snippet was copied into the current file. The concluded license information was found in the COPYING.txt file in package xyz. - - - Copyright 2010, 2011 Source Auditor Inc. - Open Logic Inc. - ./src/org/spdx/parser/DOAPProject.java - Black Duck Software In.c - - - - - - `) + + + from linux kernel + Copyright 2008-2010 John Smith + The concluded license was taken from package xyz, from which the snippet was copied into the current file. The concluded license information was found in the COPYING.txt file in package xyz. + + + Copyright 2010, 2011 Source Auditor Inc. + Open Logic Inc. + ./src/org/spdx/parser/DOAPProject.java + Black Duck Software In.c + + + + + + `) _, err = LoadFromGoRDFParser(parser.gordfParserObj) if err != nil { t.Errorf("error parsing a valid example: %v", err) diff --git a/rdfloader/parser2v2/utils_test.go b/rdfloader/parser2v2/utils_test.go index 311fb4c1..c0cc5746 100644 --- a/rdfloader/parser2v2/utils_test.go +++ b/rdfloader/parser2v2/utils_test.go @@ -70,11 +70,11 @@ func Test_rdfParser2_2_nodeToTriples(t *testing.T) { // TestCase 2: node should be addressable based on the node content and not the pointer. // It should allow new nodes same as the older ones to retrieve the associated triples. parser, _ = parserFromBodyContent(` - - - 75068c26abbed3ad3980685bae21d7202d288317 - - `) + + + 75068c26abbed3ad3980685bae21d7202d288317 + + `) newNode := &gordfParser.Node{ NodeType: gordfParser.IRI, ID: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#checksum", @@ -83,7 +83,7 @@ func Test_rdfParser2_2_nodeToTriples(t *testing.T) { // The output must have 3 triples: // 1. newNode rdf:type Checksum - // 2. newNode spdx:algorithm https://spdx.org/rdf/terms#checksumAlgorithm_sha1 + // 2. newNode spdx:algorithm http://spdx.org/rdf/terms#checksumAlgorithm_sha1 // 3. newNode spdx:checksumValue 75068c26abbed3ad3980685bae21d7202d288317 if len(output) != 3 { t.Errorf("expected output to have 3 triples, got %d", len(output)) @@ -154,11 +154,11 @@ func Test_getNodeTypeFromTriples(t *testing.T) { }, Object: &gordfParser.Node{ NodeType: gordfParser.IRI, - ID: "https://spdx.org/rdf/terms#Checksum", + ID: "http://spdx.org/rdf/terms#Checksum", }, } triples = append(triples, typeTriple) - expectedNodeType = "https://spdx.org/rdf/terms#Checksum" + expectedNodeType = "http://spdx.org/rdf/terms#Checksum" nodeType, err = getNodeTypeFromTriples(triples, node) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -176,7 +176,7 @@ func Test_getNodeTypeFromTriples(t *testing.T) { }, Object: &gordfParser.Node{ NodeType: gordfParser.IRI, - ID: "https://spdx.org/rdf/terms#Snippet", + ID: "http://spdx.org/rdf/terms#Snippet", }, } triples = append(triples, typeTriple) diff --git a/rdfloader/parser2v3/license_utils_test.go b/rdfloader/parser2v3/license_utils_test.go index da4af5dc..0156b993 100644 --- a/rdfloader/parser2v3/license_utils_test.go +++ b/rdfloader/parser2v3/license_utils_test.go @@ -51,12 +51,12 @@ func Test_rdfParser2_3_getChecksumFromNode(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -65,11 +65,11 @@ func Test_rdfParser2_3_getChecksumFromNode(t *testing.T) { // TestCase 3: valid input parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - `) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject algorithm, value, err := parser.getChecksumFromNode(checksumNode) if err != nil { From fd2ec4043617a01626fedf123a0b078cfd98fd89 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 17:06:01 +0200 Subject: [PATCH 25/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_license_test.go | 326 +++++++++--------- rdfloader/parser2v2/parse_package_test.go | 1 + .../parser2v2/parse_snippet_info_test.go | 2 +- 3 files changed, 165 insertions(+), 164 deletions(-) diff --git a/rdfloader/parser2v2/parse_license_test.go b/rdfloader/parser2v2/parse_license_test.go index 3854e5bb..e2c684dc 100644 --- a/rdfloader/parser2v2/parse_license_test.go +++ b/rdfloader/parser2v2/parse_license_test.go @@ -36,11 +36,11 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 2: DisjunctiveLicenseSet: parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -55,11 +55,11 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 3: ConjunctiveLicenseSet: parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -74,12 +74,12 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 4: ExtractedLicensingInfo parser, _ = parserFromBodyContent(` - - LicenseRef-Freeware - freeware - - - `) + + LicenseRef-Freeware + freeware + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -94,12 +94,12 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 4: ExtractedLicensingInfo parser, _ = parserFromBodyContent(` - - LicenseRef-Freeware - freeware - - - `) + + LicenseRef-Freeware + freeware + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -114,17 +114,17 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 5: License parser, _ = parserFromBodyContent(` - - <> Apache License Version 2.0, January 2004 https://www.apache.org/licenses/<><> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<> <> Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. <> Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. <> Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. <> Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: <> You must give any other recipients of the Work or Derivative Works a copy of this License; and <> You must cause any modified files to carry prominent notices stating that You changed the files; and <> You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and <> If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. <> Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. <> Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. <> Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. <> Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. <> Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<> END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright <> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.<> - http://www.apache.org/licenses/LICENSE-2.0 - Apache License 2.0 - Apache-2.0 - true - http://www.opensource.org/licenses/Apache-2.0 - ... - ... - - `) + + <> Apache License Version 2.0, January 2004 http://www.apache.org/licenses/<><> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<> <> Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. <> Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. <> Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. <> Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: <> You must give any other recipients of the Work or Derivative Works a copy of this License; and <> You must cause any modified files to carry prominent notices stating that You changed the files; and <> You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and <> If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. <> Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. <> Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. <> Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. <> Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. <> Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<> END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright <> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.<> + http://www.apache.org/licenses/LICENSE-2.0 + Apache License 2.0 + Apache-2.0 + true + http://www.opensource.org/licenses/Apache-2.0 + ... + ... + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -139,17 +139,17 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 5: WithExceptionOperator parser, _ = parserFromBodyContent(` - - - - - Libtool-exception - - - - - - `) + + + + + Libtool-exception + + + + + + `) inputNode = parser.gordfParserObj.Triples[0].Subject lic, err = parser.getAnyLicenseFromNode(inputNode) if err != nil { @@ -200,16 +200,16 @@ func Test_rdfParser2_2_getAnyLicenseFromNode(t *testing.T) { // TestCase 8: cyclic dependent license must raise an error. parser, _ = parserFromBodyContent(` - - - - - - - - - - `) + + + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getAnyLicenseFromNode(node) if err == nil { @@ -225,11 +225,11 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 1: invalid license member parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getConjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -238,12 +238,12 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 2: invalid predicate in the licenseSet. parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getConjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -252,11 +252,11 @@ func Test_rdfParser2_2_getConjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 3: valid example. parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject license, err = parser.getConjunctiveLicenseSetFromNode(licenseNode) if err != nil { @@ -282,11 +282,11 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 1: invalid license member parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getDisjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -295,12 +295,12 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 2: invalid predicate in the licenseSet. parser, _ = parserFromBodyContent(` - - - - - - `) + + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject _, err = parser.getDisjunctiveLicenseSetFromNode(licenseNode) if err == nil { @@ -309,11 +309,11 @@ func Test_rdfParser2_2_getDisjunctiveLicenseSetFromNode(t *testing.T) { // TestCase 3: valid example. parser, _ = parserFromBodyContent(` - - - - - `) + + + + + `) licenseNode = parser.gordfParserObj.Triples[0].Subject license, err = parser.getDisjunctiveLicenseSetFromNode(licenseNode) if err != nil { @@ -370,15 +370,15 @@ func Test_rdfParser2_2_getLicenseExceptionFromNode(t *testing.T) { // TestCase 3: everything valid // TestCase 1: invalid value for rdf:seeAlso parser, _ = parserFromBodyContent(` - - - no example - Libtool-exception - no comments - text - name - - `) + + + no example + Libtool-exception + no comments + text + name + + `) node = parser.gordfParserObj.Triples[0].Subject licenseException, err = parser.getLicenseExceptionFromNode(node) if err != nil { @@ -474,19 +474,19 @@ func Test_rdfParser2_2_getLicenseFromNode(t *testing.T) { // TestCase 5: everything valid: parser, _ = parserFromBodyContent(` - - http://www.opensource.org/licenses/GPL-3.0 - true - GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - GNU General Public License v3.0 or later - ... - GPL-3.0-or-later - This license was released: 29 June 2007 - true - ... - .... - - `) + + http://www.opensource.org/licenses/GPL-3.0 + true + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 + GNU General Public License v3.0 or later + ... + GPL-3.0-or-later + This license was released: 29 June 2007 + true + ... + .... + + `) node = parser.gordfParserObj.Triples[0].Subject license, err = parser.getLicenseFromNode(node) if err != nil { @@ -542,16 +542,16 @@ func Test_rdfParser2_2_getOrLaterOperatorFromNode(t *testing.T) { // TestCase 1: more than one member in the OrLaterOperator tag must raise an error parser, _ = parserFromBodyContent(` - - - - LicenseRef-Freeware - freeware - - - - - `) + + + + LicenseRef-Freeware + freeware + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getOrLaterOperatorFromNode(node) if err == nil { @@ -759,16 +759,16 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 1: more than one member in the OrLaterOperator tag must raise an error parser, _ = parserFromBodyContent(` - - - - LicenseRef-Freeware - freeware - - - - - `) + + + + LicenseRef-Freeware + freeware + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err == nil { @@ -794,14 +794,14 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 3: Invalid member parser, _ = parserFromBodyContent(` - - - - - - - - `) + + + + + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err == nil { @@ -810,20 +810,20 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 4: Invalid licenseException parser, _ = parserFromBodyContent(` - - - - - - - - example - Libtool-exception - comment - - - - `) + + + + + + + + example + Libtool-exception + comment + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err == nil { @@ -832,19 +832,19 @@ func Test_rdfParser2_2_getWithExceptionOperatorFromNode(t *testing.T) { // TestCase 5: valid input parser, _ = parserFromBodyContent(` - - - - - - - example - Libtool-exception - comment - - - - `) + + + + + + + example + Libtool-exception + comment + + + + `) node = parser.gordfParserObj.Triples[0].Subject _, err = parser.getWithExceptionOperatorFromNode(node) if err != nil { diff --git a/rdfloader/parser2v2/parse_package_test.go b/rdfloader/parser2v2/parse_package_test.go index db3e6731..f458984d 100644 --- a/rdfloader/parser2v2/parse_package_test.go +++ b/rdfloader/parser2v2/parse_package_test.go @@ -563,6 +563,7 @@ func Test_rdfParser2_2_getPackageFromNode(t *testing.T) { t.Errorf("error parsing a valid package: %v", err) } } + func Test_rdfParser2_2_setFileToPackage(t *testing.T) { var pkg *v2_2.Package var file *v2_2.File diff --git a/rdfloader/parser2v2/parse_snippet_info_test.go b/rdfloader/parser2v2/parse_snippet_info_test.go index 175b749f..df0bb70e 100644 --- a/rdfloader/parser2v2/parse_snippet_info_test.go +++ b/rdfloader/parser2v2/parse_snippet_info_test.go @@ -58,7 +58,7 @@ func Test_rdfParser2_2_getSnippetInformationFromTriple2_2(t *testing.T) { parser, _ = parserFromBodyContent(` - + `) From 639a8ba6b31e34fdbb28645cf13f4d2deb853f10 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 17:08:27 +0200 Subject: [PATCH 26/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v2/license_utils_test.go | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/rdfloader/parser2v2/license_utils_test.go b/rdfloader/parser2v2/license_utils_test.go index 467ad730..7e20b5cd 100644 --- a/rdfloader/parser2v2/license_utils_test.go +++ b/rdfloader/parser2v2/license_utils_test.go @@ -38,11 +38,11 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { var err error // TestCase 1: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - -`) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) checksumNode := parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -51,12 +51,12 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { // TestCase 2: invalid predicate parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - - -`) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject _, _, err = parser.getChecksumFromNode(checksumNode) if err == nil { @@ -65,11 +65,11 @@ func Test_rdfParser2_2_getChecksumFromNode(t *testing.T) { // TestCase 3: valid input parser, _ = parserFromBodyContent(` - - 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 - - -`) + + 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 + + + `) checksumNode = parser.gordfParserObj.Triples[0].Subject algorithm, value, err := parser.getChecksumFromNode(checksumNode) if err != nil { From d773abfeb1f74851d2243b6f95ec5591974dfc92 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 17:10:29 +0200 Subject: [PATCH 27/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_annotation_test.go | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/rdfloader/parser2v2/parse_annotation_test.go b/rdfloader/parser2v2/parse_annotation_test.go index cee4c6eb..2fee2161 100644 --- a/rdfloader/parser2v2/parse_annotation_test.go +++ b/rdfloader/parser2v2/parse_annotation_test.go @@ -98,13 +98,13 @@ func Test_setAnnotationToParser(t *testing.T) { func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 1: invalid annotator must raise an error parser, _ := parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Company: some company - - -`) + + 2010-01-29T18:30:22Z + Document level annotation + Company: some company + + + `) node := parser.gordfParserObj.Triples[0].Subject err := parser.parseAnnotationFromNode(node) if err == nil { @@ -113,13 +113,13 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 2: wrong annotation type should raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - -`) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -128,14 +128,14 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 3: unknown predicate should also raise an error parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - - -`) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err == nil { @@ -144,13 +144,13 @@ func Test_rdfParser2_2_parseAnnotationFromNode(t *testing.T) { // TestCase 4: completely valid annotation parser, _ = parserFromBodyContent(` - - 2010-01-29T18:30:22Z - Document level annotation - Person: Jane Doe - - -`) + + 2010-01-29T18:30:22Z + Document level annotation + Person: Jane Doe + + + `) node = parser.gordfParserObj.Triples[0].Subject err = parser.parseAnnotationFromNode(node) if err != nil { From 42b322c60fe7113aa3a08cb6c157148fa7660a05 Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 17:19:50 +0200 Subject: [PATCH 28/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_file_test.go | 238 ++++++++++++------------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/rdfloader/parser2v2/parse_file_test.go b/rdfloader/parser2v2/parse_file_test.go index dc7bf478..d25108f7 100644 --- a/rdfloader/parser2v2/parse_file_test.go +++ b/rdfloader/parser2v2/parse_file_test.go @@ -18,12 +18,12 @@ import ( // pads the content with the enclosing rdf:RDF tag func wrapIntoTemplate(content string) string { header := `` + xmlns:spdx="http://spdx.org/rdf/terms#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns="http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#" + xmlns:doap="http://usefulinc.com/ns/doap#" + xmlns:j.0="http://www.w3.org/2009/pointers#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">` footer := `` return header + content + footer } @@ -49,13 +49,13 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { // TestCase 1: artifactOf without project URI rdfParser, err := parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + http://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -78,13 +78,13 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { // TestCase 2: artifactOf with a Project URI rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - `) + + + http://www.openjena.org/ + Jena + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -101,14 +101,14 @@ func Test_rdfParser2_2_getArtifactFromNode(t *testing.T) { // TestCase 3: artifactOf with unknown predicate rdfParser, err = parserFromBodyContent( ` - - - http://www.openjena.org/ - Jena - - - - `) + + + http://www.openjena.org/ + Jena + + + + `) if err != nil { t.Errorf("unexpected error while parsing a valid example: %v", err) } @@ -196,11 +196,11 @@ func Test_setFileIdentifier(t *testing.T) { func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 1: md5 checksum parser, _ := parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode := gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file := &v2_2.File{} err := parser.setFileChecksumFromNode(file, checksumNode) @@ -227,11 +227,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 2: valid sha1 checksum parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -257,11 +257,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 3: valid sha256 checksum parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -300,11 +300,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 5: invalid checksum algorithm parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -314,11 +314,11 @@ func Test_rdfParser2_2_setFileChecksumFromNode(t *testing.T) { // TestCase 6: valid checksum algorithm which is invalid for file (like md4, md6, sha384, etc.) parser, _ = parserFromBodyContent(` - - - d2356e0fe1c0b85285d83c6b2ad51b5f - - `) + + + d2356e0fe1c0b85285d83c6b2ad51b5f + + `) checksumNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_CHECKSUM_CAPITALIZED)[0].Subject file = &v2_2.File{} err = parser.setFileChecksumFromNode(file, checksumNode) @@ -340,10 +340,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 2: invalid fileType parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -398,10 +398,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 6: invalid file dependency parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -454,10 +454,10 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 9: invalid licenseInfoInFile. parser, _ = parserFromBodyContent(` - - - - `) + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject _, err = parser.getFileFromNode(fileNode) if err == nil { @@ -519,65 +519,65 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 12: checking if recursive dependencies are resolved. parser, _ = parserFromBodyContent(` - - - - - - - ParentFile - - - - - - `) + + + + + + + ParentFile + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) // TestCase 11: all valid attribute and it's values. parser, _ = parserFromBodyContent(` - - time-1.9/ChangeLog - - - - - - 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd - - - - - no comments - from spdx file - - - http://www.openjena.org/ - Jena - - - no comments - - Some Organization - - attribution text - - - 2011-01-29T18:30:22Z - File level annotation copied from a spdx document - Person: File Commenter - - - - - - - - - - - `) + + time-1.9/ChangeLog + + + + + + 0a3a0e1ab72b7c132f5021c538a7a3ea6d539bcd + + + + + no comments + from spdx file + + + http://www.openjena.org/ + Jena + + + no comments + + Some Organization + + attribution text + + + 2011-01-29T18:30:22Z + File level annotation copied from a spdx document + Person: File Commenter + + + + + + + + + + + `) fileNode = gordfWriter.FilterTriples(parser.gordfParserObj.Triples, nil, &RDF_TYPE, &SPDX_FILE)[0].Subject file, err = parser.getFileFromNode(fileNode) if err != nil { From d07521aca34e6c174ee8893789721c1ad85e69be Mon Sep 17 00:00:00 2001 From: CatalinStratu Date: Mon, 2 Jan 2023 17:22:11 +0200 Subject: [PATCH 29/29] Fix after code review Signed-off-by: CatalinStratu --- rdfloader/parser2v2/parse_file_test.go | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/rdfloader/parser2v2/parse_file_test.go b/rdfloader/parser2v2/parse_file_test.go index d25108f7..0383cd97 100644 --- a/rdfloader/parser2v2/parse_file_test.go +++ b/rdfloader/parser2v2/parse_file_test.go @@ -467,21 +467,21 @@ func Test_rdfParser2_2_getFileFromNode(t *testing.T) { // TestCase 10: Splitting of File definition into parents of different tags mustn't create new file objects. fileDefinitions := []string{ ` - - - time-1.9/ChangeLog - - - - `, + + + time-1.9/ChangeLog + + + + `, ` - - - - - - - `, + + + + + + + `, } parser, _ = parserFromBodyContent(strings.Join(fileDefinitions, ""))