Search in sources :

Example 1 with SpdxDocument

use of org.spdx.rdfparser.model.SpdxDocument in project sw360portal by sw360.

the class SPDXParserTest method testAddSPDXContentToCLI.

@Test
@UseDataProvider("dataProviderAdd")
public void testAddSPDXContentToCLI(String exampleFile, List<String> expectedLicenses, int numberOfCoyprights, String exampleCopyright) throws Exception {
    AttachmentContent attachmentContent = new AttachmentContent().setFilename(exampleFile);
    InputStream input = makeAttachmentContentStream(exampleFile);
    SpdxDocument spdxDocument = SPDXDocumentFactory.createSpdxDocument(input, parser.getUriOfAttachment(attachmentContentStore.get(exampleFile)), FILETYPE_SPDX_INTERNAL);
    LicenseInfoParsingResult result = SPDXParserTools.getLicenseInfoFromSpdx(attachmentContent, spdxDocument);
    assertIsResultOfExample(result.getLicenseInfo(), exampleFile, expectedLicenses, numberOfCoyprights, exampleCopyright);
}
Also used : InputStream(java.io.InputStream) AttachmentContent(org.eclipse.sw360.datahandler.thrift.attachments.AttachmentContent) LicenseInfoParsingResult(org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseInfoParsingResult) SpdxDocument(org.spdx.rdfparser.model.SpdxDocument) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 InputStream (java.io.InputStream)1 AttachmentContent (org.eclipse.sw360.datahandler.thrift.attachments.AttachmentContent)1 LicenseInfoParsingResult (org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseInfoParsingResult)1 Test (org.junit.Test)1 SpdxDocument (org.spdx.rdfparser.model.SpdxDocument)1