Search in sources :

Example 1 with YarnLockLineAnalyzer

use of com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer 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 YarnLockLineAnalyzer

use of com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer 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 YarnLockLineAnalyzer

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

the class YarnLockDependencySpecParserTest method setup.

@BeforeAll
static void setup() {
    YarnLockLineAnalyzer yarnLockLineAnalyzer = new YarnLockLineAnalyzer();
    parser = new YarnLockDependencySpecParser(yarnLockLineAnalyzer);
}
Also used : YarnLockDependencySpecParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockDependencySpecParser) YarnLockLineAnalyzer(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with YarnLockLineAnalyzer

use of com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer 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)

Example 5 with YarnLockLineAnalyzer

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

the class YarnLockHeaderSectionParserTest method setup.

@BeforeAll
static void setup() {
    YarnLockLineAnalyzer yarnLockLineAnalyzer = new YarnLockLineAnalyzer();
    yarnLockParser = new YarnLockHeaderSectionParser(yarnLockLineAnalyzer);
}
Also used : YarnLockLineAnalyzer(com.synopsys.integration.detectable.detectables.yarn.parse.YarnLockLineAnalyzer) YarnLockHeaderSectionParser(com.synopsys.integration.detectable.detectables.yarn.parse.entry.section.YarnLockHeaderSectionParser) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

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