Search in sources :

Example 26 with IContentId

use of org.eclipse.dash.licenses.IContentId in project dash-licenses by eclipse.

the class PackageLockFileReaderTests method testV1Format.

@Test
void testV1Format() throws IOException {
    try (InputStream input = this.getClass().getResourceAsStream(PACKAGE_LOCK_JSON)) {
        PackageLockFileReader reader = new PackageLockFileReader(input);
        String[] expected = { "npm/npmjs/-/loglevel/1.6.1", "npm/npmjs/-/sax/1.2.4", "npm/npmjs/-/saxes/3.1.9", "npm/npmjs/-/slimdom-sax-parser/1.1.3", "npm/npmjs/-/slimdom/2.2.1", "npm/npmjs/-/xml-js/1.6.11", "npm/npmjs/-/xmlchars/1.3.1", "npm/npmjs/@namespace/fontoxpath/3.3.0" };
        String[] found = reader.getContentIds().stream().map(IContentId::toString).sorted().toArray(String[]::new);
        assertArrayEquals(expected, found);
    }
}
Also used : PackageLockFileReader(org.eclipse.dash.licenses.cli.PackageLockFileReader) IContentId(org.eclipse.dash.licenses.IContentId) InputStream(java.io.InputStream) Test(org.junit.jupiter.api.Test)

Aggregations

IContentId (org.eclipse.dash.licenses.IContentId)26 Test (org.junit.jupiter.api.Test)23 StringReader (java.io.StringReader)4 LicenseData (org.eclipse.dash.licenses.LicenseData)4 YarnLockFileReader (org.eclipse.dash.licenses.cli.YarnLockFileReader)3 Guice (com.google.inject.Guice)2 Injector (com.google.inject.Injector)2 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 StandardCharsets (java.nio.charset.StandardCharsets)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 List (java.util.List)2 ISettings (org.eclipse.dash.licenses.ISettings)2 LicenseChecker (org.eclipse.dash.licenses.LicenseChecker)2 PackageLockFileReader (org.eclipse.dash.licenses.cli.PackageLockFileReader)2 Disabled (org.junit.jupiter.api.Disabled)2 Json (jakarta.json.Json)1