Search in sources :

Example 66 with NameVersionGraphAssert

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

the class CarthageDeclarationTransformerTest method excludeNonGitHubOrigin.

@Test
void excludeNonGitHubOrigin() {
    CarthageDeclarationTransformer transformer = new CarthageDeclarationTransformer();
    List<CarthageDeclaration> carthageDeclarations = Arrays.asList(new CarthageDeclaration("binary", "https://some.binary.url", "binary-version"), new CarthageDeclaration("github", "some-name/resource", "some-version"), new CarthageDeclaration("wonky-origin", "wonky-name", "wonky-version"));
    DependencyGraph graph = transformer.transform(carthageDeclarations);
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GITHUB, graph);
    graphAssert.hasRootDependency("some-name/resource", "some-version");
    graphAssert.hasNoDependency("https://some.binary.url", "binary-version");
    graphAssert.hasNoDependency("wonky-name", "wonky-version");
    graphAssert.hasRootSize(1);
}
Also used : CarthageDeclaration(com.synopsys.integration.detectable.detectables.carthage.model.CarthageDeclaration) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) CarthageDeclarationTransformer(com.synopsys.integration.detectable.detectables.carthage.transform.CarthageDeclarationTransformer) Test(org.junit.jupiter.api.Test)

Example 67 with NameVersionGraphAssert

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

the class CarthageDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GITHUB, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootDependency("GEOSwift/GEOSwift", "8.0.2");
    graphAssert.hasRootDependency("MobileNativeFoundation/Kronos", "4.2.1");
    graphAssert.hasRootDependency("ReactiveCocoa/ReactiveCocoa", "11.1.0");
    graphAssert.hasRootDependency("realm/realm-cocoa", "v10.7.2");
    graphAssert.hasNoDependency("https://downloads.localytics.com/SDKs/iOS/Localytics.json", "6.2.1");
    graphAssert.hasRootSize(4);
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 68 with NameVersionGraphAssert

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

the class PubSpecLockParserTest method test.

@Test
public void test() {
    List<String> pubSpecLockLines = Arrays.asList("# Generated by pub", "# See https://dart.dev/tools/pub/glossary#lockfile", "packages:", "  async:", "    dependency: transitive", "    description:", "      name: async", "    source: hosted", "    version: \"2.6.1\"", "  boolean_selector:", "    dependency: transitive", "    description:", "      name: boolean_selector", "      url: \"https://pub.dartlang.org\"", "    version: \"2.1.0\"", "  characters:", "    description:", "      name: characters", "    version: \"1.1.0\"");
    PubSpecLockParser pubSpecLockParser = new PubSpecLockParser();
    DependencyGraph dependencyGraph = pubSpecLockParser.parse(pubSpecLockLines);
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.DART, dependencyGraph);
    graphAssert.hasRootSize(3);
    graphAssert.hasRootDependency("async", "2.6.1");
    graphAssert.hasRootDependency("boolean_selector", "2.1.0");
    graphAssert.hasRootDependency("characters", "1.1.0");
}
Also used : PubSpecLockParser(com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecLockParser) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Example 69 with NameVersionGraphAssert

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

the class CondaCliDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.ANACONDA, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootSize(2);
    graphAssert.hasRootDependency("mkl", "2017.0.3-0-osx-64");
    graphAssert.hasRootDependency("numpy", "1.13.1-py36_0-osx-64");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 70 with NameVersionGraphAssert

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

the class DartPubDepsDetectableTest 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(2);
    graphAssert.hasRootDependency("pedantic", "1.9.2");
    graphAssert.hasRootDependency("source_span", "1.7.0");
    graphAssert.hasParentChildRelationship("source_span", "1.7.0", "meta", "1.2.3");
    graphAssert.hasParentChildRelationship("source_span", "1.7.0", "path", "1.7.0");
}
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