use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml in project synopsys-detect by blackducksoftware.
the class PnpmYamlTransformerTest method testGenerateCodeLocation.
@Test
public void testGenerateCodeLocation() throws IntegrationException {
PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
PnpmYamlTransformer transformer = createTransformer();
CodeLocation codeLocation = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver);
assertTrue(codeLocation.getExternalId().isPresent(), "Expected the codelocation to produce an ExternalId.");
assertEquals("name", codeLocation.getExternalId().get().getName());
assertEquals("version", codeLocation.getExternalId().get().getVersion());
DependencyGraph dependencyGraph = codeLocation.getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
graphAssert.hasRootSize(4);
graphAssert.hasRootDependency("dep", "1.0.0");
graphAssert.hasRootDependency("devDep", "2.0.0");
graphAssert.hasRootDependency("optDep", "3.0.0");
graphAssert.hasParentChildRelationship("dep", "1.0.0", "transitive", "1.1.0");
}
use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml in project synopsys-detect by blackducksoftware.
the class PnpmYamlTransformerTest method testNoFailureOnNullNameVersion.
@Test
public void testNoFailureOnNullNameVersion() throws IntegrationException {
PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
PnpmYamlTransformer transformer = createTransformer();
transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, null, linkedPackageResolver);
}
use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml in project synopsys-detect by blackducksoftware.
the class PnpmYamlTransformerTest method testExcludeOptionalDependencies.
@Test
public void testExcludeOptionalDependencies() throws IntegrationException {
PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
PnpmYamlTransformer transformer = createTransformer(PnpmDependencyType.OPTIONAL);
DependencyGraph dependencyGraph = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver).getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
graphAssert.hasRootSize(3);
graphAssert.hasNoDependency("optDep", "3.0.0");
}
use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml in project synopsys-detect by blackducksoftware.
the class PnpmYamlTransformerTest method testParseFileDependencies.
@Test
public void testParseFileDependencies() throws IntegrationException {
PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
PnpmYamlTransformer transformer = createTransformer(PnpmDependencyType.DEV, PnpmDependencyType.OPTIONAL);
DependencyGraph dependencyGraph = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver).getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
graphAssert.hasRootSize(2);
graphAssert.hasDependency("fileDep", "1.0.0");
}
use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml in project synopsys-detect by blackducksoftware.
the class PnpmLockYamlParser method parse.
public List<CodeLocation> parse(File pnpmLockYamlFile, @Nullable NameVersion projectNameVersion, PnpmLinkedPackageResolver linkedPackageResolver) throws IOException, IntegrationException {
PnpmLockYaml pnpmLockYaml = parseYamlFile(pnpmLockYamlFile);
List<CodeLocation> codeLocationsFromImports = createCodeLocationsFromImports(pnpmLockYamlFile.getParentFile(), pnpmLockYaml, linkedPackageResolver, projectNameVersion);
if (codeLocationsFromImports.isEmpty()) {
return createCodeLocationsFromRoot(pnpmLockYamlFile.getParentFile(), pnpmLockYaml, projectNameVersion, linkedPackageResolver);
}
return codeLocationsFromImports;
}
Aggregations