public ProcessorBinding bindActivityToProcessorByMatchingPorts( Activity activity, Processor processor) { ProcessorBinding binding = new ProcessorBinding(); binding.setParent(activity.getParent()); binding.setBoundActivity(activity); binding.setBoundProcessor(processor); bindActivityToProcessorByMatchingPorts(binding); return binding; }
protected void parseActivityBinding(Activity origActivity, int activityPosition) throws ReaderException, JAXBException { ProcessorBinding processorBinding = new ProcessorBinding(); processorBinding.setName(parserState.get().getCurrentProcessor() .getName()); parserState.get().getCurrentProfile().getProcessorBindings() .addWithUniqueName(processorBinding); processorBinding.setBoundProcessor(parserState.get() .getCurrentProcessor()); parserState.get().setCurrentProcessorBinding(processorBinding); org.apache.taverna.scufl2.api.activity.Activity newActivity = parseActivityAndAddToProfile(origActivity); parserState.get().setCurrentActivity(newActivity); parserState.get().getCurrentProfile().getActivities().add(newActivity); processorBinding.setBoundActivity(newActivity); processorBinding.setActivityPosition(activityPosition); parserState.get().setCurrentConfigurable(newActivity); try { parseConfigurationAndAddToProfile(origActivity.getConfigBean()); } catch (JAXBException e) { if (isStrict()) throw e; logger.log(WARNING, "Can't configure activity" + newActivity, e); } parseActivityInputMap(origActivity.getInputMap()); parseActivityOutputMap(origActivity.getOutputMap()); parserState.get().setCurrentConfigurable(null); parserState.get().setCurrentActivity(null); parserState.get().setCurrentProcessorBinding(null); }
@Override protected void cloneInto(WorkflowBean clone, Cloning cloning) { super.cloneInto(clone, cloning); ProcessorBinding cloneBinding = (ProcessorBinding) clone; cloneBinding.setActivityPosition(getActivityPosition()); cloneBinding.setBoundProcessor(cloning .cloneOrOriginal(getBoundProcessor())); cloneBinding.setBoundActivity(cloning .cloneOrOriginal(getBoundActivity())); } }
public ProcessorBinding makeProcessorBinding() { ProcessorBinding processorBinding = new ProcessorBinding(); processorBinding.setName("Hello"); processorBinding.setBoundProcessor(processor); processorBinding.setBoundActivity(activity); new ProcessorInputPortBinding(processorBinding, processorName, personName); new ProcessorOutputPortBinding(processorBinding, hello, processorGreeting); return processorBinding; }
Processor boundProcessor = wf.getProcessors().getByName( wfProcName[1]); processorBinding.setBoundProcessor(boundProcessor); return; default:
@Test public void testCompletenessOfSpecifiedBoundProcessor() { ProcessorBinding pb = new ProcessorBinding(); pb.setBoundProcessor(new Processor()); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pb, true, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); boolean problem = false; for (NullFieldProblem nlp : nullFieldProblems) { if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor")) { problem = true; } } assertFalse(problem); }
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); } }
@Override public void parseScuflObject(Object o) { StringconstantType sc = (StringconstantType) o; Configuration configuration = new Configuration(); configuration.setParent(getParserState().getCurrentProfile()); configuration.setType(CONSTANT.resolve("#Config")); ((ObjectNode) configuration.getJson()).put("string", sc.getValue()); Activity activity = new Activity(); getParserState().setCurrentActivity(activity); activity.setParent(getParserState().getCurrentProfile()); activity.setType(CONSTANT); OutputActivityPort valuePort = new OutputActivityPort(activity, VALUE); valuePort.setDepth(0); valuePort.setGranularDepth(0); configuration.setConfigures(activity); ProcessorBinding pb = new ProcessorBinding(); pb.setParent(getParserState().getCurrentProfile()); pb.setBoundProcessor(getParserState().getCurrentProcessor()); pb.setBoundActivity(activity); } }
@Test public void testCorrectnessOfOutOfScopeBoundProcessor1() { WorkflowBundle wb = new WorkflowBundle(); Profile profile = new Profile(); profile.setParent(wb); ProcessorBinding pb = new ProcessorBinding(); Processor orphanProcessor = new Processor(); pb.setBoundProcessor(orphanProcessor); pb.setParent(profile); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pb, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); assertFalse(outOfScopeValueProblems.isEmpty()); boolean problem = false; for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) { if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(orphanProcessor)) { 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 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); ProcessorInputPortBinding pipb = new ProcessorInputPortBinding(); pipb.setParent(pb); InputProcessorPort orphanPort = new InputProcessorPort(); 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 testCorrectnessOfOutOfScopeActivityPort1() { ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor); ProcessorInputPortBinding pipb = new ProcessorInputPortBinding(); pipb.setParent(pb); InputActivityPort orphanPort = new InputActivityPort(); 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 testCorrectnessOfOutOfScopeBoundProcessor2() { WorkflowBundle wb = new WorkflowBundle(); Profile profile = new Profile(); profile.setParent(wb); ProcessorBinding pb = new ProcessorBinding(); Workflow w = new Workflow(); Processor processor = new Processor(); processor.setParent(w); pb.setBoundProcessor(processor); pb.setParent(profile); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pb, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); assertFalse(outOfScopeValueProblems.isEmpty()); boolean problem = false; for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) { if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(processor)) { 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 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); }
ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor);
ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor);
@Test public void testCorrectnessOfInScopeBoundProcessor() { WorkflowBundle wb = new WorkflowBundle(); Profile profile = new Profile(); profile.setParent(wb); ProcessorBinding pb = new ProcessorBinding(); Workflow w = new Workflow(); Processor processor = new Processor(); processor.setParent(w); w.setParent(wb); pb.setBoundProcessor(processor); pb.setParent(profile); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pb, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); // assertFalse(outOfScopeValueProblems.isEmpty()); boolean problem = false; for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) { if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(processor)) { problem = true; } } assertFalse(problem); }
protected void parseProcessorBinding( org.apache.taverna.scufl2.xml.ProcessorBinding original) throws ReaderException { org.apache.taverna.scufl2.api.profiles.ProcessorBinding binding = new org.apache.taverna.scufl2.api.profiles.ProcessorBinding(); binding.setParent(getParserState().getCurrent( org.apache.taverna.scufl2.api.profiles.Profile.class)); mapBean(original.getAbout(), binding); getParserState().push(binding); if (original.getName() != null) binding.setName(original.getName()); if (original.getActivityPosition() != null) binding.setActivityPosition(original.getActivityPosition() .getValue()); URI processorUri = resolve(original.getBindProcessor().getResource()); URI activityUri = resolve(original.getBindActivity().getResource()); binding.setBoundProcessor((Processor) resolveBeanUri(processorUri)); binding.setBoundActivity((Activity) resolveBeanUri(activityUri)); for (InputPortBinding inputPortBinding : original.getInputPortBinding()) parseInputPortBinding(inputPortBinding.getInputPortBinding()); for (OutputPortBinding outputPortBinding : original .getOutputPortBinding()) parseOutputPortBinding(outputPortBinding.getOutputPortBinding()); getParserState().pop(); }