TavernaConverter { public WorkflowProcess convertWorkflow(Workflow workflow) { WorkflowProcess process = new WorkflowProcess(); process.setName(workflow.getName()); Set<InputPort> inputs = convertInputPorts(workflow); Set<OutputPort> outputs = convertOutputPorts(workflow); process.setInputPorts(inputs); process.setOutputPorts(outputs); return process; }  WorkflowProcess convertWorkflow(Workflow workflow); Set<InputPort> convertInputPorts(Workflow workflow); Set<OutputPort> convertOutputPorts(Workflow workflow); Set<Step> convertProcessors(Workflow workflow); Step convertProcessor(Processor processor, Map<String, SenderPort> portNameToSource);  }
@Test public void testWorkflowToWorkflowProcess() { Workflow workflow = new Workflow(); workflow.setName("workflowName"); workflow.getInputPorts().add(new InputWorkflowPort(workflow, "input1")); workflow.getInputPorts().add(new InputWorkflowPort(workflow, "input2")); workflow.getOutputPorts().add(new OutputWorkflowPort(workflow, "output")); TavernaConverter converter = new TavernaConverter(); WorkflowProcess workflowProcess = converter.convertWorkflow(workflow); assertEquals(workflow.getInputPorts().size(), workflowProcess.getInputPorts().size()); assertEquals(workflow.getOutputPorts().size(), workflowProcess.getOutputPorts().size()); Set<String> expectedInputNames = workflow.getInputPorts().stream().map(InputWorkflowPort::getName).collect(Collectors.toSet()); Set<String> convertedInputNames = workflowProcess.getInputPorts().stream().map(InputPort::getName).collect(Collectors.toSet()); assertEquals(expectedInputNames, convertedInputNames); assertEquals("output", workflowProcess.getOutputPorts().iterator().next().getName()); }