taverna-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haouech <...@git.apache.org>
Subject [GitHub] incubator-taverna-language pull request #38: Cwlparser
Date Thu, 21 Jun 2018 08:41:27 GMT
Github user haouech commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-language/pull/38#discussion_r197053583
  
    --- Diff: taverna-scufl2-cwl/src/test/java/org/apache/taverna/scufl2/cwl/TestParser.java
---
    @@ -0,0 +1,96 @@
    +package org.apache.taverna.scufl2.cwl;
    +
    +
    +import java.util.Set;
    +import java.util.HashSet;
    +
    +import org.junit.Before;
    +import org.junit.Test;
    +import static org.junit.Assert.assertEquals;
    +
    +import org.yaml.snakeyaml.Yaml;
    +
    +import com.fasterxml.jackson.core.type.TypeReference;
    +import com.fasterxml.jackson.databind.JsonNode;
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import com.fasterxml.jackson.databind.node.ArrayNode;
    +
    +import org.apache.taverna.scufl2.api.core.Workflow;
    +import org.apache.taverna.scufl2.api.core.Processor;
    +import org.apache.taverna.scufl2.api.core.DataLink;
    +
    +import org.apache.taverna.scufl2.api.common.NamedSet;
    +
    +import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
    +import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
    +import org.apache.taverna.scufl2.api.port.InputProcessorPort;
    +
    +
    +public class TestParser {
    +    private static final String HELLO_WORLD_CWL = "/hello_world.cwl";
    +
    +    private static JsonNode cwlFile;
    +    private WorkflowParser parser;
    +    private Workflow workflow;
    +
    +    @Before
    +    public void initialize() {
    +
    +        Yaml reader = new Yaml();
    +        ObjectMapper mapper = new ObjectMapper();
    +        cwlFile = mapper.valueToTree(reader.load(TestParser.class.getResourceAsStream(HELLO_WORLD_CWL)));
    +        System.out.println(cwlFile);
    +        this.parser = new WorkflowParser(cwlFile);
    +
    +        this.workflow = parser.buildWorkflow();
    +    }
    +
    +    @Test
    +    public void testParseInputs() throws Exception {
    +
    +        NamedSet<InputWorkflowPort> workflowInputs = workflow.getInputPorts();
    +        NamedSet<InputWorkflowPort> expectedInputs = new NamedSet<>();
    +        expectedInputs.add(new InputWorkflowPort(workflow, "name"));
    --- End diff --
    
    I understand. I will make the workflows orphans and create the same structure for the
parsed and the expected workflows.


---

Mime
View raw message