/** * Constructs a <code>ProcessorOutputPortBinding</code> for the specified * <code>ProcessorBinding</code>. * * @param processorBinding * the <code>ProcessorBinding</code> to add this * <code>ProcessorOutputPortBinding</code> to. Can be * <code>null</code> * @param activityPort * the bound <code>OutputActivityPort</code>. Can be * <code>null</code> * @param processorPort * the bound <code>OutputProcessorPort</code>. Can be * <code>null</code> */ public ProcessorOutputPortBinding(ProcessorBinding processorBinding, OutputActivityPort activityPort, OutputProcessorPort processorPort) { setParent(processorBinding); setBoundActivityPort(activityPort); setBoundProcessorPort(processorPort); }
protected void parseOutputPortBinding( org.apache.taverna.scufl2.xml.OutputPortBinding original) throws ReaderException { ProcessorOutputPortBinding binding = new ProcessorOutputPortBinding(); mapBean(original.getAbout(), binding); binding.setBoundActivityPort(resolveBeanUri(original .getBindOutputActivityPort().getResource(), OutputActivityPort.class)); binding.setBoundProcessorPort(resolveBeanUri(original .getBindOutputProcessorPort().getResource(), OutputProcessorPort.class)); binding.setParent(getParserState().getCurrent(ProcessorBinding.class)); }
private void createDefaultProcessorBinding() { Processor p = parserState.get().getCurrentProcessor(); Activity a = parserState.get().getCurrentActivity(); ProcessorBinding pb = new ProcessorBinding(); pb.setParent(parserState.get().getCurrentProfile()); pb.setActivityPosition(0); pb.setBoundProcessor(p); pb.setBoundActivity(a); for (InputActivityPort iap : a.getInputPorts()) { InputProcessorPort ipp = findOrCreateProcessorInputPort(p, iap.getName(), iap.getDepth()); ProcessorInputPortBinding portBinding = new ProcessorInputPortBinding(); portBinding.setParent(pb); portBinding.setBoundActivityPort(iap); portBinding.setBoundProcessorPort(ipp); } for (OutputActivityPort oap : a.getOutputPorts()) { OutputProcessorPort opp = findOrCreateProcessorOutputPort(p, oap.getName(), oap.getDepth(), oap.getGranularDepth()); ProcessorOutputPortBinding portBinding = new ProcessorOutputPortBinding(); portBinding.setParent(pb); portBinding.setBoundActivityPort(oap); portBinding.setBoundProcessorPort(opp); } }
@Test public void testCorrectnessOfOutOfScopeActivityPort1() { ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor); ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding(); pipb.setParent(pb); OutputActivityPort orphanPort = new OutputActivityPort(); pipb.setBoundActivityPort(orphanPort); 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("boundActivityPort") && nlp.getValue().equals(orphanPort)) { problem = true; } } assertTrue(problem); }
@Test public void testCorrectnessOfOutOfScopeProcessorPort1() { ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor); ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding(); pipb.setParent(pb); OutputProcessorPort orphanPort = new OutputProcessorPort(); pipb.setBoundProcessorPort(orphanPort); 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(orphanPort)) { problem = true; } } assertTrue(problem); }
@Test public void testCorrectnessOfInScopeProcessorPort() { ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor); ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding(); pipb.setParent(pb); OutputProcessorPort port = new OutputProcessorPort(); 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); }
@Test public void testCorrectnessOfInScopeActivityPort() { ProcessorBinding pb = new ProcessorBinding(); Activity activity = new Activity(); pb.setBoundActivity(activity); ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding(); pipb.setParent(pb); OutputActivityPort port = new OutputActivityPort(); port.setParent(activity); pipb.setBoundActivityPort(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("boundActivityPort") && nlp.getValue().equals(port)) { problem = true; } } assertFalse(problem); }