Search in sources :

Example 1 with MavenGraphAssert

use of com.synopsys.integration.detectable.util.graph.MavenGraphAssert in project synopsys-detect by blackducksoftware.

the class GradleReplacementDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    ExtractionUtil.assertSuccessWithCodeLocationCount(extraction, 3);
    CodeLocation root = ExtractionUtil.assertAndGetCodeLocationNamed("root", extraction);
    CodeLocation projectA = ExtractionUtil.assertAndGetCodeLocationNamed("projectA", extraction);
    CodeLocation projectB = ExtractionUtil.assertAndGetCodeLocationNamed("projectB", extraction);
    MavenGraphAssert rootGraph = new MavenGraphAssert(root.getDependencyGraph());
    MavenGraphAssert projectAGraph = new MavenGraphAssert(projectA.getDependencyGraph());
    MavenGraphAssert projectBGraph = new MavenGraphAssert(projectB.getDependencyGraph());
    rootGraph.hasDependency("org.replacement:replaced:3.0.0");
    projectAGraph.hasRootDependency("org.replacement:replaced:2.0.0");
    projectBGraph.hasRootDependency("org.replacement:replaced:1.0.0");
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) MavenGraphAssert(com.synopsys.integration.detectable.util.graph.MavenGraphAssert)

Example 2 with MavenGraphAssert

use of com.synopsys.integration.detectable.util.graph.MavenGraphAssert in project synopsys-detect by blackducksoftware.

the class GradleReportParserFunctionalTest method complexTest.

@Test
void complexTest() {
    Optional<CodeLocation> codeLocation = buildCodeLocation("/gradle/complex_dependencyGraph.txt", true);
    Assertions.assertTrue(codeLocation.isPresent());
    DependencyGraph graph = codeLocation.get().getDependencyGraph();
    MavenGraphAssert graphAssert = new MavenGraphAssert(graph);
    graphAssert.hasDependency("non-project:with-nested:1.0.0");
    graphAssert.hasDependency("solo:component:4.12");
    graphAssert.hasDependency("some.group:child:2.2.2");
    graphAssert.hasDependency("terminal:child:6.2.3");
    // TODO: Get this to work in a sensible way
    // graphAssert.noDependency("child-project");
    // graphAssert.noDependency("nested-parent");
    // graphAssert.noDependency("spring-webflux");
    // graphAssert.noDependency("spring-beans");
    // graphAssert.noDependency("spring-core");
    // graphAssert.noDependency("spring-web");
    // graphAssert.noDependency("should-suppress");
    graphAssert.hasRootDependency("solo:component:4.12");
    graphAssert.hasRootDependency("non-project:with-nested:1.0.0");
    graphAssert.hasRootDependency("some.group:parent:5.0.0");
    graphAssert.hasRootDependency("terminal:child:6.2.3");
    ExternalId parent = graphAssert.hasDependency("some.group:parent:5.0.0");
    ExternalId child = graphAssert.hasDependency("some.group:child:2.2.2");
    graphAssert.hasParentChildRelationship(parent, child);
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) MavenGraphAssert(com.synopsys.integration.detectable.util.graph.MavenGraphAssert) Test(org.junit.jupiter.api.Test) UnitTest(com.synopsys.integration.detectable.annotations.UnitTest)

Aggregations

CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)2 MavenGraphAssert (com.synopsys.integration.detectable.util.graph.MavenGraphAssert)2 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)1 UnitTest (com.synopsys.integration.detectable.annotations.UnitTest)1 Test (org.junit.jupiter.api.Test)1