Search in sources :

Example 1 with YarnLockEntryParser

use of com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser in project synopsys-detect by blackducksoftware.

the class YarnLockParserFunctionalTest method testV1Lockfile.

@Test
void testV1Lockfile() throws IOException {
    File lockfile = FunctionalTestFiles.asFile("/yarn/lockfilev1/yarn.lock");
    List<String> yarnLockLines = FileUtils.readLines(lockfile, StandardCharsets.UTF_8);
    Assertions.assertTrue(lockfile.exists());
    YarnLockLineAnalyzer yarnLockLineAnalyzer = new YarnLockLineAnalyzer();
    YarnLockDependencySpecParser yarnLockDependencySpecParser = new YarnLockDependencySpecParser(yarnLockLineAnalyzer);
    YarnLockEntrySectionParserSet yarnLockEntryElementParser = new YarnLockEntrySectionParserSet(yarnLockLineAnalyzer, yarnLockDependencySpecParser);
    YarnLockEntryParser yarnLockEntryParser = new YarnLockEntryParser(yarnLockLineAnalyzer, yarnLockEntryElementParser);
    YarnLockParser yarnLockParser = new YarnLockParser(yarnLockEntryParser);
    YarnLock yarnLock = yarnLockParser.parseYarnLock(yarnLockLines);
    Assertions.assertEquals(4238, yarnLock.getEntries().size());
    Assertions.assertEquals("zwitch", yarnLock.getEntries().get(4237).getIds().get(0).getName());
    Assertions.assertEquals("^1.0.0", yarnLock.getEntries().get(4237).getIds().get(0).getVersion());
}
Also used : YarnLock(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLock) YarnLockDependencySpecParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockDependencySpecParser) YarnLockEntrySectionParserSet(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockEntrySectionParserSet) YarnLockParser(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockParser) YarnLockEntryParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser) YarnLockLineAnalyzer(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 2 with YarnLockEntryParser

use of com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser in project synopsys-detect by blackducksoftware.

the class YarnLockParserTest method createYarnLockParser.

@NotNull
private YarnLockParser createYarnLockParser() {
    YarnLockLineAnalyzer lineAnalyzer = new YarnLockLineAnalyzer();
    YarnLockDependencySpecParser yarnLockDependencySpecParser = new YarnLockDependencySpecParser(lineAnalyzer);
    YarnLockEntrySectionParserSet yarnLockEntryElementParser = new YarnLockEntrySectionParserSet(lineAnalyzer, yarnLockDependencySpecParser);
    YarnLockEntryParser entryParser = new YarnLockEntryParser(lineAnalyzer, yarnLockEntryElementParser);
    YarnLockParser yarnLockParser = new YarnLockParser(entryParser);
    return yarnLockParser;
}
Also used : YarnLockDependencySpecParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockDependencySpecParser) YarnLockEntrySectionParserSet(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockEntrySectionParserSet) YarnLockParser(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockParser) YarnLockEntryParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser) YarnLockLineAnalyzer(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with YarnLockEntryParser

use of com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser in project synopsys-detect by blackducksoftware.

the class DetectableFactory method yarnLockParser.

private YarnLockParser yarnLockParser() {
    YarnLockLineAnalyzer yarnLockLineAnalyzer = new YarnLockLineAnalyzer();
    YarnLockDependencySpecParser yarnLockDependencySpecParser = new YarnLockDependencySpecParser(yarnLockLineAnalyzer);
    YarnLockEntrySectionParserSet yarnLockEntryElementParser = new YarnLockEntrySectionParserSet(yarnLockLineAnalyzer, yarnLockDependencySpecParser);
    YarnLockEntryParser yarnLockEntryParser = new YarnLockEntryParser(yarnLockLineAnalyzer, yarnLockEntryElementParser);
    return new YarnLockParser(yarnLockEntryParser);
}
Also used : YarnLockDependencySpecParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockDependencySpecParser) YarnLockEntrySectionParserSet(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockEntrySectionParserSet) YarnLockParser(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockParser) YarnLockEntryParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser) YarnLockLineAnalyzer(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer)

Aggregations

YarnLockLineAnalyzer (com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer)3 YarnLockParser (com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockParser)3 YarnLockEntryParser (com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParser)3 YarnLockDependencySpecParser (com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockDependencySpecParser)3 YarnLockEntrySectionParserSet (com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockEntrySectionParserSet)3 YarnLock (com.synopsys.integration.detectable.detectables.yarn.parse.YarnLock)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.junit.jupiter.api.Test)1