use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer in project synopsys-detect by blackducksoftware.
the class DetectableFactory method createPnpmLockDetectable.
public PnpmLockDetectable createPnpmLockDetectable(DetectableEnvironment environment, PnpmLockOptions pnpmLockOptions) {
PnpmYamlTransformer pnpmYamlTransformer = new PnpmYamlTransformer(pnpmLockOptions.getDependencyTypeFilter());
PnpmLockYamlParser pnpmLockYamlParser = new PnpmLockYamlParser(pnpmYamlTransformer);
PnpmLockExtractor pnpmLockExtractor = new PnpmLockExtractor(pnpmLockYamlParser, packageJsonFiles());
return new PnpmLockDetectable(environment, fileFinder, pnpmLockExtractor, packageJsonFiles());
}
use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer in project synopsys-detect by blackducksoftware.
the class PnpmLockExtractorTest method testNoFailureOnNullPackageJson.
@Test
public void testNoFailureOnNullPackageJson() {
PackageJsonFiles packageJsonFiles = new PackageJsonFiles(new PackageJsonReader(new Gson()));
EnumListFilter<PnpmDependencyType> dependencyTypeFilter = EnumListFilter.fromExcluded(PnpmDependencyType.APP);
PnpmLockExtractor extractor = new PnpmLockExtractor(new PnpmLockYamlParser(new PnpmYamlTransformer(dependencyTypeFilter)), packageJsonFiles);
File pnpmLockYaml = FunctionalTestFiles.asFile("/pnpm/pnpm-lock.yaml");
Extraction extraction = extractor.extract(pnpmLockYaml, null, new PnpmLinkedPackageResolver(new File(""), packageJsonFiles));
Assertions.assertTrue(extraction.isSuccess());
}
use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer 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.process.PnpmYamlTransformer 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.process.PnpmYamlTransformer 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");
}
Aggregations