/** * Constructs an <code>InputProcessorPort</code> for the specified * <code>Processor</code> with the specified name. * <p> * The <code>InputPort</code> is added to the <code>Processor</code> (if the * <code>Processor</code> is not <code>null</code>). * * @param parent * the <code>Processor</code> to add this <code>Port</code> to. * Can be <code>null</code> * @param name * the name of the <code>Port</code>. <strong>Must not</strong> * be <code>null</code> or an empty String. */ public InputProcessorPort(Processor parent, String name) { super(name); setParent(parent); }
private InputProcessorPort findOrCreateProcessorInputPort(Processor p, String name, Integer depth) { InputProcessorPort port = p.getInputPorts().getByName(name); if (port == null) { port = new InputProcessorPort(); port.setParent(p); port.setName(name); port.setDepth(depth); } return port; }
protected void processorInputProcessorPort( org.apache.taverna.scufl2.xml.InputProcessorPort original) { org.apache.taverna.scufl2.api.port.InputProcessorPort port = new org.apache.taverna.scufl2.api.port.InputProcessorPort(); port.setName(original.getName()); if (original.getPortDepth() != null) port.setDepth(original.getPortDepth().getValue()); port.setParent(getParserState().getCurrent(Processor.class)); mapBean(getParserState().getCurrentBase().resolve(original.getAbout()), port); }
@Test public void testCorrectnessOfInScopeProcessorPort() { ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor); ProcessorInputPortBinding pipb = new ProcessorInputPortBinding(); pipb.setParent(pb); InputProcessorPort port = new InputProcessorPort(); port.setParent(processor); pipb.setBoundProcessorPort(port); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pipb, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); boolean problem = false; for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) { if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(port)) { problem = true; } } assertFalse(problem); }
elsewherePort.setParent(otherProcessor);
@Test public void testInScopeInputProcessorPort() { Processor p = new Processor(); InputProcessorPort ipp = new InputProcessorPort(); ipp.setParent(p); IterationStrategyStack iss = new IterationStrategyStack(); p.setIterationStrategyStack(iss); CrossProduct cp = new CrossProduct(); iss.add(cp); cp.setParent(iss); PortNode pn = new PortNode(); pn.setInputProcessorPort(ipp); cp.add(pn); pn.setParent(cp); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pn, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems); }
@Test public void testInScopeProcessorPorts() { Workflow w = new Workflow(); DataLink dataLink = new DataLink(); dataLink.setParent(w); Processor p1 = new Processor(); p1.setParent(w); InputProcessorPort ipp = new InputProcessorPort(); ipp.setParent(p1); Processor p2 = new Processor(); p2.setParent(w); OutputProcessorPort opp = new OutputProcessorPort(); opp.setParent(p2); dataLink.setReceivesFrom(opp); dataLink.setSendsTo(ipp); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(dataLink, true, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems); }