Scufl2Tools { public ProcessorBinding createProcessorAndBindingFromActivity( Activity activity) { Processor proc = new Processor(); proc.setName(activity.getName()); createProcessorPortsFromActivity(proc, activity); return bindActivityToProcessorByMatchingPorts(activity, proc); }  List<Annotation> annotationsFor(Child<?> bean); List<Annotation> annotationsFor(WorkflowBean bean,
			WorkflowBundle bundle); Configuration configurationFor(Configurable configurable,
			Profile profile); Configuration configurationForActivityBoundToProcessor(
			Processor processor, Profile profile); List<Configuration> configurationsFor(Configurable configurable,
			Profile profile); @SuppressWarnings("unchecked") List<BlockingControlLink> controlLinksBlocking(Processor blocked); @SuppressWarnings("unchecked") List<BlockingControlLink> controlLinksWaitingFor(
			Processor untilFinished); @SuppressWarnings("unchecked") List<DataLink> datalinksFrom(SenderPort senderPort); @SuppressWarnings("unchecked") List<DataLink> datalinksTo(ReceiverPort receiverPort); T findParent(Class<T> parentClass,
			Child<?> child); JsonNode portDefinitionFor(ActivityPort activityPort, Profile profile); ProcessorBinding processorBindingForProcessor(Processor processor,
			Profile profile); List<ProcessorBinding> processorBindingsForProcessor(
			Processor processor, Profile profile); List<ProcessorBinding> processorBindingsToActivity(Activity activity); ProcessorInputPortBinding processorPortBindingForPort(
			InputPort inputPort, Profile profile); ProcessorOutputPortBinding processorPortBindingForPort(
			OutputPort outputPort, Profile profile); void setParents(WorkflowBundle bundle); Set<Processor> possibleDownStreamProcessors(Workflow dataflow,
			Processor processor); Set<Processor> possibleUpStreamProcessors(Workflow dataflow,
			Processor firstProcessor); ProcessorSplit splitProcessors(Collection<Processor> processors,
			Processor splitPoint); Workflow nestedWorkflowForProcessor(Processor processor,
			Profile profile); List<Workflow> nestedWorkflowsForProcessor(Processor processor,
			Profile profile); boolean containsNestedWorkflow(Processor processor); boolean containsNestedWorkflow(Processor processor, Profile profile); void createActivityPortsFromProcessor(Activity activity,
			Processor processor); void createProcessorPortsFromActivity(Processor processor,
			Activity activity); ProcessorBinding bindActivityToProcessorByMatchingPorts(
			Activity activity, Processor processor); void bindActivityToProcessorByMatchingPorts(ProcessorBinding binding); ProcessorBinding createProcessorAndBindingFromActivity(
			Activity activity); Activity createActivityFromProcessor(Processor processor,
			Profile profile); Configuration setAsNestedWorkflow(Processor processor, Workflow childWorkflow, Profile profile); void removePortsBindingForUnknownPorts(ProcessorBinding binding); void updateBindingByMatchingPorts(ProcessorBinding binding); Processor createConstant(Workflow workflow, Profile profile,
			String name); Configuration createConfigurationFor(Activity activity,
			URI configType); Configuration createConfigurationFor(Processor processor,
			Profile profile); void setConstantStringValue(Processor constant, String value,
			Profile profile); String getConstantStringValue(Processor constant, Profile profile); Set<Processor> getConstants(Workflow workflow, Profile profile); void createDefaultIterationStrategyStack(Processor p); static URI PORT_DEFINITION; static URI NESTED_WORKFLOW; static URI CONSTANT; static URI CONSTANT_CONFIG; }
@Test public void createProcessorFromActivity() throws Exception { Profile profile = new Profile(); Activity a = new Activity(); a.setParent(profile); new InputActivityPort(a, "in1"); new InputActivityPort(a, "in2").setDepth(1); new OutputActivityPort(a, "out1"); new OutputActivityPort(a, "out2").setDepth(0); OutputActivityPort aOut3 = new OutputActivityPort(a, "out3"); aOut3.setDepth(2); aOut3.setGranularDepth(1); ProcessorBinding binding = scufl2Tools.createProcessorAndBindingFromActivity(a); Processor p = binding.getBoundProcessor(); assertEquals(profile, binding.getParent()); assertEquals(2, p.getInputPorts().size()); assertEquals(3, p.getOutputPorts().size()); assertEquals(2, binding.getInputPortBindings().size()); assertEquals(3, binding.getOutputPortBindings().size()); assertEquals(a, binding.getBoundActivity()); assertEquals(p, binding.getBoundProcessor()); }