aboutsummaryrefslogtreecommitdiff
path: root/yaml/yaml_v2_2_test.go
blob: 9d66f5b7db747a1584b286cef5674def2a2ed0e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

package spdx_yaml

import (
	"bytes"
	"fmt"
	"os"
	"testing"

	"github.com/google/go-cmp/cmp"

	"github.com/spdx/tools-golang/spdx/common"
	"github.com/spdx/tools-golang/spdx/v2_2"
)

func TestLoad2_2(t *testing.T) {
	file, err := os.Open("../examples/sample-docs/yaml/SPDXYAMLExample-2.2.spdx.yaml")
	if err != nil {
		panic(fmt.Errorf("error opening File: %s", err))
	}

	got, err := Load2_2(file)
	if err != nil {
		t.Errorf("yaml.parser.Load2_2() error = %v", err)
		return
	}

	// get a copy of the handwritten struct so we don't mutate it on accident
	handwrittenExample := want2_2

	if cmp.Equal(handwrittenExample, got) {
		t.Errorf("got incorrect struct after parsing YAML example")
		return
	}
}

func TestWrite2_2(t *testing.T) {
	w := &bytes.Buffer{}
	// get a copy of the handwritten struct so we don't mutate it on accident
	handwrittenExample := want2_2
	if err := Save2_2(&handwrittenExample, w); err != nil {
		t.Errorf("Save2_2() error = %v", err.Error())
		return
	}

	// we should be able to parse what the writer wrote, and it should be identical to the original handwritten struct
	parsedDoc, err := Load2_2(bytes.NewReader(w.Bytes()))
	if err != nil {
		t.Errorf("failed to parse written document: %v", err.Error())
		return
	}

	if cmp.Equal(handwrittenExample, parsedDoc) {
		t.Errorf("got incorrect struct after writing and re-parsing YAML example")
		return
	}
}

// want is handwritten translation of the official example YAML SPDX v2.2 document into a Go struct.
// We expect that the result of parsing the official document should be this value.
// We expect that the result of writing this struct should match the official example document.
var want2_2 = v2_2.Document{
	DataLicense:       "CC0-1.0",
	SPDXVersion:       "SPDX-2.2",
	SPDXIdentifier:    "SPDXRef-DOCUMENT",
	DocumentName:      "SPDX-Tools-v2.0",
	DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301",
	CreationInfo: &v2_2.CreationInfo{
		LicenseListVersion: "3.9",
		Creators: []common.Creator{
			{CreatorType: "Tool", Creator: "LicenseFind-1.0"},
			{CreatorType: "Organization", Creator: "ExampleCodeInspect ()"},
			{CreatorType: "Person", Creator: "Jane Doe ()"},
		},
		Created:        "2010-01-29T18:30:22Z",
		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.",
	},
	DocumentComment: "This document was created using SPDX 2.0 using licenses from the web site.",
	ExternalDocumentReferences: []v2_2.ExternalDocumentRef{
		{
			DocumentRefID: "DocumentRef-spdx-tool-1.2",
			URI:           "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301",
			Checksum: common.Checksum{
				Algorithm: common.SHA1,
				Value:     "d6a770ba38583ed4bb4525bd96e50461655d2759",
			},
		},
	},
	OtherLicenses: []*v2_2.OtherLicense{
		{
			LicenseIdentifier: "LicenseRef-1",
			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*/",
		},
		{
			LicenseIdentifier: "LicenseRef-2",
			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.",
		},
		{
			LicenseIdentifier: "LicenseRef-4",
			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*/",
		},
		{
			LicenseIdentifier:      "LicenseRef-Beerware-4.2",
			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/"},
		},
		{
			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",
			},
			LicenseComment: "This is tye CyperNeko License",
		},
	},
	Annotations: []*v2_2.Annotation{
		{
			Annotator: common.Annotator{
				Annotator:     "Jane Doe ()",
				AnnotatorType: "Person",
			},
			AnnotationDate:    "2010-01-29T18:30:22Z",
			AnnotationType:    "OTHER",
			AnnotationComment: "Document level annotation",
		},
		{
			Annotator: common.Annotator{
				Annotator:     "Joe Reviewer",
				AnnotatorType: "Person",
			},
			AnnotationDate:    "2010-02-10T00:00:00Z",
			AnnotationType:    "REVIEW",
			AnnotationComment: "This is just an example.  Some of the non-standard licenses look like they are actually BSD 3 clause licenses",
		},
		{
			Annotator: common.Annotator{
				Annotator:     "Suzanne Reviewer",
				AnnotatorType: "Person",
			},
			AnnotationDate:    "2011-03-13T00:00:00Z",
			AnnotationType:    "REVIEW",
			AnnotationComment: "Another example reviewer.",
		},
	},
	Packages: []*v2_2.Package{
		{
			PackageName:           "glibc",
			PackageSPDXIdentifier: "SPDXRef-Package",
			PackageVersion:        "2.11.1",
			PackageFileName:       "glibc-2.11.1.tar.gz",
			PackageSupplier: &common.Supplier{
				Supplier:     "Jane Doe (jane.doe@example.com)",
				SupplierType: "Person",
			},
			PackageOriginator: &common.Originator{
				Originator:     "ExampleCodeInspect (contact@example.com)",
				OriginatorType: "Organization",
			},
			PackageDownloadLocation: "http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz",
			FilesAnalyzed:           true,
			PackageVerificationCode: common.PackageVerificationCode{
				Value:         "d6a770ba38583ed4bb4525bd96e50461655d2758",
				ExcludedFiles: []string{"./package.spdx"},
			},
			PackageChecksums: []common.Checksum{
				{
					Algorithm: "MD5",
					Value:     "624c1abb3664f4b35547e7c73864ad24",
				},
				{
					Algorithm: "SHA1",
					Value:     "85ed0817af83a24ad8da68c2b5094de69833983c",
				},
				{
					Algorithm: "SHA256",
					Value:     "11b6d3ee554eedf79299905a98f9b9a04e498210b59f15094c916c91d150efcd",
				},
			},
			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{
				"GPL-2.0-only",
				"LicenseRef-2",
				"LicenseRef-1",
			},
			PackageLicenseDeclared: "(LGPL-2.0-only AND LicenseRef-3)",
			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.",
			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.",
			PackageComment:         "",
			PackageExternalReferences: []*v2_2.PackageExternalReference{
				{
					Category: "SECURITY",
					RefType:  "cpe23Type",
					Locator:  "cpe:2.3:a:pivotal_software:spring_framework:4.1.0:*:*:*:*:*:*:*",
				},
				{
					Category:           "OTHER",
					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",
				},
			},
			PackageAttributionTexts: []string{
				"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.",
			},
			Files: nil,
			Annotations: []v2_2.Annotation{
				{
					Annotator: common.Annotator{
						Annotator:     "Package Commenter",
						AnnotatorType: "Person",
					},
					AnnotationDate:    "2011-01-29T18:30:22Z",
					AnnotationType:    "OTHER",
					AnnotationComment: "Package level annotation",
				},
			},
		},
		{
			PackageSPDXIdentifier:   "SPDXRef-fromDoap-1",
			PackageCopyrightText:    "NOASSERTION",
			PackageDownloadLocation: "NOASSERTION",
			FilesAnalyzed:           false,
			PackageHomePage:         "http://commons.apache.org/proper/commons-lang/",
			PackageLicenseConcluded: "NOASSERTION",
			PackageLicenseDeclared:  "NOASSERTION",
			PackageName:             "Apache Commons Lang",
		},
		{
			PackageName:             "Jena",
			PackageSPDXIdentifier:   "SPDXRef-fromDoap-0",
			PackageCopyrightText:    "NOASSERTION",
			PackageDownloadLocation: "https://search.maven.org/remotecontent?filepath=org/apache/jena/apache-jena/3.12.0/apache-jena-3.12.0.tar.gz",
			PackageExternalReferences: []*v2_2.PackageExternalReference{
				{
					Category: "PACKAGE_MANAGER",
					RefType:  "purl",
					Locator:  "pkg:maven/org.apache.jena/apache-jena@3.12.0",
				},
			},
			FilesAnalyzed:           false,
			PackageHomePage:         "http://www.openjena.org/",
			PackageLicenseConcluded: "NOASSERTION",
			PackageLicenseDeclared:  "NOASSERTION",
			PackageVersion:          "3.12.0",
		},
		{
			PackageSPDXIdentifier: "SPDXRef-Saxon",
			PackageChecksums: []common.Checksum{
				{
					Algorithm: "SHA1",
					Value:     "85ed0817af83a24ad8da68c2b5094de69833983c",
				},
			},
			PackageCopyrightText:    "Copyright Saxonica Ltd",
			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/",
			PackageLicenseComments:  "Other versions available for a commercial license",
			PackageLicenseConcluded: "MPL-1.0",
			PackageLicenseDeclared:  "MPL-1.0",
			PackageName:             "Saxon",
			PackageFileName:         "saxonB-8.8.zip",
			PackageVersion:          "8.8",
		},
	},
	Files: []*v2_2.File{
		{
			FileName:           "./src/org/spdx/parser/DOAPProject.java",
			FileSPDXIdentifier: "SPDXRef-DoapSource",
			FileTypes: []string{
				"SOURCE",
			},
			Checksums: []common.Checksum{
				{
					Algorithm: "SHA1",
					Value:     "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
				},
			},
			LicenseConcluded: "Apache-2.0",
			LicenseInfoInFiles: []string{
				"Apache-2.0",
			},
			FileCopyrightText: "Copyright 2010, 2011 Source Auditor Inc.",
			FileContributors: []string{
				"Protecode Inc.",
				"SPDX Technical Team Members",
				"Open Logic Inc.",
				"Source Auditor Inc.",
				"Black Duck Software In.c",
			},
		},
		{
			FileSPDXIdentifier: "SPDXRef-CommonsLangSrc",
			Checksums: []common.Checksum{
				{
					Algorithm: "SHA1",
					Value:     "c2b4e1c67a2d28fced849ee1bb76e7391b93f125",
				},
			},
			FileComment:        "This file is used by Jena",
			FileCopyrightText:  "Copyright 2001-2011 The Apache Software Foundation",
			FileContributors:   []string{"Apache Software Foundation"},
			FileName:           "./lib-source/commons-lang3-3.1-sources.jar",
			FileTypes:          []string{"ARCHIVE"},
			LicenseConcluded:   "Apache-2.0",
			LicenseInfoInFiles: []string{"Apache-2.0"},
			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())",
		},
		{
			FileSPDXIdentifier: "SPDXRef-JenaLib",
			Checksums: []common.Checksum{
				{
					Algorithm: "SHA1",
					Value:     "3ab4e1c67a2d28fced849ee1bb76e7391b93f125",
				},
			},
			FileComment:        "This file belongs to Jena",
			FileCopyrightText:  "(c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP",
			FileContributors:   []string{"Apache Software Foundation", "Hewlett Packard Inc."},
			FileName:           "./lib-source/jena-2.6.3-sources.jar",
			FileTypes:          []string{"ARCHIVE"},
			LicenseComments:    "This license is used by Jena",
			LicenseConcluded:   "LicenseRef-1",
			LicenseInfoInFiles: []string{"LicenseRef-1"},
		},
		{
			FileSPDXIdentifier: "SPDXRef-File",
			Annotations: []v2_2.Annotation{
				{
					Annotator: common.Annotator{
						Annotator:     "File Commenter",
						AnnotatorType: "Person",
					},
					AnnotationDate:    "2011-01-29T18:30:22Z",
					AnnotationType:    "OTHER",
					AnnotationComment: "File level annotation",
				},
			},
			Checksums: []common.Checksum{
				{
					Algorithm: "SHA1",
					Value:     "d6a770ba38583ed4bb4525bd96e50461655d2758",
				},
				{
					Algorithm: "MD5",
					Value:     "624c1abb3664f4b35547e7c73864ad24",
				},
			},
			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.",
			FileCopyrightText:  "Copyright 2008-2010 John Smith",
			FileContributors:   []string{"The Regents of the University of California", "Modified by Paul Mundt lethal@linux-sh.org", "IBM Corporation"},
			FileName:           "./package/foo.c",
			FileTypes:          []string{"SOURCE"},
			LicenseComments:    "The concluded license was taken from the package level that the file was included in.",
			LicenseConcluded:   "(LGPL-2.0-only OR LicenseRef-2)",
			LicenseInfoInFiles: []string{"GPL-2.0-only", "LicenseRef-2"},
			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.",
		},
	},
	Snippets: []v2_2.Snippet{
		{
			SnippetSPDXIdentifier:         "SPDXRef-Snippet",
			SnippetFromFileSPDXIdentifier: "SPDXRef-DoapSource",
			Ranges: []common.SnippetRange{
				{
					StartPointer: common.SnippetRangePointer{
						Offset:             310,
						FileSPDXIdentifier: "SPDXRef-DoapSource",
					},
					EndPointer: common.SnippetRangePointer{
						Offset:             420,
						FileSPDXIdentifier: "SPDXRef-DoapSource",
					},
				},
				{
					StartPointer: common.SnippetRangePointer{
						LineNumber:         5,
						FileSPDXIdentifier: "SPDXRef-DoapSource",
					},
					EndPointer: common.SnippetRangePointer{
						LineNumber:         23,
						FileSPDXIdentifier: "SPDXRef-DoapSource",
					},
				},
			},
			SnippetLicenseConcluded: "GPL-2.0-only",
			LicenseInfoInSnippet:    []string{"GPL-2.0-only"},
			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.",
			SnippetCopyrightText:    "Copyright 2008-2010 John Smith",
			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.",
			SnippetName:             "from linux kernel",
		},
	},
	Relationships: []*v2_2.Relationship{
		{
			RefA:         common.MakeDocElementID("", "DOCUMENT"),
			RefB:         common.MakeDocElementID("", "Package"),
			Relationship: "CONTAINS",
		},
		{
			RefA:         common.MakeDocElementID("", "DOCUMENT"),
			RefB:         common.MakeDocElementID("spdx-tool-1.2", "ToolsElement"),
			Relationship: "COPY_OF",
		},
		{
			RefA:         common.MakeDocElementID("", "DOCUMENT"),
			RefB:         common.MakeDocElementID("", "File"),
			Relationship: "DESCRIBES",
		},
		{
			RefA:         common.MakeDocElementID("", "DOCUMENT"),
			RefB:         common.MakeDocElementID("", "Package"),
			Relationship: "DESCRIBES",
		},
		{
			RefA:         common.MakeDocElementID("", "Package"),
			RefB:         common.MakeDocElementID("", "JenaLib"),
			Relationship: "CONTAINS",
		},
		{
			RefA:         common.MakeDocElementID("", "Package"),
			RefB:         common.MakeDocElementID("", "Saxon"),
			Relationship: "DYNAMIC_LINK",
		},
		{
			RefA:         common.MakeDocElementID("", "CommonsLangSrc"),
			RefB:         common.MakeDocElementSpecial("NOASSERTION"),
			Relationship: "GENERATED_FROM",
		},
		{
			RefA:         common.MakeDocElementID("", "JenaLib"),
			RefB:         common.MakeDocElementID("", "Package"),
			Relationship: "CONTAINS",
		},
		{
			RefA:         common.MakeDocElementID("", "File"),
			RefB:         common.MakeDocElementID("", "fromDoap-0"),
			Relationship: "GENERATED_FROM",
		},
	},
}