use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackager method createMavenParseResult.
private MavenParseResult createMavenParseResult(final String sourcePath, final String line, final DependencyGraph graph) {
final Dependency dependency = textToProject(line);
if (null != dependency) {
String codeLocationSourcePath = sourcePath;
if (!sourcePath.endsWith(dependency.name)) {
codeLocationSourcePath += "/" + dependency.name;
}
final DetectCodeLocation codeLocation = new DetectCodeLocation.Builder(DetectCodeLocationType.MAVEN, codeLocationSourcePath, dependency.externalId, graph).build();
return new MavenParseResult(dependency.name, dependency.version, codeLocation);
}
return null;
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class CondaListParser method condaListElementToDependency.
public Dependency condaListElementToDependency(final String platform, final CondaListElement element) {
final String name = element.name;
final String version = String.format("%s-%s-%s", element.version, element.buildString, platform);
final ExternalId externalId = externalIdFactory.createNameVersionExternalId(Forge.ANACONDA, name, version);
return new Dependency(name, version, externalId);
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class RebarParserTest method testParseRebarTreeOutput.
@Test
public void testParseRebarTreeOutput() {
final MutableMapDependencyGraph expectedGraph = new MutableMapDependencyGraph();
final Dependency gitInnerParentDependency = buildDependency("git_inner_parent_dependency", "0.0.2");
final Dependency hexInnerChildDependency = buildDependency("hex_inner_child_dependency", "0.3.0");
final Dependency hexGrandchildDependency = buildDependency("hex_grandchild_dependency", "4.0.0");
final Dependency gitInnerChildDependency = buildDependency("git_inner_child_dependency", "0.5.0");
final Dependency gitGrandchildDependency = buildDependency("git_grandchild_dependency", "6.0.0");
final Dependency gitOuterParentDependency = buildDependency("git_outer_parent_dependency", "0.0.7");
final Dependency gitOuterChildDependency = buildDependency("git_outer_child_dependency", "0.8.0");
expectedGraph.addChildrenToRoot(gitInnerParentDependency, gitOuterParentDependency);
expectedGraph.addChildWithParent(hexInnerChildDependency, gitInnerParentDependency);
expectedGraph.addChildWithParents(hexGrandchildDependency, hexInnerChildDependency);
expectedGraph.addChildWithParent(gitInnerChildDependency, gitInnerParentDependency);
expectedGraph.addChildWithParents(gitGrandchildDependency, gitInnerChildDependency);
expectedGraph.addChildWithParents(gitOuterChildDependency, gitOuterParentDependency);
final DetectCodeLocation codeLocation = build("/hex/dependencyTree.txt");
final DependencyGraph actualGraph = codeLocation.getDependencyGraph();
assertGraph(expectedGraph, actualGraph);
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class DependencyGraphAssertions method assertParentHasChildMavenGav.
public static void assertParentHasChildMavenGav(final String parentGav, final DependencyGraph dependencyGraph, final String targetGavChild) {
final ExternalId parentId = mavenGavToExternalId(parentGav);
final ExternalId childId = mavenGavToExternalId(targetGavChild);
final Dependency dep = dependencyGraph.getDependency(parentId);
assertNotNull("Graph does not have gav '" + parentGav + "'", dep);
final Set<ExternalId> children = dependencyGraph.getChildrenExternalIdsForParent(dep);
assertTrue("Parent gav '" + parentGav + "' does not have child gav '" + targetGavChild + "'", children.contains(childId));
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class DependencyGraphAssertions method assertHasRootMavenGav.
public static void assertHasRootMavenGav(final DependencyGraph dependencyGraph, final String targetGav) {
final ExternalId targetId = mavenGavToExternalId(targetGav);
final Dependency dep = dependencyGraph.getDependency(targetId);
assertNotNull(dep);
}
Aggregations