Search in sources :

Example 6 with GraphAssert

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

the class GemspecParserTest method parseWithDevelopmentDependencies.

@Test
void parseWithDevelopmentDependencies() throws IOException {
    InputStream gemspecInputStream = createGemspecInputStream();
    DependencyGraph dependencyGraph = gemspecParser(GemspecDependencyType.RUNTIME).parse(gemspecInputStream);
    GraphAssert graphAssert = new GraphAssert(Forge.RUBYGEMS, dependencyGraph);
    graphAssert.hasRootDependency(externalId1);
    graphAssert.hasNoDependency(externalId2);
    graphAssert.hasRootDependency(externalId3);
}
Also used : GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) InputStream(java.io.InputStream) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Example 7 with GraphAssert

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

the class PackageResolvedTransformerTest method testHttpsWithGit.

@Test
void testHttpsWithGit() {
    ResolvedPackage swiftCollectionsPackage = new ResolvedPackage("swift-collections", "https://github.com/apple/swift-collections.git", new PackageState(null, "2d33a0ea89c961dcb2b3da2157963d9c0370347e", "1.0.1"));
    PackageResolved packageResolved = createPackageResolved(swiftCollectionsPackage);
    PackageResolvedTransformer transformer = new PackageResolvedTransformer();
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId swiftCollections = ExternalId.FACTORY.createNameVersionExternalId(Forge.GITHUB, "apple/swift-collections", "1.0.1");
    graphAssert.hasRootDependency(swiftCollections);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 8 with GraphAssert

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

the class PackageResolvedTransformerTest method testHttpWithGit.

@Test
void testHttpWithGit() {
    ResolvedPackage auth0Package = new ResolvedPackage("Auth0", "http://github.com/auth0/Auth0.swift.git", new PackageState(null, "8e8a6b0337a27a3342beb72b5407141fdd4a7860", "1.35.0"));
    PackageResolved packageResolved = createPackageResolved(auth0Package);
    PackageResolvedTransformer transformer = new PackageResolvedTransformer();
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId auth0 = ExternalId.FACTORY.createNameVersionExternalId(Forge.GITHUB, "auth0/Auth0.swift", "1.35.0");
    graphAssert.hasRootDependency(auth0);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 9 with GraphAssert

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

the class PackageResolvedTransformerTest method noGitExtensionTest.

@Test
void noGitExtensionTest() {
    ResolvedPackage swiftLogPackage = new ResolvedPackage("swift-log", // Won't be malformed for sanity check
    "http://github.com/apple/swift-log", new PackageState(null, "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", "1.4.2"));
    PackageResolvedTransformer transformer = new PackageResolvedTransformer();
    PackageResolved packageResolved = createPackageResolved(swiftLogPackage);
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId swiftLog = ExternalId.FACTORY.createNameVersionExternalId(Forge.GITHUB, "apple/swift-log", "1.4.2");
    graphAssert.hasRootDependency(swiftLog);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 10 with GraphAssert

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

the class PearDependencyGraphTransformerTest method buildDependencyGraphAll.

@Test
void buildDependencyGraphAll() {
    DependencyGraph dependencyGraph = buildDependencyGraph();
    Set<Dependency> rootDependencies = dependencyGraph.getRootDependencies();
    Assertions.assertEquals(2, rootDependencies.size());
    ExternalIdFactory externalIdFactory = new ExternalIdFactory();
    GraphAssert graphAssert = new GraphAssert(Forge.PEAR, dependencyGraph);
    graphAssert.hasDependency(externalIdFactory.createNameVersionExternalId(Forge.PEAR, "Archive_Tar", "1.4.3"));
    graphAssert.hasDependency(externalIdFactory.createNameVersionExternalId(Forge.PEAR, "Console_Getopt", "1.4.1"));
}
Also used : GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Dependency(com.synopsys.integration.bdio.model.dependency.Dependency) PackageDependency(com.synopsys.integration.detectable.detectables.pear.model.PackageDependency) 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