use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PubDepsParserTest method test.
@Test
public void test() {
List<String> pubDepsLines = FunctionalTestFiles.asListOfStrings("/dart/pubDeps.txt");
PubDepsParser pubDepsParser = new PubDepsParser();
DependencyGraph dependencyGraph = pubDepsParser.parse(pubDepsLines);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.DART, dependencyGraph);
graphAssert.hasRootSize(4);
graphAssert.hasRootDependency("charcode", "1.1.3");
graphAssert.hasRootDependency("pedantic", "1.9.2");
graphAssert.hasRootDependency("test", "1.15.3");
graphAssert.hasRootDependency("typed_data", "1.2.0");
graphAssert.hasParentChildRelationship("analyzer", "0.39.17", "_fe_analyzer_shared", "7.0.0");
graphAssert.hasParentChildRelationship("glob", "1.2.0", "node_io", "1.1.1");
graphAssert.hasParentChildRelationship("node_interop", "1.1.1", "js", "1.1.0");
graphAssert.hasParentChildRelationship("js", "1.1.0", "async", "2.2.1");
graphAssert.hasParentChildRelationship("async", "2.2.1", "charcode", "1.1.3");
graphAssert.hasParentChildRelationship("typed_data", "1.2.0", "webkit_inspection_protocol", "0.7.3");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class VndrParserTest method commentsTest.
@Test
void commentsTest() {
DependencyGraph dependencyGraph = vndrParser.parseVendorConf(Arrays.asList("github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109 # v0.4.15", "github.com/klauspost/compress v1.4.1", "# github.com/Azure/go-ansiterm dont_include_me"));
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GOLANG, dependencyGraph);
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("github.com/Azure/go-ansiterm", "d6e3b3328b783f23731bc4d058875b0371ff8109");
graphAssert.hasRootDependency("github.com/klauspost/compress", "v1.4.1");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class BitbakeDependencyGraphTransformerTest method ignoredNoVersionRelationship.
@Test
public void ignoredNoVersionRelationship() {
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
BitbakeGraph bitbakeGraph = new BitbakeGraph();
bitbakeGraph.addNode("example", "75", "meta");
bitbakeGraph.addNode("foobar", null, "meta");
bitbakeGraph.addChild("example", "foobar");
Map<String, List<String>> recipeToLayerMap = new HashMap<>();
recipeToLayerMap.put("example", Collections.singletonList("meta"));
recipeToLayerMap.put("foobar", Collections.singletonList("meta"));
BitbakeDependencyGraphTransformer bitbakeDependencyGraphTransformer = new BitbakeDependencyGraphTransformer(EnumListFilter.excludeNone());
DependencyGraph dependencyGraph = bitbakeDependencyGraphTransformer.transform(bitbakeGraph, recipeToLayerMap, null);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.YOCTO, dependencyGraph);
graphAssert.hasRootSize(1);
ExternalId externalId = graphAssert.hasDependency(externalIdFactory.createYoctoExternalId("meta", "example", "75"));
graphAssert.hasRelationshipCount(externalId, 0);
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class CargoDetectableTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
Assertions.assertEquals(1, extraction.getCodeLocations().size());
Assertions.assertEquals("cargo-audit", extraction.getProjectName());
Assertions.assertEquals("0.12.0", extraction.getProjectVersion());
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.CRATES, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootDependency("abscissa_core", "0.5.2");
graphAssert.hasParentChildRelationship("abscissa_core", "0.5.2", "abscissa_derive", "0.5.0");
graphAssert.hasParentChildRelationship("abscissa_core", "0.5.2", "backtrace", "0.3.46");
graphAssert.hasParentChildRelationship("abscissa_derive", "0.5.0", "darling", "0.10.2");
graphAssert.hasRootDependency("abscissa_derive", "0.5.0");
graphAssert.hasRootDependency("backtrace", "0.3.46");
graphAssert.hasRootDependency("darling", "0.10.2");
graphAssert.hasRootSize(4);
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GoModDetectableVendoredTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
assertSuccessfulExtraction(extraction);
assertEquals(1, extraction.getCodeLocations().size());
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GOLANG, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(1);
graphAssert.hasRootDependency("golang.org/x/text", "v0.3.6");
// This version should be replaced with a v0.3.6
graphAssert.hasNoDependency("golang.org/x/text", "v0.3.0");
graphAssert.hasNoDependency("golang.org/x/tools", "90fa682c2a6e");
// sigs.k8s.io/yaml and it's transitives are unused as per `go mod why`
graphAssert.hasNoDependency("sigs.k8s.io/yaml", "v1.2.0");
graphAssert.hasNoDependency("github.com/davecgh/go-spew", "v1.1.1");
graphAssert.hasNoDependency("gopkg.in/yaml.v2", "v2.2.8");
}
Aggregations