Search in sources :

Example 1 with GraphAssert

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

the class PackageResolvedTransformerTest method manyExtensionsTest.

@Test
void manyExtensionsTest() {
    ResolvedPackage rSwiftLibraryPackage = new ResolvedPackage("R.swift.Library", "http://github.com/mac-cain13/R.swift.Library", new PackageState(null, "8998cfe77f4fce79ee6dfab0c88a7d551659d8fb", "5.4.0"));
    PackageResolvedTransformer transformer = new PackageResolvedTransformer(externalIdFactory);
    PackageResolved packageResolved = createPackageResolved(rSwiftLibraryPackage);
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId rSwiftLibrary = externalIdFactory.createNameVersionExternalId(Forge.GITHUB, "mac-cain13/R.swift.Library", "5.4.0");
    graphAssert.hasRootDependency(rSwiftLibrary);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) PackageResolvedTransformer(com.synopsys.integration.detectable.detectables.xcode.process.PackageResolvedTransformer) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.xcode.model.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 2 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(externalIdFactory);
    PackageResolved packageResolved = createPackageResolved(swiftLogPackage);
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId swiftLog = externalIdFactory.createNameVersionExternalId(Forge.GITHUB, "apple/swift-log", "1.4.2");
    graphAssert.hasRootDependency(swiftLog);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) PackageResolvedTransformer(com.synopsys.integration.detectable.detectables.xcode.process.PackageResolvedTransformer) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.xcode.model.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 3 with GraphAssert

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

the class PackageResolvedTransformerTest method malformedUrlTest.

@Test
void malformedUrlTest() {
    ResolvedPackage malformedUrlPackage = new ResolvedPackage("MalformedUrlPackage", "data that isn't a url", new PackageState(null, "revision", "version"));
    PackageResolvedTransformer transformer = new PackageResolvedTransformer(externalIdFactory);
    PackageResolved packageResolved = createPackageResolved(malformedUrlPackage);
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    graphAssert.hasRootSize(0);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) PackageResolvedTransformer(com.synopsys.integration.detectable.detectables.xcode.process.PackageResolvedTransformer) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) PackageState(com.synopsys.integration.detectable.detectables.xcode.model.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 4 with GraphAssert

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

the class BitbakeDependencyGraphTransformerTest method ignoredNoVersion.

@Test
public void ignoredNoVersion() {
    ExternalIdFactory externalIdFactory = new ExternalIdFactory();
    BitbakeGraph bitbakeGraph = new BitbakeGraph();
    bitbakeGraph.addNode("example", null, "meta");
    Map<String, List<String>> recipeToLayerMap = new HashMap<>();
    recipeToLayerMap.put("example", Collections.singletonList("meta"));
    BitbakeDependencyGraphTransformer bitbakeDependencyGraphTransformer = new BitbakeDependencyGraphTransformer(EnumListFilter.excludeNone());
    DependencyGraph dependencyGraph = bitbakeDependencyGraphTransformer.transform(bitbakeGraph, recipeToLayerMap, null);
    GraphAssert graphAssert = new GraphAssert(Forge.YOCTO, dependencyGraph);
    graphAssert.hasNoDependency(externalIdFactory.createYoctoExternalId("meta", "example", null));
    graphAssert.hasRootSize(0);
}
Also used : HashMap(java.util.HashMap) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) BitbakeDependencyGraphTransformer(com.synopsys.integration.detectable.detectables.bitbake.transform.BitbakeDependencyGraphTransformer) List(java.util.List) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) BitbakeGraph(com.synopsys.integration.detectable.detectables.bitbake.model.BitbakeGraph) Test(org.junit.jupiter.api.Test) UnitTest(com.synopsys.integration.detectable.annotations.UnitTest)

Example 5 with GraphAssert

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

the class GemspecParserTest method parseWithRuntimeDependencies.

@Test
void parseWithRuntimeDependencies() throws IOException {
    InputStream gemspecInputStream = createGemspecInputStream();
    DependencyGraph dependencyGraph = gemspecParser(GemspecDependencyType.DEV).parse(gemspecInputStream);
    GraphAssert graphAssert = new GraphAssert(Forge.RUBYGEMS, dependencyGraph);
    graphAssert.hasRootDependency(externalId1);
    graphAssert.hasRootDependency(externalId2);
    graphAssert.hasNoDependency(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)

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