Search in sources :

Example 51 with NameVersionGraphAssert

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

the class PoetryLockParserTest method testParseDependencies.

@Test
public void testParseDependencies() {
    String input = String.join(System.lineSeparator(), Arrays.asList("[[package]]", "name = \"pytest-cov\"", "python-versions = \">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*\"", "version = \"2.8.1\"", "", "[package.dependencies]", "coverage = \">=4.4\"", "pytest = \">=3.6\"", "", "[[package]]", "name = \"coverage\"", "version = \"4.4\"", "", "[[package]]", "name = \"pytest\"", "version = \"3.7\""));
    PoetryLockParser poetryLockParser = new PoetryLockParser();
    DependencyGraph graph = poetryLockParser.parseLockFile(input);
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, graph);
    graphAssert.hasRootSize(1);
    graphAssert.hasRootDependency("pytest-cov", "2.8.1");
    graphAssert.hasParentChildRelationship("pytest-cov", "2.8.1", "coverage", "4.4");
    graphAssert.hasParentChildRelationship("pytest-cov", "2.8.1", "pytest", "3.7");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) PoetryLockParser(com.synopsys.integration.detectable.detectables.poetry.parser.PoetryLockParser) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Example 52 with NameVersionGraphAssert

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

the class PnpmYamlTransformerTest method testExcludeDevDependencies.

@Test
public void testExcludeDevDependencies() throws IntegrationException {
    PnpmYamlTransformer transformer = createTransformer(PnpmDependencyType.DEV);
    PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
    DependencyGraph dependencyGraph = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver).getDependencyGraph();
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
    graphAssert.hasRootSize(3);
    graphAssert.hasNoDependency("devDep", "2.0.0");
}
Also used : PnpmYamlTransformer(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) PnpmLockYaml(com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Example 53 with NameVersionGraphAssert

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

the class PnpmYamlTransformerTest method testExcludeDependencies.

@Test
public void testExcludeDependencies() throws IntegrationException {
    PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
    PnpmYamlTransformer transformer = createTransformer(PnpmDependencyType.APP);
    DependencyGraph dependencyGraph = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver).getDependencyGraph();
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
    graphAssert.hasRootSize(2);
}
Also used : PnpmYamlTransformer(com.synopsys.integration.detectable.detectables.pnpm.lockfile.process.PnpmYamlTransformer) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) PnpmLockYaml(com.synopsys.integration.detectable.detectables.pnpm.lockfile.model.PnpmLockYaml) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Example 54 with NameVersionGraphAssert

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

the class GemlockDetectableTest 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.RUBYGEMS, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(2);
    graphAssert.hasRootDependency("cocoapods", "1.2.1");
    graphAssert.hasRootDependency("cocoapods-keys", "2.0.0");
    graphAssert.hasDependency("RubyInline", "3.12.4");
    graphAssert.hasParentChildRelationship("RubyInline", "3.12.4", "ZenTest", "4.11.1");
    graphAssert.hasParentChildRelationship("activesupport", "4.2.8", "thread_safe", "0.3.6");
    graphAssert.hasParentChildRelationship("cocoapods", "1.2.1", "activesupport", "4.2.8");
    graphAssert.hasParentChildRelationship("cocoapods-keys", "2.0.0", "osx_keychain", "1.0.1");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 55 with NameVersionGraphAssert

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

the class GemlockNodeParserTest method testMissingVersionsGemfileLock.

@Test
public void testMissingVersionsGemfileLock() throws MissingExternalIdException {
    List<String> gemfileLockContents = Arrays.asList("GEM", "  remote: https://artifactory.rds.lexmark.com/artifactory/api/gems/rubygems/", "  remote: https://artifactory.rds.lexmark.com/artifactory/api/gems/enterprise-gem-IDP/", "  specs:", "    activesupport (4.2.7.1)", "      thread_safe (~> 0.3, >= 0.3.4)", "      tzinfo (~> 1.1)", "    bullet (5.5.0)", "      activesupport (>= 3.0.0)", "      uniform_notifier (~> 1.10.0)", "    devise (4.2.1)", "    thread_safe (0.3.6-java)", "    tzinfo (1.2.3)", "      thread_safe (~> 0.1)", "    uniform_notifier (1.10.0)", "", "PLATFORMS", "  java", "", "DEPENDENCIES", "  bullet (~> 5.5.0)", "  devise (~> 4.2.1)");
    GemlockParser gemlockNodeParser = new GemlockParser(new ExternalIdFactory());
    DependencyGraph dependencyGraph = gemlockNodeParser.parseProjectDependencies(gemfileLockContents);
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.RUBYGEMS, dependencyGraph);
    graphAssert.hasRootSize(2);
    graphAssert.hasRootDependency("bullet", "5.5.0");
    graphAssert.hasRootDependency("devise", "4.2.1");
    graphAssert.hasParentChildRelationship("bullet", "5.5.0", "activesupport", "4.2.7.1");
    graphAssert.hasParentChildRelationship("activesupport", "4.2.7.1", "tzinfo", "1.2.3");
    graphAssert.hasParentChildRelationship("tzinfo", "1.2.3", "thread_safe", "0.3.6-java");
    graphAssert.hasParentChildRelationship("bullet", "5.5.0", "uniform_notifier", "1.10.0");
}
Also used : ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) GemlockParser(com.synopsys.integration.detectable.detectables.rubygems.gemlock.parse.GemlockParser) Test(org.junit.jupiter.api.Test) FunctionalTest(com.synopsys.integration.detectable.annotations.FunctionalTest)

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