Search in sources :

Example 11 with GraphAssert

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

the class NpmPeerExclusionTest method testPeerDependencyNotExists.

@Test
public void testPeerDependencyNotExists() {
    NpmPackagerResult result = createPackager(NpmDependencyType.DEV, NpmDependencyType.PEER).parseAndTransform(packageJsonText, packageLockText);
    GraphAssert graphAssert = new GraphAssert(Forge.NPMJS, result.getCodeLocation().getDependencyGraph());
    graphAssert.hasNoDependency(childPeer);
    graphAssert.hasNoDependency(parentPeer);
    graphAssert.hasRootSize(0);
}
Also used : GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) NpmPackagerResult(com.synopsys.integration.detectable.detectables.npm.lockfile.result.NpmPackagerResult) Test(org.junit.jupiter.api.Test) FunctionalTest(com.synopsys.integration.detectable.annotations.FunctionalTest)

Example 12 with GraphAssert

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

the class NpmPeerExclusionTest method testPeerDependencyExists.

@Test
public void testPeerDependencyExists() {
    NpmPackagerResult result = createPackager(NpmDependencyType.DEV).parseAndTransform(packageJsonText, packageLockText);
    GraphAssert graphAssert = new GraphAssert(Forge.NPMJS, result.getCodeLocation().getDependencyGraph());
    graphAssert.hasDependency(childPeer);
    graphAssert.hasDependency(parentPeer);
    graphAssert.hasRootSize(1);
}
Also used : GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) NpmPackagerResult(com.synopsys.integration.detectable.detectables.npm.lockfile.result.NpmPackagerResult) Test(org.junit.jupiter.api.Test) FunctionalTest(com.synopsys.integration.detectable.annotations.FunctionalTest)

Example 13 with GraphAssert

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

the class PackageJsonExtractorFunctionalTest method extractWithDevDependencies.

@Test
void extractWithDevDependencies() {
    Extraction extraction = createExtractor(NpmDependencyType.PEER).extract(packageJsonInputStream);
    assertEquals(1, extraction.getCodeLocations().size());
    CodeLocation codeLocation = extraction.getCodeLocations().get(0);
    DependencyGraph dependencyGraph = codeLocation.getDependencyGraph();
    GraphAssert graphAssert = new GraphAssert(Forge.RUBYGEMS, dependencyGraph);
    graphAssert.hasRootDependency(testDep1);
    graphAssert.hasRootDependency(testDep2);
    graphAssert.hasRootDependency(testDevDep1);
    graphAssert.hasRootDependency(testDevDep2);
    graphAssert.hasNoDependency(testPeerDep1);
    graphAssert.hasNoDependency(testPeerDep2);
    graphAssert.hasRootSize(4);
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) Extraction(com.synopsys.integration.detectable.extraction.Extraction) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test) FunctionalTest(com.synopsys.integration.detectable.annotations.FunctionalTest)

Example 14 with GraphAssert

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

the class PackageJsonExtractorFunctionalTest method extractWithNoDevDependencies.

@Test
void extractWithNoDevDependencies() {
    Extraction extraction = createExtractor(NpmDependencyType.PEER, NpmDependencyType.DEV).extract(packageJsonInputStream);
    assertEquals(1, extraction.getCodeLocations().size());
    CodeLocation codeLocation = extraction.getCodeLocations().get(0);
    DependencyGraph dependencyGraph = codeLocation.getDependencyGraph();
    GraphAssert graphAssert = new GraphAssert(Forge.RUBYGEMS, dependencyGraph);
    graphAssert.hasRootDependency(testDep1);
    graphAssert.hasRootDependency(testDep2);
    graphAssert.hasNoDependency(testDevDep1);
    graphAssert.hasNoDependency(testDevDep2);
    graphAssert.hasNoDependency(testPeerDep1);
    graphAssert.hasNoDependency(testPeerDep2);
    graphAssert.hasRootSize(2);
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) Extraction(com.synopsys.integration.detectable.extraction.Extraction) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test) FunctionalTest(com.synopsys.integration.detectable.annotations.FunctionalTest)

Example 15 with GraphAssert

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

the class PackageJsonExtractorTest method extractWithNoDevOrPeerDependencies.

@Test
void extractWithNoDevOrPeerDependencies() {
    PackageJson packageJson = createPackageJson();
    Extraction extraction = createExtractor(NpmDependencyType.DEV, NpmDependencyType.PEER).extract(packageJson);
    assertEquals(1, extraction.getCodeLocations().size());
    CodeLocation codeLocation = extraction.getCodeLocations().get(0);
    DependencyGraph dependencyGraph = codeLocation.getDependencyGraph();
    GraphAssert graphAssert = new GraphAssert(Forge.RUBYGEMS, dependencyGraph);
    graphAssert.hasRootDependency(testDep1);
    graphAssert.hasRootDependency(testDep2);
    graphAssert.hasNoDependency(testDevDep1);
    graphAssert.hasNoDependency(testDevDep2);
    graphAssert.hasRootSize(2);
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) Extraction(com.synopsys.integration.detectable.extraction.Extraction) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) PackageJson(com.synopsys.integration.detectable.detectables.npm.packagejson.model.PackageJson) Test(org.junit.jupiter.api.Test) UnitTest(com.synopsys.integration.detectable.annotations.UnitTest)

Aggregations

GraphAssert (com.synopsys.integration.detectable.util.graph.GraphAssert)30 Test (org.junit.jupiter.api.Test)30 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)26 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)9 FunctionalTest (com.synopsys.integration.detectable.annotations.FunctionalTest)7 UnitTest (com.synopsys.integration.detectable.annotations.UnitTest)7 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)7 PackageResolved (com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved)5 PackageState (com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState)5 ResolvedPackage (com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage)5 PackageResolved (com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved)5 PackageState (com.synopsys.integration.detectable.detectables.xcode.model.PackageState)5 ResolvedPackage (com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage)5 PackageResolvedTransformer (com.synopsys.integration.detectable.detectables.xcode.process.PackageResolvedTransformer)5 Extraction (com.synopsys.integration.detectable.extraction.Extraction)5 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)4 NpmPackagerResult (com.synopsys.integration.detectable.detectables.npm.lockfile.result.NpmPackagerResult)4 InputStream (java.io.InputStream)4 Dependency (com.synopsys.integration.bdio.model.dependency.Dependency)3 GsonBuilder (com.google.gson.GsonBuilder)2