• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2
3package spdx_json
4
5import (
6	"bytes"
7	"encoding/json"
8	"flag"
9	"fmt"
10	"os"
11	"testing"
12
13	"github.com/google/go-cmp/cmp"
14
15	"github.com/spdx/tools-golang/spdx/common"
16	"github.com/spdx/tools-golang/spdx/v2_3"
17)
18
19var update = *flag.Bool("update-snapshots", false, "update the example snapshot")
20
21func TestLoad2_3(t *testing.T) {
22	fileName := "../examples/sample-docs/json/SPDXJSONExample-v2.3.spdx.json"
23
24	if update {
25		data, err := json.MarshalIndent(want2_3, "", "  ")
26		if err != nil {
27			t.Errorf("unable to serialize SPDX 2.3 example to JSON: %v", err)
28		}
29		err = os.WriteFile(fileName, data, 0644)
30		if err != nil {
31			t.Errorf("unable to write SPDX 2.3 example to JSON: %v", err)
32		}
33	}
34
35	file, err := os.Open(fileName)
36	if err != nil {
37		panic(fmt.Errorf("error opening File: %s", err))
38	}
39
40	got, err := Load2_3(file)
41	if err != nil {
42		t.Errorf("json.parser.Load2_3() error = %v", err)
43		return
44	}
45
46	// get a copy of the handwritten struct so we don't mutate it on accident
47	handwrittenExample := want2_3
48
49	if cmp.Equal(handwrittenExample, got) {
50		t.Errorf("Got incorrect struct after parsing JSON example")
51		return
52	}
53}
54
55func TestWrite2_3(t *testing.T) {
56	w := &bytes.Buffer{}
57	// get a copy of the handwritten struct so we don't mutate it on accident
58	handwrittenExample := want2_3
59	if err := Save2_3(&handwrittenExample, w); err != nil {
60		t.Errorf("Save2_3() error = %v", err.Error())
61		return
62	}
63
64	// we should be able to parse what the writer wrote, and it should be identical to the original struct we wrote
65	parsedDoc, err := Load2_3(bytes.NewReader(w.Bytes()))
66	if err != nil {
67		t.Errorf("failed to parse written document: %v", err.Error())
68		return
69	}
70
71	if cmp.Equal(handwrittenExample, parsedDoc) {
72		t.Errorf("Got incorrect struct after writing and re-parsing JSON example")
73		return
74	}
75}
76
77// want is handwritten translation of the official example JSON SPDX v2.3 document into a Go struct.
78// We expect that the result of parsing the official document should be this value.
79// We expect that the result of writing this struct should match the official example document.
80var want2_3 = v2_3.Document{
81	DataLicense:       "CC0-1.0",
82	SPDXVersion:       "SPDX-2.3",
83	SPDXIdentifier:    "SPDXRef-DOCUMENT",
84	DocumentName:      "SPDX-Tools-v2.0",
85	DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301",
86	CreationInfo: &v2_3.CreationInfo{
87		LicenseListVersion: "3.9",
88		Creators: []common.Creator{
89			{CreatorType: "Tool", Creator: "LicenseFind-1.0"},
90			{CreatorType: "Organization", Creator: "ExampleCodeInspect ()"},
91			{CreatorType: "Person", Creator: "Jane Doe ()"},
92		},
93		Created:        "2010-01-29T18:30:22Z",
94		CreatorComment: "This package has been shipped in source and binary form.\nThe binaries were created with gcc 4.5.1 and expect to link to\ncompatible system run time libraries.",
95	},
96	DocumentComment: "This document was created using SPDX 2.0 using licenses from the web site.",
97	ExternalDocumentReferences: []v2_3.ExternalDocumentRef{
98		{
99			DocumentRefID: "DocumentRef-spdx-tool-1.2",
100			URI:           "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301",
101			Checksum: common.Checksum{
102				Algorithm: common.SHA1,
103				Value:     "d6a770ba38583ed4bb4525bd96e50461655d2759",
104			},
105		},
106	},
107	OtherLicenses: []*v2_3.OtherLicense{
108		{
109			LicenseIdentifier: "LicenseRef-1",
110			ExtractedText:     "/*\n * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/",
111		},
112		{
113			LicenseIdentifier: "LicenseRef-2",
114			ExtractedText:     "This package includes the GRDDL parser developed by Hewlett Packard under the following license:\n� Copyright 2007 Hewlett-Packard Development Company, LP\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: \n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. \nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. \nThe name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. \nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 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.",
115		},
116		{
117			LicenseIdentifier: "LicenseRef-4",
118			ExtractedText:     "/*\n * (c) Copyright 2009 University of Bristol\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/",
119		},
120		{
121			LicenseIdentifier:      "LicenseRef-Beerware-4.2",
122			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",
123			LicenseComment:         "The beerware license has a couple of other standard variants.",
124			LicenseName:            "Beer-Ware License (Version 42)",
125			LicenseCrossReferences: []string{"http://people.freebsd.org/~phk/"},
126		},
127		{
128			LicenseIdentifier: "LicenseRef-3",
129			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.",
130			LicenseName:       "CyberNeko License",
131			LicenseCrossReferences: []string{
132				"http://people.apache.org/~andyc/neko/LICENSE",
133				"http://justasample.url.com",
134			},
135			LicenseComment: "This is tye CyperNeko License",
136		},
137	},
138	Annotations: []*v2_3.Annotation{
139		{
140			Annotator: common.Annotator{
141				Annotator:     "Jane Doe ()",
142				AnnotatorType: "Person",
143			},
144			AnnotationDate:    "2010-01-29T18:30:22Z",
145			AnnotationType:    "OTHER",
146			AnnotationComment: "Document level annotation",
147		},
148		{
149			Annotator: common.Annotator{
150				Annotator:     "Joe Reviewer",
151				AnnotatorType: "Person",
152			},
153			AnnotationDate:    "2010-02-10T00:00:00Z",
154			AnnotationType:    "REVIEW",
155			AnnotationComment: "This is just an example.  Some of the non-standard licenses look like they are actually BSD 3 clause licenses",
156		},
157		{
158			Annotator: common.Annotator{
159				Annotator:     "Suzanne Reviewer",
160				AnnotatorType: "Person",
161			},
162			AnnotationDate:    "2011-03-13T00:00:00Z",
163			AnnotationType:    "REVIEW",
164			AnnotationComment: "Another example reviewer.",
165		},
166	},
167	Packages: []*v2_3.Package{
168		{
169			PackageName:           "glibc",
170			PackageSPDXIdentifier: "SPDXRef-Package",
171			PackageVersion:        "2.11.1",
172			PackageFileName:       "glibc-2.11.1.tar.gz",
173			PackageSupplier: &common.Supplier{
174				Supplier:     "Jane Doe (jane.doe@example.com)",
175				SupplierType: "Person",
176			},
177			PackageOriginator: &common.Originator{
178				Originator:     "ExampleCodeInspect (contact@example.com)",
179				OriginatorType: "Organization",
180			},
181			PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz",
182			FilesAnalyzed:           true,
183			PackageVerificationCode: &common.PackageVerificationCode{
184				Value:         "d6a770ba38583ed4bb4525bd96e50461655d2758",
185				ExcludedFiles: []string{"./package.spdx"},
186			},
187			PackageChecksums: []common.Checksum{
188				{
189					Algorithm: "MD5",
190					Value:     "624c1abb3664f4b35547e7c73864ad24",
191				},
192				{
193					Algorithm: "SHA1",
194					Value:     "85ed0817af83a24ad8da68c2b5094de69833983c",
195				},
196				{
197					Algorithm: "SHA256",
198					Value:     "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd",
199				},
200			},
201			PackageHomePage:         "http://ftp.gnu.org/gnu/glibc",
202			PackageSourceInfo:       "uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.",
203			PackageLicenseConcluded: "(LGPL-2.0-only OR LicenseRef-3)",
204			PackageLicenseInfoFromFiles: []string{
205				"GPL-2.0-only",
206				"LicenseRef-2",
207				"LicenseRef-1",
208			},
209			PackageLicenseDeclared: "(LGPL-2.0-only AND LicenseRef-3)",
210			PackageLicenseComments: "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.",
211			PackageCopyrightText:   "Copyright 2008-2010 John Smith",
212			PackageSummary:         "GNU C library.",
213			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.",
214			PackageComment:         "",
215			PackageExternalReferences: []*v2_3.PackageExternalReference{
216				{
217					Category: "SECURITY",
218					RefType:  "cpe23Type",
219					Locator:  "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*",
220				},
221				{
222					Category:           "OTHER",
223					RefType:            "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#LocationRef-acmeforge",
224					Locator:            "acmecorp/acmenator/4.1.3-alpha",
225					ExternalRefComment: "This is the external ref for Acme",
226				},
227			},
228			PackageAttributionTexts: []string{
229				"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.",
230			},
231			Files: nil,
232			Annotations: []v2_3.Annotation{
233				{
234					Annotator: common.Annotator{
235						Annotator:     "Package Commenter",
236						AnnotatorType: "Person",
237					},
238					AnnotationDate:    "2011-01-29T18:30:22Z",
239					AnnotationType:    "OTHER",
240					AnnotationComment: "Package level annotation",
241				},
242			},
243		},
244		{
245			PackageSPDXIdentifier:   "SPDXRef-fromDoap-1",
246			PackageCopyrightText:    "NOASSERTION",
247			PackageDownloadLocation: "NOASSERTION",
248			FilesAnalyzed:           false,
249			PackageHomePage:         "http://commons.apache.org/proper/commons-lang/",
250			PackageLicenseDeclared:  "NOASSERTION",
251			PackageName:             "Apache Commons Lang",
252		},
253		{
254			PackageName:             "Jena",
255			PackageSPDXIdentifier:   "SPDXRef-fromDoap-0",
256			PackageCopyrightText:    "NOASSERTION",
257			PackageDownloadLocation: "https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz",
258			PackageExternalReferences: []*v2_3.PackageExternalReference{
259				{
260					Category: "PACKAGE-MANAGER",
261					RefType:  "purl",
262					Locator:  "pkg:maven/org.apache.jena/apache-jena@3.12.0",
263				},
264			},
265			FilesAnalyzed:           false,
266			PackageHomePage:         "http://www.openjena.org/",
267			PackageLicenseConcluded: "NOASSERTION",
268			PackageLicenseDeclared:  "NOASSERTION",
269			PackageVersion:          "3.12.0",
270		},
271		{
272			PackageSPDXIdentifier: "SPDXRef-Saxon",
273			PackageChecksums: []common.Checksum{
274				{
275					Algorithm: "SHA1",
276					Value:     "85ed0817af83a24ad8da68c2b5094de69833983c",
277				},
278			},
279			PackageCopyrightText:    "Copyright Saxonica Ltd",
280			PackageDescription:      "The Saxon package is a collection of tools for processing XML documents.",
281			PackageDownloadLocation: "https://sourceforge.net/projects/saxon/files/Saxon-B/8.8.0.7/saxonb8-8-0-7j.zip/download",
282			FilesAnalyzed:           false,
283			PackageHomePage:         "http://saxon.sourceforge.net/",
284			PackageLicenseComments:  "Other versions available for a commercial license",
285			PackageLicenseConcluded: "MPL-1.0",
286			PackageLicenseDeclared:  "MPL-1.0",
287			PackageName:             "Saxon",
288			PackageFileName:         "saxonB-8.8.zip",
289			PackageVersion:          "8.8",
290		},
291		{
292			PrimaryPackagePurpose:   "CONTAINER",
293			PackageSPDXIdentifier:   "SPDXRef-CentOS-7",
294			PackageCopyrightText:    "NOASSERTION",
295			PackageDescription:      "The CentOS container used to run the application.",
296			PackageDownloadLocation: "NOASSERTION",
297			FilesAnalyzed:           false,
298			PackageHomePage:         "https://www.centos.org/",
299			PackageName:             "centos",
300			PackageFileName:         "saxonB-8.8.zip",
301			PackageVersion:          "centos7.9.2009",
302			BuiltDate:               "2021-09-15T02:38:00Z",
303			ValidUntilDate:          "2022-10-15T02:38:00Z",
304			ReleaseDate:             "2021-10-15T02:38:00Z",
305		},
306	},
307	Files: []*v2_3.File{
308		{
309			FileName:           "./src/org/spdx/parser/DOAPProject.java",
310			FileSPDXIdentifier: "SPDXRef-DoapSource",
311			FileTypes: []string{
312				"SOURCE",
313			},
314			Checksums: []common.Checksum{
315				{
316					Algorithm: "SHA1",
317					Value:     "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
318				},
319			},
320			LicenseConcluded: "Apache-2.0",
321			LicenseInfoInFiles: []string{
322				"Apache-2.0",
323			},
324			FileCopyrightText: "Copyright 2010, 2011 Source Auditor Inc.",
325			FileContributors: []string{
326				"Protecode Inc.",
327				"SPDX Technical Team Members",
328				"Open Logic Inc.",
329				"Source Auditor Inc.",
330				"Black Duck Software In.c",
331			},
332		},
333		{
334			FileSPDXIdentifier: "SPDXRef-CommonsLangSrc",
335			Checksums: []common.Checksum{
336				{
337					Algorithm: "SHA1",
338					Value:     "c2b4e1c67a2d28fced849ee1bb76e7391b93f125",
339				},
340			},
341			FileComment:        "This file is used by Jena",
342			FileCopyrightText:  "Copyright 2001-2011 The Apache Software Foundation",
343			FileContributors:   []string{"Apache Software Foundation"},
344			FileName:           "./lib-source/commons-lang3-3.1-sources.jar",
345			FileTypes:          []string{"ARCHIVE"},
346			LicenseConcluded:   "Apache-2.0",
347			LicenseInfoInFiles: []string{"Apache-2.0"},
348			FileNotice:         "Apache Commons Lang\nCopyright 2001-2011 The Apache Software Foundation\n\nThis product includes software developed by\nThe Apache Software Foundation (http://www.apache.org/).\n\nThis product includes software from the Spring Framework,\nunder the Apache License 2.0 (see: StringUtils.containsWhitespace())",
349		},
350		{
351			FileSPDXIdentifier: "SPDXRef-JenaLib",
352			Checksums: []common.Checksum{
353				{
354					Algorithm: "SHA1",
355					Value:     "3ab4e1c67a2d28fced849ee1bb76e7391b93f125",
356				},
357			},
358			FileComment:        "This file belongs to Jena",
359			FileCopyrightText:  "(c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP",
360			FileContributors:   []string{"Apache Software Foundation", "Hewlett Packard Inc."},
361			FileName:           "./lib-source/jena-2.6.3-sources.jar",
362			FileTypes:          []string{"ARCHIVE"},
363			LicenseComments:    "This license is used by Jena",
364			LicenseConcluded:   "LicenseRef-1",
365			LicenseInfoInFiles: []string{"LicenseRef-1"},
366		},
367		{
368			FileSPDXIdentifier: "SPDXRef-File",
369			Annotations: []v2_3.Annotation{
370				{
371					Annotator: common.Annotator{
372						Annotator:     "File Commenter",
373						AnnotatorType: "Person",
374					},
375					AnnotationDate:    "2011-01-29T18:30:22Z",
376					AnnotationType:    "OTHER",
377					AnnotationComment: "File level annotation",
378				},
379			},
380			Checksums: []common.Checksum{
381				{
382					Algorithm: "SHA1",
383					Value:     "d6a770ba38583ed4bb4525bd96e50461655d2758",
384				},
385				{
386					Algorithm: "MD5",
387					Value:     "624c1abb3664f4b35547e7c73864ad24",
388				},
389			},
390			FileComment:        "The concluded license was taken from the package level that the file was included in.\nThis information was found in the COPYING.txt file in the xyz directory.",
391			FileCopyrightText:  "Copyright 2008-2010 John Smith",
392			FileContributors:   []string{"The Regents of the University of California", "Modified by Paul Mundt lethal@linux-sh.org", "IBM Corporation"},
393			FileName:           "./package/foo.c",
394			FileTypes:          []string{"SOURCE"},
395			LicenseComments:    "The concluded license was taken from the package level that the file was included in.",
396			LicenseConcluded:   "(LGPL-2.0-only OR LicenseRef-2)",
397			LicenseInfoInFiles: []string{"GPL-2.0-only", "LicenseRef-2"},
398			FileNotice:         "Copyright (c) 2001 Aaron Lehmann aaroni@vitelus.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the �Software�), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: \nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED �AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
399		},
400	},
401	Snippets: []v2_3.Snippet{
402		{
403			SnippetSPDXIdentifier:         "SPDXRef-Snippet",
404			SnippetFromFileSPDXIdentifier: "SPDXRef-DoapSource",
405			Ranges: []common.SnippetRange{
406				{
407					StartPointer: common.SnippetRangePointer{
408						Offset:             310,
409						FileSPDXIdentifier: "SPDXRef-DoapSource",
410					},
411					EndPointer: common.SnippetRangePointer{
412						Offset:             420,
413						FileSPDXIdentifier: "SPDXRef-DoapSource",
414					},
415				},
416				{
417					StartPointer: common.SnippetRangePointer{
418						LineNumber:         5,
419						FileSPDXIdentifier: "SPDXRef-DoapSource",
420					},
421					EndPointer: common.SnippetRangePointer{
422						LineNumber:         23,
423						FileSPDXIdentifier: "SPDXRef-DoapSource",
424					},
425				},
426			},
427			SnippetLicenseConcluded: "GPL-2.0-only",
428			LicenseInfoInSnippet:    []string{"GPL-2.0-only"},
429			SnippetLicenseComments:  "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.",
430			SnippetCopyrightText:    "Copyright 2008-2010 John Smith",
431			SnippetComment:          "This snippet was identified as significant and highlighted in this Apache-2.0 file, when a commercial scanner identified it as being derived from file foo.c in package xyz which is licensed under GPL-2.0.",
432			SnippetName:             "from linux kernel",
433		},
434	},
435	Relationships: []*v2_3.Relationship{
436		{
437			RefA:         common.MakeDocElementID("", "DOCUMENT"),
438			RefB:         common.MakeDocElementID("", "Package"),
439			Relationship: "CONTAINS",
440		},
441		{
442			RefA:         common.MakeDocElementID("", "DOCUMENT"),
443			RefB:         common.MakeDocElementID("spdx-tool-1.2", "ToolsElement"),
444			Relationship: "COPY_OF",
445		},
446		{
447			RefA:         common.MakeDocElementID("", "DOCUMENT"),
448			RefB:         common.MakeDocElementID("", "File"),
449			Relationship: "DESCRIBES",
450		},
451		{
452			RefA:         common.MakeDocElementID("", "DOCUMENT"),
453			RefB:         common.MakeDocElementID("", "Package"),
454			Relationship: "DESCRIBES",
455		},
456		{
457			RefA:         common.MakeDocElementID("", "Package"),
458			RefB:         common.MakeDocElementID("", "JenaLib"),
459			Relationship: "CONTAINS",
460		},
461		{
462			RefA:         common.MakeDocElementID("", "Package"),
463			RefB:         common.MakeDocElementID("", "Saxon"),
464			Relationship: "DYNAMIC_LINK",
465		},
466		{
467			RefA:         common.MakeDocElementID("", "CommonsLangSrc"),
468			RefB:         common.MakeDocElementSpecial("NOASSERTION"),
469			Relationship: "GENERATED_FROM",
470		},
471		{
472			RefA:         common.MakeDocElementID("", "JenaLib"),
473			RefB:         common.MakeDocElementID("", "Package"),
474			Relationship: "CONTAINS",
475		},
476		{
477			RefA:         common.MakeDocElementID("", "File"),
478			RefB:         common.MakeDocElementID("", "fromDoap-0"),
479			Relationship: "GENERATED_FROM",
480		},
481	},
482	Reviews: []*v2_3.Review{
483		{
484			Reviewer:      "joe@example.com",
485			ReviewerType:  "Person",
486			ReviewDate:    "2021-11-03T05:43:21Z",
487			ReviewComment: "This is a review comment",
488		},
489	},
490}
491