use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GoModDetectableTest 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(2);
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.hasDependency("golang.org/x/tools", "90fa682c2a6e");
graphAssert.hasParentChildRelationship("golang.org/x/text", "v0.3.6", "golang.org/x/tools", "90fa682c2a6e");
graphAssert.hasRootDependency("sigs.k8s.io/yaml", "v1.2.0");
graphAssert.hasDependency("github.com/davecgh/go-spew", "v1.1.1");
graphAssert.hasParentChildRelationship("sigs.k8s.io/yaml", "v1.2.0", "github.com/davecgh/go-spew", "v1.1.1");
graphAssert.hasDependency("gopkg.in/yaml.v2", "v2.2.8");
graphAssert.hasParentChildRelationship("sigs.k8s.io/yaml", "v1.2.0", "gopkg.in/yaml.v2", "v2.2.8");
graphAssert.hasDependency("gopkg.in/check.v1", "20d25e280405");
graphAssert.hasParentChildRelationship("gopkg.in/yaml.v2", "v2.2.8", "gopkg.in/check.v1", "20d25e280405");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GoModDetectableUnusedTest 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");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GoVendorDetectableTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
Assertions.assertEquals(1, extraction.getCodeLocations().size());
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GOLANG, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("github.com/pkg/errors", "059132a15dd08d6704c67711dae0cf35ab991756");
graphAssert.hasRootDependency("github.com/pkg/math", "f2ed9e40e245cdeec72c4b642d27ed4553f90667");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class MavenPomDetectableTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
Assertions.assertEquals(1, extraction.getCodeLocations().size(), "A code location should have been generated.");
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.MAVEN, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(3);
// ExternalIdFactory sets group for Maven external Ids
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
ExternalId junit = externalIdFactory.createMavenExternalId("junit", "junit", "4.12");
ExternalId powermockApiMockito = externalIdFactory.createMavenExternalId("org.powermock", "powermock-api-mockito", "1.6.6");
ExternalId hubCommon = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common", "13.1.2");
ExternalId powermockApiMockitoCommon = externalIdFactory.createMavenExternalId("org.powermock", "powermock-api-mockito-common", "1.6.6");
ExternalId powermockApiSupport = externalIdFactory.createMavenExternalId("org.powermock", "powermock-api-support", "1.6.6");
ExternalId hamcrestCore = externalIdFactory.createMavenExternalId("org.hamcrest", "hamcrest-core", "1.3");
ExternalId hubCommonRest = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common-rest", "2.1.3");
ExternalId mockitoCore = externalIdFactory.createMavenExternalId("org.mockito", "mockito-core", "1.10.19");
ExternalId integrationCommon = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "integration-common", "6.0.2");
graphAssert.hasRootDependency(junit);
graphAssert.hasRootDependency(powermockApiMockito);
graphAssert.hasRootDependency(hubCommon);
graphAssert.hasParentChildRelationship(powermockApiMockitoCommon, powermockApiSupport);
graphAssert.hasParentChildRelationship(junit, hamcrestCore);
graphAssert.hasParentChildRelationship(powermockApiMockito, powermockApiMockitoCommon);
graphAssert.hasParentChildRelationship(powermockApiMockito, mockitoCore);
graphAssert.hasParentChildRelationship(hubCommonRest, integrationCommon);
graphAssert.hasParentChildRelationship(hubCommon, hubCommonRest);
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class MavenComplexOutputTest method test.
@Test
public void test() {
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
MavenCodeLocationPackager packager = new MavenCodeLocationPackager(externalIdFactory);
List<MavenParseResult> results = packager.extractCodeLocations("", getInput(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.MAVEN, results.get(0).getCodeLocation().getDependencyGraph());
graphAssert.hasRootSize(1);
ExternalId hubCommon = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common", "13.1.2");
ExternalId integrationCommon = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "integration-common", "6.0.2");
ExternalId hubCommonRest = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common-rest", "2.1.3");
graphAssert.hasRootDependency(hubCommon);
graphAssert.hasParentChildRelationship(hubCommonRest, integrationCommon);
graphAssert.hasParentChildRelationship(hubCommon, hubCommonRest);
}
Aggregations