use of com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency in project synopsys-detect by blackducksoftware.
the class PipfileLockDependencyTransformerTest method testTransform.
@Test
public void testTransform() {
List<PipfileLockDependency> dependencies = Arrays.asList(new PipfileLockDependency("comp1", "1.0"), new PipfileLockDependency("comp2", "2.0"));
PipfileLockDependencyTransformer transformer = new PipfileLockDependencyTransformer();
DependencyGraph dependencyGraph = transformer.transform(dependencies);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, dependencyGraph);
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("comp1", "1.0");
graphAssert.hasRootDependency("comp2", "2.0");
}
use of com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency 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"));
}
use of com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency 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"));
}
use of com.synopsys.integration.detectable.detectables.pipenv.parse.model.PipfileLockDependency in project synopsys-detect by blackducksoftware.
the class PipfileLockExtractor method extract.
public Extraction extract(File pipfileLockFile) throws IOException {
String pipfileLockText = FileUtils.readFileToString(pipfileLockFile, StandardCharsets.UTF_8);
PipfileLock pipfileLock = gson.fromJson(pipfileLockText, PipfileLock.class);
List<PipfileLockDependency> dependencies = pipfileLockTransformer.transform(pipfileLock);
DependencyGraph dependencyGraph = pipfileLockDependencyTransformer.transform(dependencies);
CodeLocation codeLocation = new CodeLocation(dependencyGraph);
// No project info - hoping git can help with that.
return Extraction.success(codeLocation);
}
Aggregations