use of com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraphDependency in project synopsys-detect by blackducksoftware.
the class PipenvTransformerTest method usesProjectDependencyAsRoot.
@Test
void usesProjectDependencyAsRoot() {
PipFreeze pipFreeze = new PipFreeze(new ArrayList<>());
List<PipenvGraphEntry> pipenvGraphEntries = new ArrayList<>();
List<PipenvGraphDependency> children = new ArrayList<>();
children.add(new PipenvGraphDependency("shouldBeAtRoot", "shouldbeAtRootVersion", new ArrayList<>()));
pipenvGraphEntries.add(new PipenvGraphEntry("projectName", "projectVersion", children));
PipenvGraph pipenvGraph = new PipenvGraph(pipenvGraphEntries);
PipenvTransformer pipenvTransformer = new PipenvTransformer(new ExternalIdFactory());
CodeLocation codeLocation = pipenvTransformer.transform("projectName", "projectVersion", pipFreeze, pipenvGraph, false);
DependencyGraph graph = codeLocation.getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, graph);
graphAssert.hasRootDependency("shouldBeAtRoot", "shouldbeAtRootVersion");
}
use of com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraphDependency in project synopsys-detect by blackducksoftware.
the class PipenvTransformer method addDependenciesToGraph.
private List<Dependency> addDependenciesToGraph(List<PipenvGraphDependency> graphDependencies, DependencyGraph graph, PipFreeze pipFreeze) {
List<Dependency> dependencies = new ArrayList<>();
for (PipenvGraphDependency graphDependency : graphDependencies) {
Dependency dependency = nameVersionToDependency(graphDependency.getName(), graphDependency.getInstalledVersion(), pipFreeze);
List<Dependency> children = addDependenciesToGraph(graphDependency.getChildren(), graph, pipFreeze);
graph.addParentWithChildren(dependency, children);
dependencies.add(dependency);
}
return dependencies;
}
use of com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraphDependency in project synopsys-detect by blackducksoftware.
the class PipenvTransformerTest method ignoresNonProject.
@Test
void ignoresNonProject() {
PipFreeze pipFreeze = new PipFreeze(new ArrayList<>());
List<PipenvGraphEntry> pipenvGraphEntries = new ArrayList<>();
pipenvGraphEntries.add(new PipenvGraphEntry("projectName", "projectVersion", Collections.singletonList(new PipenvGraphDependency("child", "childVersion", Collections.emptyList()))));
pipenvGraphEntries.add(new PipenvGraphEntry("non-projectName", "non-projectVersion", new ArrayList<>()));
PipenvGraph pipenvGraph = new PipenvGraph(pipenvGraphEntries);
PipenvTransformer pipenvTransformer = new PipenvTransformer(new ExternalIdFactory());
CodeLocation codeLocation = pipenvTransformer.transform("projectName", "projectVersion", pipFreeze, pipenvGraph, true);
DependencyGraph graph = codeLocation.getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, graph);
graphAssert.hasRootDependency("child", "childVersion");
graphAssert.hasNoDependency("non-projectName", "non-projectVersion");
}
Aggregations