Search in sources :

Example 46 with NameVersionGraphAssert

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

the class CpanCliDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.CPAN, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(3);
    graphAssert.hasRootDependency("Test-More", "1.3");
    graphAssert.hasRootDependency("ExtUtils-MakeMaker", "7.24");
    graphAssert.hasRootDependency("perl", "5.1");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 47 with NameVersionGraphAssert

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

the class PackratLockDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.CRAN, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(3);
    graphAssert.hasRootDependency("BBmisc", "1.11");
    graphAssert.hasRootDependency("checkmate", "1.8.5");
    graphAssert.hasRootDependency("backports", "1.1.2");
    graphAssert.hasParentChildRelationship("BBmisc", "1.11", "checkmate", "1.8.5");
    graphAssert.hasParentChildRelationship("checkmate", "1.8.5", "backports", "1.1.2");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 48 with NameVersionGraphAssert

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

the class DartPubSpecLockDetectableTest 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.DART, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(3);
    graphAssert.hasRootDependency("clock", "1.1.0");
    graphAssert.hasRootDependency("collection", "1.15.0");
    graphAssert.hasRootDependency("contacts_service", "0.4.6");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 49 with NameVersionGraphAssert

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

the class SwiftDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertNotEquals(0, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.COCOAPODS, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(2);
    graphAssert.hasRootDependency("FisherYates", "2.0.5");
    graphAssert.hasRootDependency("PlayingCard", "3.0.5");
    graphAssert.hasParentChildRelationship("PlayingCard", "3.0.5", "GenericLibrary", "1.0.1");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 50 with NameVersionGraphAssert

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

the class PipenvTransformerTest method ignoresNonProject.

@Test
void ignoresNonProject() {
    PipFreeze pipFreeze = new PipFreeze(new ArrayList<>());
    List<PipenvGraphEntry> pipenvGraphEntries = new ArrayList<>();
    pipenvGraphEntries.add(new PipenvGraphEntry("projectName", "projectVersion", Collections.singletonList(new PipenvGraphDependency("child", "childVersion", Collections.emptyList()))));
    pipenvGraphEntries.add(new PipenvGraphEntry("non-projectName", "non-projectVersion", new ArrayList<>()));
    PipenvGraph pipenvGraph = new PipenvGraph(pipenvGraphEntries);
    PipenvTransformer pipenvTransformer = new PipenvTransformer(new ExternalIdFactory());
    CodeLocation codeLocation = pipenvTransformer.transform("projectName", "projectVersion", pipFreeze, pipenvGraph, true);
    DependencyGraph graph = codeLocation.getDependencyGraph();
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, graph);
    graphAssert.hasRootDependency("child", "childVersion");
    graphAssert.hasNoDependency("non-projectName", "non-projectVersion");
}
Also used : PipenvTransformer(com.synopsys.integration.detectable.detectables.pipenv.build.parser.PipenvTransformer) PipenvGraphEntry(com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraphEntry) CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) PipenvGraphDependency(com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraphDependency) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ArrayList(java.util.ArrayList) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) PipenvGraph(com.synopsys.integration.detectable.detectables.pipenv.build.model.PipenvGraph) PipFreeze(com.synopsys.integration.detectable.detectables.pipenv.build.model.PipFreeze) Test(org.junit.jupiter.api.Test) UnitTest(com.synopsys.integration.detectable.annotations.UnitTest)

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