Search in sources :

Example 36 with NameVersionGraphAssert

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

the class GradleInspectorDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.MAVEN, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(1);
    ExternalIdFactory externalIdFactory = new ExternalIdFactory();
    ExternalId hubCommonExternalId = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common", "11.0.0-SNAPSHOT");
    ExternalId hubCommonRestExternalId = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common-rest", "1.0.0");
    ExternalId integrationCommonExternalId = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "integration-common", "5.2.1");
    ExternalId slf4jExternalId = externalIdFactory.createMavenExternalId("org.slf4j", "slf4j-api", "1.7.22");
    ExternalId commonsIoExternalId = externalIdFactory.createMavenExternalId("commons-io", "commons-io", "2.5");
    ExternalId commonsCodecExternalId = externalIdFactory.createMavenExternalId("commons-codec", "commons-codec", "1.10");
    ExternalId commonsLangExternalId = externalIdFactory.createMavenExternalId("org.apache.commons", "commons-lang3", "3.5");
    graphAssert.hasParentChildRelationship(hubCommonExternalId, hubCommonRestExternalId);
    graphAssert.hasParentChildRelationship(hubCommonRestExternalId, integrationCommonExternalId);
    graphAssert.hasParentChildRelationship(integrationCommonExternalId, slf4jExternalId);
    graphAssert.hasParentChildRelationship(integrationCommonExternalId, commonsIoExternalId);
    graphAssert.hasParentChildRelationship(integrationCommonExternalId, commonsCodecExternalId);
    graphAssert.hasParentChildRelationship(integrationCommonExternalId, commonsLangExternalId);
}
Also used : ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 37 with NameVersionGraphAssert

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

the class IvyParseDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size(), "A code location should have been generated.");
    Assertions.assertEquals("pmdungeon", extraction.getProjectName());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.MAVEN, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(3);
    ExternalIdFactory externalIdFactory = new ExternalIdFactory();
    ExternalId gson = externalIdFactory.createMavenExternalId("com.google.code.gson", "gson", "1.0");
    ExternalId gdxUi = externalIdFactory.createMavenExternalId("com.badlogicgames.gdx", "gdx-ui", "2.0");
    ExternalId gdxBackend = externalIdFactory.createMavenExternalId("com.badlogicgames.gdx", "gdx-backend", "3.0");
    graphAssert.hasRootDependency(gson);
    graphAssert.hasRootDependency(gdxUi);
    graphAssert.hasRootDependency(gdxBackend);
}
Also used : ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 38 with NameVersionGraphAssert

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

the class LernaDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(Extraction.ExtractionResultType.SUCCESS, extraction.getResult(), "Extraction should have been a success.");
    Assertions.assertEquals(2, extraction.getCodeLocations().size(), "Expected one code location from root, and one from a non-private package.");
    NameVersionGraphAssert rootGraphAssert = new NameVersionGraphAssert(Forge.NPMJS, extraction.getCodeLocations().get(0).getDependencyGraph());
    rootGraphAssert.hasRootSize(3);
    rootGraphAssert.hasRootDependency("brace-expansion", "1.1.8");
    rootGraphAssert.hasRootDependency("concat-map", "0.0.1");
    rootGraphAssert.hasRootDependency("peer-example", "1.0.0");
    NameVersionGraphAssert packageAGraphAssert = new NameVersionGraphAssert(Forge.NPMJS, extraction.getCodeLocations().get(1).getDependencyGraph());
    packageAGraphAssert.hasRootSize(1);
    packageAGraphAssert.hasRootDependency("brace-expansion", "1.1.8");
    packageAGraphAssert.hasDependency("balanced-match", "1.0.0");
    packageAGraphAssert.hasDependency("concat-map", "0.0.1");
    packageAGraphAssert.hasNoDependency("peer-example", "1.0.0");
    packageAGraphAssert.hasParentChildRelationship("brace-expansion", "1.1.8", "balanced-match", "1.0.0");
    packageAGraphAssert.hasParentChildRelationship("brace-expansion", "1.1.8", "concat-map", "0.0.1");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 39 with NameVersionGraphAssert

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

the class GoDepCliDetectableTest 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(3);
    graphAssert.hasRootDependency("github.com/davecgh/go-spew/spew", "v1.1.0");
    graphAssert.hasRootDependency("github.com/golang/protobuf/proto", null);
    graphAssert.hasRootDependency("github.com/gorilla/context", "v1.1");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 40 with NameVersionGraphAssert

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

the class GoGradleDetectableTest 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/golang/example", "0dea2d0bf90754ffa40e0cb2f23b638f3e3d7e09");
    graphAssert.hasRootDependency("crypto", "9756ffdc24725223350eb3266ffb92590d28f278");
}
Also used : 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