Search in sources :

Example 1 with FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage

use of com.synopsys.integration.detectable.detectables.bazel.pipeline.step.FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage in project synopsys-detect by blackducksoftware.

the class FinalStepTransformJsonProtoHaskellCabalLibrariesToHackageTest method testStep.

@Test
public void testStep() throws IntegrationException, IOException {
    File jsonProtoFile = new File("src/test/resources/detectables/functional/bazel/jsonProtoForHaskellCabalLibraries.txt");
    String jsonProtoHaskellCabalLibrary = FileUtils.readFileToString(jsonProtoFile, StandardCharsets.UTF_8);
    FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage step = new FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage(new HaskellCabalLibraryJsonProtoParser(new Gson()), new ExternalIdFactory());
    List<String> input = new ArrayList<>(1);
    input.add(jsonProtoHaskellCabalLibrary);
    List<Dependency> dependencies = step.finish(input);
    DependencyGraph dependencyGraph = new BasicDependencyGraph();
    for (Dependency dependency : dependencies) {
        dependencyGraph.addChildToRoot(dependency);
    }
    Forge hackageForge = new Forge("/", "hackage");
    GraphAssert graphAssert = new GraphAssert(hackageForge, dependencyGraph);
    graphAssert.hasRootSize(1);
    ExternalId expectedExternalId = new ExternalIdFactory().createNameVersionExternalId(hackageForge, "colour", "2.3.5");
    graphAssert.hasRootDependency(expectedExternalId);
}
Also used : GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) Forge(com.synopsys.integration.bdio.model.Forge) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) Dependency(com.synopsys.integration.bdio.model.dependency.Dependency) HaskellCabalLibraryJsonProtoParser(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.HaskellCabalLibraryJsonProtoParser) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

Gson (com.google.gson.Gson)1 BasicDependencyGraph (com.synopsys.integration.bdio.graph.BasicDependencyGraph)1 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 Forge (com.synopsys.integration.bdio.model.Forge)1 Dependency (com.synopsys.integration.bdio.model.dependency.Dependency)1 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)1 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)1 FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage (com.synopsys.integration.detectable.detectables.bazel.pipeline.step.FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage)1 HaskellCabalLibraryJsonProtoParser (com.synopsys.integration.detectable.detectables.bazel.pipeline.step.HaskellCabalLibraryJsonProtoParser)1 GraphAssert (com.synopsys.integration.detectable.util.graph.GraphAssert)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1