Search in sources :

Example 21 with NameVersionGraphAssert

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

the class SwiftPackageResolvedDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    assertEquals(1, extraction.getCodeLocations().size(), "Expected only one code location.");
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GITHUB, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootDependency("apple/swift-argument-parser", "1.0.1");
    graphAssert.hasRootDependency("auth0/Auth0.swift", "1.35.0");
    graphAssert.hasRootDependency("mac-cain13/R.swift.Library", "5.4.0");
    graphAssert.hasNoDependency("invalid/url", "1.2.3");
    graphAssert.hasRootSize(3);
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 22 with NameVersionGraphAssert

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

the class XcodeProjectDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    assertEquals(1, extraction.getCodeLocations().size(), "Expected only one code location.");
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GITHUB, extraction.getCodeLocations().get(0).getDependencyGraph());
    graphAssert.hasRootDependency("apple/swift-argument-parser", "1.0.1");
    graphAssert.hasRootDependency("auth0/Auth0.swift", "1.35.0");
    graphAssert.hasRootDependency("mac-cain13/R.swift.Library", "5.4.0");
    graphAssert.hasNoDependency("invalid/url", "1.2.3");
    graphAssert.hasRootSize(3);
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 23 with NameVersionGraphAssert

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

the class XcodeWorkspaceDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    assertEquals(3, extraction.getCodeLocations().size(), "Expected 1 code location from local and 2 defined in the workspace data file.");
    NameVersionGraphAssert graphAssert;
    CodeLocation workspaceLocalCodeLocation = extraction.getCodeLocations().get(0);
    graphAssert = new NameVersionGraphAssert(Forge.GITHUB, workspaceLocalCodeLocation.getDependencyGraph());
    graphAssert.hasRootDependency("apple/swift-argument-parser", "1.0.1");
    graphAssert.hasNoDependency("invalid/url", "1.2.3");
    graphAssert.hasRootSize(1);
    CodeLocation myLibraryCodeLocation = extraction.getCodeLocations().get(1);
    graphAssert = new NameVersionGraphAssert(Forge.GITHUB, myLibraryCodeLocation.getDependencyGraph());
    graphAssert.hasRootDependency("auth0/Auth0.swift", "1.35.0");
    graphAssert.hasRootSize(1);
    CodeLocation xcodeProjectCodeLocation = extraction.getCodeLocations().get(2);
    graphAssert = new NameVersionGraphAssert(Forge.GITHUB, xcodeProjectCodeLocation.getDependencyGraph());
    graphAssert.hasRootDependency("mac-cain13/R.swift.Library", "5.4.0");
    graphAssert.hasRootSize(1);
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 24 with NameVersionGraphAssert

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

the class YarnLockDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    CodeLocation codeLocation = extraction.getCodeLocations().get(0);
    Assertions.assertEquals("babel", extraction.getProjectName());
    Assertions.assertEquals("1.2.3", extraction.getProjectVersion());
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, codeLocation.getDependencyGraph());
    graphAssert.hasRootSize(2);
    graphAssert.hasRootDependency("async", "2.5.0");
    graphAssert.hasRootDependency("lodash", "4.17.4");
    graphAssert.hasParentChildRelationship("async", "2.5.0", "lodash", "4.17.4");
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)

Example 25 with NameVersionGraphAssert

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

the class PipEnvDetectableTest method assertExtraction.

@Override
public void assertExtraction(@NotNull Extraction extraction) {
    Assertions.assertEquals("simple", extraction.getProjectName());
    Assertions.assertEquals("1", extraction.getProjectVersion());
    Assertions.assertEquals(1, extraction.getCodeLocations().size());
    DependencyGraph dependencyGraph = extraction.getCodeLocations().get(0).getDependencyGraph();
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, dependencyGraph);
    graphAssert.hasNoDependency("simple", "1");
    graphAssert.hasRootDependency("with-dashes", "2.0");
    graphAssert.hasRootDependency("dots.and-dashes", "3.1.2");
    graphAssert.hasParentChildRelationship("with-dashes", "2.0", "dots.and-dashes", "3.1.2");
}
Also used : NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph)

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