test_class.declarator: JSON_NODE_FACTORY = JsonNodeFactory.instance
test_class.modifier: private static final
test_class.original_string: private static final JsonNodeFactory JSON_NODE_FACTORY = JsonNodeFactory.instance;
test_class.type: JsonNodeFactory
test_class.var_name: JSON_NODE_FACTORY
test_class.declarator: activity
test_class.modifier: private
test_class.original_string: private WSDLActivity activity;
test_class.type: WSDLActivity
test_class.var_name: activity
test_class.declarator: dataflow
test_class.modifier: private
test_class.original_string: private DataflowImpl dataflow;
test_class.type: DataflowImpl
test_class.var_name: dataflow
test_class.declarator: configBean
test_class.modifier: private
test_class.original_string: private ObjectNode configBean;
test_class.type: ObjectNode
test_class.var_name: configBean
test_class.declarator: operationConfigBean
test_class.modifier: private static
test_class.original_string: private static ObjectNode operationConfigBean;
test_class.type: ObjectNode
test_class.var_name: operationConfigBean
test_class.declarator: wsdlLocation = WSDL_TEST_BASE
  	+ "eutils/eutils_lite.wsdl"
test_class.modifier: private
test_class.original_string: private String wsdlLocation = WSDL_TEST_BASE
  	+ "eutils/eutils_lite.wsdl";
test_class.type: String
test_class.var_name: wsdlLocation
test_class.declarator: edits
test_class.modifier: private
test_class.original_string: private Edits edits;
test_class.type: Edits
test_class.var_name: edits
test_class.file: taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
test_class.identifier: AddXMLSplitterEditTest
test_class.interfaces: implements LocationConstants
test_case.body: @Ignore("Integration test")
  	@Test
  	public void testAddInputSplitterToWSDLActivity() throws Exception {
  		AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",true, new EditsImpl());
  		edit.doEdit();
  		assertEquals("The workflow should now contain 2 services",2,dataflow.getProcessors().size());
  		Processor processor=null;
  		for (Processor p : dataflow.getProcessors()) {
  			if (p.getLocalName().equals("parametersXML")) {
  				processor = p;
  				break;
  			}
  		}
  		assertNotNull("There should be a processor named parametersXML",processor);
  		assertEquals("There should be 1 activity",1,processor.getActivityList().size());
  		assertEquals("THe processor should have 3 input ports",3,processor.getInputPorts().size());
  		assertEquals("THe processor should have 1 output port",1,processor.getOutputPorts().size());
  
  		Activity<?>a = processor.getActivityList().get(0);
  
  		assertEquals("The activity should have 3 input ports",3,a.getInputPorts().size());
  		assertEquals("The activity 1 output port",1,a.getOutputPorts().size());
  
  		assertEquals("There should be 1 datalink",1,dataflow.getLinks().size());
  	}
test_case.class_method_signature: AddXMLSplitterEditTest.testAddInputSplitterToWSDLActivity()
test_case.full_signature: @Ignore("Integration test") @Test public void testAddInputSplitterToWSDLActivity()
test_case.identifier: testAddInputSplitterToWSDLActivity
test_case.invocations: doEdit assertEquals size getProcessors getProcessors equals getLocalName assertNotNull assertEquals size getActivityList assertEquals size getInputPorts assertEquals size getOutputPorts get getActivityList assertEquals size getInputPorts assertEquals size getOutputPorts assertEquals size getLinks
test_case.modifiers: @Ignore("Integration test") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAddInputSplitterToWSDLActivity()
focal_class.declarator: edits
focal_class.modifier: private final
focal_class.original_string: private final Edits edits;
focal_class.type: Edits
focal_class.var_name: edits
focal_class.declarator: activity
focal_class.modifier: private final
focal_class.original_string: private final Activity<?> activity;
focal_class.type: Activity<?>
focal_class.var_name: activity
focal_class.declarator: portName
focal_class.modifier: private final
focal_class.original_string: private final String portName;
focal_class.type: String
focal_class.var_name: portName
focal_class.declarator: isInput
focal_class.modifier: private final
focal_class.original_string: private final boolean isInput;
focal_class.type: boolean
focal_class.var_name: isInput
focal_class.declarator: compoundEdit1 = null
focal_class.modifier: private
focal_class.original_string: private CompoundEdit compoundEdit1 = null;
focal_class.type: CompoundEdit
focal_class.var_name: compoundEdit1
focal_class.declarator: linkUpEdit
focal_class.modifier: private
focal_class.original_string: private Edit<?> linkUpEdit;
focal_class.type: Edit<?>
focal_class.var_name: linkUpEdit
focal_class.declarator: dataflow
focal_class.modifier: private final
focal_class.original_string: private final Dataflow dataflow;
focal_class.type: Dataflow
focal_class.var_name: dataflow
focal_class.declarator: applied = false
focal_class.modifier: private
focal_class.original_string: private boolean applied = false;
focal_class.type: boolean
focal_class.var_name: applied
focal_class.file: taverna-wsdl-activity/src/main/java/org/apache/taverna/activities/wsdl/xmlsplitter/AddXMLSplitterEdit.java
focal_class.identifier: AddXMLSplitterEdit
focal_class.interfaces: implements Edit<Dataflow>
focal_class.class_method_signature: AddXMLSplitterEdit.AddXMLSplitterEdit(Dataflow dataflow, Activity<?> activity,
  			String portName, boolean isInput, Edits edits)
focal_class.full_signature: public  AddXMLSplitterEdit(Dataflow dataflow, Activity<?> activity,
  			String portName, boolean isInput, Edits edits)
focal_class.identifier: AddXMLSplitterEdit
focal_class.modifiers: public
focal_class.parameters: (Dataflow dataflow, Activity<?> activity,
  			String portName, boolean isInput, Edits edits)
focal_class.signature:  AddXMLSplitterEdit(Dataflow dataflow, Activity<?> activity,
  			String portName, boolean isInput, Edits edits)
focal_class.class_method_signature: AddXMLSplitterEdit.doEdit()
focal_class.full_signature: @Override public Dataflow doEdit()
focal_class.identifier: doEdit
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Dataflow
focal_class.signature: Dataflow doEdit()
focal_class.class_method_signature: AddXMLSplitterEdit.getSinkPort(Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.full_signature: private EventHandlingInputPort getSinkPort(Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.identifier: getSinkPort
focal_class.modifiers: private
focal_class.parameters: (Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.return: EventHandlingInputPort
focal_class.signature: EventHandlingInputPort getSinkPort(Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.class_method_signature: AddXMLSplitterEdit.getSourcePort(Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.full_signature: private EventForwardingOutputPort getSourcePort(Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.identifier: getSourcePort
focal_class.modifiers: private
focal_class.parameters: (Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.return: EventForwardingOutputPort
focal_class.signature: EventForwardingOutputPort getSourcePort(Processor processor, Activity<?> activity,
  			String portName, List<Edit<?>> editList)
focal_class.class_method_signature: AddXMLSplitterEdit.undo()
focal_class.full_signature: @Override public void undo()
focal_class.identifier: undo
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void undo()
focal_class.class_method_signature: AddXMLSplitterEdit.isApplied()
focal_class.full_signature: @Override public boolean isApplied()
focal_class.identifier: isApplied
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isApplied()
focal_class.class_method_signature: AddXMLSplitterEdit.findProcessorForActivity(Dataflow dataflow,
  			Activity<?> activity)
focal_class.full_signature: private Processor findProcessorForActivity(Dataflow dataflow,
  			Activity<?> activity)
focal_class.identifier: findProcessorForActivity
focal_class.modifiers: private
focal_class.parameters: (Dataflow dataflow,
  			Activity<?> activity)
focal_class.return: Processor
focal_class.signature: Processor findProcessorForActivity(Dataflow dataflow,
  			Activity<?> activity)
focal_class.class_method_signature: AddXMLSplitterEdit.getSubject()
focal_class.full_signature: @Override public Object getSubject()
focal_class.identifier: getSubject
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Object
focal_class.signature: Object getSubject()
focal_method.body: @Override
  	public Dataflow doEdit() throws EditException {
  		if (applied) throw new EditException("Edit has already been applied!");
  		List<Edit<?>> editList = new ArrayList<Edit<?>>();
  
  		Activity<JsonNode> splitter = null;
  		String sourcePortName = "";
  		Processor sourceProcessor = null;
  		Activity<?> sourceActivity = null;
  
  		String sinkPortName = "";
  		Processor sinkProcessor = null;
  		Activity<?> sinkActivity = null;
  
  
  		Processor activityProcessor = findProcessorForActivity(dataflow,
  				activity);
  		if (activityProcessor == null) {
  			throw new EditException(
  					"Cannot find the processor that the activity belongs to");
  		}
  
  
  		String displayName = portName;
  		if (portName.equals("parameters")) {
  			displayName = isInput ? "input" : "output";
  		}
  		String processorName = activityProcessor.getLocalName();
  		String candidateName;
  		if (displayName.startsWith(processorName)) {
  			// No need to make GetRequest_GetRequestResponse
  			candidateName = displayName;
  		} else {
  			// Combine with processor name
  			String displayProcessorName;
  			if (activity instanceof XMLOutputSplitterActivity || activity instanceof XMLInputSplitterActivity) {
  				// For splitters on splitters - avoid adding up blah_bluh_blih_more_stuff
  				String[] processorNameSplit = processorName.replace("_input", "").replace("_output", "").split("_");
  				displayProcessorName = processorNameSplit[processorNameSplit.length-1];
  			} else {
  				displayProcessorName = activityProcessor.getLocalName();
  			}
  			candidateName = displayProcessorName + "_" + displayName;
  		}
  		String name = Tools.uniqueProcessorName(candidateName, dataflow);
  		Processor splitterProcessor = edits.createProcessor(name);
  
  		try {
  			if (activity instanceof XMLInputSplitterActivity) {
  				if (!isInput) {
  					throw new EditException(
  							"Can only add an input splitter to another input splitter");
  				}
  				TypeDescriptor descriptor = ((XMLInputSplitterActivity) activity)
  						.getTypeDescriptorForInputPort(portName);
  				if (descriptor instanceof ArrayTypeDescriptor && !((ArrayTypeDescriptor)descriptor).isWrapped()) {
  					descriptor=((ArrayTypeDescriptor)descriptor).getElementType();
  				}
  
  				JsonNode bean = XMLSplitterConfigurationBeanBuilder
  						.buildBeanForInput(descriptor);
  				splitter = new XMLInputSplitterActivity();
  				editList.add(edits.getConfigureActivityEdit(splitter, bean));
  
  			} else if (activity instanceof XMLOutputSplitterActivity) {
  				if (isInput) {
  					throw new EditException(
  							"Can only add an output splitter to another output splitter");
  				}
  				TypeDescriptor descriptor = ((XMLOutputSplitterActivity) activity)
  						.getTypeDescriptorForOutputPort(portName);
  
  				if (descriptor instanceof ArrayTypeDescriptor && !((ArrayTypeDescriptor)descriptor).isWrapped()) {
  					descriptor=((ArrayTypeDescriptor)descriptor).getElementType();
  				}
  
  				JsonNode bean = XMLSplitterConfigurationBeanBuilder
  						.buildBeanForOutput(descriptor);
  				splitter = new XMLOutputSplitterActivity();
  				editList.add(edits.getConfigureActivityEdit(splitter, bean));
  
  			} else if (activity instanceof WSDLActivity) {
  				if (isInput) {
  					TypeDescriptor descriptor = ((WSDLActivity) activity)
  							.getTypeDescriptorForInputPort(portName);
  					JsonNode bean = XMLSplitterConfigurationBeanBuilder
  							.buildBeanForInput(descriptor);
  					splitter = new XMLInputSplitterActivity();
  					editList
  							.add(edits.getConfigureActivityEdit(splitter, bean));
  				} else {
  					TypeDescriptor descriptor = ((WSDLActivity) activity)
  							.getTypeDescriptorForOutputPort(portName);
  					JsonNode bean = XMLSplitterConfigurationBeanBuilder
  							.buildBeanForOutput(descriptor);
  					splitter = new XMLOutputSplitterActivity();
  					editList
  							.add(edits.getConfigureActivityEdit(splitter, bean));
  				}
  			} else {
  				throw new EditException(
  						"The activity type is not suitable for adding xml processing processors");
  			}
  		} catch (Exception e) {
  			throw new EditException(
  					"An error occured whilst tyring to add an XMLSplitter to the activity:"
  							+ activity, e);
  		}
  
  		if (isInput) {
  			sourcePortName = "output";
  			sinkPortName = portName;
  			sinkProcessor = activityProcessor;
  			sinkActivity = activity;
  			sourceProcessor = splitterProcessor;
  			sourceActivity = splitter;
  		}
  		else {
  			sourcePortName = portName;
  			sinkPortName = "input";
  			sinkProcessor = splitterProcessor;
  			sinkActivity = splitter;
  			sourceProcessor = activityProcessor;
  			sourceActivity = activity;
  		}
  
  		editList.add(edits.getDefaultDispatchStackEdit(splitterProcessor));
  		editList.add(edits.getAddActivityEdit(splitterProcessor, splitter));
  //		editList.add(edits
  //				.getMapProcessorPortsForActivityEdit(splitterProcessor));
  		editList.add(edits.getAddProcessorEdit(dataflow, splitterProcessor));
  
  		compoundEdit1 = new CompoundEdit(editList);
  		compoundEdit1.doEdit();
  
  		List<Edit<?>> linkUpEditList = new ArrayList<Edit<?>>();
  
  		EventForwardingOutputPort source = getSourcePort(sourceProcessor, sourceActivity,
  				sourcePortName, linkUpEditList);
  		EventHandlingInputPort sink = getSinkPort(sinkProcessor, sinkActivity, sinkPortName, linkUpEditList);
  
  		if (source == null)
  			throw new EditException(
  					"Unable to find the source port when linking up "
  							+ sourcePortName + " to " + sinkPortName);
  		if (sink == null)
  			throw new EditException(
  					"Unable to find the sink port when linking up "
  							+ sourcePortName + " to " + sinkPortName);
  
  		linkUpEditList.add(org.apache.taverna.workflowmodel.utils.Tools.getCreateAndConnectDatalinkEdit(dataflow, source, sink, edits));
  
  		linkUpEdit = new CompoundEdit(linkUpEditList);
  		linkUpEdit.doEdit();
  		applied = true;
  		return dataflow;
  	}
focal_method.class_method_signature: AddXMLSplitterEdit.doEdit()
focal_method.full_signature: @Override public Dataflow doEdit()
focal_method.identifier: doEdit
focal_method.invocations: findProcessorForActivity equals getLocalName startsWith split replace replace getLocalName uniqueProcessorName createProcessor getTypeDescriptorForInputPort isWrapped getElementType buildBeanForInput add getConfigureActivityEdit getTypeDescriptorForOutputPort isWrapped getElementType buildBeanForOutput add getConfigureActivityEdit getTypeDescriptorForInputPort buildBeanForInput add getConfigureActivityEdit getTypeDescriptorForOutputPort buildBeanForOutput add getConfigureActivityEdit add getDefaultDispatchStackEdit add getAddActivityEdit add getAddProcessorEdit doEdit getSourcePort getSinkPort add getCreateAndConnectDatalinkEdit doEdit
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Dataflow
focal_method.signature: Dataflow doEdit()