TavernaConverter { public Set<Step> convertProcessors(Workflow workflow) { Set<Step> result = new HashSet<>(); NamedSet<Processor> processors = workflow.getProcessors(); Set<DataLink> dataLinks = workflow.getDataLinks(); Map<String, SenderPort> portNameToSource = new HashMap<>(); for(DataLink link: dataLinks) { portNameToSource.put(link.getSendsTo().getName(), link.getReceivesFrom()); } for(Processor processor: processors) { Step step = convertProcessor(processor, portNameToSource); result.add(step); } return result; }  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 testProcessorsToSteps() { Workflow workflow = new Workflow(); workflow.setName("workflowName"); workflow.getProcessors().add(new Processor(workflow, "processor1")); workflow.getProcessors().add(new Processor(workflow, "processor2")); Step step1 = new Step(); step1.setRun(new Reference("processor1")); Step step2 = new Step(); step2.setRun(new Reference("processor2")); Set<Step> steps = new HashSet<>(); steps.add(step1); steps.add(step2); TavernaConverter converter = new TavernaConverter(); Set<Step> convertedSteps = converter.convertProcessors(workflow); assertEquals(steps, convertedSteps); }