Search in sources :

Example 1 with PipfileLockTransformer

use of com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer in project synopsys-detect by blackducksoftware.

the class DetectableFactory method createPipfileLockDetectable.

public PipfileLockDetectable createPipfileLockDetectable(DetectableEnvironment environment, PipfileLockDetectableOptions pipfileLockDetectableOptions) {
    PipfileLockDependencyVersionParser dependencyVersionParser = new PipfileLockDependencyVersionParser();
    PipfileLockTransformer pipfileLockTransformer = new PipfileLockTransformer(dependencyVersionParser, pipfileLockDetectableOptions.getDependencyTypeFilter());
    PipfileLockDependencyTransformer pipfileLockDependencyTransformer = new PipfileLockDependencyTransformer();
    PipfileLockExtractor pipfileLockExtractor = new PipfileLockExtractor(gson, pipfileLockTransformer, pipfileLockDependencyTransformer);
    return new PipfileLockDetectable(environment, fileFinder, pipfileLockExtractor);
}
Also used : PipfileLockDependencyVersionParser(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDependencyVersionParser) PipfileLockTransformer(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer) PipfileLockDetectable(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDetectable) PipfileLockDependencyTransformer(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDependencyTransformer) PipfileLockExtractor(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockExtractor)

Example 2 with PipfileLockTransformer

use of com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer in project synopsys-detect by blackducksoftware.

the class PipfileLockParserTest method testParse.

@Test
public void testParse() {
    PipfileLock pipfileLock = pipfileLock();
    PipfileLockDependencyVersionParser dependencyVersionParser = new PipfileLockDependencyVersionParser();
    PipfileLockTransformer parser = new PipfileLockTransformer(dependencyVersionParser, EnumListFilter.excludeNone());
    List<PipfileLockDependency> dependencies = parser.transform(pipfileLock);
    Assertions.assertEquals(3, dependencies.size());
    Assertions.assertTrue(containsDependency(dependencies, "comp1", "1.0"));
    Assertions.assertTrue(containsDependency(dependencies, "comp2", null));
    Assertions.assertTrue(containsDependency(dependencies, "comp3", "3.0"));
}
Also used : PipfileLock(com.synopsys.integration.detectable.detectables.pipenv.parse.data.PipfileLock) PipfileLockDependencyVersionParser(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDependencyVersionParser) PipfileLockTransformer(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer) PipfileLockDependency(com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency) Test(org.junit.jupiter.api.Test)

Example 3 with PipfileLockTransformer

use of com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer in project synopsys-detect by blackducksoftware.

the class PipfileLockParserTest method testExcludeDevelopDependencies.

@Test
public void testExcludeDevelopDependencies() {
    PipfileLock pipfileLock = pipfileLock();
    PipfileLockDependencyVersionParser dependencyVersionParser = new PipfileLockDependencyVersionParser();
    PipfileLockTransformer parser = new PipfileLockTransformer(dependencyVersionParser, EnumListFilter.fromExcluded(PipenvDependencyType.DEV));
    List<PipfileLockDependency> dependencies = parser.transform(pipfileLock);
    Assertions.assertEquals(2, dependencies.size());
    Assertions.assertTrue(containsDependency(dependencies, "comp1", "1.0"));
    Assertions.assertTrue(containsDependency(dependencies, "comp2", null));
    Assertions.assertFalse(containsDependency(dependencies, "comp3", "3.0"));
}
Also used : PipfileLock(com.synopsys.integration.detectable.detectables.pipenv.parse.data.PipfileLock) PipfileLockDependencyVersionParser(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDependencyVersionParser) PipfileLockTransformer(com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer) PipfileLockDependency(com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency) Test(org.junit.jupiter.api.Test)

Aggregations

PipfileLockDependencyVersionParser (com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDependencyVersionParser)3 PipfileLockTransformer (com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockTransformer)3 PipfileLock (com.synopsys.integration.detectable.detectables.pipenv.parse.data.PipfileLock)2 PipfileLockDependency (com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency)2 Test (org.junit.jupiter.api.Test)2 PipfileLockDependencyTransformer (com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDependencyTransformer)1 PipfileLockDetectable (com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockDetectable)1 PipfileLockExtractor (com.synopsys.integration.detectable.detectables.pipenv.parse.PipfileLockExtractor)1