Search in sources :

Example 61 with NameVersionGraphAssert

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

the class PipInspectorDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals("project-name", extraction.getProjectName());
    Assertions.assertEquals("project-version", extraction.getProjectVersion());
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    DependencyGraph dependencyGraph = extraction.getCodeLocations().get(0).getDependencyGraph();
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, dependencyGraph);
    graphAssert.hasNoDependency("project-name", "project-version");
    graphAssert.hasRootDependency("dep1", "1.0");
    graphAssert.hasRootDependency("dep2", "3.0");
    graphAssert.hasParentChildRelationship("dep1", "1.0", "dep12", "2.0");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph)

Example 62 with NameVersionGraphAssert

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

the class PoetryDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(2);
    graphAssert.hasRootDependency("appdirs", "1.4.3");
    graphAssert.hasRootDependency("atomicwrites", "1.4.0");
    graphAssert.hasParentChildRelationship("atomicwrites", "1.4.0", "importlib-metadata", "1.6.0");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 63 with NameVersionGraphAssert

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

the class PodlockDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertNotEquals(0, extraction.getCodeLocations().size(), "A code location should have been generated.");
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.COCOAPODS, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(3);
    graphAssert.hasRootDependency("Allihoopa-macOS", "1.1.0");
    graphAssert.hasRootDependency("Mapbox-macOS-SDK", "0.4.1");
    graphAssert.hasRootDependency("RepliesSDK-macOS", "0.2.22");
    graphAssert.hasParentChildRelationship("Allihoopa-macOS", "1.1.0", "AllihoopaCore", "1.1.0");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 64 with NameVersionGraphAssert

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

the class PodlockTransitiveDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertNotEquals(0, extraction.getCodeLocations().size(), "A code location should have been generated.");
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.COCOAPODS, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(1);
    graphAssert.hasRootDependency("OktaDeviceSDK", "0.0.1");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 65 with NameVersionGraphAssert

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

the class LernaExternalDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(3, extraction.getCodeLocations().size(), "Expected one code location from root, and two from a non-private packages.");
    CodeLocation codeLocationA = extraction.getCodeLocations().get(1);
    Assertions.assertEquals("packageA", codeLocationA.getExternalId().map(ExternalId::getName).orElse(null), "Package A should be the second code location.");
    NameVersionGraphAssert rootGraphAssert = new NameVersionGraphAssert(Forge.NPMJS, codeLocationA.getDependencyGraph());
    rootGraphAssert.hasDependency("packageB", "3.2.1");
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Aggregations

NameVersionGraphAssert (com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)76 Test (org.junit.jupiter.api.Test)35 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)32 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)18 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)10 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)10 UnitTest (com.synopsys.integration.detectable.annotations.UnitTest)7 ArrayList (java.util.ArrayList)6 PnpmLockYaml (com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml)5 PnpmYamlTransformer (com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer)5 PipFreeze (com.synopsys.integration.detectable.detectables.pipenv.build.model.PipFreeze)4 PipenvGraph (com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraph)4 PipenvGraphEntry (com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraphEntry)4 PipenvTransformer (com.synopsys.integration.detectable.detectables.pipenv.build.parser.PipenvTransformer)4 PoetryLockParser (com.synopsys.integration.detectable.detectables.poetry.parser.PoetryLockParser)4 FunctionalTest (com.synopsys.integration.detectable.annotations.FunctionalTest)3 GemlockParser (com.synopsys.integration.detectable.detectables.rubygems.gemlock.parse.GemlockParser)3 BitbakeGraph (com.synopsys.integration.detectable.detectables.bitbake.model.BitbakeGraph)2 BitbakeDependencyGraphTransformer (com.synopsys.integration.detectable.detectables.bitbake.transform.BitbakeDependencyGraphTransformer)2 CargoLockPackage (com.synopsys.integration.detectable.detectables.cargo.model.CargoLockPackage)2