Search in sources :

Example 1 with PnpmLockExtractor

use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockExtractor 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());
}
Also used : PnpmLockDetectable(com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockDetectable) PnpmYamlTransformer(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer) PnpmLockYamlParser(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmLockYamlParser) PnpmLockExtractor(com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockExtractor)

Example 2 with PnpmLockExtractor

use of com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockExtractor 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());
}
Also used : PnpmLinkedPackageResolver(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmLinkedPackageResolver) PackageJsonReader(com.synopsys.integration.detectable.detectables.yarn.packagejson.PackageJsonReader) PnpmYamlTransformer(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer) PnpmLockYamlParser(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmLockYamlParser) Gson(com.google.gson.Gson) Extraction(com.synopsys.integration.detectable.extraction.Extraction) PackageJsonFiles(com.synopsys.integration.detectable.detectables.yarn.packagejson.PackageJsonFiles) File(java.io.File) PnpmDependencyType(com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmDependencyType) PnpmLockExtractor(com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockExtractor) Test(org.junit.jupiter.api.Test)

Aggregations

PnpmLockExtractor (com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockExtractor)2 PnpmLockYamlParser (com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmLockYamlParser)2 PnpmYamlTransformer (com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer)2 Gson (com.google.gson.Gson)1 PnpmLockDetectable (com.synopsys.integration.detectable.detectables.pnpm.lockfile.PnpmLockDetectable)1 PnpmDependencyType (com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmDependencyType)1 PnpmLinkedPackageResolver (com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmLinkedPackageResolver)1 PackageJsonFiles (com.synopsys.integration.detectable.detectables.yarn.packagejson.PackageJsonFiles)1 PackageJsonReader (com.synopsys.integration.detectable.detectables.yarn.packagejson.PackageJsonReader)1 Extraction (com.synopsys.integration.detectable.extraction.Extraction)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1